]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blame - src/js/bip39-libs.js
Replace most libraries with combined libs
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / src / js / bip39-libs.js
CommitLineData
22f87669
IC
1(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.libs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2/* base-x */
3
4let basex = require('base-x')
5
6/* bchaddrjs */
7
8let bchaddr = require('bchaddrjs')
9
10/* bchaddrjs slp */
11
12let bchaddrSlp = require('bchaddrjs-slp')
13
14/* biginteger */
15
16let BigInteger = require('javascript-biginteger')
17
18/* bitcoinjs-bip38 */
19
20let bip38 = require('bip38')
21
22/* bitcoinjs-lib */
23
24let bitcoin = require('bitcoinjs-lib')
25
26/* buffer */
27
28let buffer = require('buffer');
29
30/* elastos */
31// See https://github.com/iancoleman/bip39/pull/368
32// and https://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript/tree/iancoleman-bip39
33
34let elastosjs = require('elastos-wallet-js')
35
36/* ethereum-util */
37
38let ethUtil = require('ethereumjs-util')
39
40/* fast-levenshtein */
41
42let levenshtein = require('fast-levenshtein')
43
44/* groestlcoin */
45
46let groestlcoinjs = require('groestlcoinjs-lib')
47
48/* groestlcoin bip38 */
49
50let groestlcoinjsBip38 = require('bip38grs')
51
52/* kjua qr codes */
53
54let kjua = require('kjua')
55
56/* nebulas */
57
58let nebulas = require('nebulas')
59
60/* stellar-util */
61
62let StellarBase = require('stellar-base');
63let edHd = require('ed25519-hd-key');
64let stellarUtil = {
65 getKeypair: function (path, seed) {
66 const result = edHd.derivePath(path, seed);
67 return StellarBase.Keypair.fromRawEd25519Seed(result.key);
68 },
69 dummyNetwork: {
70 bip32: {public: 0, private: 0},
71 messagePrefix: '',
72 pubKeyHash: 0,
73 scriptHash: 0,
74 wif: 0,
75 },
76}
77
78/* unorm */
79
80let unorm = require('unorm')
81
82/* zxcvbn */
83
84let zxcvbn = require('zxcvbn')
85
86/* exports */
87
88module.exports = {
89 basex,
90 bchaddr,
91 bchaddrSlp,
92 buffer,
93 BigInteger,
94 bip38,
95 bitcoin,
96 elastosjs,
97 ethUtil,
98 groestlcoinjs,
99 groestlcoinjsBip38,
100 kjua,
101 levenshtein,
102 nebulas,
103 stellarUtil,
104 unorm,
105 zxcvbn
106}
107
108},{"base-x":54,"bchaddrjs":58,"bchaddrjs-slp":57,"bip38":66,"bip38grs":67,"bitcoinjs-lib":79,"buffer":146,"ed25519-hd-key":260,"elastos-wallet-js":264,"ethereumjs-util":333,"fast-levenshtein":338,"groestlcoinjs-lib":351,"javascript-biginteger":401,"kjua":435,"nebulas":642,"stellar-base":782,"unorm":818,"zxcvbn":837}],2:[function(require,module,exports){
109"use strict";\r
110module.exports = asPromise;\r
111\r
112/**\r
113 * Callback as used by {@link util.asPromise}.\r
114 * @typedef asPromiseCallback\r
115 * @type {function}\r
116 * @param {Error|null} error Error, if any\r
117 * @param {...*} params Additional arguments\r
118 * @returns {undefined}\r
119 */\r
120\r
121/**\r
122 * Returns a promise from a node-style callback function.\r
123 * @memberof util\r
124 * @param {asPromiseCallback} fn Function to call\r
125 * @param {*} ctx Function context\r
126 * @param {...*} params Function arguments\r
127 * @returns {Promise<*>} Promisified function\r
128 */\r
129function asPromise(fn, ctx/*, varargs */) {\r
130 var params = new Array(arguments.length - 1),\r
131 offset = 0,\r
132 index = 2,\r
133 pending = true;\r
134 while (index < arguments.length)\r
135 params[offset++] = arguments[index++];\r
136 return new Promise(function executor(resolve, reject) {\r
137 params[offset] = function callback(err/*, varargs */) {\r
138 if (pending) {\r
139 pending = false;\r
140 if (err)\r
141 reject(err);\r
142 else {\r
143 var params = new Array(arguments.length - 1),\r
144 offset = 0;\r
145 while (offset < params.length)\r
146 params[offset++] = arguments[offset];\r
147 resolve.apply(null, params);\r
148 }\r
149 }\r
150 };\r
151 try {\r
152 fn.apply(ctx || null, params);\r
153 } catch (err) {\r
154 if (pending) {\r
155 pending = false;\r
156 reject(err);\r
157 }\r
158 }\r
159 });\r
160}\r
161
162},{}],3:[function(require,module,exports){
163"use strict";\r
164\r
165/**\r
166 * A minimal base64 implementation for number arrays.\r
167 * @memberof util\r
168 * @namespace\r
169 */\r
170var base64 = exports;\r
171\r
172/**\r
173 * Calculates the byte length of a base64 encoded string.\r
174 * @param {string} string Base64 encoded string\r
175 * @returns {number} Byte length\r
176 */\r
177base64.length = function length(string) {\r
178 var p = string.length;\r
179 if (!p)\r
180 return 0;\r
181 var n = 0;\r
182 while (--p % 4 > 1 && string.charAt(p) === "=")\r
183 ++n;\r
184 return Math.ceil(string.length * 3) / 4 - n;\r
185};\r
186\r
187// Base64 encoding table\r
188var b64 = new Array(64);\r
189\r
190// Base64 decoding table\r
191var s64 = new Array(123);\r
192\r
193// 65..90, 97..122, 48..57, 43, 47\r
194for (var i = 0; i < 64;)\r
195 s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r
196\r
197/**\r
198 * Encodes a buffer to a base64 encoded string.\r
199 * @param {Uint8Array} buffer Source buffer\r
200 * @param {number} start Source start\r
201 * @param {number} end Source end\r
202 * @returns {string} Base64 encoded string\r
203 */\r
204base64.encode = function encode(buffer, start, end) {\r
205 var parts = null,\r
206 chunk = [];\r
207 var i = 0, // output index\r
208 j = 0, // goto index\r
209 t; // temporary\r
210 while (start < end) {\r
211 var b = buffer[start++];\r
212 switch (j) {\r
213 case 0:\r
214 chunk[i++] = b64[b >> 2];\r
215 t = (b & 3) << 4;\r
216 j = 1;\r
217 break;\r
218 case 1:\r
219 chunk[i++] = b64[t | b >> 4];\r
220 t = (b & 15) << 2;\r
221 j = 2;\r
222 break;\r
223 case 2:\r
224 chunk[i++] = b64[t | b >> 6];\r
225 chunk[i++] = b64[b & 63];\r
226 j = 0;\r
227 break;\r
228 }\r
229 if (i > 8191) {\r
230 (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r
231 i = 0;\r
232 }\r
233 }\r
234 if (j) {\r
235 chunk[i++] = b64[t];\r
236 chunk[i++] = 61;\r
237 if (j === 1)\r
238 chunk[i++] = 61;\r
239 }\r
240 if (parts) {\r
241 if (i)\r
242 parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r
243 return parts.join("");\r
244 }\r
245 return String.fromCharCode.apply(String, chunk.slice(0, i));\r
246};\r
247\r
248var invalidEncoding = "invalid encoding";\r
249\r
250/**\r
251 * Decodes a base64 encoded string to a buffer.\r
252 * @param {string} string Source string\r
253 * @param {Uint8Array} buffer Destination buffer\r
254 * @param {number} offset Destination offset\r
255 * @returns {number} Number of bytes written\r
256 * @throws {Error} If encoding is invalid\r
257 */\r
258base64.decode = function decode(string, buffer, offset) {\r
259 var start = offset;\r
260 var j = 0, // goto index\r
261 t; // temporary\r
262 for (var i = 0; i < string.length;) {\r
263 var c = string.charCodeAt(i++);\r
264 if (c === 61 && j > 1)\r
265 break;\r
266 if ((c = s64[c]) === undefined)\r
267 throw Error(invalidEncoding);\r
268 switch (j) {\r
269 case 0:\r
270 t = c;\r
271 j = 1;\r
272 break;\r
273 case 1:\r
274 buffer[offset++] = t << 2 | (c & 48) >> 4;\r
275 t = c;\r
276 j = 2;\r
277 break;\r
278 case 2:\r
279 buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r
280 t = c;\r
281 j = 3;\r
282 break;\r
283 case 3:\r
284 buffer[offset++] = (t & 3) << 6 | c;\r
285 j = 0;\r
286 break;\r
287 }\r
288 }\r
289 if (j === 1)\r
290 throw Error(invalidEncoding);\r
291 return offset - start;\r
292};\r
293\r
294/**\r
295 * Tests if the specified string appears to be base64 encoded.\r
296 * @param {string} string String to test\r
297 * @returns {boolean} `true` if probably base64 encoded, otherwise false\r
298 */\r
299base64.test = function test(string) {\r
300 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r
301};\r
302
303},{}],4:[function(require,module,exports){
304"use strict";\r
305module.exports = codegen;\r
306\r
307/**\r
308 * Begins generating a function.\r
309 * @memberof util\r
310 * @param {string[]} functionParams Function parameter names\r
311 * @param {string} [functionName] Function name if not anonymous\r
312 * @returns {Codegen} Appender that appends code to the function's body\r
313 */\r
314function codegen(functionParams, functionName) {\r
315\r
316 /* istanbul ignore if */\r
317 if (typeof functionParams === "string") {\r
318 functionName = functionParams;\r
319 functionParams = undefined;\r
320 }\r
321\r
322 var body = [];\r
323\r
324 /**\r
325 * Appends code to the function's body or finishes generation.\r
326 * @typedef Codegen\r
327 * @type {function}\r
328 * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r
329 * @param {...*} [formatParams] Format parameters\r
330 * @returns {Codegen|Function} Itself or the generated function if finished\r
331 * @throws {Error} If format parameter counts do not match\r
332 */\r
333\r
334 function Codegen(formatStringOrScope) {\r
335 // note that explicit array handling below makes this ~50% faster\r
336\r
337 // finish the function\r
338 if (typeof formatStringOrScope !== "string") {\r
339 var source = toString();\r
340 if (codegen.verbose)\r
341 console.log("codegen: " + source); // eslint-disable-line no-console\r
342 source = "return " + source;\r
343 if (formatStringOrScope) {\r
344 var scopeKeys = Object.keys(formatStringOrScope),\r
345 scopeParams = new Array(scopeKeys.length + 1),\r
346 scopeValues = new Array(scopeKeys.length),\r
347 scopeOffset = 0;\r
348 while (scopeOffset < scopeKeys.length) {\r
349 scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r
350 scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r
351 }\r
352 scopeParams[scopeOffset] = source;\r
353 return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r
354 }\r
355 return Function(source)(); // eslint-disable-line no-new-func\r
356 }\r
357\r
358 // otherwise append to body\r
359 var formatParams = new Array(arguments.length - 1),\r
360 formatOffset = 0;\r
361 while (formatOffset < formatParams.length)\r
362 formatParams[formatOffset] = arguments[++formatOffset];\r
363 formatOffset = 0;\r
364 formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r
365 var value = formatParams[formatOffset++];\r
366 switch ($1) {\r
367 case "d": case "f": return String(Number(value));\r
368 case "i": return String(Math.floor(value));\r
369 case "j": return JSON.stringify(value);\r
370 case "s": return String(value);\r
371 }\r
372 return "%";\r
373 });\r
374 if (formatOffset !== formatParams.length)\r
375 throw Error("parameter count mismatch");\r
376 body.push(formatStringOrScope);\r
377 return Codegen;\r
378 }\r
379\r
380 function toString(functionNameOverride) {\r
381 return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";\r
382 }\r
383\r
384 Codegen.toString = toString;\r
385 return Codegen;\r
386}\r
387\r
388/**\r
389 * Begins generating a function.\r
390 * @memberof util\r
391 * @function codegen\r
392 * @param {string} [functionName] Function name if not anonymous\r
393 * @returns {Codegen} Appender that appends code to the function's body\r
394 * @variation 2\r
395 */\r
396\r
397/**\r
398 * When set to `true`, codegen will log generated code to console. Useful for debugging.\r
399 * @name util.codegen.verbose\r
400 * @type {boolean}\r
401 */\r
402codegen.verbose = false;\r
403
404},{}],5:[function(require,module,exports){
405"use strict";\r
406module.exports = EventEmitter;\r
407\r
408/**\r
409 * Constructs a new event emitter instance.\r
410 * @classdesc A minimal event emitter.\r
411 * @memberof util\r
412 * @constructor\r
413 */\r
414function EventEmitter() {\r
415\r
416 /**\r
417 * Registered listeners.\r
418 * @type {Object.<string,*>}\r
419 * @private\r
420 */\r
421 this._listeners = {};\r
422}\r
423\r
424/**\r
425 * Registers an event listener.\r
426 * @param {string} evt Event name\r
427 * @param {function} fn Listener\r
428 * @param {*} [ctx] Listener context\r
429 * @returns {util.EventEmitter} `this`\r
430 */\r
431EventEmitter.prototype.on = function on(evt, fn, ctx) {\r
432 (this._listeners[evt] || (this._listeners[evt] = [])).push({\r
433 fn : fn,\r
434 ctx : ctx || this\r
435 });\r
436 return this;\r
437};\r
438\r
439/**\r
440 * Removes an event listener or any matching listeners if arguments are omitted.\r
441 * @param {string} [evt] Event name. Removes all listeners if omitted.\r
442 * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r
443 * @returns {util.EventEmitter} `this`\r
444 */\r
445EventEmitter.prototype.off = function off(evt, fn) {\r
446 if (evt === undefined)\r
447 this._listeners = {};\r
448 else {\r
449 if (fn === undefined)\r
450 this._listeners[evt] = [];\r
451 else {\r
452 var listeners = this._listeners[evt];\r
453 for (var i = 0; i < listeners.length;)\r
454 if (listeners[i].fn === fn)\r
455 listeners.splice(i, 1);\r
456 else\r
457 ++i;\r
458 }\r
459 }\r
460 return this;\r
461};\r
462\r
463/**\r
464 * Emits an event by calling its listeners with the specified arguments.\r
465 * @param {string} evt Event name\r
466 * @param {...*} args Arguments\r
467 * @returns {util.EventEmitter} `this`\r
468 */\r
469EventEmitter.prototype.emit = function emit(evt) {\r
470 var listeners = this._listeners[evt];\r
471 if (listeners) {\r
472 var args = [],\r
473 i = 1;\r
474 for (; i < arguments.length;)\r
475 args.push(arguments[i++]);\r
476 for (i = 0; i < listeners.length;)\r
477 listeners[i].fn.apply(listeners[i++].ctx, args);\r
478 }\r
479 return this;\r
480};\r
481
482},{}],6:[function(require,module,exports){
483"use strict";\r
484module.exports = fetch;\r
485\r
486var asPromise = require("@protobufjs/aspromise"),\r
487 inquire = require("@protobufjs/inquire");\r
488\r
489var fs = inquire("fs");\r
490\r
491/**\r
492 * Node-style callback as used by {@link util.fetch}.\r
493 * @typedef FetchCallback\r
494 * @type {function}\r
495 * @param {?Error} error Error, if any, otherwise `null`\r
496 * @param {string} [contents] File contents, if there hasn't been an error\r
497 * @returns {undefined}\r
498 */\r
499\r
500/**\r
501 * Options as used by {@link util.fetch}.\r
502 * @typedef FetchOptions\r
503 * @type {Object}\r
504 * @property {boolean} [binary=false] Whether expecting a binary response\r
505 * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r
506 */\r
507\r
508/**\r
509 * Fetches the contents of a file.\r
510 * @memberof util\r
511 * @param {string} filename File path or url\r
512 * @param {FetchOptions} options Fetch options\r
513 * @param {FetchCallback} callback Callback function\r
514 * @returns {undefined}\r
515 */\r
516function fetch(filename, options, callback) {\r
517 if (typeof options === "function") {\r
518 callback = options;\r
519 options = {};\r
520 } else if (!options)\r
521 options = {};\r
522\r
523 if (!callback)\r
524 return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r
525\r
526 // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r
527 if (!options.xhr && fs && fs.readFile)\r
528 return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r
529 return err && typeof XMLHttpRequest !== "undefined"\r
530 ? fetch.xhr(filename, options, callback)\r
531 : err\r
532 ? callback(err)\r
533 : callback(null, options.binary ? contents : contents.toString("utf8"));\r
534 });\r
535\r
536 // use the XHR version otherwise.\r
537 return fetch.xhr(filename, options, callback);\r
538}\r
539\r
540/**\r
541 * Fetches the contents of a file.\r
542 * @name util.fetch\r
543 * @function\r
544 * @param {string} path File path or url\r
545 * @param {FetchCallback} callback Callback function\r
546 * @returns {undefined}\r
547 * @variation 2\r
548 */\r
549\r
550/**\r
551 * Fetches the contents of a file.\r
552 * @name util.fetch\r
553 * @function\r
554 * @param {string} path File path or url\r
555 * @param {FetchOptions} [options] Fetch options\r
556 * @returns {Promise<string|Uint8Array>} Promise\r
557 * @variation 3\r
558 */\r
559\r
560/**/\r
561fetch.xhr = function fetch_xhr(filename, options, callback) {\r
562 var xhr = new XMLHttpRequest();\r
563 xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r
564\r
565 if (xhr.readyState !== 4)\r
566 return undefined;\r
567\r
568 // local cors security errors return status 0 / empty string, too. afaik this cannot be\r
569 // reliably distinguished from an actually empty file for security reasons. feel free\r
570 // to send a pull request if you are aware of a solution.\r
571 if (xhr.status !== 0 && xhr.status !== 200)\r
572 return callback(Error("status " + xhr.status));\r
573\r
574 // if binary data is expected, make sure that some sort of array is returned, even if\r
575 // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r
576 if (options.binary) {\r
577 var buffer = xhr.response;\r
578 if (!buffer) {\r
579 buffer = [];\r
580 for (var i = 0; i < xhr.responseText.length; ++i)\r
581 buffer.push(xhr.responseText.charCodeAt(i) & 255);\r
582 }\r
583 return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);\r
584 }\r
585 return callback(null, xhr.responseText);\r
586 };\r
587\r
588 if (options.binary) {\r
589 // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r
590 if ("overrideMimeType" in xhr)\r
591 xhr.overrideMimeType("text/plain; charset=x-user-defined");\r
592 xhr.responseType = "arraybuffer";\r
593 }\r
594\r
595 xhr.open("GET", filename);\r
596 xhr.send();\r
597};\r
598
599},{"@protobufjs/aspromise":2,"@protobufjs/inquire":8}],7:[function(require,module,exports){
600"use strict";\r
601\r
602module.exports = factory(factory);\r
603\r
604/**\r
605 * Reads / writes floats / doubles from / to buffers.\r
606 * @name util.float\r
607 * @namespace\r
608 */\r
609\r
610/**\r
611 * Writes a 32 bit float to a buffer using little endian byte order.\r
612 * @name util.float.writeFloatLE\r
613 * @function\r
614 * @param {number} val Value to write\r
615 * @param {Uint8Array} buf Target buffer\r
616 * @param {number} pos Target buffer offset\r
617 * @returns {undefined}\r
618 */\r
619\r
620/**\r
621 * Writes a 32 bit float to a buffer using big endian byte order.\r
622 * @name util.float.writeFloatBE\r
623 * @function\r
624 * @param {number} val Value to write\r
625 * @param {Uint8Array} buf Target buffer\r
626 * @param {number} pos Target buffer offset\r
627 * @returns {undefined}\r
628 */\r
629\r
630/**\r
631 * Reads a 32 bit float from a buffer using little endian byte order.\r
632 * @name util.float.readFloatLE\r
633 * @function\r
634 * @param {Uint8Array} buf Source buffer\r
635 * @param {number} pos Source buffer offset\r
636 * @returns {number} Value read\r
637 */\r
638\r
639/**\r
640 * Reads a 32 bit float from a buffer using big endian byte order.\r
641 * @name util.float.readFloatBE\r
642 * @function\r
643 * @param {Uint8Array} buf Source buffer\r
644 * @param {number} pos Source buffer offset\r
645 * @returns {number} Value read\r
646 */\r
647\r
648/**\r
649 * Writes a 64 bit double to a buffer using little endian byte order.\r
650 * @name util.float.writeDoubleLE\r
651 * @function\r
652 * @param {number} val Value to write\r
653 * @param {Uint8Array} buf Target buffer\r
654 * @param {number} pos Target buffer offset\r
655 * @returns {undefined}\r
656 */\r
657\r
658/**\r
659 * Writes a 64 bit double to a buffer using big endian byte order.\r
660 * @name util.float.writeDoubleBE\r
661 * @function\r
662 * @param {number} val Value to write\r
663 * @param {Uint8Array} buf Target buffer\r
664 * @param {number} pos Target buffer offset\r
665 * @returns {undefined}\r
666 */\r
667\r
668/**\r
669 * Reads a 64 bit double from a buffer using little endian byte order.\r
670 * @name util.float.readDoubleLE\r
671 * @function\r
672 * @param {Uint8Array} buf Source buffer\r
673 * @param {number} pos Source buffer offset\r
674 * @returns {number} Value read\r
675 */\r
676\r
677/**\r
678 * Reads a 64 bit double from a buffer using big endian byte order.\r
679 * @name util.float.readDoubleBE\r
680 * @function\r
681 * @param {Uint8Array} buf Source buffer\r
682 * @param {number} pos Source buffer offset\r
683 * @returns {number} Value read\r
684 */\r
685\r
686// Factory function for the purpose of node-based testing in modified global environments\r
687function factory(exports) {\r
688\r
689 // float: typed array\r
690 if (typeof Float32Array !== "undefined") (function() {\r
691\r
692 var f32 = new Float32Array([ -0 ]),\r
693 f8b = new Uint8Array(f32.buffer),\r
694 le = f8b[3] === 128;\r
695\r
696 function writeFloat_f32_cpy(val, buf, pos) {\r
697 f32[0] = val;\r
698 buf[pos ] = f8b[0];\r
699 buf[pos + 1] = f8b[1];\r
700 buf[pos + 2] = f8b[2];\r
701 buf[pos + 3] = f8b[3];\r
702 }\r
703\r
704 function writeFloat_f32_rev(val, buf, pos) {\r
705 f32[0] = val;\r
706 buf[pos ] = f8b[3];\r
707 buf[pos + 1] = f8b[2];\r
708 buf[pos + 2] = f8b[1];\r
709 buf[pos + 3] = f8b[0];\r
710 }\r
711\r
712 /* istanbul ignore next */\r
713 exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r
714 /* istanbul ignore next */\r
715 exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r
716\r
717 function readFloat_f32_cpy(buf, pos) {\r
718 f8b[0] = buf[pos ];\r
719 f8b[1] = buf[pos + 1];\r
720 f8b[2] = buf[pos + 2];\r
721 f8b[3] = buf[pos + 3];\r
722 return f32[0];\r
723 }\r
724\r
725 function readFloat_f32_rev(buf, pos) {\r
726 f8b[3] = buf[pos ];\r
727 f8b[2] = buf[pos + 1];\r
728 f8b[1] = buf[pos + 2];\r
729 f8b[0] = buf[pos + 3];\r
730 return f32[0];\r
731 }\r
732\r
733 /* istanbul ignore next */\r
734 exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r
735 /* istanbul ignore next */\r
736 exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r
737\r
738 // float: ieee754\r
739 })(); else (function() {\r
740\r
741 function writeFloat_ieee754(writeUint, val, buf, pos) {\r
742 var sign = val < 0 ? 1 : 0;\r
743 if (sign)\r
744 val = -val;\r
745 if (val === 0)\r
746 writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r
747 else if (isNaN(val))\r
748 writeUint(2143289344, buf, pos);\r
749 else if (val > 3.4028234663852886e+38) // +-Infinity\r
750 writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r
751 else if (val < 1.1754943508222875e-38) // denormal\r
752 writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r
753 else {\r
754 var exponent = Math.floor(Math.log(val) / Math.LN2),\r
755 mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r
756 writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r
757 }\r
758 }\r
759\r
760 exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r
761 exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r
762\r
763 function readFloat_ieee754(readUint, buf, pos) {\r
764 var uint = readUint(buf, pos),\r
765 sign = (uint >> 31) * 2 + 1,\r
766 exponent = uint >>> 23 & 255,\r
767 mantissa = uint & 8388607;\r
768 return exponent === 255\r
769 ? mantissa\r
770 ? NaN\r
771 : sign * Infinity\r
772 : exponent === 0 // denormal\r
773 ? sign * 1.401298464324817e-45 * mantissa\r
774 : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r
775 }\r
776\r
777 exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r
778 exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r
779\r
780 })();\r
781\r
782 // double: typed array\r
783 if (typeof Float64Array !== "undefined") (function() {\r
784\r
785 var f64 = new Float64Array([-0]),\r
786 f8b = new Uint8Array(f64.buffer),\r
787 le = f8b[7] === 128;\r
788\r
789 function writeDouble_f64_cpy(val, buf, pos) {\r
790 f64[0] = val;\r
791 buf[pos ] = f8b[0];\r
792 buf[pos + 1] = f8b[1];\r
793 buf[pos + 2] = f8b[2];\r
794 buf[pos + 3] = f8b[3];\r
795 buf[pos + 4] = f8b[4];\r
796 buf[pos + 5] = f8b[5];\r
797 buf[pos + 6] = f8b[6];\r
798 buf[pos + 7] = f8b[7];\r
799 }\r
800\r
801 function writeDouble_f64_rev(val, buf, pos) {\r
802 f64[0] = val;\r
803 buf[pos ] = f8b[7];\r
804 buf[pos + 1] = f8b[6];\r
805 buf[pos + 2] = f8b[5];\r
806 buf[pos + 3] = f8b[4];\r
807 buf[pos + 4] = f8b[3];\r
808 buf[pos + 5] = f8b[2];\r
809 buf[pos + 6] = f8b[1];\r
810 buf[pos + 7] = f8b[0];\r
811 }\r
812\r
813 /* istanbul ignore next */\r
814 exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r
815 /* istanbul ignore next */\r
816 exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r
817\r
818 function readDouble_f64_cpy(buf, pos) {\r
819 f8b[0] = buf[pos ];\r
820 f8b[1] = buf[pos + 1];\r
821 f8b[2] = buf[pos + 2];\r
822 f8b[3] = buf[pos + 3];\r
823 f8b[4] = buf[pos + 4];\r
824 f8b[5] = buf[pos + 5];\r
825 f8b[6] = buf[pos + 6];\r
826 f8b[7] = buf[pos + 7];\r
827 return f64[0];\r
828 }\r
829\r
830 function readDouble_f64_rev(buf, pos) {\r
831 f8b[7] = buf[pos ];\r
832 f8b[6] = buf[pos + 1];\r
833 f8b[5] = buf[pos + 2];\r
834 f8b[4] = buf[pos + 3];\r
835 f8b[3] = buf[pos + 4];\r
836 f8b[2] = buf[pos + 5];\r
837 f8b[1] = buf[pos + 6];\r
838 f8b[0] = buf[pos + 7];\r
839 return f64[0];\r
840 }\r
841\r
842 /* istanbul ignore next */\r
843 exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r
844 /* istanbul ignore next */\r
845 exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r
846\r
847 // double: ieee754\r
848 })(); else (function() {\r
849\r
850 function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r
851 var sign = val < 0 ? 1 : 0;\r
852 if (sign)\r
853 val = -val;\r
854 if (val === 0) {\r
855 writeUint(0, buf, pos + off0);\r
856 writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r
857 } else if (isNaN(val)) {\r
858 writeUint(0, buf, pos + off0);\r
859 writeUint(2146959360, buf, pos + off1);\r
860 } else if (val > 1.7976931348623157e+308) { // +-Infinity\r
861 writeUint(0, buf, pos + off0);\r
862 writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r
863 } else {\r
864 var mantissa;\r
865 if (val < 2.2250738585072014e-308) { // denormal\r
866 mantissa = val / 5e-324;\r
867 writeUint(mantissa >>> 0, buf, pos + off0);\r
868 writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r
869 } else {\r
870 var exponent = Math.floor(Math.log(val) / Math.LN2);\r
871 if (exponent === 1024)\r
872 exponent = 1023;\r
873 mantissa = val * Math.pow(2, -exponent);\r
874 writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r
875 writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r
876 }\r
877 }\r
878 }\r
879\r
880 exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r
881 exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r
882\r
883 function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r
884 var lo = readUint(buf, pos + off0),\r
885 hi = readUint(buf, pos + off1);\r
886 var sign = (hi >> 31) * 2 + 1,\r
887 exponent = hi >>> 20 & 2047,\r
888 mantissa = 4294967296 * (hi & 1048575) + lo;\r
889 return exponent === 2047\r
890 ? mantissa\r
891 ? NaN\r
892 : sign * Infinity\r
893 : exponent === 0 // denormal\r
894 ? sign * 5e-324 * mantissa\r
895 : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r
896 }\r
897\r
898 exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r
899 exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r
900\r
901 })();\r
902\r
903 return exports;\r
904}\r
905\r
906// uint helpers\r
907\r
908function writeUintLE(val, buf, pos) {\r
909 buf[pos ] = val & 255;\r
910 buf[pos + 1] = val >>> 8 & 255;\r
911 buf[pos + 2] = val >>> 16 & 255;\r
912 buf[pos + 3] = val >>> 24;\r
913}\r
914\r
915function writeUintBE(val, buf, pos) {\r
916 buf[pos ] = val >>> 24;\r
917 buf[pos + 1] = val >>> 16 & 255;\r
918 buf[pos + 2] = val >>> 8 & 255;\r
919 buf[pos + 3] = val & 255;\r
920}\r
921\r
922function readUintLE(buf, pos) {\r
923 return (buf[pos ]\r
924 | buf[pos + 1] << 8\r
925 | buf[pos + 2] << 16\r
926 | buf[pos + 3] << 24) >>> 0;\r
927}\r
928\r
929function readUintBE(buf, pos) {\r
930 return (buf[pos ] << 24\r
931 | buf[pos + 1] << 16\r
932 | buf[pos + 2] << 8\r
933 | buf[pos + 3]) >>> 0;\r
934}\r
935
936},{}],8:[function(require,module,exports){
937"use strict";\r
938module.exports = inquire;\r
939\r
940/**\r
941 * Requires a module only if available.\r
942 * @memberof util\r
943 * @param {string} moduleName Module to require\r
944 * @returns {?Object} Required module if available and not empty, otherwise `null`\r
945 */\r
946function inquire(moduleName) {\r
947 try {\r
948 var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval\r
949 if (mod && (mod.length || Object.keys(mod).length))\r
950 return mod;\r
951 } catch (e) {} // eslint-disable-line no-empty\r
952 return null;\r
953}\r
954
955},{}],9:[function(require,module,exports){
956"use strict";\r
957\r
958/**\r
959 * A minimal path module to resolve Unix, Windows and URL paths alike.\r
960 * @memberof util\r
961 * @namespace\r
962 */\r
963var path = exports;\r
964\r
965var isAbsolute =\r
966/**\r
967 * Tests if the specified path is absolute.\r
968 * @param {string} path Path to test\r
969 * @returns {boolean} `true` if path is absolute\r
970 */\r
971path.isAbsolute = function isAbsolute(path) {\r
972 return /^(?:\/|\w+:)/.test(path);\r
973};\r
974\r
975var normalize =\r
976/**\r
977 * Normalizes the specified path.\r
978 * @param {string} path Path to normalize\r
979 * @returns {string} Normalized path\r
980 */\r
981path.normalize = function normalize(path) {\r
982 path = path.replace(/\\/g, "/")\r
983 .replace(/\/{2,}/g, "/");\r
984 var parts = path.split("/"),\r
985 absolute = isAbsolute(path),\r
986 prefix = "";\r
987 if (absolute)\r
988 prefix = parts.shift() + "/";\r
989 for (var i = 0; i < parts.length;) {\r
990 if (parts[i] === "..") {\r
991 if (i > 0 && parts[i - 1] !== "..")\r
992 parts.splice(--i, 2);\r
993 else if (absolute)\r
994 parts.splice(i, 1);\r
995 else\r
996 ++i;\r
997 } else if (parts[i] === ".")\r
998 parts.splice(i, 1);\r
999 else\r
1000 ++i;\r
1001 }\r
1002 return prefix + parts.join("/");\r
1003};\r
1004\r
1005/**\r
1006 * Resolves the specified include path against the specified origin path.\r
1007 * @param {string} originPath Path to the origin file\r
1008 * @param {string} includePath Include path relative to origin path\r
1009 * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r
1010 * @returns {string} Path to the include file\r
1011 */\r
1012path.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r
1013 if (!alreadyNormalized)\r
1014 includePath = normalize(includePath);\r
1015 if (isAbsolute(includePath))\r
1016 return includePath;\r
1017 if (!alreadyNormalized)\r
1018 originPath = normalize(originPath);\r
1019 return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;\r
1020};\r
1021
1022},{}],10:[function(require,module,exports){
1023"use strict";\r
1024module.exports = pool;\r
1025\r
1026/**\r
1027 * An allocator as used by {@link util.pool}.\r
1028 * @typedef PoolAllocator\r
1029 * @type {function}\r
1030 * @param {number} size Buffer size\r
1031 * @returns {Uint8Array} Buffer\r
1032 */\r
1033\r
1034/**\r
1035 * A slicer as used by {@link util.pool}.\r
1036 * @typedef PoolSlicer\r
1037 * @type {function}\r
1038 * @param {number} start Start offset\r
1039 * @param {number} end End offset\r
1040 * @returns {Uint8Array} Buffer slice\r
1041 * @this {Uint8Array}\r
1042 */\r
1043\r
1044/**\r
1045 * A general purpose buffer pool.\r
1046 * @memberof util\r
1047 * @function\r
1048 * @param {PoolAllocator} alloc Allocator\r
1049 * @param {PoolSlicer} slice Slicer\r
1050 * @param {number} [size=8192] Slab size\r
1051 * @returns {PoolAllocator} Pooled allocator\r
1052 */\r
1053function pool(alloc, slice, size) {\r
1054 var SIZE = size || 8192;\r
1055 var MAX = SIZE >>> 1;\r
1056 var slab = null;\r
1057 var offset = SIZE;\r
1058 return function pool_alloc(size) {\r
1059 if (size < 1 || size > MAX)\r
1060 return alloc(size);\r
1061 if (offset + size > SIZE) {\r
1062 slab = alloc(SIZE);\r
1063 offset = 0;\r
1064 }\r
1065 var buf = slice.call(slab, offset, offset += size);\r
1066 if (offset & 7) // align to 32 bit\r
1067 offset = (offset | 7) + 1;\r
1068 return buf;\r
1069 };\r
1070}\r
1071
1072},{}],11:[function(require,module,exports){
1073"use strict";\r
1074\r
1075/**\r
1076 * A minimal UTF8 implementation for number arrays.\r
1077 * @memberof util\r
1078 * @namespace\r
1079 */\r
1080var utf8 = exports;\r
1081\r
1082/**\r
1083 * Calculates the UTF8 byte length of a string.\r
1084 * @param {string} string String\r
1085 * @returns {number} Byte length\r
1086 */\r
1087utf8.length = function utf8_length(string) {\r
1088 var len = 0,\r
1089 c = 0;\r
1090 for (var i = 0; i < string.length; ++i) {\r
1091 c = string.charCodeAt(i);\r
1092 if (c < 128)\r
1093 len += 1;\r
1094 else if (c < 2048)\r
1095 len += 2;\r
1096 else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r
1097 ++i;\r
1098 len += 4;\r
1099 } else\r
1100 len += 3;\r
1101 }\r
1102 return len;\r
1103};\r
1104\r
1105/**\r
1106 * Reads UTF8 bytes as a string.\r
1107 * @param {Uint8Array} buffer Source buffer\r
1108 * @param {number} start Source start\r
1109 * @param {number} end Source end\r
1110 * @returns {string} String read\r
1111 */\r
1112utf8.read = function utf8_read(buffer, start, end) {\r
1113 var len = end - start;\r
1114 if (len < 1)\r
1115 return "";\r
1116 var parts = null,\r
1117 chunk = [],\r
1118 i = 0, // char offset\r
1119 t; // temporary\r
1120 while (start < end) {\r
1121 t = buffer[start++];\r
1122 if (t < 128)\r
1123 chunk[i++] = t;\r
1124 else if (t > 191 && t < 224)\r
1125 chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r
1126 else if (t > 239 && t < 365) {\r
1127 t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r
1128 chunk[i++] = 0xD800 + (t >> 10);\r
1129 chunk[i++] = 0xDC00 + (t & 1023);\r
1130 } else\r
1131 chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r
1132 if (i > 8191) {\r
1133 (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r
1134 i = 0;\r
1135 }\r
1136 }\r
1137 if (parts) {\r
1138 if (i)\r
1139 parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r
1140 return parts.join("");\r
1141 }\r
1142 return String.fromCharCode.apply(String, chunk.slice(0, i));\r
1143};\r
1144\r
1145/**\r
1146 * Writes a string as UTF8 bytes.\r
1147 * @param {string} string Source string\r
1148 * @param {Uint8Array} buffer Destination buffer\r
1149 * @param {number} offset Destination offset\r
1150 * @returns {number} Bytes written\r
1151 */\r
1152utf8.write = function utf8_write(string, buffer, offset) {\r
1153 var start = offset,\r
1154 c1, // character 1\r
1155 c2; // character 2\r
1156 for (var i = 0; i < string.length; ++i) {\r
1157 c1 = string.charCodeAt(i);\r
1158 if (c1 < 128) {\r
1159 buffer[offset++] = c1;\r
1160 } else if (c1 < 2048) {\r
1161 buffer[offset++] = c1 >> 6 | 192;\r
1162 buffer[offset++] = c1 & 63 | 128;\r
1163 } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r
1164 c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r
1165 ++i;\r
1166 buffer[offset++] = c1 >> 18 | 240;\r
1167 buffer[offset++] = c1 >> 12 & 63 | 128;\r
1168 buffer[offset++] = c1 >> 6 & 63 | 128;\r
1169 buffer[offset++] = c1 & 63 | 128;\r
1170 } else {\r
1171 buffer[offset++] = c1 >> 12 | 224;\r
1172 buffer[offset++] = c1 >> 6 & 63 | 128;\r
1173 buffer[offset++] = c1 & 63 | 128;\r
1174 }\r
1175 }\r
1176 return offset - start;\r
1177};\r
1178
1179},{}],12:[function(require,module,exports){
1180var asn1 = exports;
1181
1182asn1.bignum = require('bn.js');
1183
1184asn1.define = require('./asn1/api').define;
1185asn1.base = require('./asn1/base');
1186asn1.constants = require('./asn1/constants');
1187asn1.decoders = require('./asn1/decoders');
1188asn1.encoders = require('./asn1/encoders');
1189
1190},{"./asn1/api":13,"./asn1/base":15,"./asn1/constants":19,"./asn1/decoders":21,"./asn1/encoders":24,"bn.js":108}],13:[function(require,module,exports){
1191var asn1 = require('../asn1');
1192var inherits = require('inherits');
1193
1194var api = exports;
1195
1196api.define = function define(name, body) {
1197 return new Entity(name, body);
1198};
1199
1200function Entity(name, body) {
1201 this.name = name;
1202 this.body = body;
1203
1204 this.decoders = {};
1205 this.encoders = {};
1206};
1207
1208Entity.prototype._createNamed = function createNamed(base) {
1209 var named;
1210 try {
1211 named = require('vm').runInThisContext(
1212 '(function ' + this.name + '(entity) {\n' +
1213 ' this._initNamed(entity);\n' +
1214 '})'
1215 );
1216 } catch (e) {
1217 named = function (entity) {
1218 this._initNamed(entity);
1219 };
1220 }
1221 inherits(named, base);
1222 named.prototype._initNamed = function initnamed(entity) {
1223 base.call(this, entity);
1224 };
1225
1226 return new named(this);
1227};
1228
1229Entity.prototype._getDecoder = function _getDecoder(enc) {
1230 enc = enc || 'der';
1231 // Lazily create decoder
1232 if (!this.decoders.hasOwnProperty(enc))
1233 this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
1234 return this.decoders[enc];
1235};
1236
1237Entity.prototype.decode = function decode(data, enc, options) {
1238 return this._getDecoder(enc).decode(data, options);
1239};
1240
1241Entity.prototype._getEncoder = function _getEncoder(enc) {
1242 enc = enc || 'der';
1243 // Lazily create encoder
1244 if (!this.encoders.hasOwnProperty(enc))
1245 this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
1246 return this.encoders[enc];
1247};
1248
1249Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
1250 return this._getEncoder(enc).encode(data, reporter);
1251};
1252
1253},{"../asn1":12,"inherits":396,"vm":831}],14:[function(require,module,exports){
1254var inherits = require('inherits');
1255var Reporter = require('../base').Reporter;
1256var Buffer = require('buffer').Buffer;
1257
1258function DecoderBuffer(base, options) {
1259 Reporter.call(this, options);
1260 if (!Buffer.isBuffer(base)) {
1261 this.error('Input not Buffer');
1262 return;
1263 }
1264
1265 this.base = base;
1266 this.offset = 0;
1267 this.length = base.length;
1268}
1269inherits(DecoderBuffer, Reporter);
1270exports.DecoderBuffer = DecoderBuffer;
1271
1272DecoderBuffer.prototype.save = function save() {
1273 return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
1274};
1275
1276DecoderBuffer.prototype.restore = function restore(save) {
1277 // Return skipped data
1278 var res = new DecoderBuffer(this.base);
1279 res.offset = save.offset;
1280 res.length = this.offset;
1281
1282 this.offset = save.offset;
1283 Reporter.prototype.restore.call(this, save.reporter);
1284
1285 return res;
1286};
1287
1288DecoderBuffer.prototype.isEmpty = function isEmpty() {
1289 return this.offset === this.length;
1290};
1291
1292DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
1293 if (this.offset + 1 <= this.length)
1294 return this.base.readUInt8(this.offset++, true);
1295 else
1296 return this.error(fail || 'DecoderBuffer overrun');
1297}
1298
1299DecoderBuffer.prototype.skip = function skip(bytes, fail) {
1300 if (!(this.offset + bytes <= this.length))
1301 return this.error(fail || 'DecoderBuffer overrun');
1302
1303 var res = new DecoderBuffer(this.base);
1304
1305 // Share reporter state
1306 res._reporterState = this._reporterState;
1307
1308 res.offset = this.offset;
1309 res.length = this.offset + bytes;
1310 this.offset += bytes;
1311 return res;
1312}
1313
1314DecoderBuffer.prototype.raw = function raw(save) {
1315 return this.base.slice(save ? save.offset : this.offset, this.length);
1316}
1317
1318function EncoderBuffer(value, reporter) {
1319 if (Array.isArray(value)) {
1320 this.length = 0;
1321 this.value = value.map(function(item) {
1322 if (!(item instanceof EncoderBuffer))
1323 item = new EncoderBuffer(item, reporter);
1324 this.length += item.length;
1325 return item;
1326 }, this);
1327 } else if (typeof value === 'number') {
1328 if (!(0 <= value && value <= 0xff))
1329 return reporter.error('non-byte EncoderBuffer value');
1330 this.value = value;
1331 this.length = 1;
1332 } else if (typeof value === 'string') {
1333 this.value = value;
1334 this.length = Buffer.byteLength(value);
1335 } else if (Buffer.isBuffer(value)) {
1336 this.value = value;
1337 this.length = value.length;
1338 } else {
1339 return reporter.error('Unsupported type: ' + typeof value);
1340 }
1341}
1342exports.EncoderBuffer = EncoderBuffer;
1343
1344EncoderBuffer.prototype.join = function join(out, offset) {
1345 if (!out)
1346 out = new Buffer(this.length);
1347 if (!offset)
1348 offset = 0;
1349
1350 if (this.length === 0)
1351 return out;
1352
1353 if (Array.isArray(this.value)) {
1354 this.value.forEach(function(item) {
1355 item.join(out, offset);
1356 offset += item.length;
1357 });
1358 } else {
1359 if (typeof this.value === 'number')
1360 out[offset] = this.value;
1361 else if (typeof this.value === 'string')
1362 out.write(this.value, offset);
1363 else if (Buffer.isBuffer(this.value))
1364 this.value.copy(out, offset);
1365 offset += this.length;
1366 }
1367
1368 return out;
1369};
1370
1371},{"../base":15,"buffer":146,"inherits":396}],15:[function(require,module,exports){
1372var base = exports;
1373
1374base.Reporter = require('./reporter').Reporter;
1375base.DecoderBuffer = require('./buffer').DecoderBuffer;
1376base.EncoderBuffer = require('./buffer').EncoderBuffer;
1377base.Node = require('./node');
1378
1379},{"./buffer":14,"./node":16,"./reporter":17}],16:[function(require,module,exports){
1380var Reporter = require('../base').Reporter;
1381var EncoderBuffer = require('../base').EncoderBuffer;
1382var DecoderBuffer = require('../base').DecoderBuffer;
1383var assert = require('minimalistic-assert');
1384
1385// Supported tags
1386var tags = [
1387 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
1388 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
1389 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
1390 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
1391];
1392
1393// Public methods list
1394var methods = [
1395 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
1396 'any', 'contains'
1397].concat(tags);
1398
1399// Overrided methods list
1400var overrided = [
1401 '_peekTag', '_decodeTag', '_use',
1402 '_decodeStr', '_decodeObjid', '_decodeTime',
1403 '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
1404
1405 '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
1406 '_encodeNull', '_encodeInt', '_encodeBool'
1407];
1408
1409function Node(enc, parent) {
1410 var state = {};
1411 this._baseState = state;
1412
1413 state.enc = enc;
1414
1415 state.parent = parent || null;
1416 state.children = null;
1417
1418 // State
1419 state.tag = null;
1420 state.args = null;
1421 state.reverseArgs = null;
1422 state.choice = null;
1423 state.optional = false;
1424 state.any = false;
1425 state.obj = false;
1426 state.use = null;
1427 state.useDecoder = null;
1428 state.key = null;
1429 state['default'] = null;
1430 state.explicit = null;
1431 state.implicit = null;
1432 state.contains = null;
1433
1434 // Should create new instance on each method
1435 if (!state.parent) {
1436 state.children = [];
1437 this._wrap();
1438 }
1439}
1440module.exports = Node;
1441
1442var stateProps = [
1443 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
1444 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
1445 'implicit', 'contains'
1446];
1447
1448Node.prototype.clone = function clone() {
1449 var state = this._baseState;
1450 var cstate = {};
1451 stateProps.forEach(function(prop) {
1452 cstate[prop] = state[prop];
1453 });
1454 var res = new this.constructor(cstate.parent);
1455 res._baseState = cstate;
1456 return res;
1457};
1458
1459Node.prototype._wrap = function wrap() {
1460 var state = this._baseState;
1461 methods.forEach(function(method) {
1462 this[method] = function _wrappedMethod() {
1463 var clone = new this.constructor(this);
1464 state.children.push(clone);
1465 return clone[method].apply(clone, arguments);
1466 };
1467 }, this);
1468};
1469
1470Node.prototype._init = function init(body) {
1471 var state = this._baseState;
1472
1473 assert(state.parent === null);
1474 body.call(this);
1475
1476 // Filter children
1477 state.children = state.children.filter(function(child) {
1478 return child._baseState.parent === this;
1479 }, this);
1480 assert.equal(state.children.length, 1, 'Root node can have only one child');
1481};
1482
1483Node.prototype._useArgs = function useArgs(args) {
1484 var state = this._baseState;
1485
1486 // Filter children and args
1487 var children = args.filter(function(arg) {
1488 return arg instanceof this.constructor;
1489 }, this);
1490 args = args.filter(function(arg) {
1491 return !(arg instanceof this.constructor);
1492 }, this);
1493
1494 if (children.length !== 0) {
1495 assert(state.children === null);
1496 state.children = children;
1497
1498 // Replace parent to maintain backward link
1499 children.forEach(function(child) {
1500 child._baseState.parent = this;
1501 }, this);
1502 }
1503 if (args.length !== 0) {
1504 assert(state.args === null);
1505 state.args = args;
1506 state.reverseArgs = args.map(function(arg) {
1507 if (typeof arg !== 'object' || arg.constructor !== Object)
1508 return arg;
1509
1510 var res = {};
1511 Object.keys(arg).forEach(function(key) {
1512 if (key == (key | 0))
1513 key |= 0;
1514 var value = arg[key];
1515 res[value] = key;
1516 });
1517 return res;
1518 });
1519 }
1520};
1521
1522//
1523// Overrided methods
1524//
1525
1526overrided.forEach(function(method) {
1527 Node.prototype[method] = function _overrided() {
1528 var state = this._baseState;
1529 throw new Error(method + ' not implemented for encoding: ' + state.enc);
1530 };
1531});
1532
1533//
1534// Public methods
1535//
1536
1537tags.forEach(function(tag) {
1538 Node.prototype[tag] = function _tagMethod() {
1539 var state = this._baseState;
1540 var args = Array.prototype.slice.call(arguments);
1541
1542 assert(state.tag === null);
1543 state.tag = tag;
1544
1545 this._useArgs(args);
1546
1547 return this;
1548 };
1549});
1550
1551Node.prototype.use = function use(item) {
1552 assert(item);
1553 var state = this._baseState;
1554
1555 assert(state.use === null);
1556 state.use = item;
1557
1558 return this;
1559};
1560
1561Node.prototype.optional = function optional() {
1562 var state = this._baseState;
1563
1564 state.optional = true;
1565
1566 return this;
1567};
1568
1569Node.prototype.def = function def(val) {
1570 var state = this._baseState;
1571
1572 assert(state['default'] === null);
1573 state['default'] = val;
1574 state.optional = true;
1575
1576 return this;
1577};
1578
1579Node.prototype.explicit = function explicit(num) {
1580 var state = this._baseState;
1581
1582 assert(state.explicit === null && state.implicit === null);
1583 state.explicit = num;
1584
1585 return this;
1586};
1587
1588Node.prototype.implicit = function implicit(num) {
1589 var state = this._baseState;
1590
1591 assert(state.explicit === null && state.implicit === null);
1592 state.implicit = num;
1593
1594 return this;
1595};
1596
1597Node.prototype.obj = function obj() {
1598 var state = this._baseState;
1599 var args = Array.prototype.slice.call(arguments);
1600
1601 state.obj = true;
1602
1603 if (args.length !== 0)
1604 this._useArgs(args);
1605
1606 return this;
1607};
1608
1609Node.prototype.key = function key(newKey) {
1610 var state = this._baseState;
1611
1612 assert(state.key === null);
1613 state.key = newKey;
1614
1615 return this;
1616};
1617
1618Node.prototype.any = function any() {
1619 var state = this._baseState;
1620
1621 state.any = true;
1622
1623 return this;
1624};
1625
1626Node.prototype.choice = function choice(obj) {
1627 var state = this._baseState;
1628
1629 assert(state.choice === null);
1630 state.choice = obj;
1631 this._useArgs(Object.keys(obj).map(function(key) {
1632 return obj[key];
1633 }));
1634
1635 return this;
1636};
1637
1638Node.prototype.contains = function contains(item) {
1639 var state = this._baseState;
1640
1641 assert(state.use === null);
1642 state.contains = item;
1643
1644 return this;
1645};
1646
1647//
1648// Decoding
1649//
1650
1651Node.prototype._decode = function decode(input, options) {
1652 var state = this._baseState;
1653
1654 // Decode root node
1655 if (state.parent === null)
1656 return input.wrapResult(state.children[0]._decode(input, options));
1657
1658 var result = state['default'];
1659 var present = true;
1660
1661 var prevKey = null;
1662 if (state.key !== null)
1663 prevKey = input.enterKey(state.key);
1664
1665 // Check if tag is there
1666 if (state.optional) {
1667 var tag = null;
1668 if (state.explicit !== null)
1669 tag = state.explicit;
1670 else if (state.implicit !== null)
1671 tag = state.implicit;
1672 else if (state.tag !== null)
1673 tag = state.tag;
1674
1675 if (tag === null && !state.any) {
1676 // Trial and Error
1677 var save = input.save();
1678 try {
1679 if (state.choice === null)
1680 this._decodeGeneric(state.tag, input, options);
1681 else
1682 this._decodeChoice(input, options);
1683 present = true;
1684 } catch (e) {
1685 present = false;
1686 }
1687 input.restore(save);
1688 } else {
1689 present = this._peekTag(input, tag, state.any);
1690
1691 if (input.isError(present))
1692 return present;
1693 }
1694 }
1695
1696 // Push object on stack
1697 var prevObj;
1698 if (state.obj && present)
1699 prevObj = input.enterObject();
1700
1701 if (present) {
1702 // Unwrap explicit values
1703 if (state.explicit !== null) {
1704 var explicit = this._decodeTag(input, state.explicit);
1705 if (input.isError(explicit))
1706 return explicit;
1707 input = explicit;
1708 }
1709
1710 var start = input.offset;
1711
1712 // Unwrap implicit and normal values
1713 if (state.use === null && state.choice === null) {
1714 if (state.any)
1715 var save = input.save();
1716 var body = this._decodeTag(
1717 input,
1718 state.implicit !== null ? state.implicit : state.tag,
1719 state.any
1720 );
1721 if (input.isError(body))
1722 return body;
1723
1724 if (state.any)
1725 result = input.raw(save);
1726 else
1727 input = body;
1728 }
1729
1730 if (options && options.track && state.tag !== null)
1731 options.track(input.path(), start, input.length, 'tagged');
1732
1733 if (options && options.track && state.tag !== null)
1734 options.track(input.path(), input.offset, input.length, 'content');
1735
1736 // Select proper method for tag
1737 if (state.any)
1738 result = result;
1739 else if (state.choice === null)
1740 result = this._decodeGeneric(state.tag, input, options);
1741 else
1742 result = this._decodeChoice(input, options);
1743
1744 if (input.isError(result))
1745 return result;
1746
1747 // Decode children
1748 if (!state.any && state.choice === null && state.children !== null) {
1749 state.children.forEach(function decodeChildren(child) {
1750 // NOTE: We are ignoring errors here, to let parser continue with other
1751 // parts of encoded data
1752 child._decode(input, options);
1753 });
1754 }
1755
1756 // Decode contained/encoded by schema, only in bit or octet strings
1757 if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
1758 var data = new DecoderBuffer(result);
1759 result = this._getUse(state.contains, input._reporterState.obj)
1760 ._decode(data, options);
1761 }
1762 }
1763
1764 // Pop object
1765 if (state.obj && present)
1766 result = input.leaveObject(prevObj);
1767
1768 // Set key
1769 if (state.key !== null && (result !== null || present === true))
1770 input.leaveKey(prevKey, state.key, result);
1771 else if (prevKey !== null)
1772 input.exitKey(prevKey);
1773
1774 return result;
1775};
1776
1777Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
1778 var state = this._baseState;
1779
1780 if (tag === 'seq' || tag === 'set')
1781 return null;
1782 if (tag === 'seqof' || tag === 'setof')
1783 return this._decodeList(input, tag, state.args[0], options);
1784 else if (/str$/.test(tag))
1785 return this._decodeStr(input, tag, options);
1786 else if (tag === 'objid' && state.args)
1787 return this._decodeObjid(input, state.args[0], state.args[1], options);
1788 else if (tag === 'objid')
1789 return this._decodeObjid(input, null, null, options);
1790 else if (tag === 'gentime' || tag === 'utctime')
1791 return this._decodeTime(input, tag, options);
1792 else if (tag === 'null_')
1793 return this._decodeNull(input, options);
1794 else if (tag === 'bool')
1795 return this._decodeBool(input, options);
1796 else if (tag === 'objDesc')
1797 return this._decodeStr(input, tag, options);
1798 else if (tag === 'int' || tag === 'enum')
1799 return this._decodeInt(input, state.args && state.args[0], options);
1800
1801 if (state.use !== null) {
1802 return this._getUse(state.use, input._reporterState.obj)
1803 ._decode(input, options);
1804 } else {
1805 return input.error('unknown tag: ' + tag);
1806 }
1807};
1808
1809Node.prototype._getUse = function _getUse(entity, obj) {
1810
1811 var state = this._baseState;
1812 // Create altered use decoder if implicit is set
1813 state.useDecoder = this._use(entity, obj);
1814 assert(state.useDecoder._baseState.parent === null);
1815 state.useDecoder = state.useDecoder._baseState.children[0];
1816 if (state.implicit !== state.useDecoder._baseState.implicit) {
1817 state.useDecoder = state.useDecoder.clone();
1818 state.useDecoder._baseState.implicit = state.implicit;
1819 }
1820 return state.useDecoder;
1821};
1822
1823Node.prototype._decodeChoice = function decodeChoice(input, options) {
1824 var state = this._baseState;
1825 var result = null;
1826 var match = false;
1827
1828 Object.keys(state.choice).some(function(key) {
1829 var save = input.save();
1830 var node = state.choice[key];
1831 try {
1832 var value = node._decode(input, options);
1833 if (input.isError(value))
1834 return false;
1835
1836 result = { type: key, value: value };
1837 match = true;
1838 } catch (e) {
1839 input.restore(save);
1840 return false;
1841 }
1842 return true;
1843 }, this);
1844
1845 if (!match)
1846 return input.error('Choice not matched');
1847
1848 return result;
1849};
1850
1851//
1852// Encoding
1853//
1854
1855Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
1856 return new EncoderBuffer(data, this.reporter);
1857};
1858
1859Node.prototype._encode = function encode(data, reporter, parent) {
1860 var state = this._baseState;
1861 if (state['default'] !== null && state['default'] === data)
1862 return;
1863
1864 var result = this._encodeValue(data, reporter, parent);
1865 if (result === undefined)
1866 return;
1867
1868 if (this._skipDefault(result, reporter, parent))
1869 return;
1870
1871 return result;
1872};
1873
1874Node.prototype._encodeValue = function encode(data, reporter, parent) {
1875 var state = this._baseState;
1876
1877 // Decode root node
1878 if (state.parent === null)
1879 return state.children[0]._encode(data, reporter || new Reporter());
1880
1881 var result = null;
1882
1883 // Set reporter to share it with a child class
1884 this.reporter = reporter;
1885
1886 // Check if data is there
1887 if (state.optional && data === undefined) {
1888 if (state['default'] !== null)
1889 data = state['default']
1890 else
1891 return;
1892 }
1893
1894 // Encode children first
1895 var content = null;
1896 var primitive = false;
1897 if (state.any) {
1898 // Anything that was given is translated to buffer
1899 result = this._createEncoderBuffer(data);
1900 } else if (state.choice) {
1901 result = this._encodeChoice(data, reporter);
1902 } else if (state.contains) {
1903 content = this._getUse(state.contains, parent)._encode(data, reporter);
1904 primitive = true;
1905 } else if (state.children) {
1906 content = state.children.map(function(child) {
1907 if (child._baseState.tag === 'null_')
1908 return child._encode(null, reporter, data);
1909
1910 if (child._baseState.key === null)
1911 return reporter.error('Child should have a key');
1912 var prevKey = reporter.enterKey(child._baseState.key);
1913
1914 if (typeof data !== 'object')
1915 return reporter.error('Child expected, but input is not object');
1916
1917 var res = child._encode(data[child._baseState.key], reporter, data);
1918 reporter.leaveKey(prevKey);
1919
1920 return res;
1921 }, this).filter(function(child) {
1922 return child;
1923 });
1924 content = this._createEncoderBuffer(content);
1925 } else {
1926 if (state.tag === 'seqof' || state.tag === 'setof') {
1927 // TODO(indutny): this should be thrown on DSL level
1928 if (!(state.args && state.args.length === 1))
1929 return reporter.error('Too many args for : ' + state.tag);
1930
1931 if (!Array.isArray(data))
1932 return reporter.error('seqof/setof, but data is not Array');
1933
1934 var child = this.clone();
1935 child._baseState.implicit = null;
1936 content = this._createEncoderBuffer(data.map(function(item) {
1937 var state = this._baseState;
1938
1939 return this._getUse(state.args[0], data)._encode(item, reporter);
1940 }, child));
1941 } else if (state.use !== null) {
1942 result = this._getUse(state.use, parent)._encode(data, reporter);
1943 } else {
1944 content = this._encodePrimitive(state.tag, data);
1945 primitive = true;
1946 }
1947 }
1948
1949 // Encode data itself
1950 var result;
1951 if (!state.any && state.choice === null) {
1952 var tag = state.implicit !== null ? state.implicit : state.tag;
1953 var cls = state.implicit === null ? 'universal' : 'context';
1954
1955 if (tag === null) {
1956 if (state.use === null)
1957 reporter.error('Tag could be omitted only for .use()');
1958 } else {
1959 if (state.use === null)
1960 result = this._encodeComposite(tag, primitive, cls, content);
1961 }
1962 }
1963
1964 // Wrap in explicit
1965 if (state.explicit !== null)
1966 result = this._encodeComposite(state.explicit, false, 'context', result);
1967
1968 return result;
1969};
1970
1971Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
1972 var state = this._baseState;
1973
1974 var node = state.choice[data.type];
1975 if (!node) {
1976 assert(
1977 false,
1978 data.type + ' not found in ' +
1979 JSON.stringify(Object.keys(state.choice)));
1980 }
1981 return node._encode(data.value, reporter);
1982};
1983
1984Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
1985 var state = this._baseState;
1986
1987 if (/str$/.test(tag))
1988 return this._encodeStr(data, tag);
1989 else if (tag === 'objid' && state.args)
1990 return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
1991 else if (tag === 'objid')
1992 return this._encodeObjid(data, null, null);
1993 else if (tag === 'gentime' || tag === 'utctime')
1994 return this._encodeTime(data, tag);
1995 else if (tag === 'null_')
1996 return this._encodeNull();
1997 else if (tag === 'int' || tag === 'enum')
1998 return this._encodeInt(data, state.args && state.reverseArgs[0]);
1999 else if (tag === 'bool')
2000 return this._encodeBool(data);
2001 else if (tag === 'objDesc')
2002 return this._encodeStr(data, tag);
2003 else
2004 throw new Error('Unsupported tag: ' + tag);
2005};
2006
2007Node.prototype._isNumstr = function isNumstr(str) {
2008 return /^[0-9 ]*$/.test(str);
2009};
2010
2011Node.prototype._isPrintstr = function isPrintstr(str) {
2012 return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
2013};
2014
2015},{"../base":15,"minimalistic-assert":640}],17:[function(require,module,exports){
2016var inherits = require('inherits');
2017
2018function Reporter(options) {
2019 this._reporterState = {
2020 obj: null,
2021 path: [],
2022 options: options || {},
2023 errors: []
2024 };
2025}
2026exports.Reporter = Reporter;
2027
2028Reporter.prototype.isError = function isError(obj) {
2029 return obj instanceof ReporterError;
2030};
2031
2032Reporter.prototype.save = function save() {
2033 var state = this._reporterState;
2034
2035 return { obj: state.obj, pathLen: state.path.length };
2036};
2037
2038Reporter.prototype.restore = function restore(data) {
2039 var state = this._reporterState;
2040
2041 state.obj = data.obj;
2042 state.path = state.path.slice(0, data.pathLen);
2043};
2044
2045Reporter.prototype.enterKey = function enterKey(key) {
2046 return this._reporterState.path.push(key);
2047};
2048
2049Reporter.prototype.exitKey = function exitKey(index) {
2050 var state = this._reporterState;
2051
2052 state.path = state.path.slice(0, index - 1);
2053};
2054
2055Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
2056 var state = this._reporterState;
2057
2058 this.exitKey(index);
2059 if (state.obj !== null)
2060 state.obj[key] = value;
2061};
2062
2063Reporter.prototype.path = function path() {
2064 return this._reporterState.path.join('/');
2065};
2066
2067Reporter.prototype.enterObject = function enterObject() {
2068 var state = this._reporterState;
2069
2070 var prev = state.obj;
2071 state.obj = {};
2072 return prev;
2073};
2074
2075Reporter.prototype.leaveObject = function leaveObject(prev) {
2076 var state = this._reporterState;
2077
2078 var now = state.obj;
2079 state.obj = prev;
2080 return now;
2081};
2082
2083Reporter.prototype.error = function error(msg) {
2084 var err;
2085 var state = this._reporterState;
2086
2087 var inherited = msg instanceof ReporterError;
2088 if (inherited) {
2089 err = msg;
2090 } else {
2091 err = new ReporterError(state.path.map(function(elem) {
2092 return '[' + JSON.stringify(elem) + ']';
2093 }).join(''), msg.message || msg, msg.stack);
2094 }
2095
2096 if (!state.options.partial)
2097 throw err;
2098
2099 if (!inherited)
2100 state.errors.push(err);
2101
2102 return err;
2103};
2104
2105Reporter.prototype.wrapResult = function wrapResult(result) {
2106 var state = this._reporterState;
2107 if (!state.options.partial)
2108 return result;
2109
2110 return {
2111 result: this.isError(result) ? null : result,
2112 errors: state.errors
2113 };
2114};
2115
2116function ReporterError(path, msg) {
2117 this.path = path;
2118 this.rethrow(msg);
2119};
2120inherits(ReporterError, Error);
2121
2122ReporterError.prototype.rethrow = function rethrow(msg) {
2123 this.message = msg + ' at: ' + (this.path || '(shallow)');
2124 if (Error.captureStackTrace)
2125 Error.captureStackTrace(this, ReporterError);
2126
2127 if (!this.stack) {
2128 try {
2129 // IE only adds stack when thrown
2130 throw new Error(this.message);
2131 } catch (e) {
2132 this.stack = e.stack;
2133 }
2134 }
2135 return this;
2136};
2137
2138},{"inherits":396}],18:[function(require,module,exports){
2139var constants = require('../constants');
2140
2141exports.tagClass = {
2142 0: 'universal',
2143 1: 'application',
2144 2: 'context',
2145 3: 'private'
2146};
2147exports.tagClassByName = constants._reverse(exports.tagClass);
2148
2149exports.tag = {
2150 0x00: 'end',
2151 0x01: 'bool',
2152 0x02: 'int',
2153 0x03: 'bitstr',
2154 0x04: 'octstr',
2155 0x05: 'null_',
2156 0x06: 'objid',
2157 0x07: 'objDesc',
2158 0x08: 'external',
2159 0x09: 'real',
2160 0x0a: 'enum',
2161 0x0b: 'embed',
2162 0x0c: 'utf8str',
2163 0x0d: 'relativeOid',
2164 0x10: 'seq',
2165 0x11: 'set',
2166 0x12: 'numstr',
2167 0x13: 'printstr',
2168 0x14: 't61str',
2169 0x15: 'videostr',
2170 0x16: 'ia5str',
2171 0x17: 'utctime',
2172 0x18: 'gentime',
2173 0x19: 'graphstr',
2174 0x1a: 'iso646str',
2175 0x1b: 'genstr',
2176 0x1c: 'unistr',
2177 0x1d: 'charstr',
2178 0x1e: 'bmpstr'
2179};
2180exports.tagByName = constants._reverse(exports.tag);
2181
2182},{"../constants":19}],19:[function(require,module,exports){
2183var constants = exports;
2184
2185// Helper
2186constants._reverse = function reverse(map) {
2187 var res = {};
2188
2189 Object.keys(map).forEach(function(key) {
2190 // Convert key to integer if it is stringified
2191 if ((key | 0) == key)
2192 key = key | 0;
2193
2194 var value = map[key];
2195 res[value] = key;
2196 });
2197
2198 return res;
2199};
2200
2201constants.der = require('./der');
2202
2203},{"./der":18}],20:[function(require,module,exports){
2204var inherits = require('inherits');
2205
2206var asn1 = require('../../asn1');
2207var base = asn1.base;
2208var bignum = asn1.bignum;
2209
2210// Import DER constants
2211var der = asn1.constants.der;
2212
2213function DERDecoder(entity) {
2214 this.enc = 'der';
2215 this.name = entity.name;
2216 this.entity = entity;
2217
2218 // Construct base tree
2219 this.tree = new DERNode();
2220 this.tree._init(entity.body);
2221};
2222module.exports = DERDecoder;
2223
2224DERDecoder.prototype.decode = function decode(data, options) {
2225 if (!(data instanceof base.DecoderBuffer))
2226 data = new base.DecoderBuffer(data, options);
2227
2228 return this.tree._decode(data, options);
2229};
2230
2231// Tree methods
2232
2233function DERNode(parent) {
2234 base.Node.call(this, 'der', parent);
2235}
2236inherits(DERNode, base.Node);
2237
2238DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
2239 if (buffer.isEmpty())
2240 return false;
2241
2242 var state = buffer.save();
2243 var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
2244 if (buffer.isError(decodedTag))
2245 return decodedTag;
2246
2247 buffer.restore(state);
2248
2249 return decodedTag.tag === tag || decodedTag.tagStr === tag ||
2250 (decodedTag.tagStr + 'of') === tag || any;
2251};
2252
2253DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
2254 var decodedTag = derDecodeTag(buffer,
2255 'Failed to decode tag of "' + tag + '"');
2256 if (buffer.isError(decodedTag))
2257 return decodedTag;
2258
2259 var len = derDecodeLen(buffer,
2260 decodedTag.primitive,
2261 'Failed to get length of "' + tag + '"');
2262
2263 // Failure
2264 if (buffer.isError(len))
2265 return len;
2266
2267 if (!any &&
2268 decodedTag.tag !== tag &&
2269 decodedTag.tagStr !== tag &&
2270 decodedTag.tagStr + 'of' !== tag) {
2271 return buffer.error('Failed to match tag: "' + tag + '"');
2272 }
2273
2274 if (decodedTag.primitive || len !== null)
2275 return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
2276
2277 // Indefinite length... find END tag
2278 var state = buffer.save();
2279 var res = this._skipUntilEnd(
2280 buffer,
2281 'Failed to skip indefinite length body: "' + this.tag + '"');
2282 if (buffer.isError(res))
2283 return res;
2284
2285 len = buffer.offset - state.offset;
2286 buffer.restore(state);
2287 return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
2288};
2289
2290DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
2291 while (true) {
2292 var tag = derDecodeTag(buffer, fail);
2293 if (buffer.isError(tag))
2294 return tag;
2295 var len = derDecodeLen(buffer, tag.primitive, fail);
2296 if (buffer.isError(len))
2297 return len;
2298
2299 var res;
2300 if (tag.primitive || len !== null)
2301 res = buffer.skip(len)
2302 else
2303 res = this._skipUntilEnd(buffer, fail);
2304
2305 // Failure
2306 if (buffer.isError(res))
2307 return res;
2308
2309 if (tag.tagStr === 'end')
2310 break;
2311 }
2312};
2313
2314DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
2315 options) {
2316 var result = [];
2317 while (!buffer.isEmpty()) {
2318 var possibleEnd = this._peekTag(buffer, 'end');
2319 if (buffer.isError(possibleEnd))
2320 return possibleEnd;
2321
2322 var res = decoder.decode(buffer, 'der', options);
2323 if (buffer.isError(res) && possibleEnd)
2324 break;
2325 result.push(res);
2326 }
2327 return result;
2328};
2329
2330DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
2331 if (tag === 'bitstr') {
2332 var unused = buffer.readUInt8();
2333 if (buffer.isError(unused))
2334 return unused;
2335 return { unused: unused, data: buffer.raw() };
2336 } else if (tag === 'bmpstr') {
2337 var raw = buffer.raw();
2338 if (raw.length % 2 === 1)
2339 return buffer.error('Decoding of string type: bmpstr length mismatch');
2340
2341 var str = '';
2342 for (var i = 0; i < raw.length / 2; i++) {
2343 str += String.fromCharCode(raw.readUInt16BE(i * 2));
2344 }
2345 return str;
2346 } else if (tag === 'numstr') {
2347 var numstr = buffer.raw().toString('ascii');
2348 if (!this._isNumstr(numstr)) {
2349 return buffer.error('Decoding of string type: ' +
2350 'numstr unsupported characters');
2351 }
2352 return numstr;
2353 } else if (tag === 'octstr') {
2354 return buffer.raw();
2355 } else if (tag === 'objDesc') {
2356 return buffer.raw();
2357 } else if (tag === 'printstr') {
2358 var printstr = buffer.raw().toString('ascii');
2359 if (!this._isPrintstr(printstr)) {
2360 return buffer.error('Decoding of string type: ' +
2361 'printstr unsupported characters');
2362 }
2363 return printstr;
2364 } else if (/str$/.test(tag)) {
2365 return buffer.raw().toString();
2366 } else {
2367 return buffer.error('Decoding of string type: ' + tag + ' unsupported');
2368 }
2369};
2370
2371DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
2372 var result;
2373 var identifiers = [];
2374 var ident = 0;
2375 while (!buffer.isEmpty()) {
2376 var subident = buffer.readUInt8();
2377 ident <<= 7;
2378 ident |= subident & 0x7f;
2379 if ((subident & 0x80) === 0) {
2380 identifiers.push(ident);
2381 ident = 0;
2382 }
2383 }
2384 if (subident & 0x80)
2385 identifiers.push(ident);
2386
2387 var first = (identifiers[0] / 40) | 0;
2388 var second = identifiers[0] % 40;
2389
2390 if (relative)
2391 result = identifiers;
2392 else
2393 result = [first, second].concat(identifiers.slice(1));
2394
2395 if (values) {
2396 var tmp = values[result.join(' ')];
2397 if (tmp === undefined)
2398 tmp = values[result.join('.')];
2399 if (tmp !== undefined)
2400 result = tmp;
2401 }
2402
2403 return result;
2404};
2405
2406DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
2407 var str = buffer.raw().toString();
2408 if (tag === 'gentime') {
2409 var year = str.slice(0, 4) | 0;
2410 var mon = str.slice(4, 6) | 0;
2411 var day = str.slice(6, 8) | 0;
2412 var hour = str.slice(8, 10) | 0;
2413 var min = str.slice(10, 12) | 0;
2414 var sec = str.slice(12, 14) | 0;
2415 } else if (tag === 'utctime') {
2416 var year = str.slice(0, 2) | 0;
2417 var mon = str.slice(2, 4) | 0;
2418 var day = str.slice(4, 6) | 0;
2419 var hour = str.slice(6, 8) | 0;
2420 var min = str.slice(8, 10) | 0;
2421 var sec = str.slice(10, 12) | 0;
2422 if (year < 70)
2423 year = 2000 + year;
2424 else
2425 year = 1900 + year;
2426 } else {
2427 return buffer.error('Decoding ' + tag + ' time is not supported yet');
2428 }
2429
2430 return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
2431};
2432
2433DERNode.prototype._decodeNull = function decodeNull(buffer) {
2434 return null;
2435};
2436
2437DERNode.prototype._decodeBool = function decodeBool(buffer) {
2438 var res = buffer.readUInt8();
2439 if (buffer.isError(res))
2440 return res;
2441 else
2442 return res !== 0;
2443};
2444
2445DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
2446 // Bigint, return as it is (assume big endian)
2447 var raw = buffer.raw();
2448 var res = new bignum(raw);
2449
2450 if (values)
2451 res = values[res.toString(10)] || res;
2452
2453 return res;
2454};
2455
2456DERNode.prototype._use = function use(entity, obj) {
2457 if (typeof entity === 'function')
2458 entity = entity(obj);
2459 return entity._getDecoder('der').tree;
2460};
2461
2462// Utility methods
2463
2464function derDecodeTag(buf, fail) {
2465 var tag = buf.readUInt8(fail);
2466 if (buf.isError(tag))
2467 return tag;
2468
2469 var cls = der.tagClass[tag >> 6];
2470 var primitive = (tag & 0x20) === 0;
2471
2472 // Multi-octet tag - load
2473 if ((tag & 0x1f) === 0x1f) {
2474 var oct = tag;
2475 tag = 0;
2476 while ((oct & 0x80) === 0x80) {
2477 oct = buf.readUInt8(fail);
2478 if (buf.isError(oct))
2479 return oct;
2480
2481 tag <<= 7;
2482 tag |= oct & 0x7f;
2483 }
2484 } else {
2485 tag &= 0x1f;
2486 }
2487 var tagStr = der.tag[tag];
2488
2489 return {
2490 cls: cls,
2491 primitive: primitive,
2492 tag: tag,
2493 tagStr: tagStr
2494 };
2495}
2496
2497function derDecodeLen(buf, primitive, fail) {
2498 var len = buf.readUInt8(fail);
2499 if (buf.isError(len))
2500 return len;
2501
2502 // Indefinite form
2503 if (!primitive && len === 0x80)
2504 return null;
2505
2506 // Definite form
2507 if ((len & 0x80) === 0) {
2508 // Short form
2509 return len;
2510 }
2511
2512 // Long form
2513 var num = len & 0x7f;
2514 if (num > 4)
2515 return buf.error('length octect is too long');
2516
2517 len = 0;
2518 for (var i = 0; i < num; i++) {
2519 len <<= 8;
2520 var j = buf.readUInt8(fail);
2521 if (buf.isError(j))
2522 return j;
2523 len |= j;
2524 }
2525
2526 return len;
2527}
2528
2529},{"../../asn1":12,"inherits":396}],21:[function(require,module,exports){
2530var decoders = exports;
2531
2532decoders.der = require('./der');
2533decoders.pem = require('./pem');
2534
2535},{"./der":20,"./pem":22}],22:[function(require,module,exports){
2536var inherits = require('inherits');
2537var Buffer = require('buffer').Buffer;
2538
2539var DERDecoder = require('./der');
2540
2541function PEMDecoder(entity) {
2542 DERDecoder.call(this, entity);
2543 this.enc = 'pem';
2544};
2545inherits(PEMDecoder, DERDecoder);
2546module.exports = PEMDecoder;
2547
2548PEMDecoder.prototype.decode = function decode(data, options) {
2549 var lines = data.toString().split(/[\r\n]+/g);
2550
2551 var label = options.label.toUpperCase();
2552
2553 var re = /^-----(BEGIN|END) ([^-]+)-----$/;
2554 var start = -1;
2555 var end = -1;
2556 for (var i = 0; i < lines.length; i++) {
2557 var match = lines[i].match(re);
2558 if (match === null)
2559 continue;
2560
2561 if (match[2] !== label)
2562 continue;
2563
2564 if (start === -1) {
2565 if (match[1] !== 'BEGIN')
2566 break;
2567 start = i;
2568 } else {
2569 if (match[1] !== 'END')
2570 break;
2571 end = i;
2572 break;
2573 }
2574 }
2575 if (start === -1 || end === -1)
2576 throw new Error('PEM section not found for: ' + label);
2577
2578 var base64 = lines.slice(start + 1, end).join('');
2579 // Remove excessive symbols
2580 base64.replace(/[^a-z0-9\+\/=]+/gi, '');
2581
2582 var input = new Buffer(base64, 'base64');
2583 return DERDecoder.prototype.decode.call(this, input, options);
2584};
2585
2586},{"./der":20,"buffer":146,"inherits":396}],23:[function(require,module,exports){
2587var inherits = require('inherits');
2588var Buffer = require('buffer').Buffer;
2589
2590var asn1 = require('../../asn1');
2591var base = asn1.base;
2592
2593// Import DER constants
2594var der = asn1.constants.der;
2595
2596function DEREncoder(entity) {
2597 this.enc = 'der';
2598 this.name = entity.name;
2599 this.entity = entity;
2600
2601 // Construct base tree
2602 this.tree = new DERNode();
2603 this.tree._init(entity.body);
2604};
2605module.exports = DEREncoder;
2606
2607DEREncoder.prototype.encode = function encode(data, reporter) {
2608 return this.tree._encode(data, reporter).join();
2609};
2610
2611// Tree methods
2612
2613function DERNode(parent) {
2614 base.Node.call(this, 'der', parent);
2615}
2616inherits(DERNode, base.Node);
2617
2618DERNode.prototype._encodeComposite = function encodeComposite(tag,
2619 primitive,
2620 cls,
2621 content) {
2622 var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
2623
2624 // Short form
2625 if (content.length < 0x80) {
2626 var header = new Buffer(2);
2627 header[0] = encodedTag;
2628 header[1] = content.length;
2629 return this._createEncoderBuffer([ header, content ]);
2630 }
2631
2632 // Long form
2633 // Count octets required to store length
2634 var lenOctets = 1;
2635 for (var i = content.length; i >= 0x100; i >>= 8)
2636 lenOctets++;
2637
2638 var header = new Buffer(1 + 1 + lenOctets);
2639 header[0] = encodedTag;
2640 header[1] = 0x80 | lenOctets;
2641
2642 for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
2643 header[i] = j & 0xff;
2644
2645 return this._createEncoderBuffer([ header, content ]);
2646};
2647
2648DERNode.prototype._encodeStr = function encodeStr(str, tag) {
2649 if (tag === 'bitstr') {
2650 return this._createEncoderBuffer([ str.unused | 0, str.data ]);
2651 } else if (tag === 'bmpstr') {
2652 var buf = new Buffer(str.length * 2);
2653 for (var i = 0; i < str.length; i++) {
2654 buf.writeUInt16BE(str.charCodeAt(i), i * 2);
2655 }
2656 return this._createEncoderBuffer(buf);
2657 } else if (tag === 'numstr') {
2658 if (!this._isNumstr(str)) {
2659 return this.reporter.error('Encoding of string type: numstr supports ' +
2660 'only digits and space');
2661 }
2662 return this._createEncoderBuffer(str);
2663 } else if (tag === 'printstr') {
2664 if (!this._isPrintstr(str)) {
2665 return this.reporter.error('Encoding of string type: printstr supports ' +
2666 'only latin upper and lower case letters, ' +
2667 'digits, space, apostrophe, left and rigth ' +
2668 'parenthesis, plus sign, comma, hyphen, ' +
2669 'dot, slash, colon, equal sign, ' +
2670 'question mark');
2671 }
2672 return this._createEncoderBuffer(str);
2673 } else if (/str$/.test(tag)) {
2674 return this._createEncoderBuffer(str);
2675 } else if (tag === 'objDesc') {
2676 return this._createEncoderBuffer(str);
2677 } else {
2678 return this.reporter.error('Encoding of string type: ' + tag +
2679 ' unsupported');
2680 }
2681};
2682
2683DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
2684 if (typeof id === 'string') {
2685 if (!values)
2686 return this.reporter.error('string objid given, but no values map found');
2687 if (!values.hasOwnProperty(id))
2688 return this.reporter.error('objid not found in values map');
2689 id = values[id].split(/[\s\.]+/g);
2690 for (var i = 0; i < id.length; i++)
2691 id[i] |= 0;
2692 } else if (Array.isArray(id)) {
2693 id = id.slice();
2694 for (var i = 0; i < id.length; i++)
2695 id[i] |= 0;
2696 }
2697
2698 if (!Array.isArray(id)) {
2699 return this.reporter.error('objid() should be either array or string, ' +
2700 'got: ' + JSON.stringify(id));
2701 }
2702
2703 if (!relative) {
2704 if (id[1] >= 40)
2705 return this.reporter.error('Second objid identifier OOB');
2706 id.splice(0, 2, id[0] * 40 + id[1]);
2707 }
2708
2709 // Count number of octets
2710 var size = 0;
2711 for (var i = 0; i < id.length; i++) {
2712 var ident = id[i];
2713 for (size++; ident >= 0x80; ident >>= 7)
2714 size++;
2715 }
2716
2717 var objid = new Buffer(size);
2718 var offset = objid.length - 1;
2719 for (var i = id.length - 1; i >= 0; i--) {
2720 var ident = id[i];
2721 objid[offset--] = ident & 0x7f;
2722 while ((ident >>= 7) > 0)
2723 objid[offset--] = 0x80 | (ident & 0x7f);
2724 }
2725
2726 return this._createEncoderBuffer(objid);
2727};
2728
2729function two(num) {
2730 if (num < 10)
2731 return '0' + num;
2732 else
2733 return num;
2734}
2735
2736DERNode.prototype._encodeTime = function encodeTime(time, tag) {
2737 var str;
2738 var date = new Date(time);
2739
2740 if (tag === 'gentime') {
2741 str = [
2742 two(date.getFullYear()),
2743 two(date.getUTCMonth() + 1),
2744 two(date.getUTCDate()),
2745 two(date.getUTCHours()),
2746 two(date.getUTCMinutes()),
2747 two(date.getUTCSeconds()),
2748 'Z'
2749 ].join('');
2750 } else if (tag === 'utctime') {
2751 str = [
2752 two(date.getFullYear() % 100),
2753 two(date.getUTCMonth() + 1),
2754 two(date.getUTCDate()),
2755 two(date.getUTCHours()),
2756 two(date.getUTCMinutes()),
2757 two(date.getUTCSeconds()),
2758 'Z'
2759 ].join('');
2760 } else {
2761 this.reporter.error('Encoding ' + tag + ' time is not supported yet');
2762 }
2763
2764 return this._encodeStr(str, 'octstr');
2765};
2766
2767DERNode.prototype._encodeNull = function encodeNull() {
2768 return this._createEncoderBuffer('');
2769};
2770
2771DERNode.prototype._encodeInt = function encodeInt(num, values) {
2772 if (typeof num === 'string') {
2773 if (!values)
2774 return this.reporter.error('String int or enum given, but no values map');
2775 if (!values.hasOwnProperty(num)) {
2776 return this.reporter.error('Values map doesn\'t contain: ' +
2777 JSON.stringify(num));
2778 }
2779 num = values[num];
2780 }
2781
2782 // Bignum, assume big endian
2783 if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
2784 var numArray = num.toArray();
2785 if (!num.sign && numArray[0] & 0x80) {
2786 numArray.unshift(0);
2787 }
2788 num = new Buffer(numArray);
2789 }
2790
2791 if (Buffer.isBuffer(num)) {
2792 var size = num.length;
2793 if (num.length === 0)
2794 size++;
2795
2796 var out = new Buffer(size);
2797 num.copy(out);
2798 if (num.length === 0)
2799 out[0] = 0
2800 return this._createEncoderBuffer(out);
2801 }
2802
2803 if (num < 0x80)
2804 return this._createEncoderBuffer(num);
2805
2806 if (num < 0x100)
2807 return this._createEncoderBuffer([0, num]);
2808
2809 var size = 1;
2810 for (var i = num; i >= 0x100; i >>= 8)
2811 size++;
2812
2813 var out = new Array(size);
2814 for (var i = out.length - 1; i >= 0; i--) {
2815 out[i] = num & 0xff;
2816 num >>= 8;
2817 }
2818 if(out[0] & 0x80) {
2819 out.unshift(0);
2820 }
2821
2822 return this._createEncoderBuffer(new Buffer(out));
2823};
2824
2825DERNode.prototype._encodeBool = function encodeBool(value) {
2826 return this._createEncoderBuffer(value ? 0xff : 0);
2827};
2828
2829DERNode.prototype._use = function use(entity, obj) {
2830 if (typeof entity === 'function')
2831 entity = entity(obj);
2832 return entity._getEncoder('der').tree;
2833};
2834
2835DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
2836 var state = this._baseState;
2837 var i;
2838 if (state['default'] === null)
2839 return false;
2840
2841 var data = dataBuffer.join();
2842 if (state.defaultBuffer === undefined)
2843 state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
2844
2845 if (data.length !== state.defaultBuffer.length)
2846 return false;
2847
2848 for (i=0; i < data.length; i++)
2849 if (data[i] !== state.defaultBuffer[i])
2850 return false;
2851
2852 return true;
2853};
2854
2855// Utility methods
2856
2857function encodeTag(tag, primitive, cls, reporter) {
2858 var res;
2859
2860 if (tag === 'seqof')
2861 tag = 'seq';
2862 else if (tag === 'setof')
2863 tag = 'set';
2864
2865 if (der.tagByName.hasOwnProperty(tag))
2866 res = der.tagByName[tag];
2867 else if (typeof tag === 'number' && (tag | 0) === tag)
2868 res = tag;
2869 else
2870 return reporter.error('Unknown tag: ' + tag);
2871
2872 if (res >= 0x1f)
2873 return reporter.error('Multi-octet tag encoding unsupported');
2874
2875 if (!primitive)
2876 res |= 0x20;
2877
2878 res |= (der.tagClassByName[cls || 'universal'] << 6);
2879
2880 return res;
2881}
2882
2883},{"../../asn1":12,"buffer":146,"inherits":396}],24:[function(require,module,exports){
2884var encoders = exports;
2885
2886encoders.der = require('./der');
2887encoders.pem = require('./pem');
2888
2889},{"./der":23,"./pem":25}],25:[function(require,module,exports){
2890var inherits = require('inherits');
2891
2892var DEREncoder = require('./der');
2893
2894function PEMEncoder(entity) {
2895 DEREncoder.call(this, entity);
2896 this.enc = 'pem';
2897};
2898inherits(PEMEncoder, DEREncoder);
2899module.exports = PEMEncoder;
2900
2901PEMEncoder.prototype.encode = function encode(data, options) {
2902 var buf = DEREncoder.prototype.encode.call(this, data);
2903
2904 var p = buf.toString('base64');
2905 var out = [ '-----BEGIN ' + options.label + '-----' ];
2906 for (var i = 0; i < p.length; i += 64)
2907 out.push(p.slice(i, i + 64));
2908 out.push('-----END ' + options.label + '-----');
2909 return out.join('\n');
2910};
2911
2912},{"./der":23,"inherits":396}],26:[function(require,module,exports){
2913(function (global){
2914'use strict';
2915
2916var objectAssign = require('object-assign');
2917
2918// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
2919// original notice:
2920
2921/*!
2922 * The buffer module from node.js, for the browser.
2923 *
2924 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
2925 * @license MIT
2926 */
2927function compare(a, b) {
2928 if (a === b) {
2929 return 0;
2930 }
2931
2932 var x = a.length;
2933 var y = b.length;
2934
2935 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
2936 if (a[i] !== b[i]) {
2937 x = a[i];
2938 y = b[i];
2939 break;
2940 }
2941 }
2942
2943 if (x < y) {
2944 return -1;
2945 }
2946 if (y < x) {
2947 return 1;
2948 }
2949 return 0;
2950}
2951function isBuffer(b) {
2952 if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
2953 return global.Buffer.isBuffer(b);
2954 }
2955 return !!(b != null && b._isBuffer);
2956}
2957
2958// based on node assert, original notice:
2959// NB: The URL to the CommonJS spec is kept just for tradition.
2960// node-assert has evolved a lot since then, both in API and behavior.
2961
2962// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
2963//
2964// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
2965//
2966// Originally from narwhal.js (http://narwhaljs.org)
2967// Copyright (c) 2009 Thomas Robinson <280north.com>
2968//
2969// Permission is hereby granted, free of charge, to any person obtaining a copy
2970// of this software and associated documentation files (the 'Software'), to
2971// deal in the Software without restriction, including without limitation the
2972// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2973// sell copies of the Software, and to permit persons to whom the Software is
2974// furnished to do so, subject to the following conditions:
2975//
2976// The above copyright notice and this permission notice shall be included in
2977// all copies or substantial portions of the Software.
2978//
2979// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2980// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2981// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2982// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2983// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2984// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2985
2986var util = require('util/');
2987var hasOwn = Object.prototype.hasOwnProperty;
2988var pSlice = Array.prototype.slice;
2989var functionsHaveNames = (function () {
2990 return function foo() {}.name === 'foo';
2991}());
2992function pToString (obj) {
2993 return Object.prototype.toString.call(obj);
2994}
2995function isView(arrbuf) {
2996 if (isBuffer(arrbuf)) {
2997 return false;
2998 }
2999 if (typeof global.ArrayBuffer !== 'function') {
3000 return false;
3001 }
3002 if (typeof ArrayBuffer.isView === 'function') {
3003 return ArrayBuffer.isView(arrbuf);
3004 }
3005 if (!arrbuf) {
3006 return false;
3007 }
3008 if (arrbuf instanceof DataView) {
3009 return true;
3010 }
3011 if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
3012 return true;
3013 }
3014 return false;
3015}
3016// 1. The assert module provides functions that throw
3017// AssertionError's when particular conditions are not met. The
3018// assert module must conform to the following interface.
3019
3020var assert = module.exports = ok;
3021
3022// 2. The AssertionError is defined in assert.
3023// new assert.AssertionError({ message: message,
3024// actual: actual,
3025// expected: expected })
3026
3027var regex = /\s*function\s+([^\(\s]*)\s*/;
3028// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
3029function getName(func) {
3030 if (!util.isFunction(func)) {
3031 return;
3032 }
3033 if (functionsHaveNames) {
3034 return func.name;
3035 }
3036 var str = func.toString();
3037 var match = str.match(regex);
3038 return match && match[1];
3039}
3040assert.AssertionError = function AssertionError(options) {
3041 this.name = 'AssertionError';
3042 this.actual = options.actual;
3043 this.expected = options.expected;
3044 this.operator = options.operator;
3045 if (options.message) {
3046 this.message = options.message;
3047 this.generatedMessage = false;
3048 } else {
3049 this.message = getMessage(this);
3050 this.generatedMessage = true;
3051 }
3052 var stackStartFunction = options.stackStartFunction || fail;
3053 if (Error.captureStackTrace) {
3054 Error.captureStackTrace(this, stackStartFunction);
3055 } else {
3056 // non v8 browsers so we can have a stacktrace
3057 var err = new Error();
3058 if (err.stack) {
3059 var out = err.stack;
3060
3061 // try to strip useless frames
3062 var fn_name = getName(stackStartFunction);
3063 var idx = out.indexOf('\n' + fn_name);
3064 if (idx >= 0) {
3065 // once we have located the function frame
3066 // we need to strip out everything before it (and its line)
3067 var next_line = out.indexOf('\n', idx + 1);
3068 out = out.substring(next_line + 1);
3069 }
3070
3071 this.stack = out;
3072 }
3073 }
3074};
3075
3076// assert.AssertionError instanceof Error
3077util.inherits(assert.AssertionError, Error);
3078
3079function truncate(s, n) {
3080 if (typeof s === 'string') {
3081 return s.length < n ? s : s.slice(0, n);
3082 } else {
3083 return s;
3084 }
3085}
3086function inspect(something) {
3087 if (functionsHaveNames || !util.isFunction(something)) {
3088 return util.inspect(something);
3089 }
3090 var rawname = getName(something);
3091 var name = rawname ? ': ' + rawname : '';
3092 return '[Function' + name + ']';
3093}
3094function getMessage(self) {
3095 return truncate(inspect(self.actual), 128) + ' ' +
3096 self.operator + ' ' +
3097 truncate(inspect(self.expected), 128);
3098}
3099
3100// At present only the three keys mentioned above are used and
3101// understood by the spec. Implementations or sub modules can pass
3102// other keys to the AssertionError's constructor - they will be
3103// ignored.
3104
3105// 3. All of the following functions must throw an AssertionError
3106// when a corresponding condition is not met, with a message that
3107// may be undefined if not provided. All assertion methods provide
3108// both the actual and expected values to the assertion error for
3109// display purposes.
3110
3111function fail(actual, expected, message, operator, stackStartFunction) {
3112 throw new assert.AssertionError({
3113 message: message,
3114 actual: actual,
3115 expected: expected,
3116 operator: operator,
3117 stackStartFunction: stackStartFunction
3118 });
3119}
3120
3121// EXTENSION! allows for well behaved errors defined elsewhere.
3122assert.fail = fail;
3123
3124// 4. Pure assertion tests whether a value is truthy, as determined
3125// by !!guard.
3126// assert.ok(guard, message_opt);
3127// This statement is equivalent to assert.equal(true, !!guard,
3128// message_opt);. To test strictly for the value true, use
3129// assert.strictEqual(true, guard, message_opt);.
3130
3131function ok(value, message) {
3132 if (!value) fail(value, true, message, '==', assert.ok);
3133}
3134assert.ok = ok;
3135
3136// 5. The equality assertion tests shallow, coercive equality with
3137// ==.
3138// assert.equal(actual, expected, message_opt);
3139
3140assert.equal = function equal(actual, expected, message) {
3141 if (actual != expected) fail(actual, expected, message, '==', assert.equal);
3142};
3143
3144// 6. The non-equality assertion tests for whether two objects are not equal
3145// with != assert.notEqual(actual, expected, message_opt);
3146
3147assert.notEqual = function notEqual(actual, expected, message) {
3148 if (actual == expected) {
3149 fail(actual, expected, message, '!=', assert.notEqual);
3150 }
3151};
3152
3153// 7. The equivalence assertion tests a deep equality relation.
3154// assert.deepEqual(actual, expected, message_opt);
3155
3156assert.deepEqual = function deepEqual(actual, expected, message) {
3157 if (!_deepEqual(actual, expected, false)) {
3158 fail(actual, expected, message, 'deepEqual', assert.deepEqual);
3159 }
3160};
3161
3162assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
3163 if (!_deepEqual(actual, expected, true)) {
3164 fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
3165 }
3166};
3167
3168function _deepEqual(actual, expected, strict, memos) {
3169 // 7.1. All identical values are equivalent, as determined by ===.
3170 if (actual === expected) {
3171 return true;
3172 } else if (isBuffer(actual) && isBuffer(expected)) {
3173 return compare(actual, expected) === 0;
3174
3175 // 7.2. If the expected value is a Date object, the actual value is
3176 // equivalent if it is also a Date object that refers to the same time.
3177 } else if (util.isDate(actual) && util.isDate(expected)) {
3178 return actual.getTime() === expected.getTime();
3179
3180 // 7.3 If the expected value is a RegExp object, the actual value is
3181 // equivalent if it is also a RegExp object with the same source and
3182 // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
3183 } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
3184 return actual.source === expected.source &&
3185 actual.global === expected.global &&
3186 actual.multiline === expected.multiline &&
3187 actual.lastIndex === expected.lastIndex &&
3188 actual.ignoreCase === expected.ignoreCase;
3189
3190 // 7.4. Other pairs that do not both pass typeof value == 'object',
3191 // equivalence is determined by ==.
3192 } else if ((actual === null || typeof actual !== 'object') &&
3193 (expected === null || typeof expected !== 'object')) {
3194 return strict ? actual === expected : actual == expected;
3195
3196 // If both values are instances of typed arrays, wrap their underlying
3197 // ArrayBuffers in a Buffer each to increase performance
3198 // This optimization requires the arrays to have the same type as checked by
3199 // Object.prototype.toString (aka pToString). Never perform binary
3200 // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
3201 // bit patterns are not identical.
3202 } else if (isView(actual) && isView(expected) &&
3203 pToString(actual) === pToString(expected) &&
3204 !(actual instanceof Float32Array ||
3205 actual instanceof Float64Array)) {
3206 return compare(new Uint8Array(actual.buffer),
3207 new Uint8Array(expected.buffer)) === 0;
3208
3209 // 7.5 For all other Object pairs, including Array objects, equivalence is
3210 // determined by having the same number of owned properties (as verified
3211 // with Object.prototype.hasOwnProperty.call), the same set of keys
3212 // (although not necessarily the same order), equivalent values for every
3213 // corresponding key, and an identical 'prototype' property. Note: this
3214 // accounts for both named and indexed properties on Arrays.
3215 } else if (isBuffer(actual) !== isBuffer(expected)) {
3216 return false;
3217 } else {
3218 memos = memos || {actual: [], expected: []};
3219
3220 var actualIndex = memos.actual.indexOf(actual);
3221 if (actualIndex !== -1) {
3222 if (actualIndex === memos.expected.indexOf(expected)) {
3223 return true;
3224 }
3225 }
3226
3227 memos.actual.push(actual);
3228 memos.expected.push(expected);
3229
3230 return objEquiv(actual, expected, strict, memos);
3231 }
3232}
3233
3234function isArguments(object) {
3235 return Object.prototype.toString.call(object) == '[object Arguments]';
3236}
3237
3238function objEquiv(a, b, strict, actualVisitedObjects) {
3239 if (a === null || a === undefined || b === null || b === undefined)
3240 return false;
3241 // if one is a primitive, the other must be same
3242 if (util.isPrimitive(a) || util.isPrimitive(b))
3243 return a === b;
3244 if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
3245 return false;
3246 var aIsArgs = isArguments(a);
3247 var bIsArgs = isArguments(b);
3248 if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
3249 return false;
3250 if (aIsArgs) {
3251 a = pSlice.call(a);
3252 b = pSlice.call(b);
3253 return _deepEqual(a, b, strict);
3254 }
3255 var ka = objectKeys(a);
3256 var kb = objectKeys(b);
3257 var key, i;
3258 // having the same number of owned properties (keys incorporates
3259 // hasOwnProperty)
3260 if (ka.length !== kb.length)
3261 return false;
3262 //the same set of keys (although not necessarily the same order),
3263 ka.sort();
3264 kb.sort();
3265 //~~~cheap key test
3266 for (i = ka.length - 1; i >= 0; i--) {
3267 if (ka[i] !== kb[i])
3268 return false;
3269 }
3270 //equivalent values for every corresponding key, and
3271 //~~~possibly expensive deep test
3272 for (i = ka.length - 1; i >= 0; i--) {
3273 key = ka[i];
3274 if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
3275 return false;
3276 }
3277 return true;
3278}
3279
3280// 8. The non-equivalence assertion tests for any deep inequality.
3281// assert.notDeepEqual(actual, expected, message_opt);
3282
3283assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
3284 if (_deepEqual(actual, expected, false)) {
3285 fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
3286 }
3287};
3288
3289assert.notDeepStrictEqual = notDeepStrictEqual;
3290function notDeepStrictEqual(actual, expected, message) {
3291 if (_deepEqual(actual, expected, true)) {
3292 fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
3293 }
3294}
3295
3296
3297// 9. The strict equality assertion tests strict equality, as determined by ===.
3298// assert.strictEqual(actual, expected, message_opt);
3299
3300assert.strictEqual = function strictEqual(actual, expected, message) {
3301 if (actual !== expected) {
3302 fail(actual, expected, message, '===', assert.strictEqual);
3303 }
3304};
3305
3306// 10. The strict non-equality assertion tests for strict inequality, as
3307// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
3308
3309assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
3310 if (actual === expected) {
3311 fail(actual, expected, message, '!==', assert.notStrictEqual);
3312 }
3313};
3314
3315function expectedException(actual, expected) {
3316 if (!actual || !expected) {
3317 return false;
3318 }
3319
3320 if (Object.prototype.toString.call(expected) == '[object RegExp]') {
3321 return expected.test(actual);
3322 }
3323
3324 try {
3325 if (actual instanceof expected) {
3326 return true;
3327 }
3328 } catch (e) {
3329 // Ignore. The instanceof check doesn't work for arrow functions.
3330 }
3331
3332 if (Error.isPrototypeOf(expected)) {
3333 return false;
3334 }
3335
3336 return expected.call({}, actual) === true;
3337}
3338
3339function _tryBlock(block) {
3340 var error;
3341 try {
3342 block();
3343 } catch (e) {
3344 error = e;
3345 }
3346 return error;
3347}
3348
3349function _throws(shouldThrow, block, expected, message) {
3350 var actual;
3351
3352 if (typeof block !== 'function') {
3353 throw new TypeError('"block" argument must be a function');
3354 }
3355
3356 if (typeof expected === 'string') {
3357 message = expected;
3358 expected = null;
3359 }
3360
3361 actual = _tryBlock(block);
3362
3363 message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
3364 (message ? ' ' + message : '.');
3365
3366 if (shouldThrow && !actual) {
3367 fail(actual, expected, 'Missing expected exception' + message);
3368 }
3369
3370 var userProvidedMessage = typeof message === 'string';
3371 var isUnwantedException = !shouldThrow && util.isError(actual);
3372 var isUnexpectedException = !shouldThrow && actual && !expected;
3373
3374 if ((isUnwantedException &&
3375 userProvidedMessage &&
3376 expectedException(actual, expected)) ||
3377 isUnexpectedException) {
3378 fail(actual, expected, 'Got unwanted exception' + message);
3379 }
3380
3381 if ((shouldThrow && actual && expected &&
3382 !expectedException(actual, expected)) || (!shouldThrow && actual)) {
3383 throw actual;
3384 }
3385}
3386
3387// 11. Expected to throw an error:
3388// assert.throws(block, Error_opt, message_opt);
3389
3390assert.throws = function(block, /*optional*/error, /*optional*/message) {
3391 _throws(true, block, error, message);
3392};
3393
3394// EXTENSION! This is annoying to write outside this module.
3395assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
3396 _throws(false, block, error, message);
3397};
3398
3399assert.ifError = function(err) { if (err) throw err; };
3400
3401// Expose a strict only variant of assert
3402function strict(value, message) {
3403 if (!value) fail(value, true, message, '==', strict);
3404}
3405assert.strict = objectAssign(strict, assert, {
3406 equal: assert.strictEqual,
3407 deepEqual: assert.deepStrictEqual,
3408 notEqual: assert.notStrictEqual,
3409 notDeepEqual: assert.notDeepStrictEqual
3410});
3411assert.strict.strict = assert.strict;
3412
3413var objectKeys = Object.keys || function (obj) {
3414 var keys = [];
3415 for (var key in obj) {
3416 if (hasOwn.call(obj, key)) keys.push(key);
3417 }
3418 return keys;
3419};
3420
3421}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3422},{"object-assign":665,"util/":29}],27:[function(require,module,exports){
3423if (typeof Object.create === 'function') {
3424 // implementation from standard node.js 'util' module
3425 module.exports = function inherits(ctor, superCtor) {
3426 ctor.super_ = superCtor
3427 ctor.prototype = Object.create(superCtor.prototype, {
3428 constructor: {
3429 value: ctor,
3430 enumerable: false,
3431 writable: true,
3432 configurable: true
3433 }
3434 });
3435 };
3436} else {
3437 // old school shim for old browsers
3438 module.exports = function inherits(ctor, superCtor) {
3439 ctor.super_ = superCtor
3440 var TempCtor = function () {}
3441 TempCtor.prototype = superCtor.prototype
3442 ctor.prototype = new TempCtor()
3443 ctor.prototype.constructor = ctor
3444 }
3445}
3446
3447},{}],28:[function(require,module,exports){
3448module.exports = function isBuffer(arg) {
3449 return arg && typeof arg === 'object'
3450 && typeof arg.copy === 'function'
3451 && typeof arg.fill === 'function'
3452 && typeof arg.readUInt8 === 'function';
3453}
3454},{}],29:[function(require,module,exports){
3455(function (process,global){
3456// Copyright Joyent, Inc. and other Node contributors.
3457//
3458// Permission is hereby granted, free of charge, to any person obtaining a
3459// copy of this software and associated documentation files (the
3460// "Software"), to deal in the Software without restriction, including
3461// without limitation the rights to use, copy, modify, merge, publish,
3462// distribute, sublicense, and/or sell copies of the Software, and to permit
3463// persons to whom the Software is furnished to do so, subject to the
3464// following conditions:
3465//
3466// The above copyright notice and this permission notice shall be included
3467// in all copies or substantial portions of the Software.
3468//
3469// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3470// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3471// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
3472// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
3473// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
3474// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
3475// USE OR OTHER DEALINGS IN THE SOFTWARE.
3476
3477var formatRegExp = /%[sdj%]/g;
3478exports.format = function(f) {
3479 if (!isString(f)) {
3480 var objects = [];
3481 for (var i = 0; i < arguments.length; i++) {
3482 objects.push(inspect(arguments[i]));
3483 }
3484 return objects.join(' ');
3485 }
3486
3487 var i = 1;
3488 var args = arguments;
3489 var len = args.length;
3490 var str = String(f).replace(formatRegExp, function(x) {
3491 if (x === '%%') return '%';
3492 if (i >= len) return x;
3493 switch (x) {
3494 case '%s': return String(args[i++]);
3495 case '%d': return Number(args[i++]);
3496 case '%j':
3497 try {
3498 return JSON.stringify(args[i++]);
3499 } catch (_) {
3500 return '[Circular]';
3501 }
3502 default:
3503 return x;
3504 }
3505 });
3506 for (var x = args[i]; i < len; x = args[++i]) {
3507 if (isNull(x) || !isObject(x)) {
3508 str += ' ' + x;
3509 } else {
3510 str += ' ' + inspect(x);
3511 }
3512 }
3513 return str;
3514};
3515
3516
3517// Mark that a method should not be used.
3518// Returns a modified function which warns once by default.
3519// If --no-deprecation is set, then it is a no-op.
3520exports.deprecate = function(fn, msg) {
3521 // Allow for deprecating things in the process of starting up.
3522 if (isUndefined(global.process)) {
3523 return function() {
3524 return exports.deprecate(fn, msg).apply(this, arguments);
3525 };
3526 }
3527
3528 if (process.noDeprecation === true) {
3529 return fn;
3530 }
3531
3532 var warned = false;
3533 function deprecated() {
3534 if (!warned) {
3535 if (process.throwDeprecation) {
3536 throw new Error(msg);
3537 } else if (process.traceDeprecation) {
3538 console.trace(msg);
3539 } else {
3540 console.error(msg);
3541 }
3542 warned = true;
3543 }
3544 return fn.apply(this, arguments);
3545 }
3546
3547 return deprecated;
3548};
3549
3550
3551var debugs = {};
3552var debugEnviron;
3553exports.debuglog = function(set) {
3554 if (isUndefined(debugEnviron))
3555 debugEnviron = process.env.NODE_DEBUG || '';
3556 set = set.toUpperCase();
3557 if (!debugs[set]) {
3558 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
3559 var pid = process.pid;
3560 debugs[set] = function() {
3561 var msg = exports.format.apply(exports, arguments);
3562 console.error('%s %d: %s', set, pid, msg);
3563 };
3564 } else {
3565 debugs[set] = function() {};
3566 }
3567 }
3568 return debugs[set];
3569};
3570
3571
3572/**
3573 * Echos the value of a value. Trys to print the value out
3574 * in the best way possible given the different types.
3575 *
3576 * @param {Object} obj The object to print out.
3577 * @param {Object} opts Optional options object that alters the output.
3578 */
3579/* legacy: obj, showHidden, depth, colors*/
3580function inspect(obj, opts) {
3581 // default options
3582 var ctx = {
3583 seen: [],
3584 stylize: stylizeNoColor
3585 };
3586 // legacy...
3587 if (arguments.length >= 3) ctx.depth = arguments[2];
3588 if (arguments.length >= 4) ctx.colors = arguments[3];
3589 if (isBoolean(opts)) {
3590 // legacy...
3591 ctx.showHidden = opts;
3592 } else if (opts) {
3593 // got an "options" object
3594 exports._extend(ctx, opts);
3595 }
3596 // set default options
3597 if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
3598 if (isUndefined(ctx.depth)) ctx.depth = 2;
3599 if (isUndefined(ctx.colors)) ctx.colors = false;
3600 if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
3601 if (ctx.colors) ctx.stylize = stylizeWithColor;
3602 return formatValue(ctx, obj, ctx.depth);
3603}
3604exports.inspect = inspect;
3605
3606
3607// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
3608inspect.colors = {
3609 'bold' : [1, 22],
3610 'italic' : [3, 23],
3611 'underline' : [4, 24],
3612 'inverse' : [7, 27],
3613 'white' : [37, 39],
3614 'grey' : [90, 39],
3615 'black' : [30, 39],
3616 'blue' : [34, 39],
3617 'cyan' : [36, 39],
3618 'green' : [32, 39],
3619 'magenta' : [35, 39],
3620 'red' : [31, 39],
3621 'yellow' : [33, 39]
3622};
3623
3624// Don't use 'blue' not visible on cmd.exe
3625inspect.styles = {
3626 'special': 'cyan',
3627 'number': 'yellow',
3628 'boolean': 'yellow',
3629 'undefined': 'grey',
3630 'null': 'bold',
3631 'string': 'green',
3632 'date': 'magenta',
3633 // "name": intentionally not styling
3634 'regexp': 'red'
3635};
3636
3637
3638function stylizeWithColor(str, styleType) {
3639 var style = inspect.styles[styleType];
3640
3641 if (style) {
3642 return '\u001b[' + inspect.colors[style][0] + 'm' + str +
3643 '\u001b[' + inspect.colors[style][1] + 'm';
3644 } else {
3645 return str;
3646 }
3647}
3648
3649
3650function stylizeNoColor(str, styleType) {
3651 return str;
3652}
3653
3654
3655function arrayToHash(array) {
3656 var hash = {};
3657
3658 array.forEach(function(val, idx) {
3659 hash[val] = true;
3660 });
3661
3662 return hash;
3663}
3664
3665
3666function formatValue(ctx, value, recurseTimes) {
3667 // Provide a hook for user-specified inspect functions.
3668 // Check that value is an object with an inspect function on it
3669 if (ctx.customInspect &&
3670 value &&
3671 isFunction(value.inspect) &&
3672 // Filter out the util module, it's inspect function is special
3673 value.inspect !== exports.inspect &&
3674 // Also filter out any prototype objects using the circular check.
3675 !(value.constructor && value.constructor.prototype === value)) {
3676 var ret = value.inspect(recurseTimes, ctx);
3677 if (!isString(ret)) {
3678 ret = formatValue(ctx, ret, recurseTimes);
3679 }
3680 return ret;
3681 }
3682
3683 // Primitive types cannot have properties
3684 var primitive = formatPrimitive(ctx, value);
3685 if (primitive) {
3686 return primitive;
3687 }
3688
3689 // Look up the keys of the object.
3690 var keys = Object.keys(value);
3691 var visibleKeys = arrayToHash(keys);
3692
3693 if (ctx.showHidden) {
3694 keys = Object.getOwnPropertyNames(value);
3695 }
3696
3697 // IE doesn't make error fields non-enumerable
3698 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
3699 if (isError(value)
3700 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
3701 return formatError(value);
3702 }
3703
3704 // Some type of object without properties can be shortcutted.
3705 if (keys.length === 0) {
3706 if (isFunction(value)) {
3707 var name = value.name ? ': ' + value.name : '';
3708 return ctx.stylize('[Function' + name + ']', 'special');
3709 }
3710 if (isRegExp(value)) {
3711 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
3712 }
3713 if (isDate(value)) {
3714 return ctx.stylize(Date.prototype.toString.call(value), 'date');
3715 }
3716 if (isError(value)) {
3717 return formatError(value);
3718 }
3719 }
3720
3721 var base = '', array = false, braces = ['{', '}'];
3722
3723 // Make Array say that they are Array
3724 if (isArray(value)) {
3725 array = true;
3726 braces = ['[', ']'];
3727 }
3728
3729 // Make functions say that they are functions
3730 if (isFunction(value)) {
3731 var n = value.name ? ': ' + value.name : '';
3732 base = ' [Function' + n + ']';
3733 }
3734
3735 // Make RegExps say that they are RegExps
3736 if (isRegExp(value)) {
3737 base = ' ' + RegExp.prototype.toString.call(value);
3738 }
3739
3740 // Make dates with properties first say the date
3741 if (isDate(value)) {
3742 base = ' ' + Date.prototype.toUTCString.call(value);
3743 }
3744
3745 // Make error with message first say the error
3746 if (isError(value)) {
3747 base = ' ' + formatError(value);
3748 }
3749
3750 if (keys.length === 0 && (!array || value.length == 0)) {
3751 return braces[0] + base + braces[1];
3752 }
3753
3754 if (recurseTimes < 0) {
3755 if (isRegExp(value)) {
3756 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
3757 } else {
3758 return ctx.stylize('[Object]', 'special');
3759 }
3760 }
3761
3762 ctx.seen.push(value);
3763
3764 var output;
3765 if (array) {
3766 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
3767 } else {
3768 output = keys.map(function(key) {
3769 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
3770 });
3771 }
3772
3773 ctx.seen.pop();
3774
3775 return reduceToSingleString(output, base, braces);
3776}
3777
3778
3779function formatPrimitive(ctx, value) {
3780 if (isUndefined(value))
3781 return ctx.stylize('undefined', 'undefined');
3782 if (isString(value)) {
3783 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
3784 .replace(/'/g, "\\'")
3785 .replace(/\\"/g, '"') + '\'';
3786 return ctx.stylize(simple, 'string');
3787 }
3788 if (isNumber(value))
3789 return ctx.stylize('' + value, 'number');
3790 if (isBoolean(value))
3791 return ctx.stylize('' + value, 'boolean');
3792 // For some reason typeof null is "object", so special case here.
3793 if (isNull(value))
3794 return ctx.stylize('null', 'null');
3795}
3796
3797
3798function formatError(value) {
3799 return '[' + Error.prototype.toString.call(value) + ']';
3800}
3801
3802
3803function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
3804 var output = [];
3805 for (var i = 0, l = value.length; i < l; ++i) {
3806 if (hasOwnProperty(value, String(i))) {
3807 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
3808 String(i), true));
3809 } else {
3810 output.push('');
3811 }
3812 }
3813 keys.forEach(function(key) {
3814 if (!key.match(/^\d+$/)) {
3815 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
3816 key, true));
3817 }
3818 });
3819 return output;
3820}
3821
3822
3823function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
3824 var name, str, desc;
3825 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
3826 if (desc.get) {
3827 if (desc.set) {
3828 str = ctx.stylize('[Getter/Setter]', 'special');
3829 } else {
3830 str = ctx.stylize('[Getter]', 'special');
3831 }
3832 } else {
3833 if (desc.set) {
3834 str = ctx.stylize('[Setter]', 'special');
3835 }
3836 }
3837 if (!hasOwnProperty(visibleKeys, key)) {
3838 name = '[' + key + ']';
3839 }
3840 if (!str) {
3841 if (ctx.seen.indexOf(desc.value) < 0) {
3842 if (isNull(recurseTimes)) {
3843 str = formatValue(ctx, desc.value, null);
3844 } else {
3845 str = formatValue(ctx, desc.value, recurseTimes - 1);
3846 }
3847 if (str.indexOf('\n') > -1) {
3848 if (array) {
3849 str = str.split('\n').map(function(line) {
3850 return ' ' + line;
3851 }).join('\n').substr(2);
3852 } else {
3853 str = '\n' + str.split('\n').map(function(line) {
3854 return ' ' + line;
3855 }).join('\n');
3856 }
3857 }
3858 } else {
3859 str = ctx.stylize('[Circular]', 'special');
3860 }
3861 }
3862 if (isUndefined(name)) {
3863 if (array && key.match(/^\d+$/)) {
3864 return str;
3865 }
3866 name = JSON.stringify('' + key);
3867 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
3868 name = name.substr(1, name.length - 2);
3869 name = ctx.stylize(name, 'name');
3870 } else {
3871 name = name.replace(/'/g, "\\'")
3872 .replace(/\\"/g, '"')
3873 .replace(/(^"|"$)/g, "'");
3874 name = ctx.stylize(name, 'string');
3875 }
3876 }
3877
3878 return name + ': ' + str;
3879}
3880
3881
3882function reduceToSingleString(output, base, braces) {
3883 var numLinesEst = 0;
3884 var length = output.reduce(function(prev, cur) {
3885 numLinesEst++;
3886 if (cur.indexOf('\n') >= 0) numLinesEst++;
3887 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
3888 }, 0);
3889
3890 if (length > 60) {
3891 return braces[0] +
3892 (base === '' ? '' : base + '\n ') +
3893 ' ' +
3894 output.join(',\n ') +
3895 ' ' +
3896 braces[1];
3897 }
3898
3899 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
3900}
3901
3902
3903// NOTE: These type checking functions intentionally don't use `instanceof`
3904// because it is fragile and can be easily faked with `Object.create()`.
3905function isArray(ar) {
3906 return Array.isArray(ar);
3907}
3908exports.isArray = isArray;
3909
3910function isBoolean(arg) {
3911 return typeof arg === 'boolean';
3912}
3913exports.isBoolean = isBoolean;
3914
3915function isNull(arg) {
3916 return arg === null;
3917}
3918exports.isNull = isNull;
3919
3920function isNullOrUndefined(arg) {
3921 return arg == null;
3922}
3923exports.isNullOrUndefined = isNullOrUndefined;
3924
3925function isNumber(arg) {
3926 return typeof arg === 'number';
3927}
3928exports.isNumber = isNumber;
3929
3930function isString(arg) {
3931 return typeof arg === 'string';
3932}
3933exports.isString = isString;
3934
3935function isSymbol(arg) {
3936 return typeof arg === 'symbol';
3937}
3938exports.isSymbol = isSymbol;
3939
3940function isUndefined(arg) {
3941 return arg === void 0;
3942}
3943exports.isUndefined = isUndefined;
3944
3945function isRegExp(re) {
3946 return isObject(re) && objectToString(re) === '[object RegExp]';
3947}
3948exports.isRegExp = isRegExp;
3949
3950function isObject(arg) {
3951 return typeof arg === 'object' && arg !== null;
3952}
3953exports.isObject = isObject;
3954
3955function isDate(d) {
3956 return isObject(d) && objectToString(d) === '[object Date]';
3957}
3958exports.isDate = isDate;
3959
3960function isError(e) {
3961 return isObject(e) &&
3962 (objectToString(e) === '[object Error]' || e instanceof Error);
3963}
3964exports.isError = isError;
3965
3966function isFunction(arg) {
3967 return typeof arg === 'function';
3968}
3969exports.isFunction = isFunction;
3970
3971function isPrimitive(arg) {
3972 return arg === null ||
3973 typeof arg === 'boolean' ||
3974 typeof arg === 'number' ||
3975 typeof arg === 'string' ||
3976 typeof arg === 'symbol' || // ES6 symbol
3977 typeof arg === 'undefined';
3978}
3979exports.isPrimitive = isPrimitive;
3980
3981exports.isBuffer = require('./support/isBuffer');
3982
3983function objectToString(o) {
3984 return Object.prototype.toString.call(o);
3985}
3986
3987
3988function pad(n) {
3989 return n < 10 ? '0' + n.toString(10) : n.toString(10);
3990}
3991
3992
3993var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
3994 'Oct', 'Nov', 'Dec'];
3995
3996// 26 Feb 16:19:34
3997function timestamp() {
3998 var d = new Date();
3999 var time = [pad(d.getHours()),
4000 pad(d.getMinutes()),
4001 pad(d.getSeconds())].join(':');
4002 return [d.getDate(), months[d.getMonth()], time].join(' ');
4003}
4004
4005
4006// log is just a thin wrapper to console.log that prepends a timestamp
4007exports.log = function() {
4008 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
4009};
4010
4011
4012/**
4013 * Inherit the prototype methods from one constructor into another.
4014 *
4015 * The Function.prototype.inherits from lang.js rewritten as a standalone
4016 * function (not on Function.prototype). NOTE: If this file is to be loaded
4017 * during bootstrapping this function needs to be rewritten using some native
4018 * functions as prototype setup using normal JavaScript does not work as
4019 * expected during bootstrapping (see mirror.js in r114903).
4020 *
4021 * @param {function} ctor Constructor function which needs to inherit the
4022 * prototype.
4023 * @param {function} superCtor Constructor function to inherit prototype from.
4024 */
4025exports.inherits = require('inherits');
4026
4027exports._extend = function(origin, add) {
4028 // Don't do anything if add isn't an object
4029 if (!add || !isObject(add)) return origin;
4030
4031 var keys = Object.keys(add);
4032 var i = keys.length;
4033 while (i--) {
4034 origin[keys[i]] = add[keys[i]];
4035 }
4036 return origin;
4037};
4038
4039function hasOwnProperty(obj, prop) {
4040 return Object.prototype.hasOwnProperty.call(obj, prop);
4041}
4042
4043}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4044},{"./support/isBuffer":28,"_process":678,"inherits":27}],30:[function(require,module,exports){
4045module.exports = require('./lib/axios');
4046},{"./lib/axios":32}],31:[function(require,module,exports){
4047'use strict';
4048
4049var utils = require('./../utils');
4050var settle = require('./../core/settle');
4051var buildURL = require('./../helpers/buildURL');
4052var parseHeaders = require('./../helpers/parseHeaders');
4053var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
4054var createError = require('../core/createError');
4055
4056module.exports = function xhrAdapter(config) {
4057 return new Promise(function dispatchXhrRequest(resolve, reject) {
4058 var requestData = config.data;
4059 var requestHeaders = config.headers;
4060
4061 if (utils.isFormData(requestData)) {
4062 delete requestHeaders['Content-Type']; // Let the browser set it
4063 }
4064
4065 var request = new XMLHttpRequest();
4066
4067 // HTTP basic authentication
4068 if (config.auth) {
4069 var username = config.auth.username || '';
4070 var password = config.auth.password || '';
4071 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
4072 }
4073
4074 request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
4075
4076 // Set the request timeout in MS
4077 request.timeout = config.timeout;
4078
4079 // Listen for ready state
4080 request.onreadystatechange = function handleLoad() {
4081 if (!request || request.readyState !== 4) {
4082 return;
4083 }
4084
4085 // The request errored out and we didn't get a response, this will be
4086 // handled by onerror instead
4087 // With one exception: request that using file: protocol, most browsers
4088 // will return status as 0 even though it's a successful request
4089 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
4090 return;
4091 }
4092
4093 // Prepare the response
4094 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
4095 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
4096 var response = {
4097 data: responseData,
4098 status: request.status,
4099 statusText: request.statusText,
4100 headers: responseHeaders,
4101 config: config,
4102 request: request
4103 };
4104
4105 settle(resolve, reject, response);
4106
4107 // Clean up request
4108 request = null;
4109 };
4110
4111 // Handle low level network errors
4112 request.onerror = function handleError() {
4113 // Real errors are hidden from us by the browser
4114 // onerror should only fire if it's a network error
4115 reject(createError('Network Error', config, null, request));
4116
4117 // Clean up request
4118 request = null;
4119 };
4120
4121 // Handle timeout
4122 request.ontimeout = function handleTimeout() {
4123 reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
4124 request));
4125
4126 // Clean up request
4127 request = null;
4128 };
4129
4130 // Add xsrf header
4131 // This is only done if running in a standard browser environment.
4132 // Specifically not if we're in a web worker, or react-native.
4133 if (utils.isStandardBrowserEnv()) {
4134 var cookies = require('./../helpers/cookies');
4135
4136 // Add xsrf header
4137 var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
4138 cookies.read(config.xsrfCookieName) :
4139 undefined;
4140
4141 if (xsrfValue) {
4142 requestHeaders[config.xsrfHeaderName] = xsrfValue;
4143 }
4144 }
4145
4146 // Add headers to the request
4147 if ('setRequestHeader' in request) {
4148 utils.forEach(requestHeaders, function setRequestHeader(val, key) {
4149 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
4150 // Remove Content-Type if data is undefined
4151 delete requestHeaders[key];
4152 } else {
4153 // Otherwise add header to the request
4154 request.setRequestHeader(key, val);
4155 }
4156 });
4157 }
4158
4159 // Add withCredentials to request if needed
4160 if (config.withCredentials) {
4161 request.withCredentials = true;
4162 }
4163
4164 // Add responseType to request if needed
4165 if (config.responseType) {
4166 try {
4167 request.responseType = config.responseType;
4168 } catch (e) {
4169 // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
4170 // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
4171 if (config.responseType !== 'json') {
4172 throw e;
4173 }
4174 }
4175 }
4176
4177 // Handle progress if needed
4178 if (typeof config.onDownloadProgress === 'function') {
4179 request.addEventListener('progress', config.onDownloadProgress);
4180 }
4181
4182 // Not all browsers support upload events
4183 if (typeof config.onUploadProgress === 'function' && request.upload) {
4184 request.upload.addEventListener('progress', config.onUploadProgress);
4185 }
4186
4187 if (config.cancelToken) {
4188 // Handle cancellation
4189 config.cancelToken.promise.then(function onCanceled(cancel) {
4190 if (!request) {
4191 return;
4192 }
4193
4194 request.abort();
4195 reject(cancel);
4196 // Clean up request
4197 request = null;
4198 });
4199 }
4200
4201 if (requestData === undefined) {
4202 requestData = null;
4203 }
4204
4205 // Send the request
4206 request.send(requestData);
4207 });
4208};
4209
4210},{"../core/createError":38,"./../core/settle":41,"./../helpers/buildURL":45,"./../helpers/cookies":47,"./../helpers/isURLSameOrigin":49,"./../helpers/parseHeaders":51,"./../utils":53}],32:[function(require,module,exports){
4211'use strict';
4212
4213var utils = require('./utils');
4214var bind = require('./helpers/bind');
4215var Axios = require('./core/Axios');
4216var defaults = require('./defaults');
4217
4218/**
4219 * Create an instance of Axios
4220 *
4221 * @param {Object} defaultConfig The default config for the instance
4222 * @return {Axios} A new instance of Axios
4223 */
4224function createInstance(defaultConfig) {
4225 var context = new Axios(defaultConfig);
4226 var instance = bind(Axios.prototype.request, context);
4227
4228 // Copy axios.prototype to instance
4229 utils.extend(instance, Axios.prototype, context);
4230
4231 // Copy context to instance
4232 utils.extend(instance, context);
4233
4234 return instance;
4235}
4236
4237// Create the default instance to be exported
4238var axios = createInstance(defaults);
4239
4240// Expose Axios class to allow class inheritance
4241axios.Axios = Axios;
4242
4243// Factory for creating new instances
4244axios.create = function create(instanceConfig) {
4245 return createInstance(utils.merge(defaults, instanceConfig));
4246};
4247
4248// Expose Cancel & CancelToken
4249axios.Cancel = require('./cancel/Cancel');
4250axios.CancelToken = require('./cancel/CancelToken');
4251axios.isCancel = require('./cancel/isCancel');
4252
4253// Expose all/spread
4254axios.all = function all(promises) {
4255 return Promise.all(promises);
4256};
4257axios.spread = require('./helpers/spread');
4258
4259module.exports = axios;
4260
4261// Allow use of default import syntax in TypeScript
4262module.exports.default = axios;
4263
4264},{"./cancel/Cancel":33,"./cancel/CancelToken":34,"./cancel/isCancel":35,"./core/Axios":36,"./defaults":43,"./helpers/bind":44,"./helpers/spread":52,"./utils":53}],33:[function(require,module,exports){
4265'use strict';
4266
4267/**
4268 * A `Cancel` is an object that is thrown when an operation is canceled.
4269 *
4270 * @class
4271 * @param {string=} message The message.
4272 */
4273function Cancel(message) {
4274 this.message = message;
4275}
4276
4277Cancel.prototype.toString = function toString() {
4278 return 'Cancel' + (this.message ? ': ' + this.message : '');
4279};
4280
4281Cancel.prototype.__CANCEL__ = true;
4282
4283module.exports = Cancel;
4284
4285},{}],34:[function(require,module,exports){
4286'use strict';
4287
4288var Cancel = require('./Cancel');
4289
4290/**
4291 * A `CancelToken` is an object that can be used to request cancellation of an operation.
4292 *
4293 * @class
4294 * @param {Function} executor The executor function.
4295 */
4296function CancelToken(executor) {
4297 if (typeof executor !== 'function') {
4298 throw new TypeError('executor must be a function.');
4299 }
4300
4301 var resolvePromise;
4302 this.promise = new Promise(function promiseExecutor(resolve) {
4303 resolvePromise = resolve;
4304 });
4305
4306 var token = this;
4307 executor(function cancel(message) {
4308 if (token.reason) {
4309 // Cancellation has already been requested
4310 return;
4311 }
4312
4313 token.reason = new Cancel(message);
4314 resolvePromise(token.reason);
4315 });
4316}
4317
4318/**
4319 * Throws a `Cancel` if cancellation has been requested.
4320 */
4321CancelToken.prototype.throwIfRequested = function throwIfRequested() {
4322 if (this.reason) {
4323 throw this.reason;
4324 }
4325};
4326
4327/**
4328 * Returns an object that contains a new `CancelToken` and a function that, when called,
4329 * cancels the `CancelToken`.
4330 */
4331CancelToken.source = function source() {
4332 var cancel;
4333 var token = new CancelToken(function executor(c) {
4334 cancel = c;
4335 });
4336 return {
4337 token: token,
4338 cancel: cancel
4339 };
4340};
4341
4342module.exports = CancelToken;
4343
4344},{"./Cancel":33}],35:[function(require,module,exports){
4345'use strict';
4346
4347module.exports = function isCancel(value) {
4348 return !!(value && value.__CANCEL__);
4349};
4350
4351},{}],36:[function(require,module,exports){
4352'use strict';
4353
4354var defaults = require('./../defaults');
4355var utils = require('./../utils');
4356var InterceptorManager = require('./InterceptorManager');
4357var dispatchRequest = require('./dispatchRequest');
4358
4359/**
4360 * Create a new instance of Axios
4361 *
4362 * @param {Object} instanceConfig The default config for the instance
4363 */
4364function Axios(instanceConfig) {
4365 this.defaults = instanceConfig;
4366 this.interceptors = {
4367 request: new InterceptorManager(),
4368 response: new InterceptorManager()
4369 };
4370}
4371
4372/**
4373 * Dispatch a request
4374 *
4375 * @param {Object} config The config specific for this request (merged with this.defaults)
4376 */
4377Axios.prototype.request = function request(config) {
4378 /*eslint no-param-reassign:0*/
4379 // Allow for axios('example/url'[, config]) a la fetch API
4380 if (typeof config === 'string') {
4381 config = utils.merge({
4382 url: arguments[0]
4383 }, arguments[1]);
4384 }
4385
4386 config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
4387 config.method = config.method.toLowerCase();
4388
4389 // Hook up interceptors middleware
4390 var chain = [dispatchRequest, undefined];
4391 var promise = Promise.resolve(config);
4392
4393 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
4394 chain.unshift(interceptor.fulfilled, interceptor.rejected);
4395 });
4396
4397 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
4398 chain.push(interceptor.fulfilled, interceptor.rejected);
4399 });
4400
4401 while (chain.length) {
4402 promise = promise.then(chain.shift(), chain.shift());
4403 }
4404
4405 return promise;
4406};
4407
4408// Provide aliases for supported request methods
4409utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
4410 /*eslint func-names:0*/
4411 Axios.prototype[method] = function(url, config) {
4412 return this.request(utils.merge(config || {}, {
4413 method: method,
4414 url: url
4415 }));
4416 };
4417});
4418
4419utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4420 /*eslint func-names:0*/
4421 Axios.prototype[method] = function(url, data, config) {
4422 return this.request(utils.merge(config || {}, {
4423 method: method,
4424 url: url,
4425 data: data
4426 }));
4427 };
4428});
4429
4430module.exports = Axios;
4431
4432},{"./../defaults":43,"./../utils":53,"./InterceptorManager":37,"./dispatchRequest":39}],37:[function(require,module,exports){
4433'use strict';
4434
4435var utils = require('./../utils');
4436
4437function InterceptorManager() {
4438 this.handlers = [];
4439}
4440
4441/**
4442 * Add a new interceptor to the stack
4443 *
4444 * @param {Function} fulfilled The function to handle `then` for a `Promise`
4445 * @param {Function} rejected The function to handle `reject` for a `Promise`
4446 *
4447 * @return {Number} An ID used to remove interceptor later
4448 */
4449InterceptorManager.prototype.use = function use(fulfilled, rejected) {
4450 this.handlers.push({
4451 fulfilled: fulfilled,
4452 rejected: rejected
4453 });
4454 return this.handlers.length - 1;
4455};
4456
4457/**
4458 * Remove an interceptor from the stack
4459 *
4460 * @param {Number} id The ID that was returned by `use`
4461 */
4462InterceptorManager.prototype.eject = function eject(id) {
4463 if (this.handlers[id]) {
4464 this.handlers[id] = null;
4465 }
4466};
4467
4468/**
4469 * Iterate over all the registered interceptors
4470 *
4471 * This method is particularly useful for skipping over any
4472 * interceptors that may have become `null` calling `eject`.
4473 *
4474 * @param {Function} fn The function to call for each interceptor
4475 */
4476InterceptorManager.prototype.forEach = function forEach(fn) {
4477 utils.forEach(this.handlers, function forEachHandler(h) {
4478 if (h !== null) {
4479 fn(h);
4480 }
4481 });
4482};
4483
4484module.exports = InterceptorManager;
4485
4486},{"./../utils":53}],38:[function(require,module,exports){
4487'use strict';
4488
4489var enhanceError = require('./enhanceError');
4490
4491/**
4492 * Create an Error with the specified message, config, error code, request and response.
4493 *
4494 * @param {string} message The error message.
4495 * @param {Object} config The config.
4496 * @param {string} [code] The error code (for example, 'ECONNABORTED').
4497 * @param {Object} [request] The request.
4498 * @param {Object} [response] The response.
4499 * @returns {Error} The created error.
4500 */
4501module.exports = function createError(message, config, code, request, response) {
4502 var error = new Error(message);
4503 return enhanceError(error, config, code, request, response);
4504};
4505
4506},{"./enhanceError":40}],39:[function(require,module,exports){
4507'use strict';
4508
4509var utils = require('./../utils');
4510var transformData = require('./transformData');
4511var isCancel = require('../cancel/isCancel');
4512var defaults = require('../defaults');
4513var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
4514var combineURLs = require('./../helpers/combineURLs');
4515
4516/**
4517 * Throws a `Cancel` if cancellation has been requested.
4518 */
4519function throwIfCancellationRequested(config) {
4520 if (config.cancelToken) {
4521 config.cancelToken.throwIfRequested();
4522 }
4523}
4524
4525/**
4526 * Dispatch a request to the server using the configured adapter.
4527 *
4528 * @param {object} config The config that is to be used for the request
4529 * @returns {Promise} The Promise to be fulfilled
4530 */
4531module.exports = function dispatchRequest(config) {
4532 throwIfCancellationRequested(config);
4533
4534 // Support baseURL config
4535 if (config.baseURL && !isAbsoluteURL(config.url)) {
4536 config.url = combineURLs(config.baseURL, config.url);
4537 }
4538
4539 // Ensure headers exist
4540 config.headers = config.headers || {};
4541
4542 // Transform request data
4543 config.data = transformData(
4544 config.data,
4545 config.headers,
4546 config.transformRequest
4547 );
4548
4549 // Flatten headers
4550 config.headers = utils.merge(
4551 config.headers.common || {},
4552 config.headers[config.method] || {},
4553 config.headers || {}
4554 );
4555
4556 utils.forEach(
4557 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
4558 function cleanHeaderConfig(method) {
4559 delete config.headers[method];
4560 }
4561 );
4562
4563 var adapter = config.adapter || defaults.adapter;
4564
4565 return adapter(config).then(function onAdapterResolution(response) {
4566 throwIfCancellationRequested(config);
4567
4568 // Transform response data
4569 response.data = transformData(
4570 response.data,
4571 response.headers,
4572 config.transformResponse
4573 );
4574
4575 return response;
4576 }, function onAdapterRejection(reason) {
4577 if (!isCancel(reason)) {
4578 throwIfCancellationRequested(config);
4579
4580 // Transform response data
4581 if (reason && reason.response) {
4582 reason.response.data = transformData(
4583 reason.response.data,
4584 reason.response.headers,
4585 config.transformResponse
4586 );
4587 }
4588 }
4589
4590 return Promise.reject(reason);
4591 });
4592};
4593
4594},{"../cancel/isCancel":35,"../defaults":43,"./../helpers/combineURLs":46,"./../helpers/isAbsoluteURL":48,"./../utils":53,"./transformData":42}],40:[function(require,module,exports){
4595'use strict';
4596
4597/**
4598 * Update an Error with the specified config, error code, and response.
4599 *
4600 * @param {Error} error The error to update.
4601 * @param {Object} config The config.
4602 * @param {string} [code] The error code (for example, 'ECONNABORTED').
4603 * @param {Object} [request] The request.
4604 * @param {Object} [response] The response.
4605 * @returns {Error} The error.
4606 */
4607module.exports = function enhanceError(error, config, code, request, response) {
4608 error.config = config;
4609 if (code) {
4610 error.code = code;
4611 }
4612 error.request = request;
4613 error.response = response;
4614 return error;
4615};
4616
4617},{}],41:[function(require,module,exports){
4618'use strict';
4619
4620var createError = require('./createError');
4621
4622/**
4623 * Resolve or reject a Promise based on response status.
4624 *
4625 * @param {Function} resolve A function that resolves the promise.
4626 * @param {Function} reject A function that rejects the promise.
4627 * @param {object} response The response.
4628 */
4629module.exports = function settle(resolve, reject, response) {
4630 var validateStatus = response.config.validateStatus;
4631 // Note: status is not exposed by XDomainRequest
4632 if (!response.status || !validateStatus || validateStatus(response.status)) {
4633 resolve(response);
4634 } else {
4635 reject(createError(
4636 'Request failed with status code ' + response.status,
4637 response.config,
4638 null,
4639 response.request,
4640 response
4641 ));
4642 }
4643};
4644
4645},{"./createError":38}],42:[function(require,module,exports){
4646'use strict';
4647
4648var utils = require('./../utils');
4649
4650/**
4651 * Transform the data for a request or a response
4652 *
4653 * @param {Object|String} data The data to be transformed
4654 * @param {Array} headers The headers for the request or response
4655 * @param {Array|Function} fns A single function or Array of functions
4656 * @returns {*} The resulting transformed data
4657 */
4658module.exports = function transformData(data, headers, fns) {
4659 /*eslint no-param-reassign:0*/
4660 utils.forEach(fns, function transform(fn) {
4661 data = fn(data, headers);
4662 });
4663
4664 return data;
4665};
4666
4667},{"./../utils":53}],43:[function(require,module,exports){
4668(function (process){
4669'use strict';
4670
4671var utils = require('./utils');
4672var normalizeHeaderName = require('./helpers/normalizeHeaderName');
4673
4674var DEFAULT_CONTENT_TYPE = {
4675 'Content-Type': 'application/x-www-form-urlencoded'
4676};
4677
4678function setContentTypeIfUnset(headers, value) {
4679 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
4680 headers['Content-Type'] = value;
4681 }
4682}
4683
4684function getDefaultAdapter() {
4685 var adapter;
4686 if (typeof XMLHttpRequest !== 'undefined') {
4687 // For browsers use XHR adapter
4688 adapter = require('./adapters/xhr');
4689 } else if (typeof process !== 'undefined') {
4690 // For node use HTTP adapter
4691 adapter = require('./adapters/http');
4692 }
4693 return adapter;
4694}
4695
4696var defaults = {
4697 adapter: getDefaultAdapter(),
4698
4699 transformRequest: [function transformRequest(data, headers) {
4700 normalizeHeaderName(headers, 'Content-Type');
4701 if (utils.isFormData(data) ||
4702 utils.isArrayBuffer(data) ||
4703 utils.isBuffer(data) ||
4704 utils.isStream(data) ||
4705 utils.isFile(data) ||
4706 utils.isBlob(data)
4707 ) {
4708 return data;
4709 }
4710 if (utils.isArrayBufferView(data)) {
4711 return data.buffer;
4712 }
4713 if (utils.isURLSearchParams(data)) {
4714 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
4715 return data.toString();
4716 }
4717 if (utils.isObject(data)) {
4718 setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
4719 return JSON.stringify(data);
4720 }
4721 return data;
4722 }],
4723
4724 transformResponse: [function transformResponse(data) {
4725 /*eslint no-param-reassign:0*/
4726 if (typeof data === 'string') {
4727 try {
4728 data = JSON.parse(data);
4729 } catch (e) { /* Ignore */ }
4730 }
4731 return data;
4732 }],
4733
4734 /**
4735 * A timeout in milliseconds to abort a request. If set to 0 (default) a
4736 * timeout is not created.
4737 */
4738 timeout: 0,
4739
4740 xsrfCookieName: 'XSRF-TOKEN',
4741 xsrfHeaderName: 'X-XSRF-TOKEN',
4742
4743 maxContentLength: -1,
4744
4745 validateStatus: function validateStatus(status) {
4746 return status >= 200 && status < 300;
4747 }
4748};
4749
4750defaults.headers = {
4751 common: {
4752 'Accept': 'application/json, text/plain, */*'
4753 }
4754};
4755
4756utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
4757 defaults.headers[method] = {};
4758});
4759
4760utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4761 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
4762});
4763
4764module.exports = defaults;
4765
4766}).call(this,require('_process'))
4767},{"./adapters/http":31,"./adapters/xhr":31,"./helpers/normalizeHeaderName":50,"./utils":53,"_process":678}],44:[function(require,module,exports){
4768'use strict';
4769
4770module.exports = function bind(fn, thisArg) {
4771 return function wrap() {
4772 var args = new Array(arguments.length);
4773 for (var i = 0; i < args.length; i++) {
4774 args[i] = arguments[i];
4775 }
4776 return fn.apply(thisArg, args);
4777 };
4778};
4779
4780},{}],45:[function(require,module,exports){
4781'use strict';
4782
4783var utils = require('./../utils');
4784
4785function encode(val) {
4786 return encodeURIComponent(val).
4787 replace(/%40/gi, '@').
4788 replace(/%3A/gi, ':').
4789 replace(/%24/g, '$').
4790 replace(/%2C/gi, ',').
4791 replace(/%20/g, '+').
4792 replace(/%5B/gi, '[').
4793 replace(/%5D/gi, ']');
4794}
4795
4796/**
4797 * Build a URL by appending params to the end
4798 *
4799 * @param {string} url The base of the url (e.g., http://www.google.com)
4800 * @param {object} [params] The params to be appended
4801 * @returns {string} The formatted url
4802 */
4803module.exports = function buildURL(url, params, paramsSerializer) {
4804 /*eslint no-param-reassign:0*/
4805 if (!params) {
4806 return url;
4807 }
4808
4809 var serializedParams;
4810 if (paramsSerializer) {
4811 serializedParams = paramsSerializer(params);
4812 } else if (utils.isURLSearchParams(params)) {
4813 serializedParams = params.toString();
4814 } else {
4815 var parts = [];
4816
4817 utils.forEach(params, function serialize(val, key) {
4818 if (val === null || typeof val === 'undefined') {
4819 return;
4820 }
4821
4822 if (utils.isArray(val)) {
4823 key = key + '[]';
4824 } else {
4825 val = [val];
4826 }
4827
4828 utils.forEach(val, function parseValue(v) {
4829 if (utils.isDate(v)) {
4830 v = v.toISOString();
4831 } else if (utils.isObject(v)) {
4832 v = JSON.stringify(v);
4833 }
4834 parts.push(encode(key) + '=' + encode(v));
4835 });
4836 });
4837
4838 serializedParams = parts.join('&');
4839 }
4840
4841 if (serializedParams) {
4842 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
4843 }
4844
4845 return url;
4846};
4847
4848},{"./../utils":53}],46:[function(require,module,exports){
4849'use strict';
4850
4851/**
4852 * Creates a new URL by combining the specified URLs
4853 *
4854 * @param {string} baseURL The base URL
4855 * @param {string} relativeURL The relative URL
4856 * @returns {string} The combined URL
4857 */
4858module.exports = function combineURLs(baseURL, relativeURL) {
4859 return relativeURL
4860 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
4861 : baseURL;
4862};
4863
4864},{}],47:[function(require,module,exports){
4865'use strict';
4866
4867var utils = require('./../utils');
4868
4869module.exports = (
4870 utils.isStandardBrowserEnv() ?
4871
4872 // Standard browser envs support document.cookie
4873 (function standardBrowserEnv() {
4874 return {
4875 write: function write(name, value, expires, path, domain, secure) {
4876 var cookie = [];
4877 cookie.push(name + '=' + encodeURIComponent(value));
4878
4879 if (utils.isNumber(expires)) {
4880 cookie.push('expires=' + new Date(expires).toGMTString());
4881 }
4882
4883 if (utils.isString(path)) {
4884 cookie.push('path=' + path);
4885 }
4886
4887 if (utils.isString(domain)) {
4888 cookie.push('domain=' + domain);
4889 }
4890
4891 if (secure === true) {
4892 cookie.push('secure');
4893 }
4894
4895 document.cookie = cookie.join('; ');
4896 },
4897
4898 read: function read(name) {
4899 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
4900 return (match ? decodeURIComponent(match[3]) : null);
4901 },
4902
4903 remove: function remove(name) {
4904 this.write(name, '', Date.now() - 86400000);
4905 }
4906 };
4907 })() :
4908
4909 // Non standard browser env (web workers, react-native) lack needed support.
4910 (function nonStandardBrowserEnv() {
4911 return {
4912 write: function write() {},
4913 read: function read() { return null; },
4914 remove: function remove() {}
4915 };
4916 })()
4917);
4918
4919},{"./../utils":53}],48:[function(require,module,exports){
4920'use strict';
4921
4922/**
4923 * Determines whether the specified URL is absolute
4924 *
4925 * @param {string} url The URL to test
4926 * @returns {boolean} True if the specified URL is absolute, otherwise false
4927 */
4928module.exports = function isAbsoluteURL(url) {
4929 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
4930 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
4931 // by any combination of letters, digits, plus, period, or hyphen.
4932 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
4933};
4934
4935},{}],49:[function(require,module,exports){
4936'use strict';
4937
4938var utils = require('./../utils');
4939
4940module.exports = (
4941 utils.isStandardBrowserEnv() ?
4942
4943 // Standard browser envs have full support of the APIs needed to test
4944 // whether the request URL is of the same origin as current location.
4945 (function standardBrowserEnv() {
4946 var msie = /(msie|trident)/i.test(navigator.userAgent);
4947 var urlParsingNode = document.createElement('a');
4948 var originURL;
4949
4950 /**
4951 * Parse a URL to discover it's components
4952 *
4953 * @param {String} url The URL to be parsed
4954 * @returns {Object}
4955 */
4956 function resolveURL(url) {
4957 var href = url;
4958
4959 if (msie) {
4960 // IE needs attribute set twice to normalize properties
4961 urlParsingNode.setAttribute('href', href);
4962 href = urlParsingNode.href;
4963 }
4964
4965 urlParsingNode.setAttribute('href', href);
4966
4967 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
4968 return {
4969 href: urlParsingNode.href,
4970 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
4971 host: urlParsingNode.host,
4972 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
4973 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
4974 hostname: urlParsingNode.hostname,
4975 port: urlParsingNode.port,
4976 pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
4977 urlParsingNode.pathname :
4978 '/' + urlParsingNode.pathname
4979 };
4980 }
4981
4982 originURL = resolveURL(window.location.href);
4983
4984 /**
4985 * Determine if a URL shares the same origin as the current location
4986 *
4987 * @param {String} requestURL The URL to test
4988 * @returns {boolean} True if URL shares the same origin, otherwise false
4989 */
4990 return function isURLSameOrigin(requestURL) {
4991 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
4992 return (parsed.protocol === originURL.protocol &&
4993 parsed.host === originURL.host);
4994 };
4995 })() :
4996
4997 // Non standard browser envs (web workers, react-native) lack needed support.
4998 (function nonStandardBrowserEnv() {
4999 return function isURLSameOrigin() {
5000 return true;
5001 };
5002 })()
5003);
5004
5005},{"./../utils":53}],50:[function(require,module,exports){
5006'use strict';
5007
5008var utils = require('../utils');
5009
5010module.exports = function normalizeHeaderName(headers, normalizedName) {
5011 utils.forEach(headers, function processHeader(value, name) {
5012 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
5013 headers[normalizedName] = value;
5014 delete headers[name];
5015 }
5016 });
5017};
5018
5019},{"../utils":53}],51:[function(require,module,exports){
5020'use strict';
5021
5022var utils = require('./../utils');
5023
5024// Headers whose duplicates are ignored by node
5025// c.f. https://nodejs.org/api/http.html#http_message_headers
5026var ignoreDuplicateOf = [
5027 'age', 'authorization', 'content-length', 'content-type', 'etag',
5028 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
5029 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
5030 'referer', 'retry-after', 'user-agent'
5031];
5032
5033/**
5034 * Parse headers into an object
5035 *
5036 * ```
5037 * Date: Wed, 27 Aug 2014 08:58:49 GMT
5038 * Content-Type: application/json
5039 * Connection: keep-alive
5040 * Transfer-Encoding: chunked
5041 * ```
5042 *
5043 * @param {String} headers Headers needing to be parsed
5044 * @returns {Object} Headers parsed into an object
5045 */
5046module.exports = function parseHeaders(headers) {
5047 var parsed = {};
5048 var key;
5049 var val;
5050 var i;
5051
5052 if (!headers) { return parsed; }
5053
5054 utils.forEach(headers.split('\n'), function parser(line) {
5055 i = line.indexOf(':');
5056 key = utils.trim(line.substr(0, i)).toLowerCase();
5057 val = utils.trim(line.substr(i + 1));
5058
5059 if (key) {
5060 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
5061 return;
5062 }
5063 if (key === 'set-cookie') {
5064 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
5065 } else {
5066 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
5067 }
5068 }
5069 });
5070
5071 return parsed;
5072};
5073
5074},{"./../utils":53}],52:[function(require,module,exports){
5075'use strict';
5076
5077/**
5078 * Syntactic sugar for invoking a function and expanding an array for arguments.
5079 *
5080 * Common use case would be to use `Function.prototype.apply`.
5081 *
5082 * ```js
5083 * function f(x, y, z) {}
5084 * var args = [1, 2, 3];
5085 * f.apply(null, args);
5086 * ```
5087 *
5088 * With `spread` this example can be re-written.
5089 *
5090 * ```js
5091 * spread(function(x, y, z) {})([1, 2, 3]);
5092 * ```
5093 *
5094 * @param {Function} callback
5095 * @returns {Function}
5096 */
5097module.exports = function spread(callback) {
5098 return function wrap(arr) {
5099 return callback.apply(null, arr);
5100 };
5101};
5102
5103},{}],53:[function(require,module,exports){
5104'use strict';
5105
5106var bind = require('./helpers/bind');
5107var isBuffer = require('is-buffer');
5108
5109/*global toString:true*/
5110
5111// utils is a library of generic helper functions non-specific to axios
5112
5113var toString = Object.prototype.toString;
5114
5115/**
5116 * Determine if a value is an Array
5117 *
5118 * @param {Object} val The value to test
5119 * @returns {boolean} True if value is an Array, otherwise false
5120 */
5121function isArray(val) {
5122 return toString.call(val) === '[object Array]';
5123}
5124
5125/**
5126 * Determine if a value is an ArrayBuffer
5127 *
5128 * @param {Object} val The value to test
5129 * @returns {boolean} True if value is an ArrayBuffer, otherwise false
5130 */
5131function isArrayBuffer(val) {
5132 return toString.call(val) === '[object ArrayBuffer]';
5133}
5134
5135/**
5136 * Determine if a value is a FormData
5137 *
5138 * @param {Object} val The value to test
5139 * @returns {boolean} True if value is an FormData, otherwise false
5140 */
5141function isFormData(val) {
5142 return (typeof FormData !== 'undefined') && (val instanceof FormData);
5143}
5144
5145/**
5146 * Determine if a value is a view on an ArrayBuffer
5147 *
5148 * @param {Object} val The value to test
5149 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
5150 */
5151function isArrayBufferView(val) {
5152 var result;
5153 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
5154 result = ArrayBuffer.isView(val);
5155 } else {
5156 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
5157 }
5158 return result;
5159}
5160
5161/**
5162 * Determine if a value is a String
5163 *
5164 * @param {Object} val The value to test
5165 * @returns {boolean} True if value is a String, otherwise false
5166 */
5167function isString(val) {
5168 return typeof val === 'string';
5169}
5170
5171/**
5172 * Determine if a value is a Number
5173 *
5174 * @param {Object} val The value to test
5175 * @returns {boolean} True if value is a Number, otherwise false
5176 */
5177function isNumber(val) {
5178 return typeof val === 'number';
5179}
5180
5181/**
5182 * Determine if a value is undefined
5183 *
5184 * @param {Object} val The value to test
5185 * @returns {boolean} True if the value is undefined, otherwise false
5186 */
5187function isUndefined(val) {
5188 return typeof val === 'undefined';
5189}
5190
5191/**
5192 * Determine if a value is an Object
5193 *
5194 * @param {Object} val The value to test
5195 * @returns {boolean} True if value is an Object, otherwise false
5196 */
5197function isObject(val) {
5198 return val !== null && typeof val === 'object';
5199}
5200
5201/**
5202 * Determine if a value is a Date
5203 *
5204 * @param {Object} val The value to test
5205 * @returns {boolean} True if value is a Date, otherwise false
5206 */
5207function isDate(val) {
5208 return toString.call(val) === '[object Date]';
5209}
5210
5211/**
5212 * Determine if a value is a File
5213 *
5214 * @param {Object} val The value to test
5215 * @returns {boolean} True if value is a File, otherwise false
5216 */
5217function isFile(val) {
5218 return toString.call(val) === '[object File]';
5219}
5220
5221/**
5222 * Determine if a value is a Blob
5223 *
5224 * @param {Object} val The value to test
5225 * @returns {boolean} True if value is a Blob, otherwise false
5226 */
5227function isBlob(val) {
5228 return toString.call(val) === '[object Blob]';
5229}
5230
5231/**
5232 * Determine if a value is a Function
5233 *
5234 * @param {Object} val The value to test
5235 * @returns {boolean} True if value is a Function, otherwise false
5236 */
5237function isFunction(val) {
5238 return toString.call(val) === '[object Function]';
5239}
5240
5241/**
5242 * Determine if a value is a Stream
5243 *
5244 * @param {Object} val The value to test
5245 * @returns {boolean} True if value is a Stream, otherwise false
5246 */
5247function isStream(val) {
5248 return isObject(val) && isFunction(val.pipe);
5249}
5250
5251/**
5252 * Determine if a value is a URLSearchParams object
5253 *
5254 * @param {Object} val The value to test
5255 * @returns {boolean} True if value is a URLSearchParams object, otherwise false
5256 */
5257function isURLSearchParams(val) {
5258 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
5259}
5260
5261/**
5262 * Trim excess whitespace off the beginning and end of a string
5263 *
5264 * @param {String} str The String to trim
5265 * @returns {String} The String freed of excess whitespace
5266 */
5267function trim(str) {
5268 return str.replace(/^\s*/, '').replace(/\s*$/, '');
5269}
5270
5271/**
5272 * Determine if we're running in a standard browser environment
5273 *
5274 * This allows axios to run in a web worker, and react-native.
5275 * Both environments support XMLHttpRequest, but not fully standard globals.
5276 *
5277 * web workers:
5278 * typeof window -> undefined
5279 * typeof document -> undefined
5280 *
5281 * react-native:
5282 * navigator.product -> 'ReactNative'
5283 */
5284function isStandardBrowserEnv() {
5285 if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
5286 return false;
5287 }
5288 return (
5289 typeof window !== 'undefined' &&
5290 typeof document !== 'undefined'
5291 );
5292}
5293
5294/**
5295 * Iterate over an Array or an Object invoking a function for each item.
5296 *
5297 * If `obj` is an Array callback will be called passing
5298 * the value, index, and complete array for each item.
5299 *
5300 * If 'obj' is an Object callback will be called passing
5301 * the value, key, and complete object for each property.
5302 *
5303 * @param {Object|Array} obj The object to iterate
5304 * @param {Function} fn The callback to invoke for each item
5305 */
5306function forEach(obj, fn) {
5307 // Don't bother if no value provided
5308 if (obj === null || typeof obj === 'undefined') {
5309 return;
5310 }
5311
5312 // Force an array if not already something iterable
5313 if (typeof obj !== 'object') {
5314 /*eslint no-param-reassign:0*/
5315 obj = [obj];
5316 }
5317
5318 if (isArray(obj)) {
5319 // Iterate over array values
5320 for (var i = 0, l = obj.length; i < l; i++) {
5321 fn.call(null, obj[i], i, obj);
5322 }
5323 } else {
5324 // Iterate over object keys
5325 for (var key in obj) {
5326 if (Object.prototype.hasOwnProperty.call(obj, key)) {
5327 fn.call(null, obj[key], key, obj);
5328 }
5329 }
5330 }
5331}
5332
5333/**
5334 * Accepts varargs expecting each argument to be an object, then
5335 * immutably merges the properties of each object and returns result.
5336 *
5337 * When multiple objects contain the same key the later object in
5338 * the arguments list will take precedence.
5339 *
5340 * Example:
5341 *
5342 * ```js
5343 * var result = merge({foo: 123}, {foo: 456});
5344 * console.log(result.foo); // outputs 456
5345 * ```
5346 *
5347 * @param {Object} obj1 Object to merge
5348 * @returns {Object} Result of all merge properties
5349 */
5350function merge(/* obj1, obj2, obj3, ... */) {
5351 var result = {};
5352 function assignValue(val, key) {
5353 if (typeof result[key] === 'object' && typeof val === 'object') {
5354 result[key] = merge(result[key], val);
5355 } else {
5356 result[key] = val;
5357 }
5358 }
5359
5360 for (var i = 0, l = arguments.length; i < l; i++) {
5361 forEach(arguments[i], assignValue);
5362 }
5363 return result;
5364}
5365
5366/**
5367 * Extends object a by mutably adding to it the properties of object b.
5368 *
5369 * @param {Object} a The object to be extended
5370 * @param {Object} b The object to copy properties from
5371 * @param {Object} thisArg The object to bind function to
5372 * @return {Object} The resulting value of object a
5373 */
5374function extend(a, b, thisArg) {
5375 forEach(b, function assignValue(val, key) {
5376 if (thisArg && typeof val === 'function') {
5377 a[key] = bind(val, thisArg);
5378 } else {
5379 a[key] = val;
5380 }
5381 });
5382 return a;
5383}
5384
5385module.exports = {
5386 isArray: isArray,
5387 isArrayBuffer: isArrayBuffer,
5388 isBuffer: isBuffer,
5389 isFormData: isFormData,
5390 isArrayBufferView: isArrayBufferView,
5391 isString: isString,
5392 isNumber: isNumber,
5393 isObject: isObject,
5394 isUndefined: isUndefined,
5395 isDate: isDate,
5396 isFile: isFile,
5397 isBlob: isBlob,
5398 isFunction: isFunction,
5399 isStream: isStream,
5400 isURLSearchParams: isURLSearchParams,
5401 isStandardBrowserEnv: isStandardBrowserEnv,
5402 forEach: forEach,
5403 merge: merge,
5404 extend: extend,
5405 trim: trim
5406};
5407
5408},{"./helpers/bind":44,"is-buffer":398}],54:[function(require,module,exports){
5409'use strict'
5410// base-x encoding / decoding
5411// Copyright (c) 2018 base-x contributors
5412// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
5413// Distributed under the MIT software license, see the accompanying
5414// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5415// @ts-ignore
5416var _Buffer = require('safe-buffer').Buffer
5417function base (ALPHABET) {
5418 if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
5419 var BASE_MAP = new Uint8Array(256)
5420 BASE_MAP.fill(255)
5421 for (var i = 0; i < ALPHABET.length; i++) {
5422 var x = ALPHABET.charAt(i)
5423 var xc = x.charCodeAt(0)
5424 if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
5425 BASE_MAP[xc] = i
5426 }
5427 var BASE = ALPHABET.length
5428 var LEADER = ALPHABET.charAt(0)
5429 var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up
5430 var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up
5431 function encode (source) {
5432 if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }
5433 if (source.length === 0) { return '' }
5434 // Skip & count leading zeroes.
5435 var zeroes = 0
5436 var length = 0
5437 var pbegin = 0
5438 var pend = source.length
5439 while (pbegin !== pend && source[pbegin] === 0) {
5440 pbegin++
5441 zeroes++
5442 }
5443 // Allocate enough space in big-endian base58 representation.
5444 var size = ((pend - pbegin) * iFACTOR + 1) >>> 0
5445 var b58 = new Uint8Array(size)
5446 // Process the bytes.
5447 while (pbegin !== pend) {
5448 var carry = source[pbegin]
5449 // Apply "b58 = b58 * 256 + ch".
5450 var i = 0
5451 for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
5452 carry += (256 * b58[it1]) >>> 0
5453 b58[it1] = (carry % BASE) >>> 0
5454 carry = (carry / BASE) >>> 0
5455 }
5456 if (carry !== 0) { throw new Error('Non-zero carry') }
5457 length = i
5458 pbegin++
5459 }
5460 // Skip leading zeroes in base58 result.
5461 var it2 = size - length
5462 while (it2 !== size && b58[it2] === 0) {
5463 it2++
5464 }
5465 // Translate the result into a string.
5466 var str = LEADER.repeat(zeroes)
5467 for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }
5468 return str
5469 }
5470 function decodeUnsafe (source) {
5471 if (typeof source !== 'string') { throw new TypeError('Expected String') }
5472 if (source.length === 0) { return _Buffer.alloc(0) }
5473 var psz = 0
5474 // Skip leading spaces.
5475 if (source[psz] === ' ') { return }
5476 // Skip and count leading '1's.
5477 var zeroes = 0
5478 var length = 0
5479 while (source[psz] === LEADER) {
5480 zeroes++
5481 psz++
5482 }
5483 // Allocate enough space in big-endian base256 representation.
5484 var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.
5485 var b256 = new Uint8Array(size)
5486 // Process the characters.
5487 while (source[psz]) {
5488 // Decode character
5489 var carry = BASE_MAP[source.charCodeAt(psz)]
5490 // Invalid character
5491 if (carry === 255) { return }
5492 var i = 0
5493 for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
5494 carry += (BASE * b256[it3]) >>> 0
5495 b256[it3] = (carry % 256) >>> 0
5496 carry = (carry / 256) >>> 0
5497 }
5498 if (carry !== 0) { throw new Error('Non-zero carry') }
5499 length = i
5500 psz++
5501 }
5502 // Skip trailing spaces.
5503 if (source[psz] === ' ') { return }
5504 // Skip leading zeroes in b256.
5505 var it4 = size - length
5506 while (it4 !== size && b256[it4] === 0) {
5507 it4++
5508 }
5509 var vch = _Buffer.allocUnsafe(zeroes + (size - it4))
5510 vch.fill(0x00, 0, zeroes)
5511 var j = zeroes
5512 while (it4 !== size) {
5513 vch[j++] = b256[it4++]
5514 }
5515 return vch
5516 }
5517 function decode (string) {
5518 var buffer = decodeUnsafe(string)
5519 if (buffer) { return buffer }
5520 throw new Error('Non-base' + BASE + ' character')
5521 }
5522 return {
5523 encode: encode,
5524 decodeUnsafe: decodeUnsafe,
5525 decode: decode
5526 }
5527}
5528module.exports = base
5529
5530},{"safe-buffer":742}],55:[function(require,module,exports){
5531"use strict";
5532
5533/**
5534 * Generate a character map.
5535 * @param {string} alphabet e.g. "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
5536 * @param {object} mappings map overrides from key to value
5537 * @method
5538 */
5539
5540var charmap = function (alphabet, mappings) {
5541 mappings || (mappings = {});
5542 alphabet.split("").forEach(function (c, i) {
5543 if (!(c in mappings)) mappings[c] = i;
5544 });
5545 return mappings;
5546}
5547
5548/**
5549 * The RFC 4648 base 32 alphabet and character map.
5550 * @see {@link https://tools.ietf.org/html/rfc4648}
5551 */
5552
5553var rfc4648 = {
5554 alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
5555 charmap: {
5556 0: 14,
5557 1: 8
5558 }
5559};
5560
5561rfc4648.charmap = charmap(rfc4648.alphabet, rfc4648.charmap);
5562
5563/**
5564 * The Crockford base 32 alphabet and character map.
5565 * @see {@link http://www.crockford.com/wrmg/base32.html}
5566 */
5567
5568var crockford = {
5569 alphabet: "0123456789ABCDEFGHJKMNPQRSTVWXYZ",
5570 charmap: {
5571 O: 0,
5572 I: 1,
5573 L: 1
5574 }
5575};
5576
5577crockford.charmap = charmap(crockford.alphabet, crockford.charmap);
5578
5579/**
5580 * base32hex
5581 * @see {@link https://en.wikipedia.org/wiki/Base32#base32hex}
5582 */
5583
5584var base32hex = {
5585 alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
5586 charmap: {}
5587};
5588
5589base32hex.charmap = charmap(base32hex.alphabet, base32hex.charmap);
5590
5591/**
5592 * Create a new `Decoder` with the given options.
5593 *
5594 * @param {object} [options]
5595 * @param {string} [type] Supported Base-32 variants are "rfc4648" and
5596 * "crockford".
5597 * @param {object} [charmap] Override the character map used in decoding.
5598 * @constructor
5599 */
5600
5601function Decoder (options) {
5602 this.buf = [];
5603 this.shift = 8;
5604 this.carry = 0;
5605
5606 if (options) {
5607
5608 switch (options.type) {
5609 case "rfc4648":
5610 this.charmap = exports.rfc4648.charmap;
5611 break;
5612 case "crockford":
5613 this.charmap = exports.crockford.charmap;
5614 break;
5615 case "base32hex":
5616 this.charmap = exports.base32hex.charmap;
5617 break;
5618 default:
5619 throw new Error("invalid type");
5620 }
5621
5622 if (options.charmap) this.charmap = options.charmap;
5623 }
5624}
5625
5626/**
5627 * The default character map coresponds to RFC4648.
5628 */
5629
5630Decoder.prototype.charmap = rfc4648.charmap;
5631
5632/**
5633 * Decode a string, continuing from the previous state.
5634 *
5635 * @param {string} str
5636 * @return {Decoder} this
5637 */
5638
5639Decoder.prototype.write = function (str) {
5640 var charmap = this.charmap;
5641 var buf = this.buf;
5642 var shift = this.shift;
5643 var carry = this.carry;
5644
5645 // decode string
5646 str.toUpperCase().split("").forEach(function (char) {
5647
5648 // ignore padding
5649 if (char == "=") return;
5650
5651 // lookup symbol
5652 var symbol = charmap[char] & 0xff;
5653
5654 // 1: 00000 000
5655 // 2: 00 00000 0
5656 // 3: 0000 0000
5657 // 4: 0 00000 00
5658 // 5: 000 00000
5659 // 6: 00000 000
5660 // 7: 00 00000 0
5661
5662 shift -= 5;
5663 if (shift > 0) {
5664 carry |= symbol << shift;
5665 } else if (shift < 0) {
5666 buf.push(carry | (symbol >> -shift));
5667 shift += 8;
5668 carry = (symbol << shift) & 0xff;
5669 } else {
5670 buf.push(carry | symbol);
5671 shift = 8;
5672 carry = 0;
5673 }
5674 });
5675
5676 // save state
5677 this.shift = shift;
5678 this.carry = carry;
5679
5680 // for chaining
5681 return this;
5682};
5683
5684/**
5685 * Finish decoding.
5686 *
5687 * @param {string} [str] The final string to decode.
5688 * @return {Array} Decoded byte array.
5689 */
5690
5691Decoder.prototype.finalize = function (str) {
5692 if (str) {
5693 this.write(str);
5694 }
5695 if (this.shift !== 8 && this.carry !== 0) {
5696 this.buf.push(this.carry);
5697 this.shift = 8;
5698 this.carry = 0;
5699 }
5700 return this.buf;
5701};
5702
5703/**
5704 * Create a new `Encoder` with the given options.
5705 *
5706 * @param {object} [options]
5707 * @param {string} [type] Supported Base-32 variants are "rfc4648" and
5708 * "crockford".
5709 * @param {object} [alphabet] Override the alphabet used in encoding.
5710 * @constructor
5711 */
5712
5713function Encoder (options) {
5714 this.buf = "";
5715 this.shift = 3;
5716 this.carry = 0;
5717
5718 if (options) {
5719
5720 switch (options.type) {
5721 case "rfc4648":
5722 this.alphabet = exports.rfc4648.alphabet;
5723 break;
5724 case "crockford":
5725 this.alphabet = exports.crockford.alphabet;
5726 break;
5727 case "base32hex":
5728 this.alphabet = exports.base32hex.alphabet;
5729 break;
5730 default:
5731 throw new Error("invalid type");
5732 }
5733
5734 if (options.alphabet) this.alphabet = options.alphabet;
5735 else if (options.lc) this.alphabet = this.alphabet.toLowerCase();
5736 }
5737}
5738
5739/**
5740 * The default alphabet coresponds to RFC4648.
5741 */
5742
5743Encoder.prototype.alphabet = rfc4648.alphabet;
5744
5745/**
5746 * Encode a byte array, continuing from the previous state.
5747 *
5748 * @param {byte[]} buf The byte array to encode.
5749 * @return {Encoder} this
5750 */
5751
5752Encoder.prototype.write = function (buf) {
5753 var shift = this.shift;
5754 var carry = this.carry;
5755 var symbol;
5756 var byte;
5757 var i;
5758
5759 // encode each byte in buf
5760 for (i = 0; i < buf.length; i++) {
5761 byte = buf[i];
5762
5763 // 1: 00000 000
5764 // 2: 00 00000 0
5765 // 3: 0000 0000
5766 // 4: 0 00000 00
5767 // 5: 000 00000
5768 // 6: 00000 000
5769 // 7: 00 00000 0
5770
5771 symbol = carry | (byte >> shift);
5772 this.buf += this.alphabet[symbol & 0x1f];
5773
5774 if (shift > 5) {
5775 shift -= 5;
5776 symbol = byte >> shift;
5777 this.buf += this.alphabet[symbol & 0x1f];
5778 }
5779
5780 shift = 5 - shift;
5781 carry = byte << shift;
5782 shift = 8 - shift;
5783 }
5784
5785 // save state
5786 this.shift = shift;
5787 this.carry = carry;
5788
5789 // for chaining
5790 return this;
5791};
5792
5793/**
5794 * Finish encoding.
5795 *
5796 * @param {byte[]} [buf] The final byte array to encode.
5797 * @return {string} The encoded byte array.
5798 */
5799
5800Encoder.prototype.finalize = function (buf) {
5801 if (buf) {
5802 this.write(buf);
5803 }
5804 if (this.shift !== 3) {
5805 this.buf += this.alphabet[this.carry & 0x1f];
5806 this.shift = 3;
5807 this.carry = 0;
5808 }
5809 return this.buf;
5810};
5811
5812/**
5813 * Convenience encoder.
5814 *
5815 * @param {byte[]} buf The byte array to encode.
5816 * @param {object} [options] Options to pass to the encoder.
5817 * @return {string} The encoded string.
5818 */
5819
5820exports.encode = function (buf, options) {
5821 return new Encoder(options).finalize(buf);
5822};
5823
5824/**
5825 * Convenience decoder.
5826 *
5827 * @param {string} str The string to decode.
5828 * @param {object} [options] Options to pass to the decoder.
5829 * @return {byte[]} The decoded byte array.
5830 */
5831
5832exports.decode = function (str, options) {
5833 return new Decoder(options).finalize(str);
5834};
5835
5836// Exports.
5837exports.Decoder = Decoder;
5838exports.Encoder = Encoder;
5839exports.charmap = charmap;
5840exports.crockford = crockford;
5841exports.rfc4648 = rfc4648;
5842exports.base32hex = base32hex;
5843
5844},{}],56:[function(require,module,exports){
5845'use strict'
5846
5847exports.byteLength = byteLength
5848exports.toByteArray = toByteArray
5849exports.fromByteArray = fromByteArray
5850
5851var lookup = []
5852var revLookup = []
5853var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
5854
5855var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
5856for (var i = 0, len = code.length; i < len; ++i) {
5857 lookup[i] = code[i]
5858 revLookup[code.charCodeAt(i)] = i
5859}
5860
5861// Support decoding URL-safe base64 strings, as Node.js does.
5862// See: https://en.wikipedia.org/wiki/Base64#URL_applications
5863revLookup['-'.charCodeAt(0)] = 62
5864revLookup['_'.charCodeAt(0)] = 63
5865
5866function getLens (b64) {
5867 var len = b64.length
5868
5869 if (len % 4 > 0) {
5870 throw new Error('Invalid string. Length must be a multiple of 4')
5871 }
5872
5873 // Trim off extra bytes after placeholder bytes are found
5874 // See: https://github.com/beatgammit/base64-js/issues/42
5875 var validLen = b64.indexOf('=')
5876 if (validLen === -1) validLen = len
5877
5878 var placeHoldersLen = validLen === len
5879 ? 0
5880 : 4 - (validLen % 4)
5881
5882 return [validLen, placeHoldersLen]
5883}
5884
5885// base64 is 4/3 + up to two characters of the original data
5886function byteLength (b64) {
5887 var lens = getLens(b64)
5888 var validLen = lens[0]
5889 var placeHoldersLen = lens[1]
5890 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
5891}
5892
5893function _byteLength (b64, validLen, placeHoldersLen) {
5894 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
5895}
5896
5897function toByteArray (b64) {
5898 var tmp
5899 var lens = getLens(b64)
5900 var validLen = lens[0]
5901 var placeHoldersLen = lens[1]
5902
5903 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
5904
5905 var curByte = 0
5906
5907 // if there are placeholders, only get up to the last complete 4 chars
5908 var len = placeHoldersLen > 0
5909 ? validLen - 4
5910 : validLen
5911
5912 var i
5913 for (i = 0; i < len; i += 4) {
5914 tmp =
5915 (revLookup[b64.charCodeAt(i)] << 18) |
5916 (revLookup[b64.charCodeAt(i + 1)] << 12) |
5917 (revLookup[b64.charCodeAt(i + 2)] << 6) |
5918 revLookup[b64.charCodeAt(i + 3)]
5919 arr[curByte++] = (tmp >> 16) & 0xFF
5920 arr[curByte++] = (tmp >> 8) & 0xFF
5921 arr[curByte++] = tmp & 0xFF
5922 }
5923
5924 if (placeHoldersLen === 2) {
5925 tmp =
5926 (revLookup[b64.charCodeAt(i)] << 2) |
5927 (revLookup[b64.charCodeAt(i + 1)] >> 4)
5928 arr[curByte++] = tmp & 0xFF
5929 }
5930
5931 if (placeHoldersLen === 1) {
5932 tmp =
5933 (revLookup[b64.charCodeAt(i)] << 10) |
5934 (revLookup[b64.charCodeAt(i + 1)] << 4) |
5935 (revLookup[b64.charCodeAt(i + 2)] >> 2)
5936 arr[curByte++] = (tmp >> 8) & 0xFF
5937 arr[curByte++] = tmp & 0xFF
5938 }
5939
5940 return arr
5941}
5942
5943function tripletToBase64 (num) {
5944 return lookup[num >> 18 & 0x3F] +
5945 lookup[num >> 12 & 0x3F] +
5946 lookup[num >> 6 & 0x3F] +
5947 lookup[num & 0x3F]
5948}
5949
5950function encodeChunk (uint8, start, end) {
5951 var tmp
5952 var output = []
5953 for (var i = start; i < end; i += 3) {
5954 tmp =
5955 ((uint8[i] << 16) & 0xFF0000) +
5956 ((uint8[i + 1] << 8) & 0xFF00) +
5957 (uint8[i + 2] & 0xFF)
5958 output.push(tripletToBase64(tmp))
5959 }
5960 return output.join('')
5961}
5962
5963function fromByteArray (uint8) {
5964 var tmp
5965 var len = uint8.length
5966 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
5967 var parts = []
5968 var maxChunkLength = 16383 // must be multiple of 3
5969
5970 // go through the array every three bytes, we'll deal with trailing stuff later
5971 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
5972 parts.push(encodeChunk(
5973 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
5974 ))
5975 }
5976
5977 // pad the end with zeros, but make sure to not forget the extra bytes
5978 if (extraBytes === 1) {
5979 tmp = uint8[len - 1]
5980 parts.push(
5981 lookup[tmp >> 2] +
5982 lookup[(tmp << 4) & 0x3F] +
5983 '=='
5984 )
5985 } else if (extraBytes === 2) {
5986 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
5987 parts.push(
5988 lookup[tmp >> 10] +
5989 lookup[(tmp >> 4) & 0x3F] +
5990 lookup[(tmp << 2) & 0x3F] +
5991 '='
5992 )
5993 }
5994
5995 return parts.join('')
5996}
5997
5998},{}],57:[function(require,module,exports){
5999(function (Buffer){
6000/***
6001 * @license
6002 * https://github.com/bitcoincashjs/bchaddr
6003 * Copyright (c) 2018 Emilio Almansi
6004 * Distributed under the MIT software license, see the accompanying
6005 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
6006 */
6007
6008var bs58check = require('bs58check')
6009var cashaddr = require('cashaddrjs-slp')
6010
6011/**
6012 * General purpose Bitcoin Cash address detection and translation.<br />
6013 * Supports all major Bitcoin Cash address formats.<br />
6014 * Currently:
6015 * <ul>
6016 * <li> Legacy format </li>
6017 * <li> Bitpay format </li>
6018 * <li> Cashaddr format </li>
6019 * </ul>
6020 * @module bchaddr
6021 */
6022
6023/**
6024 * @static
6025 * Supported Bitcoin Cash address formats.
6026 */
6027var Format = {}
6028Format.Legacy = 'legacy'
6029Format.Bitpay = 'bitpay'
6030Format.Cashaddr = 'cashaddr'
6031Format.Slpaddr = 'slpaddr'
6032
6033/**
6034 * @static
6035 * Supported networks.
6036 */
6037var Network = {}
6038Network.Mainnet = 'mainnet'
6039Network.Testnet = 'testnet'
6040
6041/**
6042 * @static
6043 * Supported address types.
6044 */
6045var Type = {}
6046Type.P2PKH = 'p2pkh'
6047Type.P2SH = 'p2sh'
6048
6049/**
6050 * Detects what is the given address' format.
6051 * @static
6052 * @param {string} address - A valid Bitcoin Cash address in any format.
6053 * @return {string}
6054 * @throws {InvalidAddressError}
6055 */
6056function detectAddressFormat (address) {
6057 return decodeAddress(address).format
6058}
6059
6060/**
6061 * Detects what is the given address' network.
6062 * @static
6063 * @param {string} address - A valid Bitcoin Cash address in any format.
6064 * @return {string}
6065 * @throws {InvalidAddressError}
6066 */
6067function detectAddressNetwork (address) {
6068 return decodeAddress(address).network
6069}
6070
6071/**
6072 * Detects what is the given address' type.
6073 * @static
6074 * @param {string} address - A valid Bitcoin Cash address in any format.
6075 * @return {string}
6076 * @throws {InvalidAddressError}
6077 */
6078function detectAddressType (address) {
6079 return decodeAddress(address).type
6080}
6081
6082/**
6083 * Translates the given address into legacy format.
6084 * @static
6085 * @param {string} address - A valid Bitcoin Cash address in any format.
6086 * @return {string}
6087 * @throws {InvalidAddressError}
6088 */
6089function toLegacyAddress (address) {
6090 var decoded = decodeAddress(address)
6091 if (decoded.format === Format.Legacy) {
6092 return address
6093 }
6094 return encodeAsLegacy(decoded)
6095}
6096
6097/**
6098 * Translates the given address into bitpay format.
6099 * @static
6100 * @param {string} address - A valid Bitcoin Cash address in any format.
6101 * @return {string}
6102 * @throws {InvalidAddressError}
6103 */
6104function toBitpayAddress (address) {
6105 var decoded = decodeAddress(address)
6106 if (decoded.format === Format.Bitpay) {
6107 return address
6108 }
6109 return encodeAsBitpay(decoded)
6110}
6111
6112/**
6113 * Translates the given address into cashaddr format.
6114 * @static
6115 * @param {string} address - A valid Bitcoin Cash address in any format.
6116 * @return {string}
6117 * @throws {InvalidAddressError}
6118 */
6119function toCashAddress (address) {
6120 var decoded = decodeAddress(address)
6121 return encodeAsCashaddr(decoded)
6122}
6123
6124/**
6125 * Translates the given address into cashaddr format.
6126 * @static
6127 * @param {string} address - A valid address in any format.
6128 * @return {string}
6129 * @throws {InvalidAddressError}
6130 */
6131function toSlpAddress (address) {
6132 var decoded = decodeAddress(address)
6133 return encodeAsSlpaddr(decoded)
6134}
6135
6136/**
6137 * Translates the given address into regtest format.
6138 * @static
6139 * @param {string} address - A valid address in any format.
6140 * @return {string}
6141 * @throws {InvalidAddressError}
6142 */
6143function toRegtestAddress (address) {
6144 var decoded = decodeAddress(address)
6145 return encodeAsRegtestaddr(decoded)
6146}
6147
6148/**
6149 * Translates the given address into regtest format.
6150 * @static
6151 * @param {string} address - A valid address in any format.
6152 * @return {string}
6153 * @throws {InvalidAddressError}
6154 */
6155function toSlpRegtestAddress (address) {
6156 var decoded = decodeAddress(address)
6157 return encodeAsSlpRegtestaddr(decoded)
6158}
6159
6160/**
6161 * Version byte table for base58 formats.
6162 * @private
6163 */
6164var VERSION_BYTE = {}
6165VERSION_BYTE[Format.Legacy] = {}
6166VERSION_BYTE[Format.Legacy][Network.Mainnet] = {}
6167VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2PKH] = 0
6168VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2SH] = 5
6169VERSION_BYTE[Format.Legacy][Network.Testnet] = {}
6170VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2PKH] = 111
6171VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2SH] = 196
6172VERSION_BYTE[Format.Bitpay] = {}
6173VERSION_BYTE[Format.Bitpay][Network.Mainnet] = {}
6174VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2PKH] = 28
6175VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2SH] = 40
6176VERSION_BYTE[Format.Bitpay][Network.Testnet] = {}
6177VERSION_BYTE[Format.Bitpay][Network.Testnet][Type.P2PKH] = 111
6178VERSION_BYTE[Format.Bitpay][Network.Testnet][Type.P2SH] = 196
6179
6180/**
6181 * Decodes the given address into its constituting hash, format, network and type.
6182 * @private
6183 * @param {string} address - A valid Bitcoin Cash address in any format.
6184 * @return {object}
6185 * @throws {InvalidAddressError}
6186 */
6187function decodeAddress (address) {
6188 try {
6189 return decodeBase58Address(address)
6190 } catch (error) {
6191 }
6192 try {
6193 return decodeCashAddress(address)
6194 } catch (error) {
6195 }
6196 try {
6197 return decodeSlpAddress(address)
6198 } catch (error) {
6199 }
6200 throw new InvalidAddressError()
6201}
6202
6203/**
6204 * Length of a valid base58check encoding payload: 1 byte for
6205 * the version byte plus 20 bytes for a RIPEMD-160 hash.
6206 * @private
6207 */
6208var BASE_58_CHECK_PAYLOAD_LENGTH = 21
6209
6210/**
6211 * Attempts to decode the given address assuming it is a base58 address.
6212 * @private
6213 * @param {string} address - A valid Bitcoin Cash address in any format.
6214 * @return {object}
6215 * @throws {InvalidAddressError}
6216 */
6217function decodeBase58Address (address) {
6218 try {
6219 var payload = bs58check.decode(address)
6220 if (payload.length !== BASE_58_CHECK_PAYLOAD_LENGTH) {
6221 throw new InvalidAddressError()
6222 }
6223 var versionByte = payload[0]
6224 var hash = Array.prototype.slice.call(payload, 1)
6225 switch (versionByte) {
6226 case VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2PKH]:
6227 return {
6228 hash: hash,
6229 format: Format.Legacy,
6230 network: Network.Mainnet,
6231 type: Type.P2PKH
6232 }
6233 case VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2SH]:
6234 return {
6235 hash: hash,
6236 format: Format.Legacy,
6237 network: Network.Mainnet,
6238 type: Type.P2SH
6239 }
6240 case VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2PKH]:
6241 return {
6242 hash: hash,
6243 format: Format.Legacy,
6244 network: Network.Testnet,
6245 type: Type.P2PKH
6246 }
6247 case VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2SH]:
6248 return {
6249 hash: hash,
6250 format: Format.Legacy,
6251 network: Network.Testnet,
6252 type: Type.P2SH
6253 }
6254 case VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2PKH]:
6255 return {
6256 hash: hash,
6257 format: Format.Bitpay,
6258 network: Network.Mainnet,
6259 type: Type.P2PKH
6260 }
6261 case VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2SH]:
6262 return {
6263 hash: hash,
6264 format: Format.Bitpay,
6265 network: Network.Mainnet,
6266 type: Type.P2SH
6267 }
6268 }
6269 } catch (error) {
6270 }
6271 throw new InvalidAddressError()
6272}
6273
6274/**
6275 * Attempts to decode the given address assuming it is a cashaddr address.
6276 * @private
6277 * @param {string} address - A valid Bitcoin Cash address in any format.
6278 * @return {object}
6279 * @throws {InvalidAddressError}
6280 */
6281function decodeCashAddress (address) {
6282 if (address.indexOf(':') !== -1) {
6283 try {
6284 return decodeCashAddressWithPrefix(address)
6285 } catch (error) {
6286 }
6287 } else {
6288 var prefixes = ['bitcoincash', 'bchtest', 'regtest', 'bchreg']
6289 for (var i = 0; i < prefixes.length; ++i) {
6290 try {
6291 var prefix = prefixes[i]
6292 return decodeCashAddressWithPrefix(prefix + ':' + address)
6293 } catch (error) {
6294 }
6295 }
6296 }
6297 throw new InvalidAddressError()
6298}
6299
6300/**
6301 * Attempts to decode the given address assuming it is a cashaddr address with explicit prefix.
6302 * @private
6303 * @param {string} address - A valid Bitcoin Cash address in any format.
6304 * @return {object}
6305 * @throws {InvalidAddressError}
6306 */
6307function decodeCashAddressWithPrefix (address) {
6308 try {
6309 var decoded = cashaddr.decode(address)
6310 var hash = Array.prototype.slice.call(decoded.hash, 0)
6311 var type = decoded.type === 'P2PKH' ? Type.P2PKH : Type.P2SH
6312 switch (decoded.prefix) {
6313 case 'bitcoincash':
6314 return {
6315 hash: hash,
6316 format: Format.Cashaddr,
6317 network: Network.Mainnet,
6318 type: type
6319 }
6320 case 'bchtest':
6321 case 'regtest':
6322 case 'bchreg':
6323 return {
6324 hash: hash,
6325 format: Format.Cashaddr,
6326 network: Network.Testnet,
6327 type: type
6328 }
6329 }
6330 } catch (error) {
6331 }
6332 throw new InvalidAddressError()
6333}
6334
6335/**
6336 * Attempts to decode the given address assuming it is a slpaddr address.
6337 * @private
6338 * @param {string} address - A valid SLP address in any format.
6339 * @return {object}
6340 * @throws {InvalidAddressError}
6341 */
6342function decodeSlpAddress (address) {
6343 if (address.indexOf(':') !== -1) {
6344 try {
6345 return decodeSlpAddressWithPrefix(address)
6346 } catch (error) {
6347 }
6348 } else {
6349 var prefixes = ['simpleledger', 'slptest', 'slpreg']
6350 for (var i = 0; i < prefixes.length; ++i) {
6351 try {
6352 var prefix = prefixes[i]
6353 return decodeSlpAddressWithPrefix(prefix + ':' + address)
6354 } catch (error) {
6355 }
6356 }
6357 }
6358 throw new InvalidAddressError()
6359}
6360
6361/**
6362 * Attempts to decode the given address assuming it is a slpaddr address with explicit prefix.
6363 * @private
6364 * @param {string} address - A valid SLP address in any format.
6365 * @return {object}
6366 * @throws {InvalidAddressError}
6367 */
6368function decodeSlpAddressWithPrefix (address) {
6369 try {
6370 var decoded = cashaddr.decode(address)
6371 var hash = Array.prototype.slice.call(decoded.hash, 0)
6372 var type = decoded.type === 'P2PKH' ? Type.P2PKH : Type.P2SH
6373 switch (decoded.prefix) {
6374 case 'simpleledger':
6375 return {
6376 hash: hash,
6377 format: Format.Slpaddr,
6378 network: Network.Mainnet,
6379 type: type
6380 }
6381 case 'slptest':
6382 case 'slpreg':
6383 return {
6384 hash: hash,
6385 format: Format.Slpaddr,
6386 network: Network.Testnet,
6387 type: type
6388 }
6389 }
6390 } catch (error) {
6391 }
6392 throw new InvalidAddressError()
6393}
6394
6395/**
6396 * Encodes the given decoded address into legacy format.
6397 * @private
6398 * @param {object} decoded
6399 * @returns {string}
6400 */
6401function encodeAsLegacy (decoded) {
6402 var versionByte = VERSION_BYTE[Format.Legacy][decoded.network][decoded.type]
6403 var buffer = Buffer.alloc(1 + decoded.hash.length)
6404 buffer[0] = versionByte
6405 buffer.set(decoded.hash, 1)
6406 return bs58check.encode(buffer)
6407}
6408
6409/**
6410 * Encodes the given decoded address into bitpay format.
6411 * @private
6412 * @param {object} decoded
6413 * @returns {string}
6414 */
6415function encodeAsBitpay (decoded) {
6416 var versionByte = VERSION_BYTE[Format.Bitpay][decoded.network][decoded.type]
6417 var buffer = Buffer.alloc(1 + decoded.hash.length)
6418 buffer[0] = versionByte
6419 buffer.set(decoded.hash, 1)
6420 return bs58check.encode(buffer)
6421}
6422
6423/**
6424 * Encodes the given decoded address into cashaddr format.
6425 * @private
6426 * @param {object} decoded
6427 * @returns {string}
6428 */
6429function encodeAsCashaddr (decoded) {
6430 var prefix = decoded.network === Network.Mainnet ? 'bitcoincash' : 'bchtest'
6431 var type = decoded.type === Type.P2PKH ? 'P2PKH' : 'P2SH'
6432 var hash = Uint8Array.from(decoded.hash)
6433 return cashaddr.encode(prefix, type, hash)
6434}
6435
6436/**
6437 * Encodes the given decoded address into slpaddr format.
6438 * @private
6439 * @param {object} decoded
6440 * @returns {string}
6441 */
6442function encodeAsSlpaddr (decoded) {
6443 var prefix = decoded.network === Network.Mainnet ? 'simpleledger' : 'slptest'
6444 var type = decoded.type === Type.P2PKH ? 'P2PKH' : 'P2SH'
6445 var hash = Uint8Array.from(decoded.hash)
6446 return cashaddr.encode(prefix, type, hash)
6447}
6448
6449/**
6450 * Encodes the given decoded address into regtest format.
6451 * @private
6452 * @param {object} decoded
6453 * @returns {string}
6454 */
6455function encodeAsRegtestaddr (decoded) {
6456 var prefix = 'bchreg'
6457 var type = decoded.type === Type.P2PKH ? 'P2PKH' : 'P2SH'
6458 var hash = Uint8Array.from(decoded.hash)
6459 return cashaddr.encode(prefix, type, hash)
6460}
6461
6462/**
6463 * Encodes the given decoded address into regtest format.
6464 * @private
6465 * @param {object} decoded
6466 * @returns {string}
6467 */
6468function encodeAsSlpRegtestaddr (decoded) {
6469 var prefix = 'slpreg'
6470 var type = decoded.type === Type.P2PKH ? 'P2PKH' : 'P2SH'
6471 var hash = Uint8Array.from(decoded.hash)
6472 return cashaddr.encode(prefix, type, hash)
6473}
6474
6475/**
6476 * Returns a boolean indicating whether the address is in legacy format.
6477 * @static
6478 * @param {string} address - A valid Bitcoin Cash address in any format.
6479 * @returns {boolean}
6480 * @throws {InvalidAddressError}
6481 */
6482function isLegacyAddress (address) {
6483 return detectAddressFormat(address) === Format.Legacy
6484}
6485
6486/**
6487 * Returns a boolean indicating whether the address is in bitpay format.
6488 * @static
6489 * @param {string} address - A valid Bitcoin Cash address in any format.
6490 * @returns {boolean}
6491 * @throws {InvalidAddressError}
6492 */
6493function isBitpayAddress (address) {
6494 return detectAddressFormat(address) === Format.Bitpay
6495}
6496
6497/**
6498 * Returns a boolean indicating whether the address is in cashaddr format.
6499 * @static
6500 * @param {string} address - A valid Bitcoin Cash address in any format.
6501 * @returns {boolean}
6502 * @throws {InvalidAddressError}
6503 */
6504function isCashAddress (address) {
6505 return detectAddressFormat(address) === Format.Cashaddr
6506}
6507
6508/**
6509 * Returns a boolean indicating whether the address is in cashaddr format.
6510 * @static
6511 * @param {string} address - A valid Bitcoin Cash address in any format.
6512 * @returns {boolean}
6513 * @throws {InvalidAddressError}
6514 */
6515function isSlpAddress (address) {
6516 return detectAddressFormat(address) === Format.Slpaddr
6517}
6518
6519/**
6520 * Returns a boolean indicating whether the address is a mainnet address.
6521 * @static
6522 * @param {string} address - A valid Bitcoin Cash address in any format.
6523 * @returns {boolean}
6524 * @throws {InvalidAddressError}
6525 */
6526function isMainnetAddress (address) {
6527 return detectAddressNetwork(address) === Network.Mainnet
6528}
6529
6530/**
6531 * Returns a boolean indicating whether the address is a testnet address.
6532 * @static
6533 * @param {string} address - A valid Bitcoin Cash address in any format.
6534 * @returns {boolean}
6535 * @throws {InvalidAddressError}
6536 */
6537function isTestnetAddress (address) {
6538 return detectAddressNetwork(address) === Network.Testnet
6539}
6540
6541/**
6542 * Returns a boolean indicating whether the address is a p2pkh address.
6543 * @static
6544 * @param {string} address - A valid Bitcoin Cash address in any format.
6545 * @returns {boolean}
6546 * @throws {InvalidAddressError}
6547 */
6548function isP2PKHAddress (address) {
6549 return detectAddressType(address) === Type.P2PKH
6550}
6551
6552/**
6553 * Returns a boolean indicating whether the address is a p2sh address.
6554 * @static
6555 * @param {string} address - A valid Bitcoin Cash address in any format.
6556 * @returns {boolean}
6557 * @throws {InvalidAddressError}
6558 */
6559function isP2SHAddress (address) {
6560 return detectAddressType(address) === Type.P2SH
6561}
6562
6563/**
6564 * Error thrown when the address given as input is not a valid Bitcoin Cash address.
6565 * @constructor
6566 * InvalidAddressError
6567 */
6568function InvalidAddressError () {
6569 var error = new Error()
6570 this.name = error.name = 'InvalidAddressError'
6571 this.message = error.message = 'Received an invalid Bitcoin Cash address as input.'
6572 this.stack = error.stack
6573}
6574
6575InvalidAddressError.prototype = Object.create(Error.prototype)
6576
6577module.exports = {
6578 Format: Format,
6579 Network: Network,
6580 Type: Type,
6581 detectAddressFormat: detectAddressFormat,
6582 detectAddressNetwork: detectAddressNetwork,
6583 detectAddressType: detectAddressType,
6584 decodeAddress: decodeAddress,
6585 toLegacyAddress: toLegacyAddress,
6586 toBitpayAddress: toBitpayAddress,
6587 encodeAsCashaddr: encodeAsCashaddr,
6588 toCashAddress: toCashAddress,
6589 encodeAsSlpaddr: encodeAsSlpaddr,
6590 toSlpAddress: toSlpAddress,
6591 encodeAsRegtestaddr: encodeAsRegtestaddr,
6592 toRegtestAddress: toRegtestAddress,
6593 encodeAsSlpRegtestaddr: encodeAsSlpRegtestaddr,
6594 toSlpRegtestAddress: toSlpRegtestAddress,
6595 encodeAsLegacy: encodeAsLegacy,
6596 isLegacyAddress: isLegacyAddress,
6597 encodeAsBitpay: encodeAsBitpay,
6598 isBitpayAddress: isBitpayAddress,
6599 isCashAddress: isCashAddress,
6600 isSlpAddress: isSlpAddress,
6601 isMainnetAddress: isMainnetAddress,
6602 isTestnetAddress: isTestnetAddress,
6603 isP2PKHAddress: isP2PKHAddress,
6604 isP2SHAddress: isP2SHAddress,
6605 InvalidAddressError: InvalidAddressError
6606}
6607
6608}).call(this,require("buffer").Buffer)
6609},{"bs58check":140,"buffer":146,"cashaddrjs-slp":148}],58:[function(require,module,exports){
6610(function (Buffer){
6611/***
6612 * @license
6613 * https://github.com/bitcoincashjs/bchaddr
6614 * Copyright (c) 2018-2019 Emilio Almansi
6615 * Distributed under the MIT software license, see the accompanying
6616 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
6617 */
6618
6619var bs58check = require('bs58check')
6620var cashaddr = require('cashaddrjs')
6621
6622/**
6623 * General purpose Bitcoin Cash address detection and translation.<br />
6624 * Supports all major Bitcoin Cash address formats.<br />
6625 * Currently:
6626 * <ul>
6627 * <li> Legacy format </li>
6628 * <li> Bitpay format </li>
6629 * <li> Cashaddr format </li>
6630 * </ul>
6631 * @module bchaddr
6632 */
6633
6634/**
6635 * @static
6636 * Supported Bitcoin Cash address formats.
6637 */
6638var Format = {}
6639Format.Legacy = 'legacy'
6640Format.Bitpay = 'bitpay'
6641Format.Cashaddr = 'cashaddr'
6642
6643/**
6644 * @static
6645 * Supported networks.
6646 */
6647var Network = {}
6648Network.Mainnet = 'mainnet'
6649Network.Testnet = 'testnet'
6650
6651/**
6652 * @static
6653 * Supported address types.
6654 */
6655var Type = {}
6656Type.P2PKH = 'p2pkh'
6657Type.P2SH = 'p2sh'
6658
6659/**
6660 * Returns a boolean indicating whether the given input is a valid Bitcoin Cash address.
6661 * @static
6662 * @param {*} input - Any input to check for validity.
6663 * @returns {boolean}
6664 */
6665function isValidAddress (input) {
6666 try {
6667 decodeAddress(input)
6668 return true
6669 } catch (error) {
6670 return false
6671 }
6672}
6673
6674/**
6675 * Detects what is the given address' format.
6676 * @static
6677 * @param {string} address - A valid Bitcoin Cash address in any format.
6678 * @return {string}
6679 * @throws {InvalidAddressError}
6680 */
6681function detectAddressFormat (address) {
6682 return decodeAddress(address).format
6683}
6684
6685/**
6686 * Detects what is the given address' network.
6687 * @static
6688 * @param {string} address - A valid Bitcoin Cash address in any format.
6689 * @return {string}
6690 * @throws {InvalidAddressError}
6691 */
6692function detectAddressNetwork (address) {
6693 return decodeAddress(address).network
6694}
6695
6696/**
6697 * Detects what is the given address' type.
6698 * @static
6699 * @param {string} address - A valid Bitcoin Cash address in any format.
6700 * @return {string}
6701 * @throws {InvalidAddressError}
6702 */
6703function detectAddressType (address) {
6704 return decodeAddress(address).type
6705}
6706
6707/**
6708 * Translates the given address into legacy format.
6709 * @static
6710 * @param {string} address - A valid Bitcoin Cash address in any format.
6711 * @return {string}
6712 * @throws {InvalidAddressError}
6713 */
6714function toLegacyAddress (address) {
6715 var decoded = decodeAddress(address)
6716 if (decoded.format === Format.Legacy) {
6717 return address
6718 }
6719 return encodeAsLegacy(decoded)
6720}
6721
6722/**
6723 * Translates the given address into bitpay format.
6724 * @static
6725 * @param {string} address - A valid Bitcoin Cash address in any format.
6726 * @return {string}
6727 * @throws {InvalidAddressError}
6728 */
6729function toBitpayAddress (address) {
6730 var decoded = decodeAddress(address)
6731 if (decoded.format === Format.Bitpay) {
6732 return address
6733 }
6734 return encodeAsBitpay(decoded)
6735}
6736
6737/**
6738 * Translates the given address into cashaddr format.
6739 * @static
6740 * @param {string} address - A valid Bitcoin Cash address in any format.
6741 * @return {string}
6742 * @throws {InvalidAddressError}
6743 */
6744function toCashAddress (address) {
6745 var decoded = decodeAddress(address)
6746 return encodeAsCashaddr(decoded)
6747}
6748
6749/**
6750 * Version byte table for base58 formats.
6751 * @private
6752 */
6753var VERSION_BYTE = {}
6754VERSION_BYTE[Format.Legacy] = {}
6755VERSION_BYTE[Format.Legacy][Network.Mainnet] = {}
6756VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2PKH] = 0
6757VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2SH] = 5
6758VERSION_BYTE[Format.Legacy][Network.Testnet] = {}
6759VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2PKH] = 111
6760VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2SH] = 196
6761VERSION_BYTE[Format.Bitpay] = {}
6762VERSION_BYTE[Format.Bitpay][Network.Mainnet] = {}
6763VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2PKH] = 28
6764VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2SH] = 40
6765VERSION_BYTE[Format.Bitpay][Network.Testnet] = {}
6766VERSION_BYTE[Format.Bitpay][Network.Testnet][Type.P2PKH] = 111
6767VERSION_BYTE[Format.Bitpay][Network.Testnet][Type.P2SH] = 196
6768
6769/**
6770 * Decodes the given address into its constituting hash, format, network and type.
6771 * @private
6772 * @param {string} address - A valid Bitcoin Cash address in any format.
6773 * @return {object}
6774 * @throws {InvalidAddressError}
6775 */
6776function decodeAddress (address) {
6777 try {
6778 return decodeBase58Address(address)
6779 } catch (error) {
6780 }
6781 try {
6782 return decodeCashAddress(address)
6783 } catch (error) {
6784 }
6785 throw new InvalidAddressError()
6786}
6787
6788/**
6789 * Length of a valid base58check encoding payload: 1 byte for
6790 * the version byte plus 20 bytes for a RIPEMD-160 hash.
6791 * @private
6792 */
6793var BASE_58_CHECK_PAYLOAD_LENGTH = 21
6794
6795/**
6796 * Attempts to decode the given address assuming it is a base58 address.
6797 * @private
6798 * @param {string} address - A valid Bitcoin Cash address in any format.
6799 * @return {object}
6800 * @throws {InvalidAddressError}
6801 */
6802function decodeBase58Address (address) {
6803 try {
6804 var payload = bs58check.decode(address)
6805 if (payload.length !== BASE_58_CHECK_PAYLOAD_LENGTH) {
6806 throw new InvalidAddressError()
6807 }
6808 var versionByte = payload[0]
6809 var hash = Array.prototype.slice.call(payload, 1)
6810 switch (versionByte) {
6811 case VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2PKH]:
6812 return {
6813 hash: hash,
6814 format: Format.Legacy,
6815 network: Network.Mainnet,
6816 type: Type.P2PKH
6817 }
6818 case VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2SH]:
6819 return {
6820 hash: hash,
6821 format: Format.Legacy,
6822 network: Network.Mainnet,
6823 type: Type.P2SH
6824 }
6825 case VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2PKH]:
6826 return {
6827 hash: hash,
6828 format: Format.Legacy,
6829 network: Network.Testnet,
6830 type: Type.P2PKH
6831 }
6832 case VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2SH]:
6833 return {
6834 hash: hash,
6835 format: Format.Legacy,
6836 network: Network.Testnet,
6837 type: Type.P2SH
6838 }
6839 case VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2PKH]:
6840 return {
6841 hash: hash,
6842 format: Format.Bitpay,
6843 network: Network.Mainnet,
6844 type: Type.P2PKH
6845 }
6846 case VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2SH]:
6847 return {
6848 hash: hash,
6849 format: Format.Bitpay,
6850 network: Network.Mainnet,
6851 type: Type.P2SH
6852 }
6853 }
6854 } catch (error) {
6855 }
6856 throw new InvalidAddressError()
6857}
6858
6859/**
6860 * Attempts to decode the given address assuming it is a cashaddr address.
6861 * @private
6862 * @param {string} address - A valid Bitcoin Cash address in any format.
6863 * @return {object}
6864 * @throws {InvalidAddressError}
6865 */
6866function decodeCashAddress (address) {
6867 if (address.indexOf(':') !== -1) {
6868 try {
6869 return decodeCashAddressWithPrefix(address)
6870 } catch (error) {
6871 }
6872 } else {
6873 var prefixes = ['bitcoincash', 'bchtest', 'bchreg']
6874 for (var i = 0; i < prefixes.length; ++i) {
6875 try {
6876 var prefix = prefixes[i]
6877 return decodeCashAddressWithPrefix(prefix + ':' + address)
6878 } catch (error) {
6879 }
6880 }
6881 }
6882 throw new InvalidAddressError()
6883}
6884
6885/**
6886 * Attempts to decode the given address assuming it is a cashaddr address with explicit prefix.
6887 * @private
6888 * @param {string} address - A valid Bitcoin Cash address in any format.
6889 * @return {object}
6890 * @throws {InvalidAddressError}
6891 */
6892function decodeCashAddressWithPrefix (address) {
6893 try {
6894 var decoded = cashaddr.decode(address)
6895 var hash = Array.prototype.slice.call(decoded.hash, 0)
6896 var type = decoded.type === 'P2PKH' ? Type.P2PKH : Type.P2SH
6897 switch (decoded.prefix) {
6898 case 'bitcoincash':
6899 return {
6900 hash: hash,
6901 format: Format.Cashaddr,
6902 network: Network.Mainnet,
6903 type: type
6904 }
6905 case 'bchtest':
6906 case 'bchreg':
6907 return {
6908 hash: hash,
6909 format: Format.Cashaddr,
6910 network: Network.Testnet,
6911 type: type
6912 }
6913 }
6914 } catch (error) {
6915 }
6916 throw new InvalidAddressError()
6917}
6918
6919/**
6920 * Encodes the given decoded address into legacy format.
6921 * @private
6922 * @param {object} decoded
6923 * @returns {string}
6924 */
6925function encodeAsLegacy (decoded) {
6926 var versionByte = VERSION_BYTE[Format.Legacy][decoded.network][decoded.type]
6927 var buffer = Buffer.alloc(1 + decoded.hash.length)
6928 buffer[0] = versionByte
6929 buffer.set(decoded.hash, 1)
6930 return bs58check.encode(buffer)
6931}
6932
6933/**
6934 * Encodes the given decoded address into bitpay format.
6935 * @private
6936 * @param {object} decoded
6937 * @returns {string}
6938 */
6939function encodeAsBitpay (decoded) {
6940 var versionByte = VERSION_BYTE[Format.Bitpay][decoded.network][decoded.type]
6941 var buffer = Buffer.alloc(1 + decoded.hash.length)
6942 buffer[0] = versionByte
6943 buffer.set(decoded.hash, 1)
6944 return bs58check.encode(buffer)
6945}
6946
6947/**
6948 * Encodes the given decoded address into cashaddr format.
6949 * @private
6950 * @param {object} decoded
6951 * @returns {string}
6952 */
6953function encodeAsCashaddr (decoded) {
6954 var prefix = decoded.network === Network.Mainnet ? 'bitcoincash' : 'bchtest'
6955 var type = decoded.type === Type.P2PKH ? 'P2PKH' : 'P2SH'
6956 var hash = new Uint8Array(decoded.hash)
6957 return cashaddr.encode(prefix, type, hash)
6958}
6959
6960/**
6961 * Returns a boolean indicating whether the address is in legacy format.
6962 * @static
6963 * @param {string} address - A valid Bitcoin Cash address in any format.
6964 * @returns {boolean}
6965 * @throws {InvalidAddressError}
6966 */
6967function isLegacyAddress (address) {
6968 return detectAddressFormat(address) === Format.Legacy
6969}
6970
6971/**
6972 * Returns a boolean indicating whether the address is in bitpay format.
6973 * @static
6974 * @param {string} address - A valid Bitcoin Cash address in any format.
6975 * @returns {boolean}
6976 * @throws {InvalidAddressError}
6977 */
6978function isBitpayAddress (address) {
6979 return detectAddressFormat(address) === Format.Bitpay
6980}
6981
6982/**
6983 * Returns a boolean indicating whether the address is in cashaddr format.
6984 * @static
6985 * @param {string} address - A valid Bitcoin Cash address in any format.
6986 * @returns {boolean}
6987 * @throws {InvalidAddressError}
6988 */
6989function isCashAddress (address) {
6990 return detectAddressFormat(address) === Format.Cashaddr
6991}
6992
6993/**
6994 * Returns a boolean indicating whether the address is a mainnet address.
6995 * @static
6996 * @param {string} address - A valid Bitcoin Cash address in any format.
6997 * @returns {boolean}
6998 * @throws {InvalidAddressError}
6999 */
7000function isMainnetAddress (address) {
7001 return detectAddressNetwork(address) === Network.Mainnet
7002}
7003
7004/**
7005 * Returns a boolean indicating whether the address is a testnet address.
7006 * @static
7007 * @param {string} address - A valid Bitcoin Cash address in any format.
7008 * @returns {boolean}
7009 * @throws {InvalidAddressError}
7010 */
7011function isTestnetAddress (address) {
7012 return detectAddressNetwork(address) === Network.Testnet
7013}
7014
7015/**
7016 * Returns a boolean indicating whether the address is a p2pkh address.
7017 * @static
7018 * @param {string} address - A valid Bitcoin Cash address in any format.
7019 * @returns {boolean}
7020 * @throws {InvalidAddressError}
7021 */
7022function isP2PKHAddress (address) {
7023 return detectAddressType(address) === Type.P2PKH
7024}
7025
7026/**
7027 * Returns a boolean indicating whether the address is a p2sh address.
7028 * @static
7029 * @param {string} address - A valid Bitcoin Cash address in any format.
7030 * @returns {boolean}
7031 * @throws {InvalidAddressError}
7032 */
7033function isP2SHAddress (address) {
7034 return detectAddressType(address) === Type.P2SH
7035}
7036
7037/**
7038 * Error thrown when the address given as input is not a valid Bitcoin Cash address.
7039 * @constructor
7040 * InvalidAddressError
7041 */
7042function InvalidAddressError () {
7043 var error = new Error()
7044 this.name = error.name = 'InvalidAddressError'
7045 this.message = error.message = 'Received an invalid Bitcoin Cash address as input.'
7046 this.stack = error.stack
7047}
7048
7049InvalidAddressError.prototype = Object.create(Error.prototype)
7050
7051module.exports = {
7052 Format: Format,
7053 Network: Network,
7054 Type: Type,
7055 isValidAddress: isValidAddress,
7056 detectAddressFormat: detectAddressFormat,
7057 detectAddressNetwork: detectAddressNetwork,
7058 detectAddressType: detectAddressType,
7059 toLegacyAddress: toLegacyAddress,
7060 toBitpayAddress: toBitpayAddress,
7061 toCashAddress: toCashAddress,
7062 isLegacyAddress: isLegacyAddress,
7063 isBitpayAddress: isBitpayAddress,
7064 isCashAddress: isCashAddress,
7065 isMainnetAddress: isMainnetAddress,
7066 isTestnetAddress: isTestnetAddress,
7067 isP2PKHAddress: isP2PKHAddress,
7068 isP2SHAddress: isP2SHAddress,
7069 InvalidAddressError: InvalidAddressError
7070}
7071
7072}).call(this,require("buffer").Buffer)
7073},{"bs58check":140,"buffer":146,"cashaddrjs":152}],59:[function(require,module,exports){
7074'use strict'
7075var ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'
7076
7077// pre-compute lookup table
7078var ALPHABET_MAP = {}
7079for (var z = 0; z < ALPHABET.length; z++) {
7080 var x = ALPHABET.charAt(z)
7081
7082 if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous')
7083 ALPHABET_MAP[x] = z
7084}
7085
7086function polymodStep (pre) {
7087 var b = pre >> 25
7088 return ((pre & 0x1FFFFFF) << 5) ^
7089 (-((b >> 0) & 1) & 0x3b6a57b2) ^
7090 (-((b >> 1) & 1) & 0x26508e6d) ^
7091 (-((b >> 2) & 1) & 0x1ea119fa) ^
7092 (-((b >> 3) & 1) & 0x3d4233dd) ^
7093 (-((b >> 4) & 1) & 0x2a1462b3)
7094}
7095
7096function prefixChk (prefix) {
7097 var chk = 1
7098 for (var i = 0; i < prefix.length; ++i) {
7099 var c = prefix.charCodeAt(i)
7100 if (c < 33 || c > 126) throw new Error('Invalid prefix (' + prefix + ')')
7101
7102 chk = polymodStep(chk) ^ (c >> 5)
7103 }
7104 chk = polymodStep(chk)
7105
7106 for (i = 0; i < prefix.length; ++i) {
7107 var v = prefix.charCodeAt(i)
7108 chk = polymodStep(chk) ^ (v & 0x1f)
7109 }
7110 return chk
7111}
7112
7113function encode (prefix, words, LIMIT) {
7114 LIMIT = LIMIT || 90
7115 if ((prefix.length + 7 + words.length) > LIMIT) throw new TypeError('Exceeds length limit')
7116
7117 prefix = prefix.toLowerCase()
7118
7119 // determine chk mod
7120 var chk = prefixChk(prefix)
7121 var result = prefix + '1'
7122 for (var i = 0; i < words.length; ++i) {
7123 var x = words[i]
7124 if ((x >> 5) !== 0) throw new Error('Non 5-bit word')
7125
7126 chk = polymodStep(chk) ^ x
7127 result += ALPHABET.charAt(x)
7128 }
7129
7130 for (i = 0; i < 6; ++i) {
7131 chk = polymodStep(chk)
7132 }
7133 chk ^= 1
7134
7135 for (i = 0; i < 6; ++i) {
7136 var v = (chk >> ((5 - i) * 5)) & 0x1f
7137 result += ALPHABET.charAt(v)
7138 }
7139
7140 return result
7141}
7142
7143function decode (str, LIMIT) {
7144 LIMIT = LIMIT || 90
7145 if (str.length < 8) throw new TypeError(str + ' too short')
7146 if (str.length > LIMIT) throw new TypeError('Exceeds length limit')
7147
7148 // don't allow mixed case
7149 var lowered = str.toLowerCase()
7150 var uppered = str.toUpperCase()
7151 if (str !== lowered && str !== uppered) throw new Error('Mixed-case string ' + str)
7152 str = lowered
7153
7154 var split = str.lastIndexOf('1')
7155 if (split === -1) throw new Error('No separator character for ' + str)
7156 if (split === 0) throw new Error('Missing prefix for ' + str)
7157
7158 var prefix = str.slice(0, split)
7159 var wordChars = str.slice(split + 1)
7160 if (wordChars.length < 6) throw new Error('Data too short')
7161
7162 var chk = prefixChk(prefix)
7163 var words = []
7164 for (var i = 0; i < wordChars.length; ++i) {
7165 var c = wordChars.charAt(i)
7166 var v = ALPHABET_MAP[c]
7167 if (v === undefined) throw new Error('Unknown character ' + c)
7168 chk = polymodStep(chk) ^ v
7169
7170 // not in the checksum?
7171 if (i + 6 >= wordChars.length) continue
7172 words.push(v)
7173 }
7174
7175 if (chk !== 1) throw new Error('Invalid checksum for ' + str)
7176 return { prefix: prefix, words: words }
7177}
7178
7179function convert (data, inBits, outBits, pad) {
7180 var value = 0
7181 var bits = 0
7182 var maxV = (1 << outBits) - 1
7183
7184 var result = []
7185 for (var i = 0; i < data.length; ++i) {
7186 value = (value << inBits) | data[i]
7187 bits += inBits
7188
7189 while (bits >= outBits) {
7190 bits -= outBits
7191 result.push((value >> bits) & maxV)
7192 }
7193 }
7194
7195 if (pad) {
7196 if (bits > 0) {
7197 result.push((value << (outBits - bits)) & maxV)
7198 }
7199 } else {
7200 if (bits >= inBits) throw new Error('Excess padding')
7201 if ((value << (outBits - bits)) & maxV) throw new Error('Non-zero padding')
7202 }
7203
7204 return result
7205}
7206
7207function toWords (bytes) {
7208 return convert(bytes, 8, 5, true)
7209}
7210
7211function fromWords (words) {
7212 return convert(words, 5, 8, false)
7213}
7214
7215module.exports = {
7216 decode: decode,
7217 encode: encode,
7218 toWords: toWords,
7219 fromWords: fromWords
7220}
7221
7222},{}],60:[function(require,module,exports){
7223var bigInt = (function (undefined) {\r
7224 "use strict";\r
7225\r
7226 var BASE = 1e7,\r
7227 LOG_BASE = 7,\r
7228 MAX_INT = 9007199254740992,\r
7229 MAX_INT_ARR = smallToArray(MAX_INT),\r
7230 LOG_MAX_INT = Math.log(MAX_INT);\r
7231\r
7232 function Integer(v, radix) {\r
7233 if (typeof v === "undefined") return Integer[0];\r
7234 if (typeof radix !== "undefined") return +radix === 10 ? parseValue(v) : parseBase(v, radix);\r
7235 return parseValue(v);\r
7236 }\r
7237\r
7238 function BigInteger(value, sign) {\r
7239 this.value = value;\r
7240 this.sign = sign;\r
7241 this.isSmall = false;\r
7242 }\r
7243 BigInteger.prototype = Object.create(Integer.prototype);\r
7244\r
7245 function SmallInteger(value) {\r
7246 this.value = value;\r
7247 this.sign = value < 0;\r
7248 this.isSmall = true;\r
7249 }\r
7250 SmallInteger.prototype = Object.create(Integer.prototype);\r
7251\r
7252 function isPrecise(n) {\r
7253 return -MAX_INT < n && n < MAX_INT;\r
7254 }\r
7255\r
7256 function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes\r
7257 if (n < 1e7)\r
7258 return [n];\r
7259 if (n < 1e14)\r
7260 return [n % 1e7, Math.floor(n / 1e7)];\r
7261 return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\r
7262 }\r
7263\r
7264 function arrayToSmall(arr) { // If BASE changes this function may need to change\r
7265 trim(arr);\r
7266 var length = arr.length;\r
7267 if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\r
7268 switch (length) {\r
7269 case 0: return 0;\r
7270 case 1: return arr[0];\r
7271 case 2: return arr[0] + arr[1] * BASE;\r
7272 default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\r
7273 }\r
7274 }\r
7275 return arr;\r
7276 }\r
7277\r
7278 function trim(v) {\r
7279 var i = v.length;\r
7280 while (v[--i] === 0);\r
7281 v.length = i + 1;\r
7282 }\r
7283\r
7284 function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger\r
7285 var x = new Array(length);\r
7286 var i = -1;\r
7287 while (++i < length) {\r
7288 x[i] = 0;\r
7289 }\r
7290 return x;\r
7291 }\r
7292\r
7293 function truncate(n) {\r
7294 if (n > 0) return Math.floor(n);\r
7295 return Math.ceil(n);\r
7296 }\r
7297\r
7298 function add(a, b) { // assumes a and b are arrays with a.length >= b.length\r
7299 var l_a = a.length,\r
7300 l_b = b.length,\r
7301 r = new Array(l_a),\r
7302 carry = 0,\r
7303 base = BASE,\r
7304 sum, i;\r
7305 for (i = 0; i < l_b; i++) {\r
7306 sum = a[i] + b[i] + carry;\r
7307 carry = sum >= base ? 1 : 0;\r
7308 r[i] = sum - carry * base;\r
7309 }\r
7310 while (i < l_a) {\r
7311 sum = a[i] + carry;\r
7312 carry = sum === base ? 1 : 0;\r
7313 r[i++] = sum - carry * base;\r
7314 }\r
7315 if (carry > 0) r.push(carry);\r
7316 return r;\r
7317 }\r
7318\r
7319 function addAny(a, b) {\r
7320 if (a.length >= b.length) return add(a, b);\r
7321 return add(b, a);\r
7322 }\r
7323\r
7324 function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT\r
7325 var l = a.length,\r
7326 r = new Array(l),\r
7327 base = BASE,\r
7328 sum, i;\r
7329 for (i = 0; i < l; i++) {\r
7330 sum = a[i] - base + carry;\r
7331 carry = Math.floor(sum / base);\r
7332 r[i] = sum - carry * base;\r
7333 carry += 1;\r
7334 }\r
7335 while (carry > 0) {\r
7336 r[i++] = carry % base;\r
7337 carry = Math.floor(carry / base);\r
7338 }\r
7339 return r;\r
7340 }\r
7341\r
7342 BigInteger.prototype.add = function (v) {\r
7343 var n = parseValue(v);\r
7344 if (this.sign !== n.sign) {\r
7345 return this.subtract(n.negate());\r
7346 }\r
7347 var a = this.value, b = n.value;\r
7348 if (n.isSmall) {\r
7349 return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\r
7350 }\r
7351 return new BigInteger(addAny(a, b), this.sign);\r
7352 };\r
7353 BigInteger.prototype.plus = BigInteger.prototype.add;\r
7354\r
7355 SmallInteger.prototype.add = function (v) {\r
7356 var n = parseValue(v);\r
7357 var a = this.value;\r
7358 if (a < 0 !== n.sign) {\r
7359 return this.subtract(n.negate());\r
7360 }\r
7361 var b = n.value;\r
7362 if (n.isSmall) {\r
7363 if (isPrecise(a + b)) return new SmallInteger(a + b);\r
7364 b = smallToArray(Math.abs(b));\r
7365 }\r
7366 return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\r
7367 };\r
7368 SmallInteger.prototype.plus = SmallInteger.prototype.add;\r
7369\r
7370 function subtract(a, b) { // assumes a and b are arrays with a >= b\r
7371 var a_l = a.length,\r
7372 b_l = b.length,\r
7373 r = new Array(a_l),\r
7374 borrow = 0,\r
7375 base = BASE,\r
7376 i, difference;\r
7377 for (i = 0; i < b_l; i++) {\r
7378 difference = a[i] - borrow - b[i];\r
7379 if (difference < 0) {\r
7380 difference += base;\r
7381 borrow = 1;\r
7382 } else borrow = 0;\r
7383 r[i] = difference;\r
7384 }\r
7385 for (i = b_l; i < a_l; i++) {\r
7386 difference = a[i] - borrow;\r
7387 if (difference < 0) difference += base;\r
7388 else {\r
7389 r[i++] = difference;\r
7390 break;\r
7391 }\r
7392 r[i] = difference;\r
7393 }\r
7394 for (; i < a_l; i++) {\r
7395 r[i] = a[i];\r
7396 }\r
7397 trim(r);\r
7398 return r;\r
7399 }\r
7400\r
7401 function subtractAny(a, b, sign) {\r
7402 var value;\r
7403 if (compareAbs(a, b) >= 0) {\r
7404 value = subtract(a, b);\r
7405 } else {\r
7406 value = subtract(b, a);\r
7407 sign = !sign;\r
7408 }\r
7409 value = arrayToSmall(value);\r
7410 if (typeof value === "number") {\r
7411 if (sign) value = -value;\r
7412 return new SmallInteger(value);\r
7413 }\r
7414 return new BigInteger(value, sign);\r
7415 }\r
7416\r
7417 function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT\r
7418 var l = a.length,\r
7419 r = new Array(l),\r
7420 carry = -b,\r
7421 base = BASE,\r
7422 i, difference;\r
7423 for (i = 0; i < l; i++) {\r
7424 difference = a[i] + carry;\r
7425 carry = Math.floor(difference / base);\r
7426 difference %= base;\r
7427 r[i] = difference < 0 ? difference + base : difference;\r
7428 }\r
7429 r = arrayToSmall(r);\r
7430 if (typeof r === "number") {\r
7431 if (sign) r = -r;\r
7432 return new SmallInteger(r);\r
7433 } return new BigInteger(r, sign);\r
7434 }\r
7435\r
7436 BigInteger.prototype.subtract = function (v) {\r
7437 var n = parseValue(v);\r
7438 if (this.sign !== n.sign) {\r
7439 return this.add(n.negate());\r
7440 }\r
7441 var a = this.value, b = n.value;\r
7442 if (n.isSmall)\r
7443 return subtractSmall(a, Math.abs(b), this.sign);\r
7444 return subtractAny(a, b, this.sign);\r
7445 };\r
7446 BigInteger.prototype.minus = BigInteger.prototype.subtract;\r
7447\r
7448 SmallInteger.prototype.subtract = function (v) {\r
7449 var n = parseValue(v);\r
7450 var a = this.value;\r
7451 if (a < 0 !== n.sign) {\r
7452 return this.add(n.negate());\r
7453 }\r
7454 var b = n.value;\r
7455 if (n.isSmall) {\r
7456 return new SmallInteger(a - b);\r
7457 }\r
7458 return subtractSmall(b, Math.abs(a), a >= 0);\r
7459 };\r
7460 SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\r
7461\r
7462 BigInteger.prototype.negate = function () {\r
7463 return new BigInteger(this.value, !this.sign);\r
7464 };\r
7465 SmallInteger.prototype.negate = function () {\r
7466 var sign = this.sign;\r
7467 var small = new SmallInteger(-this.value);\r
7468 small.sign = !sign;\r
7469 return small;\r
7470 };\r
7471\r
7472 BigInteger.prototype.abs = function () {\r
7473 return new BigInteger(this.value, false);\r
7474 };\r
7475 SmallInteger.prototype.abs = function () {\r
7476 return new SmallInteger(Math.abs(this.value));\r
7477 };\r
7478\r
7479 function multiplyLong(a, b) {\r
7480 var a_l = a.length,\r
7481 b_l = b.length,\r
7482 l = a_l + b_l,\r
7483 r = createArray(l),\r
7484 base = BASE,\r
7485 product, carry, i, a_i, b_j;\r
7486 for (i = 0; i < a_l; ++i) {\r
7487 a_i = a[i];\r
7488 for (var j = 0; j < b_l; ++j) {\r
7489 b_j = b[j];\r
7490 product = a_i * b_j + r[i + j];\r
7491 carry = Math.floor(product / base);\r
7492 r[i + j] = product - carry * base;\r
7493 r[i + j + 1] += carry;\r
7494 }\r
7495 }\r
7496 trim(r);\r
7497 return r;\r
7498 }\r
7499\r
7500 function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE\r
7501 var l = a.length,\r
7502 r = new Array(l),\r
7503 base = BASE,\r
7504 carry = 0,\r
7505 product, i;\r
7506 for (i = 0; i < l; i++) {\r
7507 product = a[i] * b + carry;\r
7508 carry = Math.floor(product / base);\r
7509 r[i] = product - carry * base;\r
7510 }\r
7511 while (carry > 0) {\r
7512 r[i++] = carry % base;\r
7513 carry = Math.floor(carry / base);\r
7514 }\r
7515 return r;\r
7516 }\r
7517\r
7518 function shiftLeft(x, n) {\r
7519 var r = [];\r
7520 while (n-- > 0) r.push(0);\r
7521 return r.concat(x);\r
7522 }\r
7523\r
7524 function multiplyKaratsuba(x, y) {\r
7525 var n = Math.max(x.length, y.length);\r
7526\r
7527 if (n <= 30) return multiplyLong(x, y);\r
7528 n = Math.ceil(n / 2);\r
7529\r
7530 var b = x.slice(n),\r
7531 a = x.slice(0, n),\r
7532 d = y.slice(n),\r
7533 c = y.slice(0, n);\r
7534\r
7535 var ac = multiplyKaratsuba(a, c),\r
7536 bd = multiplyKaratsuba(b, d),\r
7537 abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\r
7538\r
7539 var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));\r
7540 trim(product);\r
7541 return product;\r
7542 }\r
7543\r
7544 // The following function is derived from a surface fit of a graph plotting the performance difference\r
7545 // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.\r
7546 function useKaratsuba(l1, l2) {\r
7547 return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;\r
7548 }\r
7549\r
7550 BigInteger.prototype.multiply = function (v) {\r
7551 var n = parseValue(v),\r
7552 a = this.value, b = n.value,\r
7553 sign = this.sign !== n.sign,\r
7554 abs;\r
7555 if (n.isSmall) {\r
7556 if (b === 0) return Integer[0];\r
7557 if (b === 1) return this;\r
7558 if (b === -1) return this.negate();\r
7559 abs = Math.abs(b);\r
7560 if (abs < BASE) {\r
7561 return new BigInteger(multiplySmall(a, abs), sign);\r
7562 }\r
7563 b = smallToArray(abs);\r
7564 }\r
7565 if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes\r
7566 return new BigInteger(multiplyKaratsuba(a, b), sign);\r
7567 return new BigInteger(multiplyLong(a, b), sign);\r
7568 };\r
7569\r
7570 BigInteger.prototype.times = BigInteger.prototype.multiply;\r
7571\r
7572 function multiplySmallAndArray(a, b, sign) { // a >= 0\r
7573 if (a < BASE) {\r
7574 return new BigInteger(multiplySmall(b, a), sign);\r
7575 }\r
7576 return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\r
7577 }\r
7578 SmallInteger.prototype._multiplyBySmall = function (a) {\r
7579 if (isPrecise(a.value * this.value)) {\r
7580 return new SmallInteger(a.value * this.value);\r
7581 }\r
7582 return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);\r
7583 };\r
7584 BigInteger.prototype._multiplyBySmall = function (a) {\r
7585 if (a.value === 0) return Integer[0];\r
7586 if (a.value === 1) return this;\r
7587 if (a.value === -1) return this.negate();\r
7588 return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);\r
7589 };\r
7590 SmallInteger.prototype.multiply = function (v) {\r
7591 return parseValue(v)._multiplyBySmall(this);\r
7592 };\r
7593 SmallInteger.prototype.times = SmallInteger.prototype.multiply;\r
7594\r
7595 function square(a) {\r
7596 //console.assert(2 * BASE * BASE < MAX_INT);\r
7597 var l = a.length,\r
7598 r = createArray(l + l),\r
7599 base = BASE,\r
7600 product, carry, i, a_i, a_j;\r
7601 for (i = 0; i < l; i++) {\r
7602 a_i = a[i];\r
7603 carry = 0 - a_i * a_i;\r
7604 for (var j = i; j < l; j++) {\r
7605 a_j = a[j];\r
7606 product = 2 * (a_i * a_j) + r[i + j] + carry;\r
7607 carry = Math.floor(product / base);\r
7608 r[i + j] = product - carry * base;\r
7609 }\r
7610 r[i + l] = carry;\r
7611 }\r
7612 trim(r);\r
7613 return r;\r
7614 }\r
7615\r
7616 BigInteger.prototype.square = function () {\r
7617 return new BigInteger(square(this.value), false);\r
7618 };\r
7619\r
7620 SmallInteger.prototype.square = function () {\r
7621 var value = this.value * this.value;\r
7622 if (isPrecise(value)) return new SmallInteger(value);\r
7623 return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\r
7624 };\r
7625\r
7626 function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.\r
7627 var a_l = a.length,\r
7628 b_l = b.length,\r
7629 base = BASE,\r
7630 result = createArray(b.length),\r
7631 divisorMostSignificantDigit = b[b_l - 1],\r
7632 // normalization\r
7633 lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\r
7634 remainder = multiplySmall(a, lambda),\r
7635 divisor = multiplySmall(b, lambda),\r
7636 quotientDigit, shift, carry, borrow, i, l, q;\r
7637 if (remainder.length <= a_l) remainder.push(0);\r
7638 divisor.push(0);\r
7639 divisorMostSignificantDigit = divisor[b_l - 1];\r
7640 for (shift = a_l - b_l; shift >= 0; shift--) {\r
7641 quotientDigit = base - 1;\r
7642 if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\r
7643 quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);\r
7644 }\r
7645 // quotientDigit <= base - 1\r
7646 carry = 0;\r
7647 borrow = 0;\r
7648 l = divisor.length;\r
7649 for (i = 0; i < l; i++) {\r
7650 carry += quotientDigit * divisor[i];\r
7651 q = Math.floor(carry / base);\r
7652 borrow += remainder[shift + i] - (carry - q * base);\r
7653 carry = q;\r
7654 if (borrow < 0) {\r
7655 remainder[shift + i] = borrow + base;\r
7656 borrow = -1;\r
7657 } else {\r
7658 remainder[shift + i] = borrow;\r
7659 borrow = 0;\r
7660 }\r
7661 }\r
7662 while (borrow !== 0) {\r
7663 quotientDigit -= 1;\r
7664 carry = 0;\r
7665 for (i = 0; i < l; i++) {\r
7666 carry += remainder[shift + i] - base + divisor[i];\r
7667 if (carry < 0) {\r
7668 remainder[shift + i] = carry + base;\r
7669 carry = 0;\r
7670 } else {\r
7671 remainder[shift + i] = carry;\r
7672 carry = 1;\r
7673 }\r
7674 }\r
7675 borrow += carry;\r
7676 }\r
7677 result[shift] = quotientDigit;\r
7678 }\r
7679 // denormalization\r
7680 remainder = divModSmall(remainder, lambda)[0];\r
7681 return [arrayToSmall(result), arrayToSmall(remainder)];\r
7682 }\r
7683\r
7684 function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/\r
7685 // Performs faster than divMod1 on larger input sizes.\r
7686 var a_l = a.length,\r
7687 b_l = b.length,\r
7688 result = [],\r
7689 part = [],\r
7690 base = BASE,\r
7691 guess, xlen, highx, highy, check;\r
7692 while (a_l) {\r
7693 part.unshift(a[--a_l]);\r
7694 trim(part);\r
7695 if (compareAbs(part, b) < 0) {\r
7696 result.push(0);\r
7697 continue;\r
7698 }\r
7699 xlen = part.length;\r
7700 highx = part[xlen - 1] * base + part[xlen - 2];\r
7701 highy = b[b_l - 1] * base + b[b_l - 2];\r
7702 if (xlen > b_l) {\r
7703 highx = (highx + 1) * base;\r
7704 }\r
7705 guess = Math.ceil(highx / highy);\r
7706 do {\r
7707 check = multiplySmall(b, guess);\r
7708 if (compareAbs(check, part) <= 0) break;\r
7709 guess--;\r
7710 } while (guess);\r
7711 result.push(guess);\r
7712 part = subtract(part, check);\r
7713 }\r
7714 result.reverse();\r
7715 return [arrayToSmall(result), arrayToSmall(part)];\r
7716 }\r
7717\r
7718 function divModSmall(value, lambda) {\r
7719 var length = value.length,\r
7720 quotient = createArray(length),\r
7721 base = BASE,\r
7722 i, q, remainder, divisor;\r
7723 remainder = 0;\r
7724 for (i = length - 1; i >= 0; --i) {\r
7725 divisor = remainder * base + value[i];\r
7726 q = truncate(divisor / lambda);\r
7727 remainder = divisor - q * lambda;\r
7728 quotient[i] = q | 0;\r
7729 }\r
7730 return [quotient, remainder | 0];\r
7731 }\r
7732\r
7733 function divModAny(self, v) {\r
7734 var value, n = parseValue(v);\r
7735 var a = self.value, b = n.value;\r
7736 var quotient;\r
7737 if (b === 0) throw new Error("Cannot divide by zero");\r
7738 if (self.isSmall) {\r
7739 if (n.isSmall) {\r
7740 return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\r
7741 }\r
7742 return [Integer[0], self];\r
7743 }\r
7744 if (n.isSmall) {\r
7745 if (b === 1) return [self, Integer[0]];\r
7746 if (b == -1) return [self.negate(), Integer[0]];\r
7747 var abs = Math.abs(b);\r
7748 if (abs < BASE) {\r
7749 value = divModSmall(a, abs);\r
7750 quotient = arrayToSmall(value[0]);\r
7751 var remainder = value[1];\r
7752 if (self.sign) remainder = -remainder;\r
7753 if (typeof quotient === "number") {\r
7754 if (self.sign !== n.sign) quotient = -quotient;\r
7755 return [new SmallInteger(quotient), new SmallInteger(remainder)];\r
7756 }\r
7757 return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];\r
7758 }\r
7759 b = smallToArray(abs);\r
7760 }\r
7761 var comparison = compareAbs(a, b);\r
7762 if (comparison === -1) return [Integer[0], self];\r
7763 if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\r
7764\r
7765 // divMod1 is faster on smaller input sizes\r
7766 if (a.length + b.length <= 200)\r
7767 value = divMod1(a, b);\r
7768 else value = divMod2(a, b);\r
7769\r
7770 quotient = value[0];\r
7771 var qSign = self.sign !== n.sign,\r
7772 mod = value[1],\r
7773 mSign = self.sign;\r
7774 if (typeof quotient === "number") {\r
7775 if (qSign) quotient = -quotient;\r
7776 quotient = new SmallInteger(quotient);\r
7777 } else quotient = new BigInteger(quotient, qSign);\r
7778 if (typeof mod === "number") {\r
7779 if (mSign) mod = -mod;\r
7780 mod = new SmallInteger(mod);\r
7781 } else mod = new BigInteger(mod, mSign);\r
7782 return [quotient, mod];\r
7783 }\r
7784\r
7785 BigInteger.prototype.divmod = function (v) {\r
7786 var result = divModAny(this, v);\r
7787 return {\r
7788 quotient: result[0],\r
7789 remainder: result[1]\r
7790 };\r
7791 };\r
7792 SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\r
7793\r
7794 BigInteger.prototype.divide = function (v) {\r
7795 return divModAny(this, v)[0];\r
7796 };\r
7797 SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;\r
7798\r
7799 BigInteger.prototype.mod = function (v) {\r
7800 return divModAny(this, v)[1];\r
7801 };\r
7802 SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;\r
7803\r
7804 BigInteger.prototype.pow = function (v) {\r
7805 var n = parseValue(v),\r
7806 a = this.value,\r
7807 b = n.value,\r
7808 value, x, y;\r
7809 if (b === 0) return Integer[1];\r
7810 if (a === 0) return Integer[0];\r
7811 if (a === 1) return Integer[1];\r
7812 if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\r
7813 if (n.sign) {\r
7814 return Integer[0];\r
7815 }\r
7816 if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");\r
7817 if (this.isSmall) {\r
7818 if (isPrecise(value = Math.pow(a, b)))\r
7819 return new SmallInteger(truncate(value));\r
7820 }\r
7821 x = this;\r
7822 y = Integer[1];\r
7823 while (true) {\r
7824 if (b & 1 === 1) {\r
7825 y = y.times(x);\r
7826 --b;\r
7827 }\r
7828 if (b === 0) break;\r
7829 b /= 2;\r
7830 x = x.square();\r
7831 }\r
7832 return y;\r
7833 };\r
7834 SmallInteger.prototype.pow = BigInteger.prototype.pow;\r
7835\r
7836 BigInteger.prototype.modPow = function (exp, mod) {\r
7837 exp = parseValue(exp);\r
7838 mod = parseValue(mod);\r
7839 if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");\r
7840 var r = Integer[1],\r
7841 base = this.mod(mod);\r
7842 while (exp.isPositive()) {\r
7843 if (base.isZero()) return Integer[0];\r
7844 if (exp.isOdd()) r = r.multiply(base).mod(mod);\r
7845 exp = exp.divide(2);\r
7846 base = base.square().mod(mod);\r
7847 }\r
7848 return r;\r
7849 };\r
7850 SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\r
7851\r
7852 function compareAbs(a, b) {\r
7853 if (a.length !== b.length) {\r
7854 return a.length > b.length ? 1 : -1;\r
7855 }\r
7856 for (var i = a.length - 1; i >= 0; i--) {\r
7857 if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\r
7858 }\r
7859 return 0;\r
7860 }\r
7861\r
7862 BigInteger.prototype.compareAbs = function (v) {\r
7863 var n = parseValue(v),\r
7864 a = this.value,\r
7865 b = n.value;\r
7866 if (n.isSmall) return 1;\r
7867 return compareAbs(a, b);\r
7868 };\r
7869 SmallInteger.prototype.compareAbs = function (v) {\r
7870 var n = parseValue(v),\r
7871 a = Math.abs(this.value),\r
7872 b = n.value;\r
7873 if (n.isSmall) {\r
7874 b = Math.abs(b);\r
7875 return a === b ? 0 : a > b ? 1 : -1;\r
7876 }\r
7877 return -1;\r
7878 };\r
7879\r
7880 BigInteger.prototype.compare = function (v) {\r
7881 // See discussion about comparison with Infinity:\r
7882 // https://github.com/peterolson/BigInteger.js/issues/61\r
7883 if (v === Infinity) {\r
7884 return -1;\r
7885 }\r
7886 if (v === -Infinity) {\r
7887 return 1;\r
7888 }\r
7889\r
7890 var n = parseValue(v),\r
7891 a = this.value,\r
7892 b = n.value;\r
7893 if (this.sign !== n.sign) {\r
7894 return n.sign ? 1 : -1;\r
7895 }\r
7896 if (n.isSmall) {\r
7897 return this.sign ? -1 : 1;\r
7898 }\r
7899 return compareAbs(a, b) * (this.sign ? -1 : 1);\r
7900 };\r
7901 BigInteger.prototype.compareTo = BigInteger.prototype.compare;\r
7902\r
7903 SmallInteger.prototype.compare = function (v) {\r
7904 if (v === Infinity) {\r
7905 return -1;\r
7906 }\r
7907 if (v === -Infinity) {\r
7908 return 1;\r
7909 }\r
7910\r
7911 var n = parseValue(v),\r
7912 a = this.value,\r
7913 b = n.value;\r
7914 if (n.isSmall) {\r
7915 return a == b ? 0 : a > b ? 1 : -1;\r
7916 }\r
7917 if (a < 0 !== n.sign) {\r
7918 return a < 0 ? -1 : 1;\r
7919 }\r
7920 return a < 0 ? 1 : -1;\r
7921 };\r
7922 SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\r
7923\r
7924 BigInteger.prototype.equals = function (v) {\r
7925 return this.compare(v) === 0;\r
7926 };\r
7927 SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;\r
7928\r
7929 BigInteger.prototype.notEquals = function (v) {\r
7930 return this.compare(v) !== 0;\r
7931 };\r
7932 SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;\r
7933\r
7934 BigInteger.prototype.greater = function (v) {\r
7935 return this.compare(v) > 0;\r
7936 };\r
7937 SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;\r
7938\r
7939 BigInteger.prototype.lesser = function (v) {\r
7940 return this.compare(v) < 0;\r
7941 };\r
7942 SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;\r
7943\r
7944 BigInteger.prototype.greaterOrEquals = function (v) {\r
7945 return this.compare(v) >= 0;\r
7946 };\r
7947 SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;\r
7948\r
7949 BigInteger.prototype.lesserOrEquals = function (v) {\r
7950 return this.compare(v) <= 0;\r
7951 };\r
7952 SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;\r
7953\r
7954 BigInteger.prototype.isEven = function () {\r
7955 return (this.value[0] & 1) === 0;\r
7956 };\r
7957 SmallInteger.prototype.isEven = function () {\r
7958 return (this.value & 1) === 0;\r
7959 };\r
7960\r
7961 BigInteger.prototype.isOdd = function () {\r
7962 return (this.value[0] & 1) === 1;\r
7963 };\r
7964 SmallInteger.prototype.isOdd = function () {\r
7965 return (this.value & 1) === 1;\r
7966 };\r
7967\r
7968 BigInteger.prototype.isPositive = function () {\r
7969 return !this.sign;\r
7970 };\r
7971 SmallInteger.prototype.isPositive = function () {\r
7972 return this.value > 0;\r
7973 };\r
7974\r
7975 BigInteger.prototype.isNegative = function () {\r
7976 return this.sign;\r
7977 };\r
7978 SmallInteger.prototype.isNegative = function () {\r
7979 return this.value < 0;\r
7980 };\r
7981\r
7982 BigInteger.prototype.isUnit = function () {\r
7983 return false;\r
7984 };\r
7985 SmallInteger.prototype.isUnit = function () {\r
7986 return Math.abs(this.value) === 1;\r
7987 };\r
7988\r
7989 BigInteger.prototype.isZero = function () {\r
7990 return false;\r
7991 };\r
7992 SmallInteger.prototype.isZero = function () {\r
7993 return this.value === 0;\r
7994 };\r
7995 BigInteger.prototype.isDivisibleBy = function (v) {\r
7996 var n = parseValue(v);\r
7997 var value = n.value;\r
7998 if (value === 0) return false;\r
7999 if (value === 1) return true;\r
8000 if (value === 2) return this.isEven();\r
8001 return this.mod(n).equals(Integer[0]);\r
8002 };\r
8003 SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\r
8004\r
8005 function isBasicPrime(v) {\r
8006 var n = v.abs();\r
8007 if (n.isUnit()) return false;\r
8008 if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\r
8009 if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\r
8010 if (n.lesser(49)) return true;\r
8011 // we don't know if it's prime: let the other functions figure it out\r
8012 }\r
8013 \r
8014 function millerRabinTest(n, a) {\r
8015 var nPrev = n.prev(),\r
8016 b = nPrev,\r
8017 r = 0,\r
8018 d, t, i, x;\r
8019 while (b.isEven()) b = b.divide(2), r++;\r
8020 next : for (i = 0; i < a.length; i++) {\r
8021 if (n.lesser(a[i])) continue;\r
8022 x = bigInt(a[i]).modPow(b, n);\r
8023 if (x.equals(Integer[1]) || x.equals(nPrev)) continue;\r
8024 for (d = r - 1; d != 0; d--) {\r
8025 x = x.square().mod(n);\r
8026 if (x.isUnit()) return false; \r
8027 if (x.equals(nPrev)) continue next;\r
8028 }\r
8029 return false;\r
8030 }\r
8031 return true;\r
8032 }\r
8033 \r
8034// Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2\r
8035 BigInteger.prototype.isPrime = function (strict) {\r
8036 var isPrime = isBasicPrime(this);\r
8037 if (isPrime !== undefined) return isPrime;\r
8038 var n = this.abs();\r
8039 var bits = n.bitLength();\r
8040 if(bits <= 64)\r
8041 return millerRabinTest(n, [2, 325, 9375, 28178, 450775, 9780504, 1795265022]);\r
8042 var logN = Math.log(2) * bits;\r
8043 var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);\r
8044 for (var a = [], i = 0; i < t; i++) {\r
8045 a.push(bigInt(i + 2));\r
8046 }\r
8047 return millerRabinTest(n, a);\r
8048 };\r
8049 SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\r
8050\r
8051 BigInteger.prototype.isProbablePrime = function (iterations) {\r
8052 var isPrime = isBasicPrime(this);\r
8053 if (isPrime !== undefined) return isPrime;\r
8054 var n = this.abs();\r
8055 var t = iterations === undefined ? 5 : iterations;\r
8056 for (var a = [], i = 0; i < t; i++) {\r
8057 a.push(bigInt.randBetween(2, n.minus(2)));\r
8058 }\r
8059 return millerRabinTest(n, a);\r
8060 };\r
8061 SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\r
8062\r
8063 BigInteger.prototype.modInv = function (n) {\r
8064 var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;\r
8065 while (!newR.equals(bigInt.zero)) {\r
8066 q = r.divide(newR);\r
8067 lastT = t;\r
8068 lastR = r;\r
8069 t = newT;\r
8070 r = newR;\r
8071 newT = lastT.subtract(q.multiply(newT));\r
8072 newR = lastR.subtract(q.multiply(newR));\r
8073 }\r
8074 if (!r.equals(1)) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");\r
8075 if (t.compare(0) === -1) {\r
8076 t = t.add(n);\r
8077 }\r
8078 if (this.isNegative()) {\r
8079 return t.negate();\r
8080 }\r
8081 return t;\r
8082 };\r
8083\r
8084 SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\r
8085\r
8086 BigInteger.prototype.next = function () {\r
8087 var value = this.value;\r
8088 if (this.sign) {\r
8089 return subtractSmall(value, 1, this.sign);\r
8090 }\r
8091 return new BigInteger(addSmall(value, 1), this.sign);\r
8092 };\r
8093 SmallInteger.prototype.next = function () {\r
8094 var value = this.value;\r
8095 if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\r
8096 return new BigInteger(MAX_INT_ARR, false);\r
8097 };\r
8098\r
8099 BigInteger.prototype.prev = function () {\r
8100 var value = this.value;\r
8101 if (this.sign) {\r
8102 return new BigInteger(addSmall(value, 1), true);\r
8103 }\r
8104 return subtractSmall(value, 1, this.sign);\r
8105 };\r
8106 SmallInteger.prototype.prev = function () {\r
8107 var value = this.value;\r
8108 if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\r
8109 return new BigInteger(MAX_INT_ARR, true);\r
8110 };\r
8111\r
8112 var powersOfTwo = [1];\r
8113 while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\r
8114 var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];\r
8115\r
8116 function shift_isSmall(n) {\r
8117 return ((typeof n === "number" || typeof n === "string") && +Math.abs(n) <= BASE) ||\r
8118 (n instanceof BigInteger && n.value.length <= 1);\r
8119 }\r
8120\r
8121 BigInteger.prototype.shiftLeft = function (n) {\r
8122 if (!shift_isSmall(n)) {\r
8123 throw new Error(String(n) + " is too large for shifting.");\r
8124 }\r
8125 n = +n;\r
8126 if (n < 0) return this.shiftRight(-n);\r
8127 var result = this;\r
8128 if (result.isZero()) return result;\r
8129 while (n >= powers2Length) {\r
8130 result = result.multiply(highestPower2);\r
8131 n -= powers2Length - 1;\r
8132 }\r
8133 return result.multiply(powersOfTwo[n]);\r
8134 };\r
8135 SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\r
8136\r
8137 BigInteger.prototype.shiftRight = function (n) {\r
8138 var remQuo;\r
8139 if (!shift_isSmall(n)) {\r
8140 throw new Error(String(n) + " is too large for shifting.");\r
8141 }\r
8142 n = +n;\r
8143 if (n < 0) return this.shiftLeft(-n);\r
8144 var result = this;\r
8145 while (n >= powers2Length) {\r
8146 if (result.isZero() || (result.isNegative() && result.isUnit())) return result;\r
8147 remQuo = divModAny(result, highestPower2);\r
8148 result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r
8149 n -= powers2Length - 1;\r
8150 }\r
8151 remQuo = divModAny(result, powersOfTwo[n]);\r
8152 return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r
8153 };\r
8154 SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\r
8155\r
8156 function bitwise(x, y, fn) {\r
8157 y = parseValue(y);\r
8158 var xSign = x.isNegative(), ySign = y.isNegative();\r
8159 var xRem = xSign ? x.not() : x,\r
8160 yRem = ySign ? y.not() : y;\r
8161 var xDigit = 0, yDigit = 0;\r
8162 var xDivMod = null, yDivMod = null;\r
8163 var result = [];\r
8164 while (!xRem.isZero() || !yRem.isZero()) {\r
8165 xDivMod = divModAny(xRem, highestPower2);\r
8166 xDigit = xDivMod[1].toJSNumber();\r
8167 if (xSign) {\r
8168 xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers\r
8169 }\r
8170\r
8171 yDivMod = divModAny(yRem, highestPower2);\r
8172 yDigit = yDivMod[1].toJSNumber();\r
8173 if (ySign) {\r
8174 yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers\r
8175 }\r
8176\r
8177 xRem = xDivMod[0];\r
8178 yRem = yDivMod[0];\r
8179 result.push(fn(xDigit, yDigit));\r
8180 }\r
8181 var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\r
8182 for (var i = result.length - 1; i >= 0; i -= 1) {\r
8183 sum = sum.multiply(highestPower2).add(bigInt(result[i]));\r
8184 }\r
8185 return sum;\r
8186 }\r
8187\r
8188 BigInteger.prototype.not = function () {\r
8189 return this.negate().prev();\r
8190 };\r
8191 SmallInteger.prototype.not = BigInteger.prototype.not;\r
8192\r
8193 BigInteger.prototype.and = function (n) {\r
8194 return bitwise(this, n, function (a, b) { return a & b; });\r
8195 };\r
8196 SmallInteger.prototype.and = BigInteger.prototype.and;\r
8197\r
8198 BigInteger.prototype.or = function (n) {\r
8199 return bitwise(this, n, function (a, b) { return a | b; });\r
8200 };\r
8201 SmallInteger.prototype.or = BigInteger.prototype.or;\r
8202\r
8203 BigInteger.prototype.xor = function (n) {\r
8204 return bitwise(this, n, function (a, b) { return a ^ b; });\r
8205 };\r
8206 SmallInteger.prototype.xor = BigInteger.prototype.xor;\r
8207\r
8208 var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;\r
8209 function roughLOB(n) { // get lowestOneBit (rough)\r
8210 // SmallInteger: return Min(lowestOneBit(n), 1 << 30)\r
8211 // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]\r
8212 var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : v[0] + v[1] * BASE | LOBMASK_BI;\r
8213 return x & -x;\r
8214 }\r
8215\r
8216 function integerLogarithm(value, base) {\r
8217 if (base.compareTo(value) <= 0) {\r
8218 var tmp = integerLogarithm(value, base.square(base));\r
8219 var p = tmp.p;\r
8220 var e = tmp.e;\r
8221 var t = p.multiply(base);\r
8222 return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };\r
8223 }\r
8224 return { p: bigInt(1), e: 0 };\r
8225 }\r
8226\r
8227 BigInteger.prototype.bitLength = function () {\r
8228 var n = this;\r
8229 if (n.compareTo(bigInt(0)) < 0) {\r
8230 n = n.negate().subtract(bigInt(1));\r
8231 }\r
8232 if (n.compareTo(bigInt(0)) === 0) {\r
8233 return bigInt(0);\r
8234 }\r
8235 return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\r
8236 }\r
8237 SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\r
8238\r
8239 function max(a, b) {\r
8240 a = parseValue(a);\r
8241 b = parseValue(b);\r
8242 return a.greater(b) ? a : b;\r
8243 }\r
8244 function min(a, b) {\r
8245 a = parseValue(a);\r
8246 b = parseValue(b);\r
8247 return a.lesser(b) ? a : b;\r
8248 }\r
8249 function gcd(a, b) {\r
8250 a = parseValue(a).abs();\r
8251 b = parseValue(b).abs();\r
8252 if (a.equals(b)) return a;\r
8253 if (a.isZero()) return b;\r
8254 if (b.isZero()) return a;\r
8255 var c = Integer[1], d, t;\r
8256 while (a.isEven() && b.isEven()) {\r
8257 d = Math.min(roughLOB(a), roughLOB(b));\r
8258 a = a.divide(d);\r
8259 b = b.divide(d);\r
8260 c = c.multiply(d);\r
8261 }\r
8262 while (a.isEven()) {\r
8263 a = a.divide(roughLOB(a));\r
8264 }\r
8265 do {\r
8266 while (b.isEven()) {\r
8267 b = b.divide(roughLOB(b));\r
8268 }\r
8269 if (a.greater(b)) {\r
8270 t = b; b = a; a = t;\r
8271 }\r
8272 b = b.subtract(a);\r
8273 } while (!b.isZero());\r
8274 return c.isUnit() ? a : a.multiply(c);\r
8275 }\r
8276 function lcm(a, b) {\r
8277 a = parseValue(a).abs();\r
8278 b = parseValue(b).abs();\r
8279 return a.divide(gcd(a, b)).multiply(b);\r
8280 }\r
8281 function randBetween(a, b) {\r
8282 a = parseValue(a);\r
8283 b = parseValue(b);\r
8284 var low = min(a, b), high = max(a, b);\r
8285 var range = high.subtract(low).add(1);\r
8286 if (range.isSmall) return low.add(Math.floor(Math.random() * range));\r
8287 var length = range.value.length - 1;\r
8288 var result = [], restricted = true;\r
8289 for (var i = length; i >= 0; i--) {\r
8290 var top = restricted ? range.value[i] : BASE;\r
8291 var digit = truncate(Math.random() * top);\r
8292 result.unshift(digit);\r
8293 if (digit < top) restricted = false;\r
8294 }\r
8295 result = arrayToSmall(result);\r
8296 return low.add(typeof result === "number" ? new SmallInteger(result) : new BigInteger(result, false));\r
8297 }\r
8298 var parseBase = function (text, base) {\r
8299 var length = text.length;\r
8300 var i;\r
8301 var absBase = Math.abs(base);\r
8302 for (var i = 0; i < length; i++) {\r
8303 var c = text[i].toLowerCase();\r
8304 if (c === "-") continue;\r
8305 if (/[a-z0-9]/.test(c)) {\r
8306 if (/[0-9]/.test(c) && +c >= absBase) {\r
8307 if (c === "1" && absBase === 1) continue;\r
8308 throw new Error(c + " is not a valid digit in base " + base + ".");\r
8309 } else if (c.charCodeAt(0) - 87 >= absBase) {\r
8310 throw new Error(c + " is not a valid digit in base " + base + ".");\r
8311 }\r
8312 }\r
8313 }\r
8314 if (2 <= base && base <= 36) {\r
8315 if (length <= LOG_MAX_INT / Math.log(base)) {\r
8316 var result = parseInt(text, base);\r
8317 if (isNaN(result)) {\r
8318 throw new Error(c + " is not a valid digit in base " + base + ".");\r
8319 }\r
8320 return new SmallInteger(parseInt(text, base));\r
8321 }\r
8322 }\r
8323 base = parseValue(base);\r
8324 var digits = [];\r
8325 var isNegative = text[0] === "-";\r
8326 for (i = isNegative ? 1 : 0; i < text.length; i++) {\r
8327 var c = text[i].toLowerCase(),\r
8328 charCode = c.charCodeAt(0);\r
8329 if (48 <= charCode && charCode <= 57) digits.push(parseValue(c));\r
8330 else if (97 <= charCode && charCode <= 122) digits.push(parseValue(c.charCodeAt(0) - 87));\r
8331 else if (c === "<") {\r
8332 var start = i;\r
8333 do { i++; } while (text[i] !== ">");\r
8334 digits.push(parseValue(text.slice(start + 1, i)));\r
8335 }\r
8336 else throw new Error(c + " is not a valid character");\r
8337 }\r
8338 return parseBaseFromArray(digits, base, isNegative);\r
8339 };\r
8340\r
8341 function parseBaseFromArray(digits, base, isNegative) {\r
8342 var val = Integer[0], pow = Integer[1], i;\r
8343 for (i = digits.length - 1; i >= 0; i--) {\r
8344 val = val.add(digits[i].times(pow));\r
8345 pow = pow.times(base);\r
8346 }\r
8347 return isNegative ? val.negate() : val;\r
8348 }\r
8349\r
8350 function stringify(digit) {\r
8351 if (digit <= 35) {\r
8352 return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(digit);\r
8353 }\r
8354 return "<" + digit + ">";\r
8355 }\r
8356\r
8357 function toBase(n, base) {\r
8358 base = bigInt(base);\r
8359 if (base.isZero()) {\r
8360 if (n.isZero()) return { value: [0], isNegative: false };\r
8361 throw new Error("Cannot convert nonzero numbers to base 0.");\r
8362 }\r
8363 if (base.equals(-1)) {\r
8364 if (n.isZero()) return { value: [0], isNegative: false };\r
8365 if (n.isNegative())\r
8366 return {\r
8367 value: [].concat.apply([], Array.apply(null, Array(-n))\r
8368 .map(Array.prototype.valueOf, [1, 0])\r
8369 ),\r
8370 isNegative: false\r
8371 };\r
8372\r
8373 var arr = Array.apply(null, Array(+n - 1))\r
8374 .map(Array.prototype.valueOf, [0, 1]);\r
8375 arr.unshift([1]);\r
8376 return {\r
8377 value: [].concat.apply([], arr),\r
8378 isNegative: false\r
8379 };\r
8380 }\r
8381\r
8382 var neg = false;\r
8383 if (n.isNegative() && base.isPositive()) {\r
8384 neg = true;\r
8385 n = n.abs();\r
8386 }\r
8387 if (base.equals(1)) {\r
8388 if (n.isZero()) return { value: [0], isNegative: false };\r
8389\r
8390 return {\r
8391 value: Array.apply(null, Array(+n))\r
8392 .map(Number.prototype.valueOf, 1),\r
8393 isNegative: neg\r
8394 };\r
8395 }\r
8396 var out = [];\r
8397 var left = n, divmod;\r
8398 while (left.isNegative() || left.compareAbs(base) >= 0) {\r
8399 divmod = left.divmod(base);\r
8400 left = divmod.quotient;\r
8401 var digit = divmod.remainder;\r
8402 if (digit.isNegative()) {\r
8403 digit = base.minus(digit).abs();\r
8404 left = left.next();\r
8405 }\r
8406 out.push(digit.toJSNumber());\r
8407 }\r
8408 out.push(left.toJSNumber());\r
8409 return { value: out.reverse(), isNegative: neg };\r
8410 }\r
8411\r
8412 function toBaseString(n, base) {\r
8413 var arr = toBase(n, base);\r
8414 return (arr.isNegative ? "-" : "") + arr.value.map(stringify).join('');\r
8415 }\r
8416\r
8417 BigInteger.prototype.toArray = function (radix) {\r
8418 return toBase(this, radix);\r
8419 };\r
8420\r
8421 SmallInteger.prototype.toArray = function (radix) {\r
8422 return toBase(this, radix);\r
8423 };\r
8424\r
8425 BigInteger.prototype.toString = function (radix) {\r
8426 if (radix === undefined) radix = 10;\r
8427 if (radix !== 10) return toBaseString(this, radix);\r
8428 var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;\r
8429 while (--l >= 0) {\r
8430 digit = String(v[l]);\r
8431 str += zeros.slice(digit.length) + digit;\r
8432 }\r
8433 var sign = this.sign ? "-" : "";\r
8434 return sign + str;\r
8435 };\r
8436\r
8437 SmallInteger.prototype.toString = function (radix) {\r
8438 if (radix === undefined) radix = 10;\r
8439 if (radix != 10) return toBaseString(this, radix);\r
8440 return String(this.value);\r
8441 };\r
8442 BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }\r
8443\r
8444 BigInteger.prototype.valueOf = function () {\r
8445 return parseInt(this.toString(), 10);\r
8446 };\r
8447 BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\r
8448\r
8449 SmallInteger.prototype.valueOf = function () {\r
8450 return this.value;\r
8451 };\r
8452 SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\r
8453\r
8454 function parseStringValue(v) {\r
8455 if (isPrecise(+v)) {\r
8456 var x = +v;\r
8457 if (x === truncate(x))\r
8458 return new SmallInteger(x);\r
8459 throw new Error("Invalid integer: " + v);\r
8460 }\r
8461 var sign = v[0] === "-";\r
8462 if (sign) v = v.slice(1);\r
8463 var split = v.split(/e/i);\r
8464 if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));\r
8465 if (split.length === 2) {\r
8466 var exp = split[1];\r
8467 if (exp[0] === "+") exp = exp.slice(1);\r
8468 exp = +exp;\r
8469 if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");\r
8470 var text = split[0];\r
8471 var decimalPlace = text.indexOf(".");\r
8472 if (decimalPlace >= 0) {\r
8473 exp -= text.length - decimalPlace - 1;\r
8474 text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\r
8475 }\r
8476 if (exp < 0) throw new Error("Cannot include negative exponent part for integers");\r
8477 text += (new Array(exp + 1)).join("0");\r
8478 v = text;\r
8479 }\r
8480 var isValid = /^([0-9][0-9]*)$/.test(v);\r
8481 if (!isValid) throw new Error("Invalid integer: " + v);\r
8482 var r = [], max = v.length, l = LOG_BASE, min = max - l;\r
8483 while (max > 0) {\r
8484 r.push(+v.slice(min, max));\r
8485 min -= l;\r
8486 if (min < 0) min = 0;\r
8487 max -= l;\r
8488 }\r
8489 trim(r);\r
8490 return new BigInteger(r, sign);\r
8491 }\r
8492\r
8493 function parseNumberValue(v) {\r
8494 if (isPrecise(v)) {\r
8495 if (v !== truncate(v)) throw new Error(v + " is not an integer.");\r
8496 return new SmallInteger(v);\r
8497 }\r
8498 return parseStringValue(v.toString());\r
8499 }\r
8500\r
8501 function parseValue(v) {\r
8502 if (typeof v === "number") {\r
8503 return parseNumberValue(v);\r
8504 }\r
8505 if (typeof v === "string") {\r
8506 return parseStringValue(v);\r
8507 }\r
8508 return v;\r
8509 }\r
8510 // Pre-define numbers in range [-999,999]\r
8511 for (var i = 0; i < 1000; i++) {\r
8512 Integer[i] = new SmallInteger(i);\r
8513 if (i > 0) Integer[-i] = new SmallInteger(-i);\r
8514 }\r
8515 // Backwards compatibility\r
8516 Integer.one = Integer[1];\r
8517 Integer.zero = Integer[0];\r
8518 Integer.minusOne = Integer[-1];\r
8519 Integer.max = max;\r
8520 Integer.min = min;\r
8521 Integer.gcd = gcd;\r
8522 Integer.lcm = lcm;\r
8523 Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger; };\r
8524 Integer.randBetween = randBetween;\r
8525\r
8526 Integer.fromArray = function (digits, base, isNegative) {\r
8527 return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);\r
8528 };\r
8529\r
8530 return Integer;\r
8531})();\r
8532\r
8533// Node.js check\r
8534if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {\r
8535 module.exports = bigInt;\r
8536}\r
8537\r
8538//amd check\r
8539if (typeof define === "function" && define.amd) {\r
8540 define("big-integer", [], function () {\r
8541 return bigInt;\r
8542 });\r
8543}\r
8544
8545},{}],61:[function(require,module,exports){
8546// (public) Constructor
8547function BigInteger(a, b, c) {
8548 if (!(this instanceof BigInteger))
8549 return new BigInteger(a, b, c)
8550
8551 if (a != null) {
8552 if ("number" == typeof a) this.fromNumber(a, b, c)
8553 else if (b == null && "string" != typeof a) this.fromString(a, 256)
8554 else this.fromString(a, b)
8555 }
8556}
8557
8558var proto = BigInteger.prototype
8559
8560// duck-typed isBigInteger
8561proto.__bigi = require('../package.json').version
8562BigInteger.isBigInteger = function (obj, check_ver) {
8563 return obj && obj.__bigi && (!check_ver || obj.__bigi === proto.__bigi)
8564}
8565
8566// Bits per digit
8567var dbits
8568
8569// am: Compute w_j += (x*this_i), propagate carries,
8570// c is initial carry, returns final carry.
8571// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
8572// We need to select the fastest one that works in this environment.
8573
8574// am1: use a single mult and divide to get the high bits,
8575// max digit bits should be 26 because
8576// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
8577function am1(i, x, w, j, c, n) {
8578 while (--n >= 0) {
8579 var v = x * this[i++] + w[j] + c
8580 c = Math.floor(v / 0x4000000)
8581 w[j++] = v & 0x3ffffff
8582 }
8583 return c
8584}
8585// am2 avoids a big mult-and-extract completely.
8586// Max digit bits should be <= 30 because we do bitwise ops
8587// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
8588function am2(i, x, w, j, c, n) {
8589 var xl = x & 0x7fff,
8590 xh = x >> 15
8591 while (--n >= 0) {
8592 var l = this[i] & 0x7fff
8593 var h = this[i++] >> 15
8594 var m = xh * l + h * xl
8595 l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff)
8596 c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30)
8597 w[j++] = l & 0x3fffffff
8598 }
8599 return c
8600}
8601// Alternately, set max digit bits to 28 since some
8602// browsers slow down when dealing with 32-bit numbers.
8603function am3(i, x, w, j, c, n) {
8604 var xl = x & 0x3fff,
8605 xh = x >> 14
8606 while (--n >= 0) {
8607 var l = this[i] & 0x3fff
8608 var h = this[i++] >> 14
8609 var m = xh * l + h * xl
8610 l = xl * l + ((m & 0x3fff) << 14) + w[j] + c
8611 c = (l >> 28) + (m >> 14) + xh * h
8612 w[j++] = l & 0xfffffff
8613 }
8614 return c
8615}
8616
8617// wtf?
8618BigInteger.prototype.am = am1
8619dbits = 26
8620
8621BigInteger.prototype.DB = dbits
8622BigInteger.prototype.DM = ((1 << dbits) - 1)
8623var DV = BigInteger.prototype.DV = (1 << dbits)
8624
8625var BI_FP = 52
8626BigInteger.prototype.FV = Math.pow(2, BI_FP)
8627BigInteger.prototype.F1 = BI_FP - dbits
8628BigInteger.prototype.F2 = 2 * dbits - BI_FP
8629
8630// Digit conversions
8631var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"
8632var BI_RC = new Array()
8633var rr, vv
8634rr = "0".charCodeAt(0)
8635for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv
8636rr = "a".charCodeAt(0)
8637for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
8638rr = "A".charCodeAt(0)
8639for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
8640
8641function int2char(n) {
8642 return BI_RM.charAt(n)
8643}
8644
8645function intAt(s, i) {
8646 var c = BI_RC[s.charCodeAt(i)]
8647 return (c == null) ? -1 : c
8648}
8649
8650// (protected) copy this to r
8651function bnpCopyTo(r) {
8652 for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]
8653 r.t = this.t
8654 r.s = this.s
8655}
8656
8657// (protected) set from integer value x, -DV <= x < DV
8658function bnpFromInt(x) {
8659 this.t = 1
8660 this.s = (x < 0) ? -1 : 0
8661 if (x > 0) this[0] = x
8662 else if (x < -1) this[0] = x + DV
8663 else this.t = 0
8664}
8665
8666// return bigint initialized to value
8667function nbv(i) {
8668 var r = new BigInteger()
8669 r.fromInt(i)
8670 return r
8671}
8672
8673// (protected) set from string and radix
8674function bnpFromString(s, b) {
8675 var self = this
8676
8677 var k
8678 if (b == 16) k = 4
8679 else if (b == 8) k = 3
8680 else if (b == 256) k = 8; // byte array
8681 else if (b == 2) k = 1
8682 else if (b == 32) k = 5
8683 else if (b == 4) k = 2
8684 else {
8685 self.fromRadix(s, b)
8686 return
8687 }
8688 self.t = 0
8689 self.s = 0
8690 var i = s.length,
8691 mi = false,
8692 sh = 0
8693 while (--i >= 0) {
8694 var x = (k == 8) ? s[i] & 0xff : intAt(s, i)
8695 if (x < 0) {
8696 if (s.charAt(i) == "-") mi = true
8697 continue
8698 }
8699 mi = false
8700 if (sh == 0)
8701 self[self.t++] = x
8702 else if (sh + k > self.DB) {
8703 self[self.t - 1] |= (x & ((1 << (self.DB - sh)) - 1)) << sh
8704 self[self.t++] = (x >> (self.DB - sh))
8705 } else
8706 self[self.t - 1] |= x << sh
8707 sh += k
8708 if (sh >= self.DB) sh -= self.DB
8709 }
8710 if (k == 8 && (s[0] & 0x80) != 0) {
8711 self.s = -1
8712 if (sh > 0) self[self.t - 1] |= ((1 << (self.DB - sh)) - 1) << sh
8713 }
8714 self.clamp()
8715 if (mi) BigInteger.ZERO.subTo(self, self)
8716}
8717
8718// (protected) clamp off excess high words
8719function bnpClamp() {
8720 var c = this.s & this.DM
8721 while (this.t > 0 && this[this.t - 1] == c)--this.t
8722}
8723
8724// (public) return string representation in given radix
8725function bnToString(b) {
8726 var self = this
8727 if (self.s < 0) return "-" + self.negate()
8728 .toString(b)
8729 var k
8730 if (b == 16) k = 4
8731 else if (b == 8) k = 3
8732 else if (b == 2) k = 1
8733 else if (b == 32) k = 5
8734 else if (b == 4) k = 2
8735 else return self.toRadix(b)
8736 var km = (1 << k) - 1,
8737 d, m = false,
8738 r = "",
8739 i = self.t
8740 var p = self.DB - (i * self.DB) % k
8741 if (i-- > 0) {
8742 if (p < self.DB && (d = self[i] >> p) > 0) {
8743 m = true
8744 r = int2char(d)
8745 }
8746 while (i >= 0) {
8747 if (p < k) {
8748 d = (self[i] & ((1 << p) - 1)) << (k - p)
8749 d |= self[--i] >> (p += self.DB - k)
8750 } else {
8751 d = (self[i] >> (p -= k)) & km
8752 if (p <= 0) {
8753 p += self.DB
8754 --i
8755 }
8756 }
8757 if (d > 0) m = true
8758 if (m) r += int2char(d)
8759 }
8760 }
8761 return m ? r : "0"
8762}
8763
8764// (public) -this
8765function bnNegate() {
8766 var r = new BigInteger()
8767 BigInteger.ZERO.subTo(this, r)
8768 return r
8769}
8770
8771// (public) |this|
8772function bnAbs() {
8773 return (this.s < 0) ? this.negate() : this
8774}
8775
8776// (public) return + if this > a, - if this < a, 0 if equal
8777function bnCompareTo(a) {
8778 var r = this.s - a.s
8779 if (r != 0) return r
8780 var i = this.t
8781 r = i - a.t
8782 if (r != 0) return (this.s < 0) ? -r : r
8783 while (--i >= 0)
8784 if ((r = this[i] - a[i]) != 0) return r
8785 return 0
8786}
8787
8788// returns bit length of the integer x
8789function nbits(x) {
8790 var r = 1,
8791 t
8792 if ((t = x >>> 16) != 0) {
8793 x = t
8794 r += 16
8795 }
8796 if ((t = x >> 8) != 0) {
8797 x = t
8798 r += 8
8799 }
8800 if ((t = x >> 4) != 0) {
8801 x = t
8802 r += 4
8803 }
8804 if ((t = x >> 2) != 0) {
8805 x = t
8806 r += 2
8807 }
8808 if ((t = x >> 1) != 0) {
8809 x = t
8810 r += 1
8811 }
8812 return r
8813}
8814
8815// (public) return the number of bits in "this"
8816function bnBitLength() {
8817 if (this.t <= 0) return 0
8818 return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM))
8819}
8820
8821// (public) return the number of bytes in "this"
8822function bnByteLength() {
8823 return this.bitLength() >> 3
8824}
8825
8826// (protected) r = this << n*DB
8827function bnpDLShiftTo(n, r) {
8828 var i
8829 for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]
8830 for (i = n - 1; i >= 0; --i) r[i] = 0
8831 r.t = this.t + n
8832 r.s = this.s
8833}
8834
8835// (protected) r = this >> n*DB
8836function bnpDRShiftTo(n, r) {
8837 for (var i = n; i < this.t; ++i) r[i - n] = this[i]
8838 r.t = Math.max(this.t - n, 0)
8839 r.s = this.s
8840}
8841
8842// (protected) r = this << n
8843function bnpLShiftTo(n, r) {
8844 var self = this
8845 var bs = n % self.DB
8846 var cbs = self.DB - bs
8847 var bm = (1 << cbs) - 1
8848 var ds = Math.floor(n / self.DB),
8849 c = (self.s << bs) & self.DM,
8850 i
8851 for (i = self.t - 1; i >= 0; --i) {
8852 r[i + ds + 1] = (self[i] >> cbs) | c
8853 c = (self[i] & bm) << bs
8854 }
8855 for (i = ds - 1; i >= 0; --i) r[i] = 0
8856 r[ds] = c
8857 r.t = self.t + ds + 1
8858 r.s = self.s
8859 r.clamp()
8860}
8861
8862// (protected) r = this >> n
8863function bnpRShiftTo(n, r) {
8864 var self = this
8865 r.s = self.s
8866 var ds = Math.floor(n / self.DB)
8867 if (ds >= self.t) {
8868 r.t = 0
8869 return
8870 }
8871 var bs = n % self.DB
8872 var cbs = self.DB - bs
8873 var bm = (1 << bs) - 1
8874 r[0] = self[ds] >> bs
8875 for (var i = ds + 1; i < self.t; ++i) {
8876 r[i - ds - 1] |= (self[i] & bm) << cbs
8877 r[i - ds] = self[i] >> bs
8878 }
8879 if (bs > 0) r[self.t - ds - 1] |= (self.s & bm) << cbs
8880 r.t = self.t - ds
8881 r.clamp()
8882}
8883
8884// (protected) r = this - a
8885function bnpSubTo(a, r) {
8886 var self = this
8887 var i = 0,
8888 c = 0,
8889 m = Math.min(a.t, self.t)
8890 while (i < m) {
8891 c += self[i] - a[i]
8892 r[i++] = c & self.DM
8893 c >>= self.DB
8894 }
8895 if (a.t < self.t) {
8896 c -= a.s
8897 while (i < self.t) {
8898 c += self[i]
8899 r[i++] = c & self.DM
8900 c >>= self.DB
8901 }
8902 c += self.s
8903 } else {
8904 c += self.s
8905 while (i < a.t) {
8906 c -= a[i]
8907 r[i++] = c & self.DM
8908 c >>= self.DB
8909 }
8910 c -= a.s
8911 }
8912 r.s = (c < 0) ? -1 : 0
8913 if (c < -1) r[i++] = self.DV + c
8914 else if (c > 0) r[i++] = c
8915 r.t = i
8916 r.clamp()
8917}
8918
8919// (protected) r = this * a, r != this,a (HAC 14.12)
8920// "this" should be the larger one if appropriate.
8921function bnpMultiplyTo(a, r) {
8922 var x = this.abs(),
8923 y = a.abs()
8924 var i = x.t
8925 r.t = i + y.t
8926 while (--i >= 0) r[i] = 0
8927 for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t)
8928 r.s = 0
8929 r.clamp()
8930 if (this.s != a.s) BigInteger.ZERO.subTo(r, r)
8931}
8932
8933// (protected) r = this^2, r != this (HAC 14.16)
8934function bnpSquareTo(r) {
8935 var x = this.abs()
8936 var i = r.t = 2 * x.t
8937 while (--i >= 0) r[i] = 0
8938 for (i = 0; i < x.t - 1; ++i) {
8939 var c = x.am(i, x[i], r, 2 * i, 0, 1)
8940 if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
8941 r[i + x.t] -= x.DV
8942 r[i + x.t + 1] = 1
8943 }
8944 }
8945 if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1)
8946 r.s = 0
8947 r.clamp()
8948}
8949
8950// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
8951// r != q, this != m. q or r may be null.
8952function bnpDivRemTo(m, q, r) {
8953 var self = this
8954 var pm = m.abs()
8955 if (pm.t <= 0) return
8956 var pt = self.abs()
8957 if (pt.t < pm.t) {
8958 if (q != null) q.fromInt(0)
8959 if (r != null) self.copyTo(r)
8960 return
8961 }
8962 if (r == null) r = new BigInteger()
8963 var y = new BigInteger(),
8964 ts = self.s,
8965 ms = m.s
8966 var nsh = self.DB - nbits(pm[pm.t - 1]); // normalize modulus
8967 if (nsh > 0) {
8968 pm.lShiftTo(nsh, y)
8969 pt.lShiftTo(nsh, r)
8970 } else {
8971 pm.copyTo(y)
8972 pt.copyTo(r)
8973 }
8974 var ys = y.t
8975 var y0 = y[ys - 1]
8976 if (y0 == 0) return
8977 var yt = y0 * (1 << self.F1) + ((ys > 1) ? y[ys - 2] >> self.F2 : 0)
8978 var d1 = self.FV / yt,
8979 d2 = (1 << self.F1) / yt,
8980 e = 1 << self.F2
8981 var i = r.t,
8982 j = i - ys,
8983 t = (q == null) ? new BigInteger() : q
8984 y.dlShiftTo(j, t)
8985 if (r.compareTo(t) >= 0) {
8986 r[r.t++] = 1
8987 r.subTo(t, r)
8988 }
8989 BigInteger.ONE.dlShiftTo(ys, t)
8990 t.subTo(y, y); // "negative" y so we can replace sub with am later
8991 while (y.t < ys) y[y.t++] = 0
8992 while (--j >= 0) {
8993 // Estimate quotient digit
8994 var qd = (r[--i] == y0) ? self.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2)
8995 if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out
8996 y.dlShiftTo(j, t)
8997 r.subTo(t, r)
8998 while (r[i] < --qd) r.subTo(t, r)
8999 }
9000 }
9001 if (q != null) {
9002 r.drShiftTo(ys, q)
9003 if (ts != ms) BigInteger.ZERO.subTo(q, q)
9004 }
9005 r.t = ys
9006 r.clamp()
9007 if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder
9008 if (ts < 0) BigInteger.ZERO.subTo(r, r)
9009}
9010
9011// (public) this mod a
9012function bnMod(a) {
9013 var r = new BigInteger()
9014 this.abs()
9015 .divRemTo(a, null, r)
9016 if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r)
9017 return r
9018}
9019
9020// Modular reduction using "classic" algorithm
9021function Classic(m) {
9022 this.m = m
9023}
9024
9025function cConvert(x) {
9026 if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m)
9027 else return x
9028}
9029
9030function cRevert(x) {
9031 return x
9032}
9033
9034function cReduce(x) {
9035 x.divRemTo(this.m, null, x)
9036}
9037
9038function cMulTo(x, y, r) {
9039 x.multiplyTo(y, r)
9040 this.reduce(r)
9041}
9042
9043function cSqrTo(x, r) {
9044 x.squareTo(r)
9045 this.reduce(r)
9046}
9047
9048Classic.prototype.convert = cConvert
9049Classic.prototype.revert = cRevert
9050Classic.prototype.reduce = cReduce
9051Classic.prototype.mulTo = cMulTo
9052Classic.prototype.sqrTo = cSqrTo
9053
9054// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
9055// justification:
9056// xy == 1 (mod m)
9057// xy = 1+km
9058// xy(2-xy) = (1+km)(1-km)
9059// x[y(2-xy)] = 1-k^2m^2
9060// x[y(2-xy)] == 1 (mod m^2)
9061// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
9062// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
9063// JS multiply "overflows" differently from C/C++, so care is needed here.
9064function bnpInvDigit() {
9065 if (this.t < 1) return 0
9066 var x = this[0]
9067 if ((x & 1) == 0) return 0
9068 var y = x & 3; // y == 1/x mod 2^2
9069 y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4
9070 y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8
9071 y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
9072 // last step - calculate inverse mod DV directly
9073 // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
9074 y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits
9075 // we really want the negative inverse, and -DV < y < DV
9076 return (y > 0) ? this.DV - y : -y
9077}
9078
9079// Montgomery reduction
9080function Montgomery(m) {
9081 this.m = m
9082 this.mp = m.invDigit()
9083 this.mpl = this.mp & 0x7fff
9084 this.mph = this.mp >> 15
9085 this.um = (1 << (m.DB - 15)) - 1
9086 this.mt2 = 2 * m.t
9087}
9088
9089// xR mod m
9090function montConvert(x) {
9091 var r = new BigInteger()
9092 x.abs()
9093 .dlShiftTo(this.m.t, r)
9094 r.divRemTo(this.m, null, r)
9095 if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r)
9096 return r
9097}
9098
9099// x/R mod m
9100function montRevert(x) {
9101 var r = new BigInteger()
9102 x.copyTo(r)
9103 this.reduce(r)
9104 return r
9105}
9106
9107// x = x/R mod m (HAC 14.32)
9108function montReduce(x) {
9109 while (x.t <= this.mt2) // pad x so am has enough room later
9110 x[x.t++] = 0
9111 for (var i = 0; i < this.m.t; ++i) {
9112 // faster way of calculating u0 = x[i]*mp mod DV
9113 var j = x[i] & 0x7fff
9114 var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM
9115 // use am to combine the multiply-shift-add into one call
9116 j = i + this.m.t
9117 x[j] += this.m.am(0, u0, x, i, 0, this.m.t)
9118 // propagate carry
9119 while (x[j] >= x.DV) {
9120 x[j] -= x.DV
9121 x[++j]++
9122 }
9123 }
9124 x.clamp()
9125 x.drShiftTo(this.m.t, x)
9126 if (x.compareTo(this.m) >= 0) x.subTo(this.m, x)
9127}
9128
9129// r = "x^2/R mod m"; x != r
9130function montSqrTo(x, r) {
9131 x.squareTo(r)
9132 this.reduce(r)
9133}
9134
9135// r = "xy/R mod m"; x,y != r
9136function montMulTo(x, y, r) {
9137 x.multiplyTo(y, r)
9138 this.reduce(r)
9139}
9140
9141Montgomery.prototype.convert = montConvert
9142Montgomery.prototype.revert = montRevert
9143Montgomery.prototype.reduce = montReduce
9144Montgomery.prototype.mulTo = montMulTo
9145Montgomery.prototype.sqrTo = montSqrTo
9146
9147// (protected) true iff this is even
9148function bnpIsEven() {
9149 return ((this.t > 0) ? (this[0] & 1) : this.s) == 0
9150}
9151
9152// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
9153function bnpExp(e, z) {
9154 if (e > 0xffffffff || e < 1) return BigInteger.ONE
9155 var r = new BigInteger(),
9156 r2 = new BigInteger(),
9157 g = z.convert(this),
9158 i = nbits(e) - 1
9159 g.copyTo(r)
9160 while (--i >= 0) {
9161 z.sqrTo(r, r2)
9162 if ((e & (1 << i)) > 0) z.mulTo(r2, g, r)
9163 else {
9164 var t = r
9165 r = r2
9166 r2 = t
9167 }
9168 }
9169 return z.revert(r)
9170}
9171
9172// (public) this^e % m, 0 <= e < 2^32
9173function bnModPowInt(e, m) {
9174 var z
9175 if (e < 256 || m.isEven()) z = new Classic(m)
9176 else z = new Montgomery(m)
9177 return this.exp(e, z)
9178}
9179
9180// protected
9181proto.copyTo = bnpCopyTo
9182proto.fromInt = bnpFromInt
9183proto.fromString = bnpFromString
9184proto.clamp = bnpClamp
9185proto.dlShiftTo = bnpDLShiftTo
9186proto.drShiftTo = bnpDRShiftTo
9187proto.lShiftTo = bnpLShiftTo
9188proto.rShiftTo = bnpRShiftTo
9189proto.subTo = bnpSubTo
9190proto.multiplyTo = bnpMultiplyTo
9191proto.squareTo = bnpSquareTo
9192proto.divRemTo = bnpDivRemTo
9193proto.invDigit = bnpInvDigit
9194proto.isEven = bnpIsEven
9195proto.exp = bnpExp
9196
9197// public
9198proto.toString = bnToString
9199proto.negate = bnNegate
9200proto.abs = bnAbs
9201proto.compareTo = bnCompareTo
9202proto.bitLength = bnBitLength
9203proto.byteLength = bnByteLength
9204proto.mod = bnMod
9205proto.modPowInt = bnModPowInt
9206
9207// (public)
9208function bnClone() {
9209 var r = new BigInteger()
9210 this.copyTo(r)
9211 return r
9212}
9213
9214// (public) return value as integer
9215function bnIntValue() {
9216 if (this.s < 0) {
9217 if (this.t == 1) return this[0] - this.DV
9218 else if (this.t == 0) return -1
9219 } else if (this.t == 1) return this[0]
9220 else if (this.t == 0) return 0
9221 // assumes 16 < DB < 32
9222 return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]
9223}
9224
9225// (public) return value as byte
9226function bnByteValue() {
9227 return (this.t == 0) ? this.s : (this[0] << 24) >> 24
9228}
9229
9230// (public) return value as short (assumes DB>=16)
9231function bnShortValue() {
9232 return (this.t == 0) ? this.s : (this[0] << 16) >> 16
9233}
9234
9235// (protected) return x s.t. r^x < DV
9236function bnpChunkSize(r) {
9237 return Math.floor(Math.LN2 * this.DB / Math.log(r))
9238}
9239
9240// (public) 0 if this == 0, 1 if this > 0
9241function bnSigNum() {
9242 if (this.s < 0) return -1
9243 else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0
9244 else return 1
9245}
9246
9247// (protected) convert to radix string
9248function bnpToRadix(b) {
9249 if (b == null) b = 10
9250 if (this.signum() == 0 || b < 2 || b > 36) return "0"
9251 var cs = this.chunkSize(b)
9252 var a = Math.pow(b, cs)
9253 var d = nbv(a),
9254 y = new BigInteger(),
9255 z = new BigInteger(),
9256 r = ""
9257 this.divRemTo(d, y, z)
9258 while (y.signum() > 0) {
9259 r = (a + z.intValue())
9260 .toString(b)
9261 .substr(1) + r
9262 y.divRemTo(d, y, z)
9263 }
9264 return z.intValue()
9265 .toString(b) + r
9266}
9267
9268// (protected) convert from radix string
9269function bnpFromRadix(s, b) {
9270 var self = this
9271 self.fromInt(0)
9272 if (b == null) b = 10
9273 var cs = self.chunkSize(b)
9274 var d = Math.pow(b, cs),
9275 mi = false,
9276 j = 0,
9277 w = 0
9278 for (var i = 0; i < s.length; ++i) {
9279 var x = intAt(s, i)
9280 if (x < 0) {
9281 if (s.charAt(i) == "-" && self.signum() == 0) mi = true
9282 continue
9283 }
9284 w = b * w + x
9285 if (++j >= cs) {
9286 self.dMultiply(d)
9287 self.dAddOffset(w, 0)
9288 j = 0
9289 w = 0
9290 }
9291 }
9292 if (j > 0) {
9293 self.dMultiply(Math.pow(b, j))
9294 self.dAddOffset(w, 0)
9295 }
9296 if (mi) BigInteger.ZERO.subTo(self, self)
9297}
9298
9299// (protected) alternate constructor
9300function bnpFromNumber(a, b, c) {
9301 var self = this
9302 if ("number" == typeof b) {
9303 // new BigInteger(int,int,RNG)
9304 if (a < 2) self.fromInt(1)
9305 else {
9306 self.fromNumber(a, c)
9307 if (!self.testBit(a - 1)) // force MSB set
9308 self.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, self)
9309 if (self.isEven()) self.dAddOffset(1, 0); // force odd
9310 while (!self.isProbablePrime(b)) {
9311 self.dAddOffset(2, 0)
9312 if (self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a - 1), self)
9313 }
9314 }
9315 } else {
9316 // new BigInteger(int,RNG)
9317 var x = new Array(),
9318 t = a & 7
9319 x.length = (a >> 3) + 1
9320 b.nextBytes(x)
9321 if (t > 0) x[0] &= ((1 << t) - 1)
9322 else x[0] = 0
9323 self.fromString(x, 256)
9324 }
9325}
9326
9327// (public) convert to bigendian byte array
9328function bnToByteArray() {
9329 var self = this
9330 var i = self.t,
9331 r = new Array()
9332 r[0] = self.s
9333 var p = self.DB - (i * self.DB) % 8,
9334 d, k = 0
9335 if (i-- > 0) {
9336 if (p < self.DB && (d = self[i] >> p) != (self.s & self.DM) >> p)
9337 r[k++] = d | (self.s << (self.DB - p))
9338 while (i >= 0) {
9339 if (p < 8) {
9340 d = (self[i] & ((1 << p) - 1)) << (8 - p)
9341 d |= self[--i] >> (p += self.DB - 8)
9342 } else {
9343 d = (self[i] >> (p -= 8)) & 0xff
9344 if (p <= 0) {
9345 p += self.DB
9346 --i
9347 }
9348 }
9349 if ((d & 0x80) != 0) d |= -256
9350 if (k === 0 && (self.s & 0x80) != (d & 0x80))++k
9351 if (k > 0 || d != self.s) r[k++] = d
9352 }
9353 }
9354 return r
9355}
9356
9357function bnEquals(a) {
9358 return (this.compareTo(a) == 0)
9359}
9360
9361function bnMin(a) {
9362 return (this.compareTo(a) < 0) ? this : a
9363}
9364
9365function bnMax(a) {
9366 return (this.compareTo(a) > 0) ? this : a
9367}
9368
9369// (protected) r = this op a (bitwise)
9370function bnpBitwiseTo(a, op, r) {
9371 var self = this
9372 var i, f, m = Math.min(a.t, self.t)
9373 for (i = 0; i < m; ++i) r[i] = op(self[i], a[i])
9374 if (a.t < self.t) {
9375 f = a.s & self.DM
9376 for (i = m; i < self.t; ++i) r[i] = op(self[i], f)
9377 r.t = self.t
9378 } else {
9379 f = self.s & self.DM
9380 for (i = m; i < a.t; ++i) r[i] = op(f, a[i])
9381 r.t = a.t
9382 }
9383 r.s = op(self.s, a.s)
9384 r.clamp()
9385}
9386
9387// (public) this & a
9388function op_and(x, y) {
9389 return x & y
9390}
9391
9392function bnAnd(a) {
9393 var r = new BigInteger()
9394 this.bitwiseTo(a, op_and, r)
9395 return r
9396}
9397
9398// (public) this | a
9399function op_or(x, y) {
9400 return x | y
9401}
9402
9403function bnOr(a) {
9404 var r = new BigInteger()
9405 this.bitwiseTo(a, op_or, r)
9406 return r
9407}
9408
9409// (public) this ^ a
9410function op_xor(x, y) {
9411 return x ^ y
9412}
9413
9414function bnXor(a) {
9415 var r = new BigInteger()
9416 this.bitwiseTo(a, op_xor, r)
9417 return r
9418}
9419
9420// (public) this & ~a
9421function op_andnot(x, y) {
9422 return x & ~y
9423}
9424
9425function bnAndNot(a) {
9426 var r = new BigInteger()
9427 this.bitwiseTo(a, op_andnot, r)
9428 return r
9429}
9430
9431// (public) ~this
9432function bnNot() {
9433 var r = new BigInteger()
9434 for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]
9435 r.t = this.t
9436 r.s = ~this.s
9437 return r
9438}
9439
9440// (public) this << n
9441function bnShiftLeft(n) {
9442 var r = new BigInteger()
9443 if (n < 0) this.rShiftTo(-n, r)
9444 else this.lShiftTo(n, r)
9445 return r
9446}
9447
9448// (public) this >> n
9449function bnShiftRight(n) {
9450 var r = new BigInteger()
9451 if (n < 0) this.lShiftTo(-n, r)
9452 else this.rShiftTo(n, r)
9453 return r
9454}
9455
9456// return index of lowest 1-bit in x, x < 2^31
9457function lbit(x) {
9458 if (x == 0) return -1
9459 var r = 0
9460 if ((x & 0xffff) == 0) {
9461 x >>= 16
9462 r += 16
9463 }
9464 if ((x & 0xff) == 0) {
9465 x >>= 8
9466 r += 8
9467 }
9468 if ((x & 0xf) == 0) {
9469 x >>= 4
9470 r += 4
9471 }
9472 if ((x & 3) == 0) {
9473 x >>= 2
9474 r += 2
9475 }
9476 if ((x & 1) == 0)++r
9477 return r
9478}
9479
9480// (public) returns index of lowest 1-bit (or -1 if none)
9481function bnGetLowestSetBit() {
9482 for (var i = 0; i < this.t; ++i)
9483 if (this[i] != 0) return i * this.DB + lbit(this[i])
9484 if (this.s < 0) return this.t * this.DB
9485 return -1
9486}
9487
9488// return number of 1 bits in x
9489function cbit(x) {
9490 var r = 0
9491 while (x != 0) {
9492 x &= x - 1
9493 ++r
9494 }
9495 return r
9496}
9497
9498// (public) return number of set bits
9499function bnBitCount() {
9500 var r = 0,
9501 x = this.s & this.DM
9502 for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x)
9503 return r
9504}
9505
9506// (public) true iff nth bit is set
9507function bnTestBit(n) {
9508 var j = Math.floor(n / this.DB)
9509 if (j >= this.t) return (this.s != 0)
9510 return ((this[j] & (1 << (n % this.DB))) != 0)
9511}
9512
9513// (protected) this op (1<<n)
9514function bnpChangeBit(n, op) {
9515 var r = BigInteger.ONE.shiftLeft(n)
9516 this.bitwiseTo(r, op, r)
9517 return r
9518}
9519
9520// (public) this | (1<<n)
9521function bnSetBit(n) {
9522 return this.changeBit(n, op_or)
9523}
9524
9525// (public) this & ~(1<<n)
9526function bnClearBit(n) {
9527 return this.changeBit(n, op_andnot)
9528}
9529
9530// (public) this ^ (1<<n)
9531function bnFlipBit(n) {
9532 return this.changeBit(n, op_xor)
9533}
9534
9535// (protected) r = this + a
9536function bnpAddTo(a, r) {
9537 var self = this
9538
9539 var i = 0,
9540 c = 0,
9541 m = Math.min(a.t, self.t)
9542 while (i < m) {
9543 c += self[i] + a[i]
9544 r[i++] = c & self.DM
9545 c >>= self.DB
9546 }
9547 if (a.t < self.t) {
9548 c += a.s
9549 while (i < self.t) {
9550 c += self[i]
9551 r[i++] = c & self.DM
9552 c >>= self.DB
9553 }
9554 c += self.s
9555 } else {
9556 c += self.s
9557 while (i < a.t) {
9558 c += a[i]
9559 r[i++] = c & self.DM
9560 c >>= self.DB
9561 }
9562 c += a.s
9563 }
9564 r.s = (c < 0) ? -1 : 0
9565 if (c > 0) r[i++] = c
9566 else if (c < -1) r[i++] = self.DV + c
9567 r.t = i
9568 r.clamp()
9569}
9570
9571// (public) this + a
9572function bnAdd(a) {
9573 var r = new BigInteger()
9574 this.addTo(a, r)
9575 return r
9576}
9577
9578// (public) this - a
9579function bnSubtract(a) {
9580 var r = new BigInteger()
9581 this.subTo(a, r)
9582 return r
9583}
9584
9585// (public) this * a
9586function bnMultiply(a) {
9587 var r = new BigInteger()
9588 this.multiplyTo(a, r)
9589 return r
9590}
9591
9592// (public) this^2
9593function bnSquare() {
9594 var r = new BigInteger()
9595 this.squareTo(r)
9596 return r
9597}
9598
9599// (public) this / a
9600function bnDivide(a) {
9601 var r = new BigInteger()
9602 this.divRemTo(a, r, null)
9603 return r
9604}
9605
9606// (public) this % a
9607function bnRemainder(a) {
9608 var r = new BigInteger()
9609 this.divRemTo(a, null, r)
9610 return r
9611}
9612
9613// (public) [this/a,this%a]
9614function bnDivideAndRemainder(a) {
9615 var q = new BigInteger(),
9616 r = new BigInteger()
9617 this.divRemTo(a, q, r)
9618 return new Array(q, r)
9619}
9620
9621// (protected) this *= n, this >= 0, 1 < n < DV
9622function bnpDMultiply(n) {
9623 this[this.t] = this.am(0, n - 1, this, 0, 0, this.t)
9624 ++this.t
9625 this.clamp()
9626}
9627
9628// (protected) this += n << w words, this >= 0
9629function bnpDAddOffset(n, w) {
9630 if (n == 0) return
9631 while (this.t <= w) this[this.t++] = 0
9632 this[w] += n
9633 while (this[w] >= this.DV) {
9634 this[w] -= this.DV
9635 if (++w >= this.t) this[this.t++] = 0
9636 ++this[w]
9637 }
9638}
9639
9640// A "null" reducer
9641function NullExp() {}
9642
9643function nNop(x) {
9644 return x
9645}
9646
9647function nMulTo(x, y, r) {
9648 x.multiplyTo(y, r)
9649}
9650
9651function nSqrTo(x, r) {
9652 x.squareTo(r)
9653}
9654
9655NullExp.prototype.convert = nNop
9656NullExp.prototype.revert = nNop
9657NullExp.prototype.mulTo = nMulTo
9658NullExp.prototype.sqrTo = nSqrTo
9659
9660// (public) this^e
9661function bnPow(e) {
9662 return this.exp(e, new NullExp())
9663}
9664
9665// (protected) r = lower n words of "this * a", a.t <= n
9666// "this" should be the larger one if appropriate.
9667function bnpMultiplyLowerTo(a, n, r) {
9668 var i = Math.min(this.t + a.t, n)
9669 r.s = 0; // assumes a,this >= 0
9670 r.t = i
9671 while (i > 0) r[--i] = 0
9672 var j
9673 for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t)
9674 for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i)
9675 r.clamp()
9676}
9677
9678// (protected) r = "this * a" without lower n words, n > 0
9679// "this" should be the larger one if appropriate.
9680function bnpMultiplyUpperTo(a, n, r) {
9681 --n
9682 var i = r.t = this.t + a.t - n
9683 r.s = 0; // assumes a,this >= 0
9684 while (--i >= 0) r[i] = 0
9685 for (i = Math.max(n - this.t, 0); i < a.t; ++i)
9686 r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n)
9687 r.clamp()
9688 r.drShiftTo(1, r)
9689}
9690
9691// Barrett modular reduction
9692function Barrett(m) {
9693 // setup Barrett
9694 this.r2 = new BigInteger()
9695 this.q3 = new BigInteger()
9696 BigInteger.ONE.dlShiftTo(2 * m.t, this.r2)
9697 this.mu = this.r2.divide(m)
9698 this.m = m
9699}
9700
9701function barrettConvert(x) {
9702 if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m)
9703 else if (x.compareTo(this.m) < 0) return x
9704 else {
9705 var r = new BigInteger()
9706 x.copyTo(r)
9707 this.reduce(r)
9708 return r
9709 }
9710}
9711
9712function barrettRevert(x) {
9713 return x
9714}
9715
9716// x = x mod m (HAC 14.42)
9717function barrettReduce(x) {
9718 var self = this
9719 x.drShiftTo(self.m.t - 1, self.r2)
9720 if (x.t > self.m.t + 1) {
9721 x.t = self.m.t + 1
9722 x.clamp()
9723 }
9724 self.mu.multiplyUpperTo(self.r2, self.m.t + 1, self.q3)
9725 self.m.multiplyLowerTo(self.q3, self.m.t + 1, self.r2)
9726 while (x.compareTo(self.r2) < 0) x.dAddOffset(1, self.m.t + 1)
9727 x.subTo(self.r2, x)
9728 while (x.compareTo(self.m) >= 0) x.subTo(self.m, x)
9729}
9730
9731// r = x^2 mod m; x != r
9732function barrettSqrTo(x, r) {
9733 x.squareTo(r)
9734 this.reduce(r)
9735}
9736
9737// r = x*y mod m; x,y != r
9738function barrettMulTo(x, y, r) {
9739 x.multiplyTo(y, r)
9740 this.reduce(r)
9741}
9742
9743Barrett.prototype.convert = barrettConvert
9744Barrett.prototype.revert = barrettRevert
9745Barrett.prototype.reduce = barrettReduce
9746Barrett.prototype.mulTo = barrettMulTo
9747Barrett.prototype.sqrTo = barrettSqrTo
9748
9749// (public) this^e % m (HAC 14.85)
9750function bnModPow(e, m) {
9751 var i = e.bitLength(),
9752 k, r = nbv(1),
9753 z
9754 if (i <= 0) return r
9755 else if (i < 18) k = 1
9756 else if (i < 48) k = 3
9757 else if (i < 144) k = 4
9758 else if (i < 768) k = 5
9759 else k = 6
9760 if (i < 8)
9761 z = new Classic(m)
9762 else if (m.isEven())
9763 z = new Barrett(m)
9764 else
9765 z = new Montgomery(m)
9766
9767 // precomputation
9768 var g = new Array(),
9769 n = 3,
9770 k1 = k - 1,
9771 km = (1 << k) - 1
9772 g[1] = z.convert(this)
9773 if (k > 1) {
9774 var g2 = new BigInteger()
9775 z.sqrTo(g[1], g2)
9776 while (n <= km) {
9777 g[n] = new BigInteger()
9778 z.mulTo(g2, g[n - 2], g[n])
9779 n += 2
9780 }
9781 }
9782
9783 var j = e.t - 1,
9784 w, is1 = true,
9785 r2 = new BigInteger(),
9786 t
9787 i = nbits(e[j]) - 1
9788 while (j >= 0) {
9789 if (i >= k1) w = (e[j] >> (i - k1)) & km
9790 else {
9791 w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)
9792 if (j > 0) w |= e[j - 1] >> (this.DB + i - k1)
9793 }
9794
9795 n = k
9796 while ((w & 1) == 0) {
9797 w >>= 1
9798 --n
9799 }
9800 if ((i -= n) < 0) {
9801 i += this.DB
9802 --j
9803 }
9804 if (is1) { // ret == 1, don't bother squaring or multiplying it
9805 g[w].copyTo(r)
9806 is1 = false
9807 } else {
9808 while (n > 1) {
9809 z.sqrTo(r, r2)
9810 z.sqrTo(r2, r)
9811 n -= 2
9812 }
9813 if (n > 0) z.sqrTo(r, r2)
9814 else {
9815 t = r
9816 r = r2
9817 r2 = t
9818 }
9819 z.mulTo(r2, g[w], r)
9820 }
9821
9822 while (j >= 0 && (e[j] & (1 << i)) == 0) {
9823 z.sqrTo(r, r2)
9824 t = r
9825 r = r2
9826 r2 = t
9827 if (--i < 0) {
9828 i = this.DB - 1
9829 --j
9830 }
9831 }
9832 }
9833 return z.revert(r)
9834}
9835
9836// (public) gcd(this,a) (HAC 14.54)
9837function bnGCD(a) {
9838 var x = (this.s < 0) ? this.negate() : this.clone()
9839 var y = (a.s < 0) ? a.negate() : a.clone()
9840 if (x.compareTo(y) < 0) {
9841 var t = x
9842 x = y
9843 y = t
9844 }
9845 var i = x.getLowestSetBit(),
9846 g = y.getLowestSetBit()
9847 if (g < 0) return x
9848 if (i < g) g = i
9849 if (g > 0) {
9850 x.rShiftTo(g, x)
9851 y.rShiftTo(g, y)
9852 }
9853 while (x.signum() > 0) {
9854 if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x)
9855 if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y)
9856 if (x.compareTo(y) >= 0) {
9857 x.subTo(y, x)
9858 x.rShiftTo(1, x)
9859 } else {
9860 y.subTo(x, y)
9861 y.rShiftTo(1, y)
9862 }
9863 }
9864 if (g > 0) y.lShiftTo(g, y)
9865 return y
9866}
9867
9868// (protected) this % n, n < 2^26
9869function bnpModInt(n) {
9870 if (n <= 0) return 0
9871 var d = this.DV % n,
9872 r = (this.s < 0) ? n - 1 : 0
9873 if (this.t > 0)
9874 if (d == 0) r = this[0] % n
9875 else
9876 for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n
9877 return r
9878}
9879
9880// (public) 1/this % m (HAC 14.61)
9881function bnModInverse(m) {
9882 var ac = m.isEven()
9883 if (this.signum() === 0) throw new Error('division by zero')
9884 if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO
9885 var u = m.clone(),
9886 v = this.clone()
9887 var a = nbv(1),
9888 b = nbv(0),
9889 c = nbv(0),
9890 d = nbv(1)
9891 while (u.signum() != 0) {
9892 while (u.isEven()) {
9893 u.rShiftTo(1, u)
9894 if (ac) {
9895 if (!a.isEven() || !b.isEven()) {
9896 a.addTo(this, a)
9897 b.subTo(m, b)
9898 }
9899 a.rShiftTo(1, a)
9900 } else if (!b.isEven()) b.subTo(m, b)
9901 b.rShiftTo(1, b)
9902 }
9903 while (v.isEven()) {
9904 v.rShiftTo(1, v)
9905 if (ac) {
9906 if (!c.isEven() || !d.isEven()) {
9907 c.addTo(this, c)
9908 d.subTo(m, d)
9909 }
9910 c.rShiftTo(1, c)
9911 } else if (!d.isEven()) d.subTo(m, d)
9912 d.rShiftTo(1, d)
9913 }
9914 if (u.compareTo(v) >= 0) {
9915 u.subTo(v, u)
9916 if (ac) a.subTo(c, a)
9917 b.subTo(d, b)
9918 } else {
9919 v.subTo(u, v)
9920 if (ac) c.subTo(a, c)
9921 d.subTo(b, d)
9922 }
9923 }
9924 if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO
9925 while (d.compareTo(m) >= 0) d.subTo(m, d)
9926 while (d.signum() < 0) d.addTo(m, d)
9927 return d
9928}
9929
9930var lowprimes = [
9931 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
9932 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
9933 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
9934 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
9935 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
9936 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
9937 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,
9938 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
9939 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,
9940 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
9941 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997
9942]
9943
9944var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]
9945
9946// (public) test primality with certainty >= 1-.5^t
9947function bnIsProbablePrime(t) {
9948 var i, x = this.abs()
9949 if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
9950 for (i = 0; i < lowprimes.length; ++i)
9951 if (x[0] == lowprimes[i]) return true
9952 return false
9953 }
9954 if (x.isEven()) return false
9955 i = 1
9956 while (i < lowprimes.length) {
9957 var m = lowprimes[i],
9958 j = i + 1
9959 while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]
9960 m = x.modInt(m)
9961 while (i < j) if (m % lowprimes[i++] == 0) return false
9962 }
9963 return x.millerRabin(t)
9964}
9965
9966// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
9967function bnpMillerRabin(t) {
9968 var n1 = this.subtract(BigInteger.ONE)
9969 var k = n1.getLowestSetBit()
9970 if (k <= 0) return false
9971 var r = n1.shiftRight(k)
9972 t = (t + 1) >> 1
9973 if (t > lowprimes.length) t = lowprimes.length
9974 var a = new BigInteger(null)
9975 var j, bases = []
9976 for (var i = 0; i < t; ++i) {
9977 for (;;) {
9978 j = lowprimes[Math.floor(Math.random() * lowprimes.length)]
9979 if (bases.indexOf(j) == -1) break
9980 }
9981 bases.push(j)
9982 a.fromInt(j)
9983 var y = a.modPow(r, this)
9984 if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
9985 var j = 1
9986 while (j++ < k && y.compareTo(n1) != 0) {
9987 y = y.modPowInt(2, this)
9988 if (y.compareTo(BigInteger.ONE) == 0) return false
9989 }
9990 if (y.compareTo(n1) != 0) return false
9991 }
9992 }
9993 return true
9994}
9995
9996// protected
9997proto.chunkSize = bnpChunkSize
9998proto.toRadix = bnpToRadix
9999proto.fromRadix = bnpFromRadix
10000proto.fromNumber = bnpFromNumber
10001proto.bitwiseTo = bnpBitwiseTo
10002proto.changeBit = bnpChangeBit
10003proto.addTo = bnpAddTo
10004proto.dMultiply = bnpDMultiply
10005proto.dAddOffset = bnpDAddOffset
10006proto.multiplyLowerTo = bnpMultiplyLowerTo
10007proto.multiplyUpperTo = bnpMultiplyUpperTo
10008proto.modInt = bnpModInt
10009proto.millerRabin = bnpMillerRabin
10010
10011// public
10012proto.clone = bnClone
10013proto.intValue = bnIntValue
10014proto.byteValue = bnByteValue
10015proto.shortValue = bnShortValue
10016proto.signum = bnSigNum
10017proto.toByteArray = bnToByteArray
10018proto.equals = bnEquals
10019proto.min = bnMin
10020proto.max = bnMax
10021proto.and = bnAnd
10022proto.or = bnOr
10023proto.xor = bnXor
10024proto.andNot = bnAndNot
10025proto.not = bnNot
10026proto.shiftLeft = bnShiftLeft
10027proto.shiftRight = bnShiftRight
10028proto.getLowestSetBit = bnGetLowestSetBit
10029proto.bitCount = bnBitCount
10030proto.testBit = bnTestBit
10031proto.setBit = bnSetBit
10032proto.clearBit = bnClearBit
10033proto.flipBit = bnFlipBit
10034proto.add = bnAdd
10035proto.subtract = bnSubtract
10036proto.multiply = bnMultiply
10037proto.divide = bnDivide
10038proto.remainder = bnRemainder
10039proto.divideAndRemainder = bnDivideAndRemainder
10040proto.modPow = bnModPow
10041proto.modInverse = bnModInverse
10042proto.pow = bnPow
10043proto.gcd = bnGCD
10044proto.isProbablePrime = bnIsProbablePrime
10045
10046// JSBN-specific extension
10047proto.square = bnSquare
10048
10049// constants
10050BigInteger.ZERO = nbv(0)
10051BigInteger.ONE = nbv(1)
10052BigInteger.valueOf = nbv
10053
10054module.exports = BigInteger
10055
10056},{"../package.json":64}],62:[function(require,module,exports){
10057(function (Buffer){
10058// FIXME: Kind of a weird way to throw exceptions, consider removing
10059var assert = require('assert')
10060var BigInteger = require('./bigi')
10061
10062/**
10063 * Turns a byte array into a big integer.
10064 *
10065 * This function will interpret a byte array as a big integer in big
10066 * endian notation.
10067 */
10068BigInteger.fromByteArrayUnsigned = function(byteArray) {
10069 // BigInteger expects a DER integer conformant byte array
10070 if (byteArray[0] & 0x80) {
10071 return new BigInteger([0].concat(byteArray))
10072 }
10073
10074 return new BigInteger(byteArray)
10075}
10076
10077/**
10078 * Returns a byte array representation of the big integer.
10079 *
10080 * This returns the absolute of the contained value in big endian
10081 * form. A value of zero results in an empty array.
10082 */
10083BigInteger.prototype.toByteArrayUnsigned = function() {
10084 var byteArray = this.toByteArray()
10085 return byteArray[0] === 0 ? byteArray.slice(1) : byteArray
10086}
10087
10088BigInteger.fromDERInteger = function(byteArray) {
10089 return new BigInteger(byteArray)
10090}
10091
10092/*
10093 * Converts BigInteger to a DER integer representation.
10094 *
10095 * The format for this value uses the most significant bit as a sign
10096 * bit. If the most significant bit is already set and the integer is
10097 * positive, a 0x00 is prepended.
10098 *
10099 * Examples:
10100 *
10101 * 0 => 0x00
10102 * 1 => 0x01
10103 * -1 => 0xff
10104 * 127 => 0x7f
10105 * -127 => 0x81
10106 * 128 => 0x0080
10107 * -128 => 0x80
10108 * 255 => 0x00ff
10109 * -255 => 0xff01
10110 * 16300 => 0x3fac
10111 * -16300 => 0xc054
10112 * 62300 => 0x00f35c
10113 * -62300 => 0xff0ca4
10114*/
10115BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray
10116
10117BigInteger.fromBuffer = function(buffer) {
10118 // BigInteger expects a DER integer conformant byte array
10119 if (buffer[0] & 0x80) {
10120 var byteArray = Array.prototype.slice.call(buffer)
10121
10122 return new BigInteger([0].concat(byteArray))
10123 }
10124
10125 return new BigInteger(buffer)
10126}
10127
10128BigInteger.fromHex = function(hex) {
10129 if (hex === '') return BigInteger.ZERO
10130
10131 assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')
10132 assert.equal(hex.length % 2, 0, 'Incomplete hex')
10133 return new BigInteger(hex, 16)
10134}
10135
10136BigInteger.prototype.toBuffer = function(size) {
10137 var byteArray = this.toByteArrayUnsigned()
10138 var zeros = []
10139
10140 var padding = size - byteArray.length
10141 while (zeros.length < padding) zeros.push(0)
10142
10143 return new Buffer(zeros.concat(byteArray))
10144}
10145
10146BigInteger.prototype.toHex = function(size) {
10147 return this.toBuffer(size).toString('hex')
10148}
10149
10150}).call(this,require("buffer").Buffer)
10151},{"./bigi":61,"assert":26,"buffer":146}],63:[function(require,module,exports){
10152var BigInteger = require('./bigi')
10153
10154//addons
10155require('./convert')
10156
10157module.exports = BigInteger
10158},{"./bigi":61,"./convert":62}],64:[function(require,module,exports){
10159module.exports={
10160 "_from": "bigi@^1.2.0",
10161 "_id": "bigi@1.4.2",
10162 "_inBundle": false,
10163 "_integrity": "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU=",
10164 "_location": "/bigi",
10165 "_phantomChildren": {},
10166 "_requested": {
10167 "type": "range",
10168 "registry": true,
10169 "raw": "bigi@^1.2.0",
10170 "name": "bigi",
10171 "escapedName": "bigi",
10172 "rawSpec": "^1.2.0",
10173 "saveSpec": null,
10174 "fetchSpec": "^1.2.0"
10175 },
10176 "_requiredBy": [
10177 "/bip38",
10178 "/bitcoinjs-lib",
10179 "/ecurve"
10180 ],
10181 "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",
10182 "_shasum": "9c665a95f88b8b08fc05cfd731f561859d725825",
10183 "_spec": "bigi@^1.2.0",
10184 "_where": "/home/ian/git/bitcoin/bip39/libs/combined/node_modules/bip38",
10185 "bugs": {
10186 "url": "https://github.com/cryptocoinjs/bigi/issues"
10187 },
10188 "bundleDependencies": false,
10189 "dependencies": {},
10190 "deprecated": false,
10191 "description": "Big integers.",
10192 "devDependencies": {
10193 "coveralls": "^2.11.2",
10194 "istanbul": "^0.3.5",
10195 "jshint": "^2.5.1",
10196 "mocha": "^2.1.0",
10197 "mochify": "^2.1.0"
10198 },
10199 "homepage": "https://github.com/cryptocoinjs/bigi#readme",
10200 "keywords": [
10201 "cryptography",
10202 "math",
10203 "bitcoin",
10204 "arbitrary",
10205 "precision",
10206 "arithmetic",
10207 "big",
10208 "integer",
10209 "int",
10210 "number",
10211 "biginteger",
10212 "bigint",
10213 "bignumber",
10214 "decimal",
10215 "float"
10216 ],
10217 "main": "./lib/index.js",
10218 "name": "bigi",
10219 "repository": {
10220 "url": "git+https://github.com/cryptocoinjs/bigi.git",
10221 "type": "git"
10222 },
10223 "scripts": {
10224 "browser-test": "mochify --wd -R spec",
10225 "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
10226 "coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info",
10227 "jshint": "jshint --config jshint.json lib/*.js ; true",
10228 "test": "_mocha -- test/*.js",
10229 "unit": "mocha"
10230 },
10231 "testling": {
10232 "files": "test/*.js",
10233 "harness": "mocha",
10234 "browsers": [
10235 "ie/9..latest",
10236 "firefox/latest",
10237 "chrome/latest",
10238 "safari/6.0..latest",
10239 "iphone/6.0..latest",
10240 "android-browser/4.2..latest"
10241 ]
10242 },
10243 "version": "1.4.2"
10244}
10245
10246},{}],65:[function(require,module,exports){
10247/*! bignumber.js v5.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\r
10248\r
10249;(function (globalObj) {\r
10250 'use strict';\r
10251\r
10252 /*\r
10253 bignumber.js v5.0.0\r
10254 A JavaScript library for arbitrary-precision arithmetic.\r
10255 https://github.com/MikeMcl/bignumber.js\r
10256 Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>\r
10257 MIT Expat Licence\r
10258 */\r
10259\r
10260\r
10261 var BigNumber,\r
10262 isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,\r
10263 mathceil = Math.ceil,\r
10264 mathfloor = Math.floor,\r
10265 notBool = ' not a boolean or binary digit',\r
10266 roundingMode = 'rounding mode',\r
10267 tooManyDigits = 'number type has more than 15 significant digits',\r
10268 ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',\r
10269 BASE = 1e14,\r
10270 LOG_BASE = 14,\r
10271 MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\r
10272 // MAX_INT32 = 0x7fffffff, // 2^31 - 1\r
10273 POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\r
10274 SQRT_BASE = 1e7,\r
10275\r
10276 /*\r
10277 * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\r
10278 * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an\r
10279 * exception is thrown (if ERRORS is true).\r
10280 */\r
10281 MAX = 1E9; // 0 to MAX_INT32\r
10282\r
10283\r
10284 /*\r
10285 * Create and return a BigNumber constructor.\r
10286 */\r
10287 function constructorFactory(config) {\r
10288 var div, parseNumeric,\r
10289\r
10290 // id tracks the caller function, so its name can be included in error messages.\r
10291 id = 0,\r
10292 P = BigNumber.prototype,\r
10293 ONE = new BigNumber(1),\r
10294\r
10295\r
10296 /********************************* EDITABLE DEFAULTS **********************************/\r
10297\r
10298\r
10299 /*\r
10300 * The default values below must be integers within the inclusive ranges stated.\r
10301 * The values can also be changed at run-time using BigNumber.config.\r
10302 */\r
10303\r
10304 // The maximum number of decimal places for operations involving division.\r
10305 DECIMAL_PLACES = 20, // 0 to MAX\r
10306\r
10307 /*\r
10308 * The rounding mode used when rounding to the above decimal places, and when using\r
10309 * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r
10310 * UP 0 Away from zero.\r
10311 * DOWN 1 Towards zero.\r
10312 * CEIL 2 Towards +Infinity.\r
10313 * FLOOR 3 Towards -Infinity.\r
10314 * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r
10315 * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r
10316 * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r
10317 * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r
10318 * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r
10319 */\r
10320 ROUNDING_MODE = 4, // 0 to 8\r
10321\r
10322 // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r
10323\r
10324 // The exponent value at and beneath which toString returns exponential notation.\r
10325 // Number type: -7\r
10326 TO_EXP_NEG = -7, // 0 to -MAX\r
10327\r
10328 // The exponent value at and above which toString returns exponential notation.\r
10329 // Number type: 21\r
10330 TO_EXP_POS = 21, // 0 to MAX\r
10331\r
10332 // RANGE : [MIN_EXP, MAX_EXP]\r
10333\r
10334 // The minimum exponent value, beneath which underflow to zero occurs.\r
10335 // Number type: -324 (5e-324)\r
10336 MIN_EXP = -1e7, // -1 to -MAX\r
10337\r
10338 // The maximum exponent value, above which overflow to Infinity occurs.\r
10339 // Number type: 308 (1.7976931348623157e+308)\r
10340 // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r
10341 MAX_EXP = 1e7, // 1 to MAX\r
10342\r
10343 // Whether BigNumber Errors are ever thrown.\r
10344 ERRORS = true, // true or false\r
10345\r
10346 // Change to intValidatorNoErrors if ERRORS is false.\r
10347 isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r
10348\r
10349 // Whether to use cryptographically-secure random number generation, if available.\r
10350 CRYPTO = false, // true or false\r
10351\r
10352 /*\r
10353 * The modulo mode used when calculating the modulus: a mod n.\r
10354 * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r
10355 * The remainder (r) is calculated as: r = a - n * q.\r
10356 *\r
10357 * UP 0 The remainder is positive if the dividend is negative, else is negative.\r
10358 * DOWN 1 The remainder has the same sign as the dividend.\r
10359 * This modulo mode is commonly known as 'truncated division' and is\r
10360 * equivalent to (a % n) in JavaScript.\r
10361 * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r
10362 * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r
10363 * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r
10364 * The remainder is always positive.\r
10365 *\r
10366 * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r
10367 * modes are commonly used for the modulus operation.\r
10368 * Although the other rounding modes can also be used, they may not give useful results.\r
10369 */\r
10370 MODULO_MODE = 1, // 0 to 9\r
10371\r
10372 // The maximum number of significant digits of the result of the toPower operation.\r
10373 // If POW_PRECISION is 0, there will be unlimited significant digits.\r
10374 POW_PRECISION = 0, // 0 to MAX\r
10375\r
10376 // The format specification used by the BigNumber.prototype.toFormat method.\r
10377 FORMAT = {\r
10378 decimalSeparator: '.',\r
10379 groupSeparator: ',',\r
10380 groupSize: 3,\r
10381 secondaryGroupSize: 0,\r
10382 fractionGroupSeparator: '\xA0', // non-breaking space\r
10383 fractionGroupSize: 0\r
10384 };\r
10385\r
10386\r
10387 /******************************************************************************************/\r
10388\r
10389\r
10390 // CONSTRUCTOR\r
10391\r
10392\r
10393 /*\r
10394 * The BigNumber constructor and exported function.\r
10395 * Create and return a new instance of a BigNumber object.\r
10396 *\r
10397 * n {number|string|BigNumber} A numeric value.\r
10398 * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r
10399 */\r
10400 function BigNumber( n, b ) {\r
10401 var c, e, i, num, len, str,\r
10402 x = this;\r
10403\r
10404 // Enable constructor usage without new.\r
10405 if ( !( x instanceof BigNumber ) ) {\r
10406\r
10407 // 'BigNumber() constructor call without new: {n}'\r
10408 // See GitHub issue: #81.\r
10409 //if (ERRORS) raise( 26, 'constructor call without new', n );\r
10410 return new BigNumber( n, b );\r
10411 }\r
10412\r
10413 // 'new BigNumber() base not an integer: {b}'\r
10414 // 'new BigNumber() base out of range: {b}'\r
10415 if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r
10416\r
10417 // Duplicate.\r
10418 if ( n instanceof BigNumber ) {\r
10419 x.s = n.s;\r
10420 x.e = n.e;\r
10421 x.c = ( n = n.c ) ? n.slice() : n;\r
10422 id = 0;\r
10423 return;\r
10424 }\r
10425\r
10426 if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r
10427 x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r
10428\r
10429 // Fast path for integers.\r
10430 if ( n === ~~n ) {\r
10431 for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r
10432 x.e = e;\r
10433 x.c = [n];\r
10434 id = 0;\r
10435 return;\r
10436 }\r
10437\r
10438 str = n + '';\r
10439 } else {\r
10440 if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r
10441 x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r
10442 }\r
10443 } else {\r
10444 b = b | 0;\r
10445 str = n + '';\r
10446\r
10447 // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r
10448 // Allow exponential notation to be used with base 10 argument.\r
10449 if ( b == 10 ) {\r
10450 x = new BigNumber( n instanceof BigNumber ? n : str );\r
10451 return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r
10452 }\r
10453\r
10454 // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r
10455 // Any number in exponential form will fail due to the [Ee][+-].\r
10456 if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r
10457 !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r
10458 '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r
10459 return parseNumeric( x, str, num, b );\r
10460 }\r
10461\r
10462 if (num) {\r
10463 x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r
10464\r
10465 if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) {\r
10466\r
10467 // 'new BigNumber() number type has more than 15 significant digits: {n}'\r
10468 raise( id, tooManyDigits, n );\r
10469 }\r
10470\r
10471 // Prevent later check for length on converted number.\r
10472 num = false;\r
10473 } else {\r
10474 x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r
10475 }\r
10476\r
10477 str = convertBase( str, 10, b, x.s );\r
10478 }\r
10479\r
10480 // Decimal point?\r
10481 if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r
10482\r
10483 // Exponential form?\r
10484 if ( ( i = str.search( /e/i ) ) > 0 ) {\r
10485\r
10486 // Determine exponent.\r
10487 if ( e < 0 ) e = i;\r
10488 e += +str.slice( i + 1 );\r
10489 str = str.substring( 0, i );\r
10490 } else if ( e < 0 ) {\r
10491\r
10492 // Integer.\r
10493 e = str.length;\r
10494 }\r
10495\r
10496 // Determine leading zeros.\r
10497 for ( i = 0; str.charCodeAt(i) === 48; i++ );\r
10498\r
10499 // Determine trailing zeros.\r
10500 for ( len = str.length; str.charCodeAt(--len) === 48; );\r
10501 str = str.slice( i, len + 1 );\r
10502\r
10503 if (str) {\r
10504 len = str.length;\r
10505\r
10506 // Disallow numbers with over 15 significant digits if number type.\r
10507 // 'new BigNumber() number type has more than 15 significant digits: {n}'\r
10508 if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r
10509 raise( id, tooManyDigits, x.s * n );\r
10510 }\r
10511\r
10512 e = e - i - 1;\r
10513\r
10514 // Overflow?\r
10515 if ( e > MAX_EXP ) {\r
10516\r
10517 // Infinity.\r
10518 x.c = x.e = null;\r
10519\r
10520 // Underflow?\r
10521 } else if ( e < MIN_EXP ) {\r
10522\r
10523 // Zero.\r
10524 x.c = [ x.e = 0 ];\r
10525 } else {\r
10526 x.e = e;\r
10527 x.c = [];\r
10528\r
10529 // Transform base\r
10530\r
10531 // e is the base 10 exponent.\r
10532 // i is where to slice str to get the first element of the coefficient array.\r
10533 i = ( e + 1 ) % LOG_BASE;\r
10534 if ( e < 0 ) i += LOG_BASE;\r
10535\r
10536 if ( i < len ) {\r
10537 if (i) x.c.push( +str.slice( 0, i ) );\r
10538\r
10539 for ( len -= LOG_BASE; i < len; ) {\r
10540 x.c.push( +str.slice( i, i += LOG_BASE ) );\r
10541 }\r
10542\r
10543 str = str.slice(i);\r
10544 i = LOG_BASE - str.length;\r
10545 } else {\r
10546 i -= len;\r
10547 }\r
10548\r
10549 for ( ; i--; str += '0' );\r
10550 x.c.push( +str );\r
10551 }\r
10552 } else {\r
10553\r
10554 // Zero.\r
10555 x.c = [ x.e = 0 ];\r
10556 }\r
10557\r
10558 id = 0;\r
10559 }\r
10560\r
10561\r
10562 // CONSTRUCTOR PROPERTIES\r
10563\r
10564\r
10565 BigNumber.another = constructorFactory;\r
10566\r
10567 BigNumber.ROUND_UP = 0;\r
10568 BigNumber.ROUND_DOWN = 1;\r
10569 BigNumber.ROUND_CEIL = 2;\r
10570 BigNumber.ROUND_FLOOR = 3;\r
10571 BigNumber.ROUND_HALF_UP = 4;\r
10572 BigNumber.ROUND_HALF_DOWN = 5;\r
10573 BigNumber.ROUND_HALF_EVEN = 6;\r
10574 BigNumber.ROUND_HALF_CEIL = 7;\r
10575 BigNumber.ROUND_HALF_FLOOR = 8;\r
10576 BigNumber.EUCLID = 9;\r
10577\r
10578\r
10579 /*\r
10580 * Configure infrequently-changing library-wide settings.\r
10581 *\r
10582 * Accept an object or an argument list, with one or many of the following properties or\r
10583 * parameters respectively:\r
10584 *\r
10585 * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r
10586 * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r
10587 * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r
10588 * [integer -MAX to 0 incl., 0 to MAX incl.]\r
10589 * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r
10590 * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r
10591 * ERRORS {boolean|number} true, false, 1 or 0\r
10592 * CRYPTO {boolean|number} true, false, 1 or 0\r
10593 * MODULO_MODE {number} 0 to 9 inclusive\r
10594 * POW_PRECISION {number} 0 to MAX inclusive\r
10595 * FORMAT {object} See BigNumber.prototype.toFormat\r
10596 * decimalSeparator {string}\r
10597 * groupSeparator {string}\r
10598 * groupSize {number}\r
10599 * secondaryGroupSize {number}\r
10600 * fractionGroupSeparator {string}\r
10601 * fractionGroupSize {number}\r
10602 *\r
10603 * (The values assigned to the above FORMAT object properties are not checked for validity.)\r
10604 *\r
10605 * E.g.\r
10606 * BigNumber.config(20, 4) is equivalent to\r
10607 * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r
10608 *\r
10609 * Ignore properties/parameters set to null or undefined.\r
10610 * Return an object with the properties current values.\r
10611 */\r
10612 BigNumber.config = BigNumber.set = function () {\r
10613 var v, p,\r
10614 i = 0,\r
10615 r = {},\r
10616 a = arguments,\r
10617 o = a[0],\r
10618 has = o && typeof o == 'object'\r
10619 ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r
10620 : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r
10621\r
10622 // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r
10623 // 'config() DECIMAL_PLACES not an integer: {v}'\r
10624 // 'config() DECIMAL_PLACES out of range: {v}'\r
10625 if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r
10626 DECIMAL_PLACES = v | 0;\r
10627 }\r
10628 r[p] = DECIMAL_PLACES;\r
10629\r
10630 // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r
10631 // 'config() ROUNDING_MODE not an integer: {v}'\r
10632 // 'config() ROUNDING_MODE out of range: {v}'\r
10633 if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r
10634 ROUNDING_MODE = v | 0;\r
10635 }\r
10636 r[p] = ROUNDING_MODE;\r
10637\r
10638 // EXPONENTIAL_AT {number|number[]}\r
10639 // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r
10640 // 'config() EXPONENTIAL_AT not an integer: {v}'\r
10641 // 'config() EXPONENTIAL_AT out of range: {v}'\r
10642 if ( has( p = 'EXPONENTIAL_AT' ) ) {\r
10643\r
10644 if ( isArray(v) ) {\r
10645 if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r
10646 TO_EXP_NEG = v[0] | 0;\r
10647 TO_EXP_POS = v[1] | 0;\r
10648 }\r
10649 } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r
10650 TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r
10651 }\r
10652 }\r
10653 r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r
10654\r
10655 // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r
10656 // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r
10657 // 'config() RANGE not an integer: {v}'\r
10658 // 'config() RANGE cannot be zero: {v}'\r
10659 // 'config() RANGE out of range: {v}'\r
10660 if ( has( p = 'RANGE' ) ) {\r
10661\r
10662 if ( isArray(v) ) {\r
10663 if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r
10664 MIN_EXP = v[0] | 0;\r
10665 MAX_EXP = v[1] | 0;\r
10666 }\r
10667 } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r
10668 if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r
10669 else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r
10670 }\r
10671 }\r
10672 r[p] = [ MIN_EXP, MAX_EXP ];\r
10673\r
10674 // ERRORS {boolean|number} true, false, 1 or 0.\r
10675 // 'config() ERRORS not a boolean or binary digit: {v}'\r
10676 if ( has( p = 'ERRORS' ) ) {\r
10677\r
10678 if ( v === !!v || v === 1 || v === 0 ) {\r
10679 id = 0;\r
10680 isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r
10681 } else if (ERRORS) {\r
10682 raise( 2, p + notBool, v );\r
10683 }\r
10684 }\r
10685 r[p] = ERRORS;\r
10686\r
10687 // CRYPTO {boolean|number} true, false, 1 or 0.\r
10688 // 'config() CRYPTO not a boolean or binary digit: {v}'\r
10689 // 'config() crypto unavailable: {crypto}'\r
10690 if ( has( p = 'CRYPTO' ) ) {\r
10691\r
10692 if ( v === true || v === false || v === 1 || v === 0 ) {\r
10693 if (v) {\r
10694 v = typeof crypto == 'undefined';\r
10695 if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r
10696 CRYPTO = true;\r
10697 } else if (ERRORS) {\r
10698 raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r
10699 } else {\r
10700 CRYPTO = false;\r
10701 }\r
10702 } else {\r
10703 CRYPTO = false;\r
10704 }\r
10705 } else if (ERRORS) {\r
10706 raise( 2, p + notBool, v );\r
10707 }\r
10708 }\r
10709 r[p] = CRYPTO;\r
10710\r
10711 // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r
10712 // 'config() MODULO_MODE not an integer: {v}'\r
10713 // 'config() MODULO_MODE out of range: {v}'\r
10714 if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r
10715 MODULO_MODE = v | 0;\r
10716 }\r
10717 r[p] = MODULO_MODE;\r
10718\r
10719 // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r
10720 // 'config() POW_PRECISION not an integer: {v}'\r
10721 // 'config() POW_PRECISION out of range: {v}'\r
10722 if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r
10723 POW_PRECISION = v | 0;\r
10724 }\r
10725 r[p] = POW_PRECISION;\r
10726\r
10727 // FORMAT {object}\r
10728 // 'config() FORMAT not an object: {v}'\r
10729 if ( has( p = 'FORMAT' ) ) {\r
10730\r
10731 if ( typeof v == 'object' ) {\r
10732 FORMAT = v;\r
10733 } else if (ERRORS) {\r
10734 raise( 2, p + ' not an object', v );\r
10735 }\r
10736 }\r
10737 r[p] = FORMAT;\r
10738\r
10739 return r;\r
10740 };\r
10741\r
10742\r
10743 /*\r
10744 * Return a new BigNumber whose value is the maximum of the arguments.\r
10745 *\r
10746 * arguments {number|string|BigNumber}\r
10747 */\r
10748 BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r
10749\r
10750\r
10751 /*\r
10752 * Return a new BigNumber whose value is the minimum of the arguments.\r
10753 *\r
10754 * arguments {number|string|BigNumber}\r
10755 */\r
10756 BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r
10757\r
10758\r
10759 /*\r
10760 * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r
10761 * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r
10762 * zeros are produced).\r
10763 *\r
10764 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
10765 *\r
10766 * 'random() decimal places not an integer: {dp}'\r
10767 * 'random() decimal places out of range: {dp}'\r
10768 * 'random() crypto unavailable: {crypto}'\r
10769 */\r
10770 BigNumber.random = (function () {\r
10771 var pow2_53 = 0x20000000000000;\r
10772\r
10773 // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r
10774 // Check if Math.random() produces more than 32 bits of randomness.\r
10775 // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r
10776 // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r
10777 var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r
10778 ? function () { return mathfloor( Math.random() * pow2_53 ); }\r
10779 : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r
10780 (Math.random() * 0x800000 | 0); };\r
10781\r
10782 return function (dp) {\r
10783 var a, b, e, k, v,\r
10784 i = 0,\r
10785 c = [],\r
10786 rand = new BigNumber(ONE);\r
10787\r
10788 dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r
10789 k = mathceil( dp / LOG_BASE );\r
10790\r
10791 if (CRYPTO) {\r
10792\r
10793 // Browsers supporting crypto.getRandomValues.\r
10794 if (crypto.getRandomValues) {\r
10795\r
10796 a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r
10797\r
10798 for ( ; i < k; ) {\r
10799\r
10800 // 53 bits:\r
10801 // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r
10802 // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r
10803 // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r
10804 // 11111 11111111 11111111\r
10805 // 0x20000 is 2^21.\r
10806 v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r
10807\r
10808 // Rejection sampling:\r
10809 // 0 <= v < 9007199254740992\r
10810 // Probability that v >= 9e15, is\r
10811 // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r
10812 if ( v >= 9e15 ) {\r
10813 b = crypto.getRandomValues( new Uint32Array(2) );\r
10814 a[i] = b[0];\r
10815 a[i + 1] = b[1];\r
10816 } else {\r
10817\r
10818 // 0 <= v <= 8999999999999999\r
10819 // 0 <= (v % 1e14) <= 99999999999999\r
10820 c.push( v % 1e14 );\r
10821 i += 2;\r
10822 }\r
10823 }\r
10824 i = k / 2;\r
10825\r
10826 // Node.js supporting crypto.randomBytes.\r
10827 } else if (crypto.randomBytes) {\r
10828\r
10829 // buffer\r
10830 a = crypto.randomBytes( k *= 7 );\r
10831\r
10832 for ( ; i < k; ) {\r
10833\r
10834 // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r
10835 // 0x100000000 is 2^32, 0x1000000 is 2^24\r
10836 // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r
10837 // 0 <= v < 9007199254740992\r
10838 v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r
10839 ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r
10840 ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r
10841\r
10842 if ( v >= 9e15 ) {\r
10843 crypto.randomBytes(7).copy( a, i );\r
10844 } else {\r
10845\r
10846 // 0 <= (v % 1e14) <= 99999999999999\r
10847 c.push( v % 1e14 );\r
10848 i += 7;\r
10849 }\r
10850 }\r
10851 i = k / 7;\r
10852 } else {\r
10853 CRYPTO = false;\r
10854 if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r
10855 }\r
10856 }\r
10857\r
10858 // Use Math.random.\r
10859 if (!CRYPTO) {\r
10860\r
10861 for ( ; i < k; ) {\r
10862 v = random53bitInt();\r
10863 if ( v < 9e15 ) c[i++] = v % 1e14;\r
10864 }\r
10865 }\r
10866\r
10867 k = c[--i];\r
10868 dp %= LOG_BASE;\r
10869\r
10870 // Convert trailing digits to zeros according to dp.\r
10871 if ( k && dp ) {\r
10872 v = POWS_TEN[LOG_BASE - dp];\r
10873 c[i] = mathfloor( k / v ) * v;\r
10874 }\r
10875\r
10876 // Remove trailing elements which are zero.\r
10877 for ( ; c[i] === 0; c.pop(), i-- );\r
10878\r
10879 // Zero?\r
10880 if ( i < 0 ) {\r
10881 c = [ e = 0 ];\r
10882 } else {\r
10883\r
10884 // Remove leading elements which are zero and adjust exponent accordingly.\r
10885 for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r
10886\r
10887 // Count the digits of the first element of c to determine leading zeros, and...\r
10888 for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r
10889\r
10890 // adjust the exponent accordingly.\r
10891 if ( i < LOG_BASE ) e -= LOG_BASE - i;\r
10892 }\r
10893\r
10894 rand.e = e;\r
10895 rand.c = c;\r
10896 return rand;\r
10897 };\r
10898 })();\r
10899\r
10900\r
10901 // PRIVATE FUNCTIONS\r
10902\r
10903\r
10904 // Convert a numeric string of baseIn to a numeric string of baseOut.\r
10905 function convertBase( str, baseOut, baseIn, sign ) {\r
10906 var d, e, k, r, x, xc, y,\r
10907 i = str.indexOf( '.' ),\r
10908 dp = DECIMAL_PLACES,\r
10909 rm = ROUNDING_MODE;\r
10910\r
10911 if ( baseIn < 37 ) str = str.toLowerCase();\r
10912\r
10913 // Non-integer.\r
10914 if ( i >= 0 ) {\r
10915 k = POW_PRECISION;\r
10916\r
10917 // Unlimited precision.\r
10918 POW_PRECISION = 0;\r
10919 str = str.replace( '.', '' );\r
10920 y = new BigNumber(baseIn);\r
10921 x = y.pow( str.length - i );\r
10922 POW_PRECISION = k;\r
10923\r
10924 // Convert str as if an integer, then restore the fraction part by dividing the\r
10925 // result by its base raised to a power.\r
10926 y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r
10927 y.e = y.c.length;\r
10928 }\r
10929\r
10930 // Convert the number as integer.\r
10931 xc = toBaseOut( str, baseIn, baseOut );\r
10932 e = k = xc.length;\r
10933\r
10934 // Remove trailing zeros.\r
10935 for ( ; xc[--k] == 0; xc.pop() );\r
10936 if ( !xc[0] ) return '0';\r
10937\r
10938 if ( i < 0 ) {\r
10939 --e;\r
10940 } else {\r
10941 x.c = xc;\r
10942 x.e = e;\r
10943\r
10944 // sign is needed for correct rounding.\r
10945 x.s = sign;\r
10946 x = div( x, y, dp, rm, baseOut );\r
10947 xc = x.c;\r
10948 r = x.r;\r
10949 e = x.e;\r
10950 }\r
10951\r
10952 d = e + dp + 1;\r
10953\r
10954 // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r
10955 i = xc[d];\r
10956 k = baseOut / 2;\r
10957 r = r || d < 0 || xc[d + 1] != null;\r
10958\r
10959 r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r
10960 : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r
10961 rm == ( x.s < 0 ? 8 : 7 ) );\r
10962\r
10963 if ( d < 1 || !xc[0] ) {\r
10964\r
10965 // 1^-dp or 0.\r
10966 str = r ? toFixedPoint( '1', -dp ) : '0';\r
10967 } else {\r
10968 xc.length = d;\r
10969\r
10970 if (r) {\r
10971\r
10972 // Rounding up may mean the previous digit has to be rounded up and so on.\r
10973 for ( --baseOut; ++xc[--d] > baseOut; ) {\r
10974 xc[d] = 0;\r
10975\r
10976 if ( !d ) {\r
10977 ++e;\r
10978 xc = [1].concat(xc);\r
10979 }\r
10980 }\r
10981 }\r
10982\r
10983 // Determine trailing zeros.\r
10984 for ( k = xc.length; !xc[--k]; );\r
10985\r
10986 // E.g. [4, 11, 15] becomes 4bf.\r
10987 for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r
10988 str = toFixedPoint( str, e );\r
10989 }\r
10990\r
10991 // The caller will add the sign.\r
10992 return str;\r
10993 }\r
10994\r
10995\r
10996 // Perform division in the specified base. Called by div and convertBase.\r
10997 div = (function () {\r
10998\r
10999 // Assume non-zero x and k.\r
11000 function multiply( x, k, base ) {\r
11001 var m, temp, xlo, xhi,\r
11002 carry = 0,\r
11003 i = x.length,\r
11004 klo = k % SQRT_BASE,\r
11005 khi = k / SQRT_BASE | 0;\r
11006\r
11007 for ( x = x.slice(); i--; ) {\r
11008 xlo = x[i] % SQRT_BASE;\r
11009 xhi = x[i] / SQRT_BASE | 0;\r
11010 m = khi * xlo + xhi * klo;\r
11011 temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r
11012 carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r
11013 x[i] = temp % base;\r
11014 }\r
11015\r
11016 if (carry) x = [carry].concat(x);\r
11017\r
11018 return x;\r
11019 }\r
11020\r
11021 function compare( a, b, aL, bL ) {\r
11022 var i, cmp;\r
11023\r
11024 if ( aL != bL ) {\r
11025 cmp = aL > bL ? 1 : -1;\r
11026 } else {\r
11027\r
11028 for ( i = cmp = 0; i < aL; i++ ) {\r
11029\r
11030 if ( a[i] != b[i] ) {\r
11031 cmp = a[i] > b[i] ? 1 : -1;\r
11032 break;\r
11033 }\r
11034 }\r
11035 }\r
11036 return cmp;\r
11037 }\r
11038\r
11039 function subtract( a, b, aL, base ) {\r
11040 var i = 0;\r
11041\r
11042 // Subtract b from a.\r
11043 for ( ; aL--; ) {\r
11044 a[aL] -= i;\r
11045 i = a[aL] < b[aL] ? 1 : 0;\r
11046 a[aL] = i * base + a[aL] - b[aL];\r
11047 }\r
11048\r
11049 // Remove leading zeros.\r
11050 for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r
11051 }\r
11052\r
11053 // x: dividend, y: divisor.\r
11054 return function ( x, y, dp, rm, base ) {\r
11055 var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r
11056 yL, yz,\r
11057 s = x.s == y.s ? 1 : -1,\r
11058 xc = x.c,\r
11059 yc = y.c;\r
11060\r
11061 // Either NaN, Infinity or 0?\r
11062 if ( !xc || !xc[0] || !yc || !yc[0] ) {\r
11063\r
11064 return new BigNumber(\r
11065\r
11066 // Return NaN if either NaN, or both Infinity or 0.\r
11067 !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r
11068\r
11069 // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r
11070 xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r
11071 );\r
11072 }\r
11073\r
11074 q = new BigNumber(s);\r
11075 qc = q.c = [];\r
11076 e = x.e - y.e;\r
11077 s = dp + e + 1;\r
11078\r
11079 if ( !base ) {\r
11080 base = BASE;\r
11081 e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r
11082 s = s / LOG_BASE | 0;\r
11083 }\r
11084\r
11085 // Result exponent may be one less then the current value of e.\r
11086 // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r
11087 for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r
11088 if ( yc[i] > ( xc[i] || 0 ) ) e--;\r
11089\r
11090 if ( s < 0 ) {\r
11091 qc.push(1);\r
11092 more = true;\r
11093 } else {\r
11094 xL = xc.length;\r
11095 yL = yc.length;\r
11096 i = 0;\r
11097 s += 2;\r
11098\r
11099 // Normalise xc and yc so highest order digit of yc is >= base / 2.\r
11100\r
11101 n = mathfloor( base / ( yc[0] + 1 ) );\r
11102\r
11103 // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r
11104 // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r
11105 if ( n > 1 ) {\r
11106 yc = multiply( yc, n, base );\r
11107 xc = multiply( xc, n, base );\r
11108 yL = yc.length;\r
11109 xL = xc.length;\r
11110 }\r
11111\r
11112 xi = yL;\r
11113 rem = xc.slice( 0, yL );\r
11114 remL = rem.length;\r
11115\r
11116 // Add zeros to make remainder as long as divisor.\r
11117 for ( ; remL < yL; rem[remL++] = 0 );\r
11118 yz = yc.slice();\r
11119 yz = [0].concat(yz);\r
11120 yc0 = yc[0];\r
11121 if ( yc[1] >= base / 2 ) yc0++;\r
11122 // Not necessary, but to prevent trial digit n > base, when using base 3.\r
11123 // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r
11124\r
11125 do {\r
11126 n = 0;\r
11127\r
11128 // Compare divisor and remainder.\r
11129 cmp = compare( yc, rem, yL, remL );\r
11130\r
11131 // If divisor < remainder.\r
11132 if ( cmp < 0 ) {\r
11133\r
11134 // Calculate trial digit, n.\r
11135\r
11136 rem0 = rem[0];\r
11137 if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r
11138\r
11139 // n is how many times the divisor goes into the current remainder.\r
11140 n = mathfloor( rem0 / yc0 );\r
11141\r
11142 // Algorithm:\r
11143 // 1. product = divisor * trial digit (n)\r
11144 // 2. if product > remainder: product -= divisor, n--\r
11145 // 3. remainder -= product\r
11146 // 4. if product was < remainder at 2:\r
11147 // 5. compare new remainder and divisor\r
11148 // 6. If remainder > divisor: remainder -= divisor, n++\r
11149\r
11150 if ( n > 1 ) {\r
11151\r
11152 // n may be > base only when base is 3.\r
11153 if (n >= base) n = base - 1;\r
11154\r
11155 // product = divisor * trial digit.\r
11156 prod = multiply( yc, n, base );\r
11157 prodL = prod.length;\r
11158 remL = rem.length;\r
11159\r
11160 // Compare product and remainder.\r
11161 // If product > remainder.\r
11162 // Trial digit n too high.\r
11163 // n is 1 too high about 5% of the time, and is not known to have\r
11164 // ever been more than 1 too high.\r
11165 while ( compare( prod, rem, prodL, remL ) == 1 ) {\r
11166 n--;\r
11167\r
11168 // Subtract divisor from product.\r
11169 subtract( prod, yL < prodL ? yz : yc, prodL, base );\r
11170 prodL = prod.length;\r
11171 cmp = 1;\r
11172 }\r
11173 } else {\r
11174\r
11175 // n is 0 or 1, cmp is -1.\r
11176 // If n is 0, there is no need to compare yc and rem again below,\r
11177 // so change cmp to 1 to avoid it.\r
11178 // If n is 1, leave cmp as -1, so yc and rem are compared again.\r
11179 if ( n == 0 ) {\r
11180\r
11181 // divisor < remainder, so n must be at least 1.\r
11182 cmp = n = 1;\r
11183 }\r
11184\r
11185 // product = divisor\r
11186 prod = yc.slice();\r
11187 prodL = prod.length;\r
11188 }\r
11189\r
11190 if ( prodL < remL ) prod = [0].concat(prod);\r
11191\r
11192 // Subtract product from remainder.\r
11193 subtract( rem, prod, remL, base );\r
11194 remL = rem.length;\r
11195\r
11196 // If product was < remainder.\r
11197 if ( cmp == -1 ) {\r
11198\r
11199 // Compare divisor and new remainder.\r
11200 // If divisor < new remainder, subtract divisor from remainder.\r
11201 // Trial digit n too low.\r
11202 // n is 1 too low about 5% of the time, and very rarely 2 too low.\r
11203 while ( compare( yc, rem, yL, remL ) < 1 ) {\r
11204 n++;\r
11205\r
11206 // Subtract divisor from remainder.\r
11207 subtract( rem, yL < remL ? yz : yc, remL, base );\r
11208 remL = rem.length;\r
11209 }\r
11210 }\r
11211 } else if ( cmp === 0 ) {\r
11212 n++;\r
11213 rem = [0];\r
11214 } // else cmp === 1 and n will be 0\r
11215\r
11216 // Add the next digit, n, to the result array.\r
11217 qc[i++] = n;\r
11218\r
11219 // Update the remainder.\r
11220 if ( rem[0] ) {\r
11221 rem[remL++] = xc[xi] || 0;\r
11222 } else {\r
11223 rem = [ xc[xi] ];\r
11224 remL = 1;\r
11225 }\r
11226 } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r
11227\r
11228 more = rem[0] != null;\r
11229\r
11230 // Leading zero?\r
11231 if ( !qc[0] ) qc.splice(0, 1);\r
11232 }\r
11233\r
11234 if ( base == BASE ) {\r
11235\r
11236 // To calculate q.e, first get the number of digits of qc[0].\r
11237 for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r
11238 round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r
11239\r
11240 // Caller is convertBase.\r
11241 } else {\r
11242 q.e = e;\r
11243 q.r = +more;\r
11244 }\r
11245\r
11246 return q;\r
11247 };\r
11248 })();\r
11249\r
11250\r
11251 /*\r
11252 * Return a string representing the value of BigNumber n in fixed-point or exponential\r
11253 * notation rounded to the specified decimal places or significant digits.\r
11254 *\r
11255 * n is a BigNumber.\r
11256 * i is the index of the last digit required (i.e. the digit that may be rounded up).\r
11257 * rm is the rounding mode.\r
11258 * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r
11259 */\r
11260 function format( n, i, rm, caller ) {\r
11261 var c0, e, ne, len, str;\r
11262\r
11263 rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r
11264 ? rm | 0 : ROUNDING_MODE;\r
11265\r
11266 if ( !n.c ) return n.toString();\r
11267 c0 = n.c[0];\r
11268 ne = n.e;\r
11269\r
11270 if ( i == null ) {\r
11271 str = coeffToString( n.c );\r
11272 str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r
11273 ? toExponential( str, ne )\r
11274 : toFixedPoint( str, ne );\r
11275 } else {\r
11276 n = round( new BigNumber(n), i, rm );\r
11277\r
11278 // n.e may have changed if the value was rounded up.\r
11279 e = n.e;\r
11280\r
11281 str = coeffToString( n.c );\r
11282 len = str.length;\r
11283\r
11284 // toPrecision returns exponential notation if the number of significant digits\r
11285 // specified is less than the number of digits necessary to represent the integer\r
11286 // part of the value in fixed-point notation.\r
11287\r
11288 // Exponential notation.\r
11289 if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r
11290\r
11291 // Append zeros?\r
11292 for ( ; len < i; str += '0', len++ );\r
11293 str = toExponential( str, e );\r
11294\r
11295 // Fixed-point notation.\r
11296 } else {\r
11297 i -= ne;\r
11298 str = toFixedPoint( str, e );\r
11299\r
11300 // Append zeros?\r
11301 if ( e + 1 > len ) {\r
11302 if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r
11303 } else {\r
11304 i += e - len;\r
11305 if ( i > 0 ) {\r
11306 if ( e + 1 == len ) str += '.';\r
11307 for ( ; i--; str += '0' );\r
11308 }\r
11309 }\r
11310 }\r
11311 }\r
11312\r
11313 return n.s < 0 && c0 ? '-' + str : str;\r
11314 }\r
11315\r
11316\r
11317 // Handle BigNumber.max and BigNumber.min.\r
11318 function maxOrMin( args, method ) {\r
11319 var m, n,\r
11320 i = 0;\r
11321\r
11322 if ( isArray( args[0] ) ) args = args[0];\r
11323 m = new BigNumber( args[0] );\r
11324\r
11325 for ( ; ++i < args.length; ) {\r
11326 n = new BigNumber( args[i] );\r
11327\r
11328 // If any number is NaN, return NaN.\r
11329 if ( !n.s ) {\r
11330 m = n;\r
11331 break;\r
11332 } else if ( method.call( m, n ) ) {\r
11333 m = n;\r
11334 }\r
11335 }\r
11336\r
11337 return m;\r
11338 }\r
11339\r
11340\r
11341 /*\r
11342 * Return true if n is an integer in range, otherwise throw.\r
11343 * Use for argument validation when ERRORS is true.\r
11344 */\r
11345 function intValidatorWithErrors( n, min, max, caller, name ) {\r
11346 if ( n < min || n > max || n != truncate(n) ) {\r
11347 raise( caller, ( name || 'decimal places' ) +\r
11348 ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r
11349 }\r
11350\r
11351 return true;\r
11352 }\r
11353\r
11354\r
11355 /*\r
11356 * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r
11357 * Called by minus, plus and times.\r
11358 */\r
11359 function normalise( n, c, e ) {\r
11360 var i = 1,\r
11361 j = c.length;\r
11362\r
11363 // Remove trailing zeros.\r
11364 for ( ; !c[--j]; c.pop() );\r
11365\r
11366 // Calculate the base 10 exponent. First get the number of digits of c[0].\r
11367 for ( j = c[0]; j >= 10; j /= 10, i++ );\r
11368\r
11369 // Overflow?\r
11370 if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r
11371\r
11372 // Infinity.\r
11373 n.c = n.e = null;\r
11374\r
11375 // Underflow?\r
11376 } else if ( e < MIN_EXP ) {\r
11377\r
11378 // Zero.\r
11379 n.c = [ n.e = 0 ];\r
11380 } else {\r
11381 n.e = e;\r
11382 n.c = c;\r
11383 }\r
11384\r
11385 return n;\r
11386 }\r
11387\r
11388\r
11389 // Handle values that fail the validity test in BigNumber.\r
11390 parseNumeric = (function () {\r
11391 var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,\r
11392 dotAfter = /^([^.]+)\.$/,\r
11393 dotBefore = /^\.([^.]+)$/,\r
11394 isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r
11395 whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;\r
11396\r
11397 return function ( x, str, num, b ) {\r
11398 var base,\r
11399 s = num ? str : str.replace( whitespaceOrPlus, '' );\r
11400\r
11401 // No exception on ±Infinity or NaN.\r
11402 if ( isInfinityOrNaN.test(s) ) {\r
11403 x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r
11404 } else {\r
11405 if ( !num ) {\r
11406\r
11407 // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i\r
11408 s = s.replace( basePrefix, function ( m, p1, p2 ) {\r
11409 base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r
11410 return !b || b == base ? p1 : m;\r
11411 });\r
11412\r
11413 if (b) {\r
11414 base = b;\r
11415\r
11416 // E.g. '1.' to '1', '.1' to '0.1'\r
11417 s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r
11418 }\r
11419\r
11420 if ( str != s ) return new BigNumber( s, base );\r
11421 }\r
11422\r
11423 // 'new BigNumber() not a number: {n}'\r
11424 // 'new BigNumber() not a base {b} number: {n}'\r
11425 if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r
11426 x.s = null;\r
11427 }\r
11428\r
11429 x.c = x.e = null;\r
11430 id = 0;\r
11431 }\r
11432 })();\r
11433\r
11434\r
11435 // Throw a BigNumber Error.\r
11436 function raise( caller, msg, val ) {\r
11437 var error = new Error( [\r
11438 'new BigNumber', // 0\r
11439 'cmp', // 1\r
11440 'config', // 2\r
11441 'div', // 3\r
11442 'divToInt', // 4\r
11443 'eq', // 5\r
11444 'gt', // 6\r
11445 'gte', // 7\r
11446 'lt', // 8\r
11447 'lte', // 9\r
11448 'minus', // 10\r
11449 'mod', // 11\r
11450 'plus', // 12\r
11451 'precision', // 13\r
11452 'random', // 14\r
11453 'round', // 15\r
11454 'shift', // 16\r
11455 'times', // 17\r
11456 'toDigits', // 18\r
11457 'toExponential', // 19\r
11458 'toFixed', // 20\r
11459 'toFormat', // 21\r
11460 'toFraction', // 22\r
11461 'pow', // 23\r
11462 'toPrecision', // 24\r
11463 'toString', // 25\r
11464 'BigNumber' // 26\r
11465 ][caller] + '() ' + msg + ': ' + val );\r
11466\r
11467 error.name = 'BigNumber Error';\r
11468 id = 0;\r
11469 throw error;\r
11470 }\r
11471\r
11472\r
11473 /*\r
11474 * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r
11475 * If r is truthy, it is known that there are more digits after the rounding digit.\r
11476 */\r
11477 function round( x, sd, rm, r ) {\r
11478 var d, i, j, k, n, ni, rd,\r
11479 xc = x.c,\r
11480 pows10 = POWS_TEN;\r
11481\r
11482 // if x is not Infinity or NaN...\r
11483 if (xc) {\r
11484\r
11485 // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r
11486 // n is a base 1e14 number, the value of the element of array x.c containing rd.\r
11487 // ni is the index of n within x.c.\r
11488 // d is the number of digits of n.\r
11489 // i is the index of rd within n including leading zeros.\r
11490 // j is the actual index of rd within n (if < 0, rd is a leading zero).\r
11491 out: {\r
11492\r
11493 // Get the number of digits of the first element of xc.\r
11494 for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r
11495 i = sd - d;\r
11496\r
11497 // If the rounding digit is in the first element of xc...\r
11498 if ( i < 0 ) {\r
11499 i += LOG_BASE;\r
11500 j = sd;\r
11501 n = xc[ ni = 0 ];\r
11502\r
11503 // Get the rounding digit at index j of n.\r
11504 rd = n / pows10[ d - j - 1 ] % 10 | 0;\r
11505 } else {\r
11506 ni = mathceil( ( i + 1 ) / LOG_BASE );\r
11507\r
11508 if ( ni >= xc.length ) {\r
11509\r
11510 if (r) {\r
11511\r
11512 // Needed by sqrt.\r
11513 for ( ; xc.length <= ni; xc.push(0) );\r
11514 n = rd = 0;\r
11515 d = 1;\r
11516 i %= LOG_BASE;\r
11517 j = i - LOG_BASE + 1;\r
11518 } else {\r
11519 break out;\r
11520 }\r
11521 } else {\r
11522 n = k = xc[ni];\r
11523\r
11524 // Get the number of digits of n.\r
11525 for ( d = 1; k >= 10; k /= 10, d++ );\r
11526\r
11527 // Get the index of rd within n.\r
11528 i %= LOG_BASE;\r
11529\r
11530 // Get the index of rd within n, adjusted for leading zeros.\r
11531 // The number of leading zeros of n is given by LOG_BASE - d.\r
11532 j = i - LOG_BASE + d;\r
11533\r
11534 // Get the rounding digit at index j of n.\r
11535 rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r
11536 }\r
11537 }\r
11538\r
11539 r = r || sd < 0 ||\r
11540\r
11541 // Are there any non-zero digits after the rounding digit?\r
11542 // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r
11543 // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r
11544 xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r
11545\r
11546 r = rm < 4\r
11547 ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r
11548 : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r
11549\r
11550 // Check whether the digit to the left of the rounding digit is odd.\r
11551 ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r
11552 rm == ( x.s < 0 ? 8 : 7 ) );\r
11553\r
11554 if ( sd < 1 || !xc[0] ) {\r
11555 xc.length = 0;\r
11556\r
11557 if (r) {\r
11558\r
11559 // Convert sd to decimal places.\r
11560 sd -= x.e + 1;\r
11561\r
11562 // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r
11563 xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r
11564 x.e = -sd || 0;\r
11565 } else {\r
11566\r
11567 // Zero.\r
11568 xc[0] = x.e = 0;\r
11569 }\r
11570\r
11571 return x;\r
11572 }\r
11573\r
11574 // Remove excess digits.\r
11575 if ( i == 0 ) {\r
11576 xc.length = ni;\r
11577 k = 1;\r
11578 ni--;\r
11579 } else {\r
11580 xc.length = ni + 1;\r
11581 k = pows10[ LOG_BASE - i ];\r
11582\r
11583 // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r
11584 // j > 0 means i > number of leading zeros of n.\r
11585 xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r
11586 }\r
11587\r
11588 // Round up?\r
11589 if (r) {\r
11590\r
11591 for ( ; ; ) {\r
11592\r
11593 // If the digit to be rounded up is in the first element of xc...\r
11594 if ( ni == 0 ) {\r
11595\r
11596 // i will be the length of xc[0] before k is added.\r
11597 for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r
11598 j = xc[0] += k;\r
11599 for ( k = 1; j >= 10; j /= 10, k++ );\r
11600\r
11601 // if i != k the length has increased.\r
11602 if ( i != k ) {\r
11603 x.e++;\r
11604 if ( xc[0] == BASE ) xc[0] = 1;\r
11605 }\r
11606\r
11607 break;\r
11608 } else {\r
11609 xc[ni] += k;\r
11610 if ( xc[ni] != BASE ) break;\r
11611 xc[ni--] = 0;\r
11612 k = 1;\r
11613 }\r
11614 }\r
11615 }\r
11616\r
11617 // Remove trailing zeros.\r
11618 for ( i = xc.length; xc[--i] === 0; xc.pop() );\r
11619 }\r
11620\r
11621 // Overflow? Infinity.\r
11622 if ( x.e > MAX_EXP ) {\r
11623 x.c = x.e = null;\r
11624\r
11625 // Underflow? Zero.\r
11626 } else if ( x.e < MIN_EXP ) {\r
11627 x.c = [ x.e = 0 ];\r
11628 }\r
11629 }\r
11630\r
11631 return x;\r
11632 }\r
11633\r
11634\r
11635 // PROTOTYPE/INSTANCE METHODS\r
11636\r
11637\r
11638 /*\r
11639 * Return a new BigNumber whose value is the absolute value of this BigNumber.\r
11640 */\r
11641 P.absoluteValue = P.abs = function () {\r
11642 var x = new BigNumber(this);\r
11643 if ( x.s < 0 ) x.s = 1;\r
11644 return x;\r
11645 };\r
11646\r
11647\r
11648 /*\r
11649 * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r
11650 * number in the direction of Infinity.\r
11651 */\r
11652 P.ceil = function () {\r
11653 return round( new BigNumber(this), this.e + 1, 2 );\r
11654 };\r
11655\r
11656\r
11657 /*\r
11658 * Return\r
11659 * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r
11660 * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r
11661 * 0 if they have the same value,\r
11662 * or null if the value of either is NaN.\r
11663 */\r
11664 P.comparedTo = P.cmp = function ( y, b ) {\r
11665 id = 1;\r
11666 return compare( this, new BigNumber( y, b ) );\r
11667 };\r
11668\r
11669\r
11670 /*\r
11671 * Return the number of decimal places of the value of this BigNumber, or null if the value\r
11672 * of this BigNumber is ±Infinity or NaN.\r
11673 */\r
11674 P.decimalPlaces = P.dp = function () {\r
11675 var n, v,\r
11676 c = this.c;\r
11677\r
11678 if ( !c ) return null;\r
11679 n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r
11680\r
11681 // Subtract the number of trailing zeros of the last number.\r
11682 if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r
11683 if ( n < 0 ) n = 0;\r
11684\r
11685 return n;\r
11686 };\r
11687\r
11688\r
11689 /*\r
11690 * n / 0 = I\r
11691 * n / N = N\r
11692 * n / I = 0\r
11693 * 0 / n = 0\r
11694 * 0 / 0 = N\r
11695 * 0 / N = N\r
11696 * 0 / I = 0\r
11697 * N / n = N\r
11698 * N / 0 = N\r
11699 * N / N = N\r
11700 * N / I = N\r
11701 * I / n = I\r
11702 * I / 0 = I\r
11703 * I / N = N\r
11704 * I / I = N\r
11705 *\r
11706 * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r
11707 * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r
11708 */\r
11709 P.dividedBy = P.div = function ( y, b ) {\r
11710 id = 3;\r
11711 return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r
11712 };\r
11713\r
11714\r
11715 /*\r
11716 * Return a new BigNumber whose value is the integer part of dividing the value of this\r
11717 * BigNumber by the value of BigNumber(y, b).\r
11718 */\r
11719 P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r
11720 id = 4;\r
11721 return div( this, new BigNumber( y, b ), 0, 1 );\r
11722 };\r
11723\r
11724\r
11725 /*\r
11726 * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r
11727 * otherwise returns false.\r
11728 */\r
11729 P.equals = P.eq = function ( y, b ) {\r
11730 id = 5;\r
11731 return compare( this, new BigNumber( y, b ) ) === 0;\r
11732 };\r
11733\r
11734\r
11735 /*\r
11736 * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r
11737 * number in the direction of -Infinity.\r
11738 */\r
11739 P.floor = function () {\r
11740 return round( new BigNumber(this), this.e + 1, 3 );\r
11741 };\r
11742\r
11743\r
11744 /*\r
11745 * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r
11746 * otherwise returns false.\r
11747 */\r
11748 P.greaterThan = P.gt = function ( y, b ) {\r
11749 id = 6;\r
11750 return compare( this, new BigNumber( y, b ) ) > 0;\r
11751 };\r
11752\r
11753\r
11754 /*\r
11755 * Return true if the value of this BigNumber is greater than or equal to the value of\r
11756 * BigNumber(y, b), otherwise returns false.\r
11757 */\r
11758 P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r
11759 id = 7;\r
11760 return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r
11761\r
11762 };\r
11763\r
11764\r
11765 /*\r
11766 * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r
11767 */\r
11768 P.isFinite = function () {\r
11769 return !!this.c;\r
11770 };\r
11771\r
11772\r
11773 /*\r
11774 * Return true if the value of this BigNumber is an integer, otherwise return false.\r
11775 */\r
11776 P.isInteger = P.isInt = function () {\r
11777 return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r
11778 };\r
11779\r
11780\r
11781 /*\r
11782 * Return true if the value of this BigNumber is NaN, otherwise returns false.\r
11783 */\r
11784 P.isNaN = function () {\r
11785 return !this.s;\r
11786 };\r
11787\r
11788\r
11789 /*\r
11790 * Return true if the value of this BigNumber is negative, otherwise returns false.\r
11791 */\r
11792 P.isNegative = P.isNeg = function () {\r
11793 return this.s < 0;\r
11794 };\r
11795\r
11796\r
11797 /*\r
11798 * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r
11799 */\r
11800 P.isZero = function () {\r
11801 return !!this.c && this.c[0] == 0;\r
11802 };\r
11803\r
11804\r
11805 /*\r
11806 * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r
11807 * otherwise returns false.\r
11808 */\r
11809 P.lessThan = P.lt = function ( y, b ) {\r
11810 id = 8;\r
11811 return compare( this, new BigNumber( y, b ) ) < 0;\r
11812 };\r
11813\r
11814\r
11815 /*\r
11816 * Return true if the value of this BigNumber is less than or equal to the value of\r
11817 * BigNumber(y, b), otherwise returns false.\r
11818 */\r
11819 P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r
11820 id = 9;\r
11821 return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r
11822 };\r
11823\r
11824\r
11825 /*\r
11826 * n - 0 = n\r
11827 * n - N = N\r
11828 * n - I = -I\r
11829 * 0 - n = -n\r
11830 * 0 - 0 = 0\r
11831 * 0 - N = N\r
11832 * 0 - I = -I\r
11833 * N - n = N\r
11834 * N - 0 = N\r
11835 * N - N = N\r
11836 * N - I = N\r
11837 * I - n = I\r
11838 * I - 0 = I\r
11839 * I - N = N\r
11840 * I - I = N\r
11841 *\r
11842 * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r
11843 * BigNumber(y, b).\r
11844 */\r
11845 P.minus = P.sub = function ( y, b ) {\r
11846 var i, j, t, xLTy,\r
11847 x = this,\r
11848 a = x.s;\r
11849\r
11850 id = 10;\r
11851 y = new BigNumber( y, b );\r
11852 b = y.s;\r
11853\r
11854 // Either NaN?\r
11855 if ( !a || !b ) return new BigNumber(NaN);\r
11856\r
11857 // Signs differ?\r
11858 if ( a != b ) {\r
11859 y.s = -b;\r
11860 return x.plus(y);\r
11861 }\r
11862\r
11863 var xe = x.e / LOG_BASE,\r
11864 ye = y.e / LOG_BASE,\r
11865 xc = x.c,\r
11866 yc = y.c;\r
11867\r
11868 if ( !xe || !ye ) {\r
11869\r
11870 // Either Infinity?\r
11871 if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r
11872\r
11873 // Either zero?\r
11874 if ( !xc[0] || !yc[0] ) {\r
11875\r
11876 // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r
11877 return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r
11878\r
11879 // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r
11880 ROUNDING_MODE == 3 ? -0 : 0 );\r
11881 }\r
11882 }\r
11883\r
11884 xe = bitFloor(xe);\r
11885 ye = bitFloor(ye);\r
11886 xc = xc.slice();\r
11887\r
11888 // Determine which is the bigger number.\r
11889 if ( a = xe - ye ) {\r
11890\r
11891 if ( xLTy = a < 0 ) {\r
11892 a = -a;\r
11893 t = xc;\r
11894 } else {\r
11895 ye = xe;\r
11896 t = yc;\r
11897 }\r
11898\r
11899 t.reverse();\r
11900\r
11901 // Prepend zeros to equalise exponents.\r
11902 for ( b = a; b--; t.push(0) );\r
11903 t.reverse();\r
11904 } else {\r
11905\r
11906 // Exponents equal. Check digit by digit.\r
11907 j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r
11908\r
11909 for ( a = b = 0; b < j; b++ ) {\r
11910\r
11911 if ( xc[b] != yc[b] ) {\r
11912 xLTy = xc[b] < yc[b];\r
11913 break;\r
11914 }\r
11915 }\r
11916 }\r
11917\r
11918 // x < y? Point xc to the array of the bigger number.\r
11919 if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r
11920\r
11921 b = ( j = yc.length ) - ( i = xc.length );\r
11922\r
11923 // Append zeros to xc if shorter.\r
11924 // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r
11925 if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r
11926 b = BASE - 1;\r
11927\r
11928 // Subtract yc from xc.\r
11929 for ( ; j > a; ) {\r
11930\r
11931 if ( xc[--j] < yc[j] ) {\r
11932 for ( i = j; i && !xc[--i]; xc[i] = b );\r
11933 --xc[i];\r
11934 xc[j] += BASE;\r
11935 }\r
11936\r
11937 xc[j] -= yc[j];\r
11938 }\r
11939\r
11940 // Remove leading zeros and adjust exponent accordingly.\r
11941 for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r
11942\r
11943 // Zero?\r
11944 if ( !xc[0] ) {\r
11945\r
11946 // Following IEEE 754 (2008) 6.3,\r
11947 // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r
11948 y.s = ROUNDING_MODE == 3 ? -1 : 1;\r
11949 y.c = [ y.e = 0 ];\r
11950 return y;\r
11951 }\r
11952\r
11953 // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r
11954 // for finite x and y.\r
11955 return normalise( y, xc, ye );\r
11956 };\r
11957\r
11958\r
11959 /*\r
11960 * n % 0 = N\r
11961 * n % N = N\r
11962 * n % I = n\r
11963 * 0 % n = 0\r
11964 * -0 % n = -0\r
11965 * 0 % 0 = N\r
11966 * 0 % N = N\r
11967 * 0 % I = 0\r
11968 * N % n = N\r
11969 * N % 0 = N\r
11970 * N % N = N\r
11971 * N % I = N\r
11972 * I % n = N\r
11973 * I % 0 = N\r
11974 * I % N = N\r
11975 * I % I = N\r
11976 *\r
11977 * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r
11978 * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r
11979 */\r
11980 P.modulo = P.mod = function ( y, b ) {\r
11981 var q, s,\r
11982 x = this;\r
11983\r
11984 id = 11;\r
11985 y = new BigNumber( y, b );\r
11986\r
11987 // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r
11988 if ( !x.c || !y.s || y.c && !y.c[0] ) {\r
11989 return new BigNumber(NaN);\r
11990\r
11991 // Return x if y is Infinity or x is zero.\r
11992 } else if ( !y.c || x.c && !x.c[0] ) {\r
11993 return new BigNumber(x);\r
11994 }\r
11995\r
11996 if ( MODULO_MODE == 9 ) {\r
11997\r
11998 // Euclidian division: q = sign(y) * floor(x / abs(y))\r
11999 // r = x - qy where 0 <= r < abs(y)\r
12000 s = y.s;\r
12001 y.s = 1;\r
12002 q = div( x, y, 0, 3 );\r
12003 y.s = s;\r
12004 q.s *= s;\r
12005 } else {\r
12006 q = div( x, y, 0, MODULO_MODE );\r
12007 }\r
12008\r
12009 return x.minus( q.times(y) );\r
12010 };\r
12011\r
12012\r
12013 /*\r
12014 * Return a new BigNumber whose value is the value of this BigNumber negated,\r
12015 * i.e. multiplied by -1.\r
12016 */\r
12017 P.negated = P.neg = function () {\r
12018 var x = new BigNumber(this);\r
12019 x.s = -x.s || null;\r
12020 return x;\r
12021 };\r
12022\r
12023\r
12024 /*\r
12025 * n + 0 = n\r
12026 * n + N = N\r
12027 * n + I = I\r
12028 * 0 + n = n\r
12029 * 0 + 0 = 0\r
12030 * 0 + N = N\r
12031 * 0 + I = I\r
12032 * N + n = N\r
12033 * N + 0 = N\r
12034 * N + N = N\r
12035 * N + I = N\r
12036 * I + n = I\r
12037 * I + 0 = I\r
12038 * I + N = N\r
12039 * I + I = I\r
12040 *\r
12041 * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r
12042 * BigNumber(y, b).\r
12043 */\r
12044 P.plus = P.add = function ( y, b ) {\r
12045 var t,\r
12046 x = this,\r
12047 a = x.s;\r
12048\r
12049 id = 12;\r
12050 y = new BigNumber( y, b );\r
12051 b = y.s;\r
12052\r
12053 // Either NaN?\r
12054 if ( !a || !b ) return new BigNumber(NaN);\r
12055\r
12056 // Signs differ?\r
12057 if ( a != b ) {\r
12058 y.s = -b;\r
12059 return x.minus(y);\r
12060 }\r
12061\r
12062 var xe = x.e / LOG_BASE,\r
12063 ye = y.e / LOG_BASE,\r
12064 xc = x.c,\r
12065 yc = y.c;\r
12066\r
12067 if ( !xe || !ye ) {\r
12068\r
12069 // Return ±Infinity if either ±Infinity.\r
12070 if ( !xc || !yc ) return new BigNumber( a / 0 );\r
12071\r
12072 // Either zero?\r
12073 // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r
12074 if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r
12075 }\r
12076\r
12077 xe = bitFloor(xe);\r
12078 ye = bitFloor(ye);\r
12079 xc = xc.slice();\r
12080\r
12081 // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r
12082 if ( a = xe - ye ) {\r
12083 if ( a > 0 ) {\r
12084 ye = xe;\r
12085 t = yc;\r
12086 } else {\r
12087 a = -a;\r
12088 t = xc;\r
12089 }\r
12090\r
12091 t.reverse();\r
12092 for ( ; a--; t.push(0) );\r
12093 t.reverse();\r
12094 }\r
12095\r
12096 a = xc.length;\r
12097 b = yc.length;\r
12098\r
12099 // Point xc to the longer array, and b to the shorter length.\r
12100 if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r
12101\r
12102 // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r
12103 for ( a = 0; b; ) {\r
12104 a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r
12105 xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r
12106 }\r
12107\r
12108 if (a) {\r
12109 xc = [a].concat(xc);\r
12110 ++ye;\r
12111 }\r
12112\r
12113 // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r
12114 // ye = MAX_EXP + 1 possible\r
12115 return normalise( y, xc, ye );\r
12116 };\r
12117\r
12118\r
12119 /*\r
12120 * Return the number of significant digits of the value of this BigNumber.\r
12121 *\r
12122 * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r
12123 */\r
12124 P.precision = P.sd = function (z) {\r
12125 var n, v,\r
12126 x = this,\r
12127 c = x.c;\r
12128\r
12129 // 'precision() argument not a boolean or binary digit: {z}'\r
12130 if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r
12131 if (ERRORS) raise( 13, 'argument' + notBool, z );\r
12132 if ( z != !!z ) z = null;\r
12133 }\r
12134\r
12135 if ( !c ) return null;\r
12136 v = c.length - 1;\r
12137 n = v * LOG_BASE + 1;\r
12138\r
12139 if ( v = c[v] ) {\r
12140\r
12141 // Subtract the number of trailing zeros of the last element.\r
12142 for ( ; v % 10 == 0; v /= 10, n-- );\r
12143\r
12144 // Add the number of digits of the first element.\r
12145 for ( v = c[0]; v >= 10; v /= 10, n++ );\r
12146 }\r
12147\r
12148 if ( z && x.e + 1 > n ) n = x.e + 1;\r
12149\r
12150 return n;\r
12151 };\r
12152\r
12153\r
12154 /*\r
12155 * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r
12156 * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r
12157 * omitted.\r
12158 *\r
12159 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
12160 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
12161 *\r
12162 * 'round() decimal places out of range: {dp}'\r
12163 * 'round() decimal places not an integer: {dp}'\r
12164 * 'round() rounding mode not an integer: {rm}'\r
12165 * 'round() rounding mode out of range: {rm}'\r
12166 */\r
12167 P.round = function ( dp, rm ) {\r
12168 var n = new BigNumber(this);\r
12169\r
12170 if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r
12171 round( n, ~~dp + this.e + 1, rm == null ||\r
12172 !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r
12173 }\r
12174\r
12175 return n;\r
12176 };\r
12177\r
12178\r
12179 /*\r
12180 * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r
12181 * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r
12182 *\r
12183 * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r
12184 *\r
12185 * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r
12186 * otherwise.\r
12187 *\r
12188 * 'shift() argument not an integer: {k}'\r
12189 * 'shift() argument out of range: {k}'\r
12190 */\r
12191 P.shift = function (k) {\r
12192 var n = this;\r
12193 return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r
12194\r
12195 // k < 1e+21, or truncate(k) will produce exponential notation.\r
12196 ? n.times( '1e' + truncate(k) )\r
12197 : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r
12198 ? n.s * ( k < 0 ? 0 : 1 / 0 )\r
12199 : n );\r
12200 };\r
12201\r
12202\r
12203 /*\r
12204 * sqrt(-n) = N\r
12205 * sqrt( N) = N\r
12206 * sqrt(-I) = N\r
12207 * sqrt( I) = I\r
12208 * sqrt( 0) = 0\r
12209 * sqrt(-0) = -0\r
12210 *\r
12211 * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r
12212 * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r
12213 */\r
12214 P.squareRoot = P.sqrt = function () {\r
12215 var m, n, r, rep, t,\r
12216 x = this,\r
12217 c = x.c,\r
12218 s = x.s,\r
12219 e = x.e,\r
12220 dp = DECIMAL_PLACES + 4,\r
12221 half = new BigNumber('0.5');\r
12222\r
12223 // Negative/NaN/Infinity/zero?\r
12224 if ( s !== 1 || !c || !c[0] ) {\r
12225 return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r
12226 }\r
12227\r
12228 // Initial estimate.\r
12229 s = Math.sqrt( +x );\r
12230\r
12231 // Math.sqrt underflow/overflow?\r
12232 // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r
12233 if ( s == 0 || s == 1 / 0 ) {\r
12234 n = coeffToString(c);\r
12235 if ( ( n.length + e ) % 2 == 0 ) n += '0';\r
12236 s = Math.sqrt(n);\r
12237 e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r
12238\r
12239 if ( s == 1 / 0 ) {\r
12240 n = '1e' + e;\r
12241 } else {\r
12242 n = s.toExponential();\r
12243 n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r
12244 }\r
12245\r
12246 r = new BigNumber(n);\r
12247 } else {\r
12248 r = new BigNumber( s + '' );\r
12249 }\r
12250\r
12251 // Check for zero.\r
12252 // r could be zero if MIN_EXP is changed after the this value was created.\r
12253 // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r
12254 // coeffToString to throw.\r
12255 if ( r.c[0] ) {\r
12256 e = r.e;\r
12257 s = e + dp;\r
12258 if ( s < 3 ) s = 0;\r
12259\r
12260 // Newton-Raphson iteration.\r
12261 for ( ; ; ) {\r
12262 t = r;\r
12263 r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r
12264\r
12265 if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r
12266 coeffToString( r.c ) ).slice( 0, s ) ) {\r
12267\r
12268 // The exponent of r may here be one less than the final result exponent,\r
12269 // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r
12270 // are indexed correctly.\r
12271 if ( r.e < e ) --s;\r
12272 n = n.slice( s - 3, s + 1 );\r
12273\r
12274 // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r
12275 // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r
12276 // iteration.\r
12277 if ( n == '9999' || !rep && n == '4999' ) {\r
12278\r
12279 // On the first iteration only, check to see if rounding up gives the\r
12280 // exact result as the nines may infinitely repeat.\r
12281 if ( !rep ) {\r
12282 round( t, t.e + DECIMAL_PLACES + 2, 0 );\r
12283\r
12284 if ( t.times(t).eq(x) ) {\r
12285 r = t;\r
12286 break;\r
12287 }\r
12288 }\r
12289\r
12290 dp += 4;\r
12291 s += 4;\r
12292 rep = 1;\r
12293 } else {\r
12294\r
12295 // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r
12296 // result. If not, then there are further digits and m will be truthy.\r
12297 if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r
12298\r
12299 // Truncate to the first rounding digit.\r
12300 round( r, r.e + DECIMAL_PLACES + 2, 1 );\r
12301 m = !r.times(r).eq(x);\r
12302 }\r
12303\r
12304 break;\r
12305 }\r
12306 }\r
12307 }\r
12308 }\r
12309\r
12310 return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r
12311 };\r
12312\r
12313\r
12314 /*\r
12315 * n * 0 = 0\r
12316 * n * N = N\r
12317 * n * I = I\r
12318 * 0 * n = 0\r
12319 * 0 * 0 = 0\r
12320 * 0 * N = N\r
12321 * 0 * I = N\r
12322 * N * n = N\r
12323 * N * 0 = N\r
12324 * N * N = N\r
12325 * N * I = N\r
12326 * I * n = I\r
12327 * I * 0 = N\r
12328 * I * N = N\r
12329 * I * I = I\r
12330 *\r
12331 * Return a new BigNumber whose value is the value of this BigNumber times the value of\r
12332 * BigNumber(y, b).\r
12333 */\r
12334 P.times = P.mul = function ( y, b ) {\r
12335 var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r
12336 base, sqrtBase,\r
12337 x = this,\r
12338 xc = x.c,\r
12339 yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r
12340\r
12341 // Either NaN, ±Infinity or ±0?\r
12342 if ( !xc || !yc || !xc[0] || !yc[0] ) {\r
12343\r
12344 // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r
12345 if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r
12346 y.c = y.e = y.s = null;\r
12347 } else {\r
12348 y.s *= x.s;\r
12349\r
12350 // Return ±Infinity if either is ±Infinity.\r
12351 if ( !xc || !yc ) {\r
12352 y.c = y.e = null;\r
12353\r
12354 // Return ±0 if either is ±0.\r
12355 } else {\r
12356 y.c = [0];\r
12357 y.e = 0;\r
12358 }\r
12359 }\r
12360\r
12361 return y;\r
12362 }\r
12363\r
12364 e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r
12365 y.s *= x.s;\r
12366 xcL = xc.length;\r
12367 ycL = yc.length;\r
12368\r
12369 // Ensure xc points to longer array and xcL to its length.\r
12370 if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r
12371\r
12372 // Initialise the result array with zeros.\r
12373 for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r
12374\r
12375 base = BASE;\r
12376 sqrtBase = SQRT_BASE;\r
12377\r
12378 for ( i = ycL; --i >= 0; ) {\r
12379 c = 0;\r
12380 ylo = yc[i] % sqrtBase;\r
12381 yhi = yc[i] / sqrtBase | 0;\r
12382\r
12383 for ( k = xcL, j = i + k; j > i; ) {\r
12384 xlo = xc[--k] % sqrtBase;\r
12385 xhi = xc[k] / sqrtBase | 0;\r
12386 m = yhi * xlo + xhi * ylo;\r
12387 xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r
12388 c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r
12389 zc[j--] = xlo % base;\r
12390 }\r
12391\r
12392 zc[j] = c;\r
12393 }\r
12394\r
12395 if (c) {\r
12396 ++e;\r
12397 } else {\r
12398 zc.splice(0, 1);\r
12399 }\r
12400\r
12401 return normalise( y, zc, e );\r
12402 };\r
12403\r
12404\r
12405 /*\r
12406 * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r
12407 * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r
12408 *\r
12409 * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r
12410 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
12411 *\r
12412 * 'toDigits() precision out of range: {sd}'\r
12413 * 'toDigits() precision not an integer: {sd}'\r
12414 * 'toDigits() rounding mode not an integer: {rm}'\r
12415 * 'toDigits() rounding mode out of range: {rm}'\r
12416 */\r
12417 P.toDigits = function ( sd, rm ) {\r
12418 var n = new BigNumber(this);\r
12419 sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r
12420 rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r
12421 return sd ? round( n, sd, rm ) : n;\r
12422 };\r
12423\r
12424\r
12425 /*\r
12426 * Return a string representing the value of this BigNumber in exponential notation and\r
12427 * rounded using ROUNDING_MODE to dp fixed decimal places.\r
12428 *\r
12429 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
12430 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
12431 *\r
12432 * 'toExponential() decimal places not an integer: {dp}'\r
12433 * 'toExponential() decimal places out of range: {dp}'\r
12434 * 'toExponential() rounding mode not an integer: {rm}'\r
12435 * 'toExponential() rounding mode out of range: {rm}'\r
12436 */\r
12437 P.toExponential = function ( dp, rm ) {\r
12438 return format( this,\r
12439 dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r
12440 };\r
12441\r
12442\r
12443 /*\r
12444 * Return a string representing the value of this BigNumber in fixed-point notation rounding\r
12445 * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r
12446 *\r
12447 * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r
12448 * but e.g. (-0.00001).toFixed(0) is '-0'.\r
12449 *\r
12450 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
12451 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
12452 *\r
12453 * 'toFixed() decimal places not an integer: {dp}'\r
12454 * 'toFixed() decimal places out of range: {dp}'\r
12455 * 'toFixed() rounding mode not an integer: {rm}'\r
12456 * 'toFixed() rounding mode out of range: {rm}'\r
12457 */\r
12458 P.toFixed = function ( dp, rm ) {\r
12459 return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r
12460 ? ~~dp + this.e + 1 : null, rm, 20 );\r
12461 };\r
12462\r
12463\r
12464 /*\r
12465 * Return a string representing the value of this BigNumber in fixed-point notation rounded\r
12466 * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r
12467 * of the FORMAT object (see BigNumber.config).\r
12468 *\r
12469 * FORMAT = {\r
12470 * decimalSeparator : '.',\r
12471 * groupSeparator : ',',\r
12472 * groupSize : 3,\r
12473 * secondaryGroupSize : 0,\r
12474 * fractionGroupSeparator : '\xA0', // non-breaking space\r
12475 * fractionGroupSize : 0\r
12476 * };\r
12477 *\r
12478 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
12479 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
12480 *\r
12481 * 'toFormat() decimal places not an integer: {dp}'\r
12482 * 'toFormat() decimal places out of range: {dp}'\r
12483 * 'toFormat() rounding mode not an integer: {rm}'\r
12484 * 'toFormat() rounding mode out of range: {rm}'\r
12485 */\r
12486 P.toFormat = function ( dp, rm ) {\r
12487 var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r
12488 ? ~~dp + this.e + 1 : null, rm, 21 );\r
12489\r
12490 if ( this.c ) {\r
12491 var i,\r
12492 arr = str.split('.'),\r
12493 g1 = +FORMAT.groupSize,\r
12494 g2 = +FORMAT.secondaryGroupSize,\r
12495 groupSeparator = FORMAT.groupSeparator,\r
12496 intPart = arr[0],\r
12497 fractionPart = arr[1],\r
12498 isNeg = this.s < 0,\r
12499 intDigits = isNeg ? intPart.slice(1) : intPart,\r
12500 len = intDigits.length;\r
12501\r
12502 if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r
12503\r
12504 if ( g1 > 0 && len > 0 ) {\r
12505 i = len % g1 || g1;\r
12506 intPart = intDigits.substr( 0, i );\r
12507\r
12508 for ( ; i < len; i += g1 ) {\r
12509 intPart += groupSeparator + intDigits.substr( i, g1 );\r
12510 }\r
12511\r
12512 if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r
12513 if (isNeg) intPart = '-' + intPart;\r
12514 }\r
12515\r
12516 str = fractionPart\r
12517 ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r
12518 ? fractionPart.replace( new RegExp( '\\d{' + g2 + '}\\B', 'g' ),\r
12519 '$&' + FORMAT.fractionGroupSeparator )\r
12520 : fractionPart )\r
12521 : intPart;\r
12522 }\r
12523\r
12524 return str;\r
12525 };\r
12526\r
12527\r
12528 /*\r
12529 * Return a string array representing the value of this BigNumber as a simple fraction with\r
12530 * an integer numerator and an integer denominator. The denominator will be a positive\r
12531 * non-zero value less than or equal to the specified maximum denominator. If a maximum\r
12532 * denominator is not specified, the denominator will be the lowest value necessary to\r
12533 * represent the number exactly.\r
12534 *\r
12535 * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r
12536 *\r
12537 * 'toFraction() max denominator not an integer: {md}'\r
12538 * 'toFraction() max denominator out of range: {md}'\r
12539 */\r
12540 P.toFraction = function (md) {\r
12541 var arr, d0, d2, e, exp, n, n0, q, s,\r
12542 k = ERRORS,\r
12543 x = this,\r
12544 xc = x.c,\r
12545 d = new BigNumber(ONE),\r
12546 n1 = d0 = new BigNumber(ONE),\r
12547 d1 = n0 = new BigNumber(ONE);\r
12548\r
12549 if ( md != null ) {\r
12550 ERRORS = false;\r
12551 n = new BigNumber(md);\r
12552 ERRORS = k;\r
12553\r
12554 if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r
12555\r
12556 if (ERRORS) {\r
12557 raise( 22,\r
12558 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r
12559 }\r
12560\r
12561 // ERRORS is false:\r
12562 // If md is a finite non-integer >= 1, round it to an integer and use it.\r
12563 md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r
12564 }\r
12565 }\r
12566\r
12567 if ( !xc ) return x.toString();\r
12568 s = coeffToString(xc);\r
12569\r
12570 // Determine initial denominator.\r
12571 // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r
12572 e = d.e = s.length - x.e - 1;\r
12573 d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r
12574 md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r
12575\r
12576 exp = MAX_EXP;\r
12577 MAX_EXP = 1 / 0;\r
12578 n = new BigNumber(s);\r
12579\r
12580 // n0 = d1 = 0\r
12581 n0.c[0] = 0;\r
12582\r
12583 for ( ; ; ) {\r
12584 q = div( n, d, 0, 1 );\r
12585 d2 = d0.plus( q.times(d1) );\r
12586 if ( d2.cmp(md) == 1 ) break;\r
12587 d0 = d1;\r
12588 d1 = d2;\r
12589 n1 = n0.plus( q.times( d2 = n1 ) );\r
12590 n0 = d2;\r
12591 d = n.minus( q.times( d2 = d ) );\r
12592 n = d2;\r
12593 }\r
12594\r
12595 d2 = div( md.minus(d0), d1, 0, 1 );\r
12596 n0 = n0.plus( d2.times(n1) );\r
12597 d0 = d0.plus( d2.times(d1) );\r
12598 n0.s = n1.s = x.s;\r
12599 e *= 2;\r
12600\r
12601 // Determine which fraction is closer to x, n0/d0 or n1/d1\r
12602 arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r
12603 div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r
12604 ? [ n1.toString(), d1.toString() ]\r
12605 : [ n0.toString(), d0.toString() ];\r
12606\r
12607 MAX_EXP = exp;\r
12608 return arr;\r
12609 };\r
12610\r
12611\r
12612 /*\r
12613 * Return the value of this BigNumber converted to a number primitive.\r
12614 */\r
12615 P.toNumber = function () {\r
12616 return +this;\r
12617 };\r
12618\r
12619\r
12620 /*\r
12621 * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r
12622 * If m is present, return the result modulo m.\r
12623 * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r
12624 * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r
12625 * ROUNDING_MODE.\r
12626 *\r
12627 * The modular power operation works efficiently when x, n, and m are positive integers,\r
12628 * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r
12629 *\r
12630 * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r
12631 * [m] {number|string|BigNumber} The modulus.\r
12632 *\r
12633 * 'pow() exponent not an integer: {n}'\r
12634 * 'pow() exponent out of range: {n}'\r
12635 *\r
12636 * Performs 54 loop iterations for n of 9007199254740991.\r
12637 */\r
12638 P.toPower = P.pow = function ( n, m ) {\r
12639 var k, y, z,\r
12640 i = mathfloor( n < 0 ? -n : +n ),\r
12641 x = this;\r
12642\r
12643 if ( m != null ) {\r
12644 id = 23;\r
12645 m = new BigNumber(m);\r
12646 }\r
12647\r
12648 // Pass ±Infinity to Math.pow if exponent is out of range.\r
12649 if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r
12650 ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r
12651 parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r
12652 k = Math.pow( +x, n );\r
12653 return new BigNumber( m ? k % m : k );\r
12654 }\r
12655\r
12656 if (m) {\r
12657 if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r
12658 x = x.mod(m);\r
12659 } else {\r
12660 z = m;\r
12661\r
12662 // Nullify m so only a single mod operation is performed at the end.\r
12663 m = null;\r
12664 }\r
12665 } else if (POW_PRECISION) {\r
12666\r
12667 // Truncating each coefficient array to a length of k after each multiplication\r
12668 // equates to truncating significant digits to POW_PRECISION + [28, 41],\r
12669 // i.e. there will be a minimum of 28 guard digits retained.\r
12670 // (Using + 1.5 would give [9, 21] guard digits.)\r
12671 k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r
12672 }\r
12673\r
12674 y = new BigNumber(ONE);\r
12675\r
12676 for ( ; ; ) {\r
12677 if ( i % 2 ) {\r
12678 y = y.times(x);\r
12679 if ( !y.c ) break;\r
12680 if (k) {\r
12681 if ( y.c.length > k ) y.c.length = k;\r
12682 } else if (m) {\r
12683 y = y.mod(m);\r
12684 }\r
12685 }\r
12686\r
12687 i = mathfloor( i / 2 );\r
12688 if ( !i ) break;\r
12689 x = x.times(x);\r
12690 if (k) {\r
12691 if ( x.c && x.c.length > k ) x.c.length = k;\r
12692 } else if (m) {\r
12693 x = x.mod(m);\r
12694 }\r
12695 }\r
12696\r
12697 if (m) return y;\r
12698 if ( n < 0 ) y = ONE.div(y);\r
12699\r
12700 return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r
12701 };\r
12702\r
12703\r
12704 /*\r
12705 * Return a string representing the value of this BigNumber rounded to sd significant digits\r
12706 * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r
12707 * necessary to represent the integer part of the value in fixed-point notation, then use\r
12708 * exponential notation.\r
12709 *\r
12710 * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r
12711 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
12712 *\r
12713 * 'toPrecision() precision not an integer: {sd}'\r
12714 * 'toPrecision() precision out of range: {sd}'\r
12715 * 'toPrecision() rounding mode not an integer: {rm}'\r
12716 * 'toPrecision() rounding mode out of range: {rm}'\r
12717 */\r
12718 P.toPrecision = function ( sd, rm ) {\r
12719 return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r
12720 ? sd | 0 : null, rm, 24 );\r
12721 };\r
12722\r
12723\r
12724 /*\r
12725 * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r
12726 * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r
12727 * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r
12728 * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r
12729 * TO_EXP_NEG, return exponential notation.\r
12730 *\r
12731 * [b] {number} Integer, 2 to 64 inclusive.\r
12732 *\r
12733 * 'toString() base not an integer: {b}'\r
12734 * 'toString() base out of range: {b}'\r
12735 */\r
12736 P.toString = function (b) {\r
12737 var str,\r
12738 n = this,\r
12739 s = n.s,\r
12740 e = n.e;\r
12741\r
12742 // Infinity or NaN?\r
12743 if ( e === null ) {\r
12744\r
12745 if (s) {\r
12746 str = 'Infinity';\r
12747 if ( s < 0 ) str = '-' + str;\r
12748 } else {\r
12749 str = 'NaN';\r
12750 }\r
12751 } else {\r
12752 str = coeffToString( n.c );\r
12753\r
12754 if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r
12755 str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r
12756 ? toExponential( str, e )\r
12757 : toFixedPoint( str, e );\r
12758 } else {\r
12759 str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r
12760 }\r
12761\r
12762 if ( s < 0 && n.c[0] ) str = '-' + str;\r
12763 }\r
12764\r
12765 return str;\r
12766 };\r
12767\r
12768\r
12769 /*\r
12770 * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r
12771 * number.\r
12772 */\r
12773 P.truncated = P.trunc = function () {\r
12774 return round( new BigNumber(this), this.e + 1, 1 );\r
12775 };\r
12776\r
12777\r
12778 /*\r
12779 * Return as toString, but do not accept a base argument, and include the minus sign for\r
12780 * negative zero.\r
12781 */\r
12782 P.valueOf = P.toJSON = function () {\r
12783 var str,\r
12784 n = this,\r
12785 e = n.e;\r
12786\r
12787 if ( e === null ) return n.toString();\r
12788\r
12789 str = coeffToString( n.c );\r
12790\r
12791 str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r
12792 ? toExponential( str, e )\r
12793 : toFixedPoint( str, e );\r
12794\r
12795 return n.s < 0 ? '-' + str : str;\r
12796 };\r
12797\r
12798\r
12799 P.isBigNumber = true;\r
12800\r
12801 if ( config != null ) BigNumber.config(config);\r
12802\r
12803 return BigNumber;\r
12804 }\r
12805\r
12806\r
12807 // PRIVATE HELPER FUNCTIONS\r
12808\r
12809\r
12810 function bitFloor(n) {\r
12811 var i = n | 0;\r
12812 return n > 0 || n === i ? i : i - 1;\r
12813 }\r
12814\r
12815\r
12816 // Return a coefficient array as a string of base 10 digits.\r
12817 function coeffToString(a) {\r
12818 var s, z,\r
12819 i = 1,\r
12820 j = a.length,\r
12821 r = a[0] + '';\r
12822\r
12823 for ( ; i < j; ) {\r
12824 s = a[i++] + '';\r
12825 z = LOG_BASE - s.length;\r
12826 for ( ; z--; s = '0' + s );\r
12827 r += s;\r
12828 }\r
12829\r
12830 // Determine trailing zeros.\r
12831 for ( j = r.length; r.charCodeAt(--j) === 48; );\r
12832 return r.slice( 0, j + 1 || 1 );\r
12833 }\r
12834\r
12835\r
12836 // Compare the value of BigNumbers x and y.\r
12837 function compare( x, y ) {\r
12838 var a, b,\r
12839 xc = x.c,\r
12840 yc = y.c,\r
12841 i = x.s,\r
12842 j = y.s,\r
12843 k = x.e,\r
12844 l = y.e;\r
12845\r
12846 // Either NaN?\r
12847 if ( !i || !j ) return null;\r
12848\r
12849 a = xc && !xc[0];\r
12850 b = yc && !yc[0];\r
12851\r
12852 // Either zero?\r
12853 if ( a || b ) return a ? b ? 0 : -j : i;\r
12854\r
12855 // Signs differ?\r
12856 if ( i != j ) return i;\r
12857\r
12858 a = i < 0;\r
12859 b = k == l;\r
12860\r
12861 // Either Infinity?\r
12862 if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1;\r
12863\r
12864 // Compare exponents.\r
12865 if ( !b ) return k > l ^ a ? 1 : -1;\r
12866\r
12867 j = ( k = xc.length ) < ( l = yc.length ) ? k : l;\r
12868\r
12869 // Compare digit by digit.\r
12870 for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1;\r
12871\r
12872 // Compare lengths.\r
12873 return k == l ? 0 : k > l ^ a ? 1 : -1;\r
12874 }\r
12875\r
12876\r
12877 /*\r
12878 * Return true if n is a valid number in range, otherwise false.\r
12879 * Use for argument validation when ERRORS is false.\r
12880 * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10.\r
12881 */\r
12882 function intValidatorNoErrors( n, min, max ) {\r
12883 return ( n = truncate(n) ) >= min && n <= max;\r
12884 }\r
12885\r
12886\r
12887 function isArray(obj) {\r
12888 return Object.prototype.toString.call(obj) == '[object Array]';\r
12889 }\r
12890\r
12891\r
12892 /*\r
12893 * Convert string of baseIn to an array of numbers of baseOut.\r
12894 * Eg. convertBase('255', 10, 16) returns [15, 15].\r
12895 * Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\r
12896 */\r
12897 function toBaseOut( str, baseIn, baseOut ) {\r
12898 var j,\r
12899 arr = [0],\r
12900 arrL,\r
12901 i = 0,\r
12902 len = str.length;\r
12903\r
12904 for ( ; i < len; ) {\r
12905 for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r
12906 arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r
12907\r
12908 for ( ; j < arr.length; j++ ) {\r
12909\r
12910 if ( arr[j] > baseOut - 1 ) {\r
12911 if ( arr[j + 1] == null ) arr[j + 1] = 0;\r
12912 arr[j + 1] += arr[j] / baseOut | 0;\r
12913 arr[j] %= baseOut;\r
12914 }\r
12915 }\r
12916 }\r
12917\r
12918 return arr.reverse();\r
12919 }\r
12920\r
12921\r
12922 function toExponential( str, e ) {\r
12923 return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) +\r
12924 ( e < 0 ? 'e' : 'e+' ) + e;\r
12925 }\r
12926\r
12927\r
12928 function toFixedPoint( str, e ) {\r
12929 var len, z;\r
12930\r
12931 // Negative exponent?\r
12932 if ( e < 0 ) {\r
12933\r
12934 // Prepend zeros.\r
12935 for ( z = '0.'; ++e; z += '0' );\r
12936 str = z + str;\r
12937\r
12938 // Positive exponent\r
12939 } else {\r
12940 len = str.length;\r
12941\r
12942 // Append zeros.\r
12943 if ( ++e > len ) {\r
12944 for ( z = '0', e -= len; --e; z += '0' );\r
12945 str += z;\r
12946 } else if ( e < len ) {\r
12947 str = str.slice( 0, e ) + '.' + str.slice(e);\r
12948 }\r
12949 }\r
12950\r
12951 return str;\r
12952 }\r
12953\r
12954\r
12955 function truncate(n) {\r
12956 n = parseFloat(n);\r
12957 return n < 0 ? mathceil(n) : mathfloor(n);\r
12958 }\r
12959\r
12960\r
12961 // EXPORT\r
12962\r
12963\r
12964 BigNumber = constructorFactory();\r
12965 BigNumber['default'] = BigNumber.BigNumber = BigNumber;\r
12966\r
12967\r
12968 // AMD.\r
12969 if ( typeof define == 'function' && define.amd ) {\r
12970 define( function () { return BigNumber; } );\r
12971\r
12972 // Node.js and other environments that support module.exports.\r
12973 } else if ( typeof module != 'undefined' && module.exports ) {\r
12974 module.exports = BigNumber;\r
12975\r
12976 // Browser.\r
12977 } else {\r
12978 if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')();\r
12979 globalObj.BigNumber = BigNumber;\r
12980 }\r
12981})(this);\r
12982
12983},{}],66:[function(require,module,exports){
12984var aes = require('browserify-aes')
12985var assert = require('assert')
12986var Buffer = require('safe-buffer').Buffer
12987var bs58check = require('bs58check')
12988var createHash = require('create-hash')
12989var scrypt = require('scryptsy')
12990var xor = require('buffer-xor/inplace')
12991
12992var ecurve = require('ecurve')
12993var curve = ecurve.getCurveByName('secp256k1')
12994
12995var BigInteger = require('bigi')
12996
12997// constants
12998var SCRYPT_PARAMS = {
12999 N: 16384, // specified by BIP38
13000 r: 8,
13001 p: 8
13002}
13003var NULL = Buffer.alloc(0)
13004
13005function hash160 (buffer) {
13006 return createHash('rmd160').update(
13007 createHash('sha256').update(buffer).digest()
13008 ).digest()
13009}
13010
13011function hash256 (buffer) {
13012 return createHash('sha256').update(
13013 createHash('sha256').update(buffer).digest()
13014 ).digest()
13015}
13016
13017function getAddress (d, compressed) {
13018 var Q = curve.G.multiply(d).getEncoded(compressed)
13019 var hash = hash160(Q)
13020 var payload = Buffer.allocUnsafe(21)
13021 payload.writeUInt8(0x00, 0) // XXX TODO FIXME bitcoin only??? damn you BIP38
13022 hash.copy(payload, 1)
13023
13024 return bs58check.encode(payload)
13025}
13026
13027function encryptRaw (buffer, compressed, passphrase, progressCallback, scryptParams) {
13028 if (buffer.length !== 32) throw new Error('Invalid private key length')
13029 scryptParams = scryptParams || SCRYPT_PARAMS
13030
13031 var d = BigInteger.fromBuffer(buffer)
13032 var address = getAddress(d, compressed)
13033 var secret = Buffer.from(passphrase, 'utf8')
13034 var salt = hash256(address).slice(0, 4)
13035
13036 var N = scryptParams.N
13037 var r = scryptParams.r
13038 var p = scryptParams.p
13039
13040 var scryptBuf = scrypt(secret, salt, N, r, p, 64, progressCallback)
13041 var derivedHalf1 = scryptBuf.slice(0, 32)
13042 var derivedHalf2 = scryptBuf.slice(32, 64)
13043
13044 var xorBuf = xor(derivedHalf1, buffer)
13045 var cipher = aes.createCipheriv('aes-256-ecb', derivedHalf2, NULL)
13046 cipher.setAutoPadding(false)
13047 cipher.end(xorBuf)
13048
13049 var cipherText = cipher.read()
13050
13051 // 0x01 | 0x42 | flagByte | salt (4) | cipherText (32)
13052 var result = Buffer.allocUnsafe(7 + 32)
13053 result.writeUInt8(0x01, 0)
13054 result.writeUInt8(0x42, 1)
13055 result.writeUInt8(compressed ? 0xe0 : 0xc0, 2)
13056 salt.copy(result, 3)
13057 cipherText.copy(result, 7)
13058
13059 return result
13060}
13061
13062function encrypt (buffer, compressed, passphrase, progressCallback, scryptParams) {
13063 return bs58check.encode(encryptRaw(buffer, compressed, passphrase, progressCallback, scryptParams))
13064}
13065
13066// some of the techniques borrowed from: https://github.com/pointbiz/bitaddress.org
13067function decryptRaw (buffer, passphrase, progressCallback, scryptParams) {
13068 // 39 bytes: 2 bytes prefix, 37 bytes payload
13069 if (buffer.length !== 39) throw new Error('Invalid BIP38 data length')
13070 if (buffer.readUInt8(0) !== 0x01) throw new Error('Invalid BIP38 prefix')
13071 scryptParams = scryptParams || SCRYPT_PARAMS
13072
13073 // check if BIP38 EC multiply
13074 var type = buffer.readUInt8(1)
13075 if (type === 0x43) return decryptECMult(buffer, passphrase, progressCallback, scryptParams)
13076 if (type !== 0x42) throw new Error('Invalid BIP38 type')
13077
13078 passphrase = Buffer.from(passphrase, 'utf8')
13079
13080 var flagByte = buffer.readUInt8(2)
13081 var compressed = flagByte === 0xe0
13082 if (!compressed && flagByte !== 0xc0) throw new Error('Invalid BIP38 compression flag')
13083
13084 var N = scryptParams.N
13085 var r = scryptParams.r
13086 var p = scryptParams.p
13087
13088 var salt = buffer.slice(3, 7)
13089 var scryptBuf = scrypt(passphrase, salt, N, r, p, 64, progressCallback)
13090 var derivedHalf1 = scryptBuf.slice(0, 32)
13091 var derivedHalf2 = scryptBuf.slice(32, 64)
13092
13093 var privKeyBuf = buffer.slice(7, 7 + 32)
13094 var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, NULL)
13095 decipher.setAutoPadding(false)
13096 decipher.end(privKeyBuf)
13097
13098 var plainText = decipher.read()
13099 var privateKey = xor(derivedHalf1, plainText)
13100
13101 // verify salt matches address
13102 var d = BigInteger.fromBuffer(privateKey)
13103 var address = getAddress(d, compressed)
13104 var checksum = hash256(address).slice(0, 4)
13105 assert.deepEqual(salt, checksum)
13106
13107 return {
13108 privateKey: privateKey,
13109 compressed: compressed
13110 }
13111}
13112
13113function decrypt (string, passphrase, progressCallback, scryptParams) {
13114 return decryptRaw(bs58check.decode(string), passphrase, progressCallback, scryptParams)
13115}
13116
13117function decryptECMult (buffer, passphrase, progressCallback, scryptParams) {
13118 passphrase = Buffer.from(passphrase, 'utf8')
13119 buffer = buffer.slice(1) // FIXME: we can avoid this
13120 scryptParams = scryptParams || SCRYPT_PARAMS
13121
13122 var flag = buffer.readUInt8(1)
13123 var compressed = (flag & 0x20) !== 0
13124 var hasLotSeq = (flag & 0x04) !== 0
13125
13126 assert.equal((flag & 0x24), flag, 'Invalid private key.')
13127
13128 var addressHash = buffer.slice(2, 6)
13129 var ownerEntropy = buffer.slice(6, 14)
13130 var ownerSalt
13131
13132 // 4 bytes ownerSalt if 4 bytes lot/sequence
13133 if (hasLotSeq) {
13134 ownerSalt = ownerEntropy.slice(0, 4)
13135
13136 // else, 8 bytes ownerSalt
13137 } else {
13138 ownerSalt = ownerEntropy
13139 }
13140
13141 var encryptedPart1 = buffer.slice(14, 22) // First 8 bytes
13142 var encryptedPart2 = buffer.slice(22, 38) // 16 bytes
13143
13144 var N = scryptParams.N
13145 var r = scryptParams.r
13146 var p = scryptParams.p
13147 var preFactor = scrypt(passphrase, ownerSalt, N, r, p, 32, progressCallback)
13148
13149 var passFactor
13150 if (hasLotSeq) {
13151 var hashTarget = Buffer.concat([preFactor, ownerEntropy])
13152 passFactor = hash256(hashTarget)
13153 } else {
13154 passFactor = preFactor
13155 }
13156
13157 var passInt = BigInteger.fromBuffer(passFactor)
13158 var passPoint = curve.G.multiply(passInt).getEncoded(true)
13159
13160 var seedBPass = scrypt(passPoint, Buffer.concat([addressHash, ownerEntropy]), 1024, 1, 1, 64)
13161 var derivedHalf1 = seedBPass.slice(0, 32)
13162 var derivedHalf2 = seedBPass.slice(32, 64)
13163
13164 var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0))
13165 decipher.setAutoPadding(false)
13166 decipher.end(encryptedPart2)
13167
13168 var decryptedPart2 = decipher.read()
13169 var tmp = xor(decryptedPart2, derivedHalf1.slice(16, 32))
13170 var seedBPart2 = tmp.slice(8, 16)
13171
13172 var decipher2 = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0))
13173 decipher2.setAutoPadding(false)
13174 decipher2.write(encryptedPart1) // first 8 bytes
13175 decipher2.end(tmp.slice(0, 8)) // last 8 bytes
13176
13177 var seedBPart1 = xor(decipher2.read(), derivedHalf1.slice(0, 16))
13178 var seedB = Buffer.concat([seedBPart1, seedBPart2], 24)
13179 var factorB = BigInteger.fromBuffer(hash256(seedB))
13180
13181 // d = passFactor * factorB (mod n)
13182 var d = passInt.multiply(factorB).mod(curve.n)
13183
13184 return {
13185 privateKey: d.toBuffer(32),
13186 compressed: compressed
13187 }
13188}
13189
13190function verify (string) {
13191 var decoded = bs58check.decodeUnsafe(string)
13192 if (!decoded) return false
13193
13194 if (decoded.length !== 39) return false
13195 if (decoded.readUInt8(0) !== 0x01) return false
13196
13197 var type = decoded.readUInt8(1)
13198 var flag = decoded.readUInt8(2)
13199
13200 // encrypted WIF
13201 if (type === 0x42) {
13202 if (flag !== 0xc0 && flag !== 0xe0) return false
13203
13204 // EC mult
13205 } else if (type === 0x43) {
13206 if ((flag & ~0x24)) return false
13207 } else {
13208 return false
13209 }
13210
13211 return true
13212}
13213
13214module.exports = {
13215 decrypt: decrypt,
13216 decryptECMult: decryptECMult,
13217 decryptRaw: decryptRaw,
13218 encrypt: encrypt,
13219 encryptRaw: encryptRaw,
13220 verify: verify
13221}
13222
13223},{"assert":26,"bigi":63,"browserify-aes":113,"bs58check":140,"buffer-xor/inplace":145,"create-hash":239,"ecurve":257,"safe-buffer":742,"scryptsy":743}],67:[function(require,module,exports){
13224var aes = require('browserify-aes')
13225var assert = require('assert')
13226var Buffer = require('safe-buffer').Buffer
13227var bs58check = require('bs58check')
13228var bs58grscheck = require('bs58grscheck')
13229var createHash = require('create-hash')
13230var scrypt = require('scryptsy')
13231var xor = require('buffer-xor/inplace')
13232
13233var ecurve = require('ecurve')
13234var curve = ecurve.getCurveByName('secp256k1')
13235
13236var BigInteger = require('bigi')
13237
13238// constants
13239var SCRYPT_PARAMS = {
13240 N: 16384, // specified by BIP38
13241 r: 8,
13242 p: 8
13243}
13244var NULL = Buffer.alloc(0)
13245
13246function hash160 (buffer) {
13247 return createHash('rmd160').update(
13248 createHash('sha256').update(buffer).digest()
13249 ).digest()
13250}
13251
13252function hash256 (buffer) {
13253 return createHash('sha256').update(
13254 createHash('sha256').update(buffer).digest()
13255 ).digest()
13256}
13257
13258function getAddress (d, compressed) {
13259 var Q = curve.G.multiply(d).getEncoded(compressed)
13260 var hash = hash160(Q)
13261 var payload = Buffer.allocUnsafe(21)
13262 payload.writeUInt8(0x24, 0) // XXX TODO FIXME bitcoin only??? damn you BIP38
13263 hash.copy(payload, 1)
13264
13265 return bs58grscheck.encode(payload)
13266}
13267
13268function encryptRaw (buffer, compressed, passphrase, progressCallback, scryptParams) {
13269 if (buffer.length !== 32) throw new Error('Invalid private key length')
13270 scryptParams = scryptParams || SCRYPT_PARAMS
13271
13272 var d = BigInteger.fromBuffer(buffer)
13273 var address = getAddress(d, compressed)
13274 var secret = Buffer.from(passphrase, 'utf8')
13275 var salt = hash256(address).slice(0, 4)
13276
13277 var N = scryptParams.N
13278 var r = scryptParams.r
13279 var p = scryptParams.p
13280
13281 var scryptBuf = scrypt(secret, salt, N, r, p, 64, progressCallback)
13282 var derivedHalf1 = scryptBuf.slice(0, 32)
13283 var derivedHalf2 = scryptBuf.slice(32, 64)
13284
13285 var xorBuf = xor(derivedHalf1, buffer)
13286 var cipher = aes.createCipheriv('aes-256-ecb', derivedHalf2, NULL)
13287 cipher.setAutoPadding(false)
13288 cipher.end(xorBuf)
13289
13290 var cipherText = cipher.read()
13291
13292 // 0x01 | 0x42 | flagByte | salt (4) | cipherText (32)
13293 var result = Buffer.allocUnsafe(7 + 32)
13294 result.writeUInt8(0x01, 0)
13295 result.writeUInt8(0x42, 1)
13296 result.writeUInt8(compressed ? 0xe0 : 0xc0, 2)
13297 salt.copy(result, 3)
13298 cipherText.copy(result, 7)
13299
13300 return result
13301}
13302
13303function encrypt (buffer, compressed, passphrase, progressCallback, scryptParams) {
13304 return bs58check.encode(encryptRaw(buffer, compressed, passphrase, progressCallback, scryptParams))
13305}
13306
13307// some of the techniques borrowed from: https://github.com/pointbiz/bitaddress.org
13308function decryptRaw (buffer, passphrase, progressCallback, scryptParams) {
13309 // 39 bytes: 2 bytes prefix, 37 bytes payload
13310 if (buffer.length !== 39) throw new Error('Invalid BIP38 data length')
13311 if (buffer.readUInt8(0) !== 0x01) throw new Error('Invalid BIP38 prefix')
13312 scryptParams = scryptParams || SCRYPT_PARAMS
13313
13314 // check if BIP38 EC multiply
13315 var type = buffer.readUInt8(1)
13316 if (type === 0x43) return decryptECMult(buffer, passphrase, progressCallback, scryptParams)
13317 if (type !== 0x42) throw new Error('Invalid BIP38 type')
13318
13319 passphrase = Buffer.from(passphrase, 'utf8')
13320
13321 var flagByte = buffer.readUInt8(2)
13322 var compressed = flagByte === 0xe0
13323 if (!compressed && flagByte !== 0xc0) throw new Error('Invalid BIP38 compression flag')
13324
13325 var N = scryptParams.N
13326 var r = scryptParams.r
13327 var p = scryptParams.p
13328
13329 var salt = buffer.slice(3, 7)
13330 var scryptBuf = scrypt(passphrase, salt, N, r, p, 64, progressCallback)
13331 var derivedHalf1 = scryptBuf.slice(0, 32)
13332 var derivedHalf2 = scryptBuf.slice(32, 64)
13333
13334 var privKeyBuf = buffer.slice(7, 7 + 32)
13335 var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, NULL)
13336 decipher.setAutoPadding(false)
13337 decipher.end(privKeyBuf)
13338
13339 var plainText = decipher.read()
13340 var privateKey = xor(derivedHalf1, plainText)
13341
13342 // verify salt matches address
13343 var d = BigInteger.fromBuffer(privateKey)
13344 var address = getAddress(d, compressed)
13345 var checksum = hash256(address).slice(0, 4)
13346 assert.deepEqual(salt, checksum)
13347
13348 return {
13349 privateKey: privateKey,
13350 compressed: compressed
13351 }
13352}
13353
13354function decrypt (string, passphrase, progressCallback, scryptParams) {
13355 return decryptRaw(bs58check.decode(string), passphrase, progressCallback, scryptParams)
13356}
13357
13358function decryptECMult (buffer, passphrase, progressCallback, scryptParams) {
13359 passphrase = Buffer.from(passphrase, 'utf8')
13360 buffer = buffer.slice(1) // FIXME: we can avoid this
13361 scryptParams = scryptParams || SCRYPT_PARAMS
13362
13363 var flag = buffer.readUInt8(1)
13364 var compressed = (flag & 0x20) !== 0
13365 var hasLotSeq = (flag & 0x04) !== 0
13366
13367 assert.equal((flag & 0x24), flag, 'Invalid private key.')
13368
13369 var addressHash = buffer.slice(2, 6)
13370 var ownerEntropy = buffer.slice(6, 14)
13371 var ownerSalt
13372
13373 // 4 bytes ownerSalt if 4 bytes lot/sequence
13374 if (hasLotSeq) {
13375 ownerSalt = ownerEntropy.slice(0, 4)
13376
13377 // else, 8 bytes ownerSalt
13378 } else {
13379 ownerSalt = ownerEntropy
13380 }
13381
13382 var encryptedPart1 = buffer.slice(14, 22) // First 8 bytes
13383 var encryptedPart2 = buffer.slice(22, 38) // 16 bytes
13384
13385 var N = scryptParams.N
13386 var r = scryptParams.r
13387 var p = scryptParams.p
13388 var preFactor = scrypt(passphrase, ownerSalt, N, r, p, 32, progressCallback)
13389
13390 var passFactor
13391 if (hasLotSeq) {
13392 var hashTarget = Buffer.concat([preFactor, ownerEntropy])
13393 passFactor = hash256(hashTarget)
13394 } else {
13395 passFactor = preFactor
13396 }
13397
13398 var passInt = BigInteger.fromBuffer(passFactor)
13399 var passPoint = curve.G.multiply(passInt).getEncoded(true)
13400
13401 var seedBPass = scrypt(passPoint, Buffer.concat([addressHash, ownerEntropy]), 1024, 1, 1, 64)
13402 var derivedHalf1 = seedBPass.slice(0, 32)
13403 var derivedHalf2 = seedBPass.slice(32, 64)
13404
13405 var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0))
13406 decipher.setAutoPadding(false)
13407 decipher.end(encryptedPart2)
13408
13409 var decryptedPart2 = decipher.read()
13410 var tmp = xor(decryptedPart2, derivedHalf1.slice(16, 32))
13411 var seedBPart2 = tmp.slice(8, 16)
13412
13413 var decipher2 = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0))
13414 decipher2.setAutoPadding(false)
13415 decipher2.write(encryptedPart1) // first 8 bytes
13416 decipher2.end(tmp.slice(0, 8)) // last 8 bytes
13417
13418 var seedBPart1 = xor(decipher2.read(), derivedHalf1.slice(0, 16))
13419 var seedB = Buffer.concat([seedBPart1, seedBPart2], 24)
13420 var factorB = BigInteger.fromBuffer(hash256(seedB))
13421
13422 // d = passFactor * factorB (mod n)
13423 var d = passInt.multiply(factorB).mod(curve.n)
13424
13425 return {
13426 privateKey: d.toBuffer(32),
13427 compressed: compressed
13428 }
13429}
13430
13431function verify (string) {
13432 var decoded = bs58grscheck.decodeUnsafe(string)
13433 if (!decoded) return false
13434
13435 if (decoded.length !== 39) return false
13436 if (decoded.readUInt8(0) !== 0x01) return false
13437
13438 var type = decoded.readUInt8(1)
13439 var flag = decoded.readUInt8(2)
13440
13441 // encrypted WIF
13442 if (type === 0x42) {
13443 if (flag !== 0xc0 && flag !== 0xe0) return false
13444
13445 // EC mult
13446 } else if (type === 0x43) {
13447 if ((flag & ~0x24)) return false
13448 } else {
13449 return false
13450 }
13451
13452 return true
13453}
13454
13455module.exports = {
13456 decrypt: decrypt,
13457 decryptECMult: decryptECMult,
13458 decryptRaw: decryptRaw,
13459 encrypt: encrypt,
13460 encryptRaw: encryptRaw,
13461 verify: verify
13462}
13463
13464},{"assert":26,"bigi":63,"browserify-aes":113,"bs58check":140,"bs58grscheck":142,"buffer-xor/inplace":145,"create-hash":239,"ecurve":257,"safe-buffer":742,"scryptsy":743}],68:[function(require,module,exports){
13465// Reference https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki
13466// Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
13467// NOTE: SIGHASH byte ignored AND restricted, truncate before use
13468
13469var Buffer = require('safe-buffer').Buffer
13470
13471function check (buffer) {
13472 if (buffer.length < 8) return false
13473 if (buffer.length > 72) return false
13474 if (buffer[0] !== 0x30) return false
13475 if (buffer[1] !== buffer.length - 2) return false
13476 if (buffer[2] !== 0x02) return false
13477
13478 var lenR = buffer[3]
13479 if (lenR === 0) return false
13480 if (5 + lenR >= buffer.length) return false
13481 if (buffer[4 + lenR] !== 0x02) return false
13482
13483 var lenS = buffer[5 + lenR]
13484 if (lenS === 0) return false
13485 if ((6 + lenR + lenS) !== buffer.length) return false
13486
13487 if (buffer[4] & 0x80) return false
13488 if (lenR > 1 && (buffer[4] === 0x00) && !(buffer[5] & 0x80)) return false
13489
13490 if (buffer[lenR + 6] & 0x80) return false
13491 if (lenS > 1 && (buffer[lenR + 6] === 0x00) && !(buffer[lenR + 7] & 0x80)) return false
13492 return true
13493}
13494
13495function decode (buffer) {
13496 if (buffer.length < 8) throw new Error('DER sequence length is too short')
13497 if (buffer.length > 72) throw new Error('DER sequence length is too long')
13498 if (buffer[0] !== 0x30) throw new Error('Expected DER sequence')
13499 if (buffer[1] !== buffer.length - 2) throw new Error('DER sequence length is invalid')
13500 if (buffer[2] !== 0x02) throw new Error('Expected DER integer')
13501
13502 var lenR = buffer[3]
13503 if (lenR === 0) throw new Error('R length is zero')
13504 if (5 + lenR >= buffer.length) throw new Error('R length is too long')
13505 if (buffer[4 + lenR] !== 0x02) throw new Error('Expected DER integer (2)')
13506
13507 var lenS = buffer[5 + lenR]
13508 if (lenS === 0) throw new Error('S length is zero')
13509 if ((6 + lenR + lenS) !== buffer.length) throw new Error('S length is invalid')
13510
13511 if (buffer[4] & 0x80) throw new Error('R value is negative')
13512 if (lenR > 1 && (buffer[4] === 0x00) && !(buffer[5] & 0x80)) throw new Error('R value excessively padded')
13513
13514 if (buffer[lenR + 6] & 0x80) throw new Error('S value is negative')
13515 if (lenS > 1 && (buffer[lenR + 6] === 0x00) && !(buffer[lenR + 7] & 0x80)) throw new Error('S value excessively padded')
13516
13517 // non-BIP66 - extract R, S values
13518 return {
13519 r: buffer.slice(4, 4 + lenR),
13520 s: buffer.slice(6 + lenR)
13521 }
13522}
13523
13524/*
13525 * Expects r and s to be positive DER integers.
13526 *
13527 * The DER format uses the most significant bit as a sign bit (& 0x80).
13528 * If the significant bit is set AND the integer is positive, a 0x00 is prepended.
13529 *
13530 * Examples:
13531 *
13532 * 0 => 0x00
13533 * 1 => 0x01
13534 * -1 => 0xff
13535 * 127 => 0x7f
13536 * -127 => 0x81
13537 * 128 => 0x0080
13538 * -128 => 0x80
13539 * 255 => 0x00ff
13540 * -255 => 0xff01
13541 * 16300 => 0x3fac
13542 * -16300 => 0xc054
13543 * 62300 => 0x00f35c
13544 * -62300 => 0xff0ca4
13545*/
13546function encode (r, s) {
13547 var lenR = r.length
13548 var lenS = s.length
13549 if (lenR === 0) throw new Error('R length is zero')
13550 if (lenS === 0) throw new Error('S length is zero')
13551 if (lenR > 33) throw new Error('R length is too long')
13552 if (lenS > 33) throw new Error('S length is too long')
13553 if (r[0] & 0x80) throw new Error('R value is negative')
13554 if (s[0] & 0x80) throw new Error('S value is negative')
13555 if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded')
13556 if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded')
13557
13558 var signature = Buffer.allocUnsafe(6 + lenR + lenS)
13559
13560 // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
13561 signature[0] = 0x30
13562 signature[1] = signature.length - 2
13563 signature[2] = 0x02
13564 signature[3] = r.length
13565 r.copy(signature, 4)
13566 signature[4 + lenR] = 0x02
13567 signature[5 + lenR] = s.length
13568 s.copy(signature, 6 + lenR)
13569
13570 return signature
13571}
13572
13573module.exports = {
13574 check: check,
13575 decode: decode,
13576 encode: encode
13577}
13578
13579},{"safe-buffer":742}],69:[function(require,module,exports){
13580module.exports={
13581 "OP_FALSE": 0,
13582 "OP_0": 0,
13583 "OP_PUSHDATA1": 76,
13584 "OP_PUSHDATA2": 77,
13585 "OP_PUSHDATA4": 78,
13586 "OP_1NEGATE": 79,
13587 "OP_RESERVED": 80,
13588 "OP_TRUE": 81,
13589 "OP_1": 81,
13590 "OP_2": 82,
13591 "OP_3": 83,
13592 "OP_4": 84,
13593 "OP_5": 85,
13594 "OP_6": 86,
13595 "OP_7": 87,
13596 "OP_8": 88,
13597 "OP_9": 89,
13598 "OP_10": 90,
13599 "OP_11": 91,
13600 "OP_12": 92,
13601 "OP_13": 93,
13602 "OP_14": 94,
13603 "OP_15": 95,
13604 "OP_16": 96,
13605
13606 "OP_NOP": 97,
13607 "OP_VER": 98,
13608 "OP_IF": 99,
13609 "OP_NOTIF": 100,
13610 "OP_VERIF": 101,
13611 "OP_VERNOTIF": 102,
13612 "OP_ELSE": 103,
13613 "OP_ENDIF": 104,
13614 "OP_VERIFY": 105,
13615 "OP_RETURN": 106,
13616
13617 "OP_TOALTSTACK": 107,
13618 "OP_FROMALTSTACK": 108,
13619 "OP_2DROP": 109,
13620 "OP_2DUP": 110,
13621 "OP_3DUP": 111,
13622 "OP_2OVER": 112,
13623 "OP_2ROT": 113,
13624 "OP_2SWAP": 114,
13625 "OP_IFDUP": 115,
13626 "OP_DEPTH": 116,
13627 "OP_DROP": 117,
13628 "OP_DUP": 118,
13629 "OP_NIP": 119,
13630 "OP_OVER": 120,
13631 "OP_PICK": 121,
13632 "OP_ROLL": 122,
13633 "OP_ROT": 123,
13634 "OP_SWAP": 124,
13635 "OP_TUCK": 125,
13636
13637 "OP_CAT": 126,
13638 "OP_SUBSTR": 127,
13639 "OP_LEFT": 128,
13640 "OP_RIGHT": 129,
13641 "OP_SIZE": 130,
13642
13643 "OP_INVERT": 131,
13644 "OP_AND": 132,
13645 "OP_OR": 133,
13646 "OP_XOR": 134,
13647 "OP_EQUAL": 135,
13648 "OP_EQUALVERIFY": 136,
13649 "OP_RESERVED1": 137,
13650 "OP_RESERVED2": 138,
13651
13652 "OP_1ADD": 139,
13653 "OP_1SUB": 140,
13654 "OP_2MUL": 141,
13655 "OP_2DIV": 142,
13656 "OP_NEGATE": 143,
13657 "OP_ABS": 144,
13658 "OP_NOT": 145,
13659 "OP_0NOTEQUAL": 146,
13660 "OP_ADD": 147,
13661 "OP_SUB": 148,
13662 "OP_MUL": 149,
13663 "OP_DIV": 150,
13664 "OP_MOD": 151,
13665 "OP_LSHIFT": 152,
13666 "OP_RSHIFT": 153,
13667
13668 "OP_BOOLAND": 154,
13669 "OP_BOOLOR": 155,
13670 "OP_NUMEQUAL": 156,
13671 "OP_NUMEQUALVERIFY": 157,
13672 "OP_NUMNOTEQUAL": 158,
13673 "OP_LESSTHAN": 159,
13674 "OP_GREATERTHAN": 160,
13675 "OP_LESSTHANOREQUAL": 161,
13676 "OP_GREATERTHANOREQUAL": 162,
13677 "OP_MIN": 163,
13678 "OP_MAX": 164,
13679
13680 "OP_WITHIN": 165,
13681
13682 "OP_RIPEMD160": 166,
13683 "OP_SHA1": 167,
13684 "OP_SHA256": 168,
13685 "OP_HASH160": 169,
13686 "OP_HASH256": 170,
13687 "OP_CODESEPARATOR": 171,
13688 "OP_CHECKSIG": 172,
13689 "OP_CHECKSIGVERIFY": 173,
13690 "OP_CHECKMULTISIG": 174,
13691 "OP_CHECKMULTISIGVERIFY": 175,
13692
13693 "OP_NOP1": 176,
13694
13695 "OP_NOP2": 177,
13696 "OP_CHECKLOCKTIMEVERIFY": 177,
13697
13698 "OP_NOP3": 178,
13699 "OP_CHECKSEQUENCEVERIFY": 178,
13700
13701 "OP_NOP4": 179,
13702 "OP_NOP5": 180,
13703 "OP_NOP6": 181,
13704 "OP_NOP7": 182,
13705 "OP_NOP8": 183,
13706 "OP_NOP9": 184,
13707 "OP_NOP10": 185,
13708
13709 "OP_PUBKEYHASH": 253,
13710 "OP_PUBKEY": 254,
13711 "OP_INVALIDOPCODE": 255
13712}
13713
13714},{}],70:[function(require,module,exports){
13715var OPS = require('./index.json')
13716
13717var map = {}
13718for (var op in OPS) {
13719 var code = OPS[op]
13720 map[code] = op
13721}
13722
13723module.exports = map
13724
13725},{"./index.json":69}],71:[function(require,module,exports){
13726var Buffer = require('safe-buffer').Buffer
13727var bech32 = require('bech32')
13728var bs58check = require('bs58check')
13729var bscript = require('./script')
13730var btemplates = require('./templates')
13731var networks = require('./networks')
13732var typeforce = require('typeforce')
13733var types = require('./types')
13734
13735function fromBase58Check (address) {
13736 var payload = bs58check.decode(address)
13737
13738 // TODO: 4.0.0, move to "toOutputScript"
13739 if (payload.length < 21) throw new TypeError(address + ' is too short')
13740 if (payload.length > 21) throw new TypeError(address + ' is too long')
13741
13742 var version = payload.readUInt8(0)
13743 var hash = payload.slice(1)
13744
13745 return { version: version, hash: hash }
13746}
13747
13748function fromBech32 (address) {
13749 var result = bech32.decode(address)
13750 var data = bech32.fromWords(result.words.slice(1))
13751
13752 return {
13753 version: result.words[0],
13754 prefix: result.prefix,
13755 data: Buffer.from(data)
13756 }
13757}
13758
13759function toBase58Check (hash, version) {
13760 // see https://github.com/iancoleman/bip39/pull/212
13761 if (version < 256){
13762 typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments)
13763
13764 var payload = Buffer.allocUnsafe(21)
13765 payload.writeUInt8(version, 0)
13766 hash.copy(payload, 1)
13767
13768 return bs58check.encode(payload)
13769 }
13770 else{
13771 typeforce(types.tuple(types.Hash160bit, types.UInt16), arguments)
13772
13773 var payload = Buffer.allocUnsafe(22)
13774 payload.writeUInt16BE(version, 0)
13775 hash.copy(payload, 2)
13776
13777 return bs58check.encode(payload)
13778 }
13779}
13780
13781function toBech32 (data, version, prefix) {
13782 var words = bech32.toWords(data)
13783 words.unshift(version)
13784
13785 return bech32.encode(prefix, words)
13786}
13787
13788function fromOutputScript (outputScript, network) {
13789 network = network || networks.bitcoin
13790
13791 if (btemplates.pubKeyHash.output.check(outputScript)) return toBase58Check(bscript.compile(outputScript).slice(3, 23), network.pubKeyHash)
13792 if (btemplates.scriptHash.output.check(outputScript)) return toBase58Check(bscript.compile(outputScript).slice(2, 22), network.scriptHash)
13793 if (btemplates.witnessPubKeyHash.output.check(outputScript)) return toBech32(bscript.compile(outputScript).slice(2, 22), 0, network.bech32)
13794 if (btemplates.witnessScriptHash.output.check(outputScript)) return toBech32(bscript.compile(outputScript).slice(2, 34), 0, network.bech32)
13795
13796 throw new Error(bscript.toASM(outputScript) + ' has no matching Address')
13797}
13798
13799function toOutputScript (address, network) {
13800 network = network || networks.bitcoin
13801
13802 var decode
13803 try {
13804 decode = fromBase58Check(address)
13805 } catch (e) {}
13806
13807 if (decode) {
13808 if (decode.version === network.pubKeyHash) return btemplates.pubKeyHash.output.encode(decode.hash)
13809 if (decode.version === network.scriptHash) return btemplates.scriptHash.output.encode(decode.hash)
13810 } else {
13811 try {
13812 decode = fromBech32(address)
13813 } catch (e) {}
13814
13815 if (decode) {
13816 if (decode.prefix !== network.bech32) throw new Error(address + ' has an invalid prefix')
13817 if (decode.version === 0) {
13818 if (decode.data.length === 20) return btemplates.witnessPubKeyHash.output.encode(decode.data)
13819 if (decode.data.length === 32) return btemplates.witnessScriptHash.output.encode(decode.data)
13820 }
13821 }
13822 }
13823
13824 throw new Error(address + ' has no matching Script')
13825}
13826
13827module.exports = {
13828 fromBase58Check: fromBase58Check,
13829 fromBech32: fromBech32,
13830 fromOutputScript: fromOutputScript,
13831 toBase58Check: toBase58Check,
13832 toBech32: toBech32,
13833 toOutputScript: toOutputScript
13834}
13835
13836},{"./networks":80,"./script":81,"./templates":83,"./types":107,"bech32":59,"bs58check":140,"safe-buffer":742,"typeforce":816}],72:[function(require,module,exports){
13837var Buffer = require('safe-buffer').Buffer
13838var bcrypto = require('./crypto')
13839var fastMerkleRoot = require('merkle-lib/fastRoot')
13840var typeforce = require('typeforce')
13841var types = require('./types')
13842var varuint = require('varuint-bitcoin')
13843
13844var Transaction = require('./transaction')
13845
13846function Block () {
13847 this.version = 1
13848 this.prevHash = null
13849 this.merkleRoot = null
13850 this.timestamp = 0
13851 this.bits = 0
13852 this.nonce = 0
13853}
13854
13855Block.fromBuffer = function (buffer) {
13856 if (buffer.length < 80) throw new Error('Buffer too small (< 80 bytes)')
13857
13858 var offset = 0
13859 function readSlice (n) {
13860 offset += n
13861 return buffer.slice(offset - n, offset)
13862 }
13863
13864 function readUInt32 () {
13865 var i = buffer.readUInt32LE(offset)
13866 offset += 4
13867 return i
13868 }
13869
13870 function readInt32 () {
13871 var i = buffer.readInt32LE(offset)
13872 offset += 4
13873 return i
13874 }
13875
13876 var block = new Block()
13877 block.version = readInt32()
13878 block.prevHash = readSlice(32)
13879 block.merkleRoot = readSlice(32)
13880 block.timestamp = readUInt32()
13881 block.bits = readUInt32()
13882 block.nonce = readUInt32()
13883
13884 if (buffer.length === 80) return block
13885
13886 function readVarInt () {
13887 var vi = varuint.decode(buffer, offset)
13888 offset += varuint.decode.bytes
13889 return vi
13890 }
13891
13892 function readTransaction () {
13893 var tx = Transaction.fromBuffer(buffer.slice(offset), true)
13894 offset += tx.byteLength()
13895 return tx
13896 }
13897
13898 var nTransactions = readVarInt()
13899 block.transactions = []
13900
13901 for (var i = 0; i < nTransactions; ++i) {
13902 var tx = readTransaction()
13903 block.transactions.push(tx)
13904 }
13905
13906 return block
13907}
13908
13909Block.prototype.byteLength = function (headersOnly) {
13910 if (headersOnly || !this.transactions) return 80
13911
13912 return 80 + varuint.encodingLength(this.transactions.length) + this.transactions.reduce(function (a, x) {
13913 return a + x.byteLength()
13914 }, 0)
13915}
13916
13917Block.fromHex = function (hex) {
13918 return Block.fromBuffer(Buffer.from(hex, 'hex'))
13919}
13920
13921Block.prototype.getHash = function () {
13922 return bcrypto.hash256(this.toBuffer(true))
13923}
13924
13925Block.prototype.getId = function () {
13926 return this.getHash().reverse().toString('hex')
13927}
13928
13929Block.prototype.getUTCDate = function () {
13930 var date = new Date(0) // epoch
13931 date.setUTCSeconds(this.timestamp)
13932
13933 return date
13934}
13935
13936// TODO: buffer, offset compatibility
13937Block.prototype.toBuffer = function (headersOnly) {
13938 var buffer = Buffer.allocUnsafe(this.byteLength(headersOnly))
13939
13940 var offset = 0
13941 function writeSlice (slice) {
13942 slice.copy(buffer, offset)
13943 offset += slice.length
13944 }
13945
13946 function writeInt32 (i) {
13947 buffer.writeInt32LE(i, offset)
13948 offset += 4
13949 }
13950 function writeUInt32 (i) {
13951 buffer.writeUInt32LE(i, offset)
13952 offset += 4
13953 }
13954
13955 writeInt32(this.version)
13956 writeSlice(this.prevHash)
13957 writeSlice(this.merkleRoot)
13958 writeUInt32(this.timestamp)
13959 writeUInt32(this.bits)
13960 writeUInt32(this.nonce)
13961
13962 if (headersOnly || !this.transactions) return buffer
13963
13964 varuint.encode(this.transactions.length, buffer, offset)
13965 offset += varuint.encode.bytes
13966
13967 this.transactions.forEach(function (tx) {
13968 var txSize = tx.byteLength() // TODO: extract from toBuffer?
13969 tx.toBuffer(buffer, offset)
13970 offset += txSize
13971 })
13972
13973 return buffer
13974}
13975
13976Block.prototype.toHex = function (headersOnly) {
13977 return this.toBuffer(headersOnly).toString('hex')
13978}
13979
13980Block.calculateTarget = function (bits) {
13981 var exponent = ((bits & 0xff000000) >> 24) - 3
13982 var mantissa = bits & 0x007fffff
13983 var target = Buffer.alloc(32, 0)
13984 target.writeUInt32BE(mantissa, 28 - exponent)
13985 return target
13986}
13987
13988Block.calculateMerkleRoot = function (transactions) {
13989 typeforce([{ getHash: types.Function }], transactions)
13990 if (transactions.length === 0) throw TypeError('Cannot compute merkle root for zero transactions')
13991
13992 var hashes = transactions.map(function (transaction) {
13993 return transaction.getHash()
13994 })
13995
13996 return fastMerkleRoot(hashes, bcrypto.hash256)
13997}
13998
13999Block.prototype.checkMerkleRoot = function () {
14000 if (!this.transactions) return false
14001
14002 var actualMerkleRoot = Block.calculateMerkleRoot(this.transactions)
14003 return this.merkleRoot.compare(actualMerkleRoot) === 0
14004}
14005
14006Block.prototype.checkProofOfWork = function () {
14007 var hash = this.getHash().reverse()
14008 var target = Block.calculateTarget(this.bits)
14009
14010 return hash.compare(target) <= 0
14011}
14012
14013module.exports = Block
14014
14015},{"./crypto":74,"./transaction":105,"./types":107,"merkle-lib/fastRoot":638,"safe-buffer":742,"typeforce":816,"varuint-bitcoin":830}],73:[function(require,module,exports){
14016var pushdata = require('pushdata-bitcoin')
14017var varuint = require('varuint-bitcoin')
14018
14019// https://github.com/feross/buffer/blob/master/index.js#L1127
14020function verifuint (value, max) {
14021 if (typeof value !== 'number') throw new Error('cannot write a non-number as a number')
14022 if (value < 0) throw new Error('specified a negative value for writing an unsigned value')
14023 if (value > max) throw new Error('RangeError: value out of range')
14024 if (Math.floor(value) !== value) throw new Error('value has a fractional component')
14025}
14026
14027function readUInt64LE (buffer, offset) {
14028 var a = buffer.readUInt32LE(offset)
14029 var b = buffer.readUInt32LE(offset + 4)
14030 b *= 0x100000000
14031
14032 verifuint(b + a, 0x001fffffffffffff)
14033
14034 return b + a
14035}
14036
14037function writeUInt64LE (buffer, value, offset) {
14038 verifuint(value, 0x001fffffffffffff)
14039
14040 buffer.writeInt32LE(value & -1, offset)
14041 buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4)
14042 return offset + 8
14043}
14044
14045// TODO: remove in 4.0.0?
14046function readVarInt (buffer, offset) {
14047 var result = varuint.decode(buffer, offset)
14048
14049 return {
14050 number: result,
14051 size: varuint.decode.bytes
14052 }
14053}
14054
14055// TODO: remove in 4.0.0?
14056function writeVarInt (buffer, number, offset) {
14057 varuint.encode(number, buffer, offset)
14058 return varuint.encode.bytes
14059}
14060
14061module.exports = {
14062 pushDataSize: pushdata.encodingLength,
14063 readPushDataInt: pushdata.decode,
14064 readUInt64LE: readUInt64LE,
14065 readVarInt: readVarInt,
14066 varIntBuffer: varuint.encode,
14067 varIntSize: varuint.encodingLength,
14068 writePushDataInt: pushdata.encode,
14069 writeUInt64LE: writeUInt64LE,
14070 writeVarInt: writeVarInt
14071}
14072
14073},{"pushdata-bitcoin":720,"varuint-bitcoin":830}],74:[function(require,module,exports){
14074var createHash = require('create-hash')
14075
14076function ripemd160 (buffer) {
14077 return createHash('rmd160').update(buffer).digest()
14078}
14079
14080function sha1 (buffer) {
14081 return createHash('sha1').update(buffer).digest()
14082}
14083
14084function sha256 (buffer) {
14085 return createHash('sha256').update(buffer).digest()
14086}
14087
14088function hash160 (buffer) {
14089 return ripemd160(sha256(buffer))
14090}
14091
14092function hash256 (buffer) {
14093 return sha256(sha256(buffer))
14094}
14095
14096module.exports = {
14097 hash160: hash160,
14098 hash256: hash256,
14099 ripemd160: ripemd160,
14100 sha1: sha1,
14101 sha256: sha256
14102}
14103
14104},{"create-hash":239}],75:[function(require,module,exports){
14105var Buffer = require('safe-buffer').Buffer
14106var createHmac = require('create-hmac')
14107var typeforce = require('typeforce')
14108var types = require('./types')
14109
14110var BigInteger = require('bigi')
14111var ECSignature = require('./ecsignature')
14112
14113var ZERO = Buffer.alloc(1, 0)
14114var ONE = Buffer.alloc(1, 1)
14115
14116var ecurve = require('ecurve')
14117var secp256k1 = ecurve.getCurveByName('secp256k1')
14118
14119// https://tools.ietf.org/html/rfc6979#section-3.2
14120function deterministicGenerateK (hash, x, checkSig) {
14121 typeforce(types.tuple(
14122 types.Hash256bit,
14123 types.Buffer256bit,
14124 types.Function
14125 ), arguments)
14126
14127 // Step A, ignored as hash already provided
14128 // Step B
14129 // Step C
14130 var k = Buffer.alloc(32, 0)
14131 var v = Buffer.alloc(32, 1)
14132
14133 // Step D
14134 k = createHmac('sha256', k)
14135 .update(v)
14136 .update(ZERO)
14137 .update(x)
14138 .update(hash)
14139 .digest()
14140
14141 // Step E
14142 v = createHmac('sha256', k).update(v).digest()
14143
14144 // Step F
14145 k = createHmac('sha256', k)
14146 .update(v)
14147 .update(ONE)
14148 .update(x)
14149 .update(hash)
14150 .digest()
14151
14152 // Step G
14153 v = createHmac('sha256', k).update(v).digest()
14154
14155 // Step H1/H2a, ignored as tlen === qlen (256 bit)
14156 // Step H2b
14157 v = createHmac('sha256', k).update(v).digest()
14158
14159 var T = BigInteger.fromBuffer(v)
14160
14161 // Step H3, repeat until T is within the interval [1, n - 1] and is suitable for ECDSA
14162 while (T.signum() <= 0 || T.compareTo(secp256k1.n) >= 0 || !checkSig(T)) {
14163 k = createHmac('sha256', k)
14164 .update(v)
14165 .update(ZERO)
14166 .digest()
14167
14168 v = createHmac('sha256', k).update(v).digest()
14169
14170 // Step H1/H2a, again, ignored as tlen === qlen (256 bit)
14171 // Step H2b again
14172 v = createHmac('sha256', k).update(v).digest()
14173 T = BigInteger.fromBuffer(v)
14174 }
14175
14176 return T
14177}
14178
14179var N_OVER_TWO = secp256k1.n.shiftRight(1)
14180
14181function sign (hash, d) {
14182 typeforce(types.tuple(types.Hash256bit, types.BigInt), arguments)
14183
14184 var x = d.toBuffer(32)
14185 var e = BigInteger.fromBuffer(hash)
14186 var n = secp256k1.n
14187 var G = secp256k1.G
14188
14189 var r, s
14190 deterministicGenerateK(hash, x, function (k) {
14191 var Q = G.multiply(k)
14192
14193 if (secp256k1.isInfinity(Q)) return false
14194
14195 r = Q.affineX.mod(n)
14196 if (r.signum() === 0) return false
14197
14198 s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)
14199 if (s.signum() === 0) return false
14200
14201 return true
14202 })
14203
14204 // enforce low S values, see bip62: 'low s values in signatures'
14205 if (s.compareTo(N_OVER_TWO) > 0) {
14206 s = n.subtract(s)
14207 }
14208
14209 return new ECSignature(r, s)
14210}
14211
14212function verify (hash, signature, Q) {
14213 typeforce(types.tuple(
14214 types.Hash256bit,
14215 types.ECSignature,
14216 types.ECPoint
14217 ), arguments)
14218
14219 var n = secp256k1.n
14220 var G = secp256k1.G
14221
14222 var r = signature.r
14223 var s = signature.s
14224
14225 // 1.4.1 Enforce r and s are both integers in the interval [1, n − 1]
14226 if (r.signum() <= 0 || r.compareTo(n) >= 0) return false
14227 if (s.signum() <= 0 || s.compareTo(n) >= 0) return false
14228
14229 // 1.4.2 H = Hash(M), already done by the user
14230 // 1.4.3 e = H
14231 var e = BigInteger.fromBuffer(hash)
14232
14233 // Compute s^-1
14234 var sInv = s.modInverse(n)
14235
14236 // 1.4.4 Compute u1 = es^−1 mod n
14237 // u2 = rs^−1 mod n
14238 var u1 = e.multiply(sInv).mod(n)
14239 var u2 = r.multiply(sInv).mod(n)
14240
14241 // 1.4.5 Compute R = (xR, yR)
14242 // R = u1G + u2Q
14243 var R = G.multiplyTwo(u1, Q, u2)
14244
14245 // 1.4.5 (cont.) Enforce R is not at infinity
14246 if (secp256k1.isInfinity(R)) return false
14247
14248 // 1.4.6 Convert the field element R.x to an integer
14249 var xR = R.affineX
14250
14251 // 1.4.7 Set v = xR mod n
14252 var v = xR.mod(n)
14253
14254 // 1.4.8 If v = r, output "valid", and if v != r, output "invalid"
14255 return v.equals(r)
14256}
14257
14258module.exports = {
14259 deterministicGenerateK: deterministicGenerateK,
14260 sign: sign,
14261 verify: verify,
14262
14263 // TODO: remove
14264 __curve: secp256k1
14265}
14266
14267},{"./ecsignature":77,"./types":107,"bigi":63,"create-hmac":241,"ecurve":257,"safe-buffer":742,"typeforce":816}],76:[function(require,module,exports){
14268var baddress = require('./address')
14269var bcrypto = require('./crypto')
14270var ecdsa = require('./ecdsa')
14271var randomBytes = require('randombytes')
14272var typeforce = require('typeforce')
14273var types = require('./types')
14274var wif = require('wif')
14275
14276var NETWORKS = require('./networks')
14277var BigInteger = require('bigi')
14278
14279var ecurve = require('ecurve')
14280var secp256k1 = ecdsa.__curve
14281
14282function ECPair (d, Q, options) {
14283 if (options) {
14284 typeforce({
14285 compressed: types.maybe(types.Boolean),
14286 network: types.maybe(types.Network)
14287 }, options)
14288 }
14289
14290 options = options || {}
14291
14292 if (d) {
14293 if (d.signum() <= 0) throw new Error('Private key must be greater than 0')
14294 if (d.compareTo(secp256k1.n) >= 0) throw new Error('Private key must be less than the curve order')
14295 if (Q) throw new TypeError('Unexpected publicKey parameter')
14296
14297 this.d = d
14298 } else {
14299 typeforce(types.ECPoint, Q)
14300
14301 this.__Q = Q
14302 }
14303
14304 this.compressed = options.compressed === undefined ? true : options.compressed
14305 this.network = options.network || NETWORKS.bitcoin
14306}
14307
14308Object.defineProperty(ECPair.prototype, 'Q', {
14309 get: function () {
14310 if (!this.__Q && this.d) {
14311 this.__Q = secp256k1.G.multiply(this.d)
14312 }
14313
14314 return this.__Q
14315 }
14316})
14317
14318ECPair.fromPublicKeyBuffer = function (buffer, network) {
14319 var Q = ecurve.Point.decodeFrom(secp256k1, buffer)
14320
14321 return new ECPair(null, Q, {
14322 compressed: Q.compressed,
14323 network: network
14324 })
14325}
14326
14327ECPair.fromWIF = function (string, network) {
14328 var decoded = wif.decode(string)
14329 var version = decoded.version
14330
14331 // list of networks?
14332 if (types.Array(network)) {
14333 network = network.filter(function (x) {
14334 return version === x.wif
14335 }).pop()
14336
14337 if (!network) throw new Error('Unknown network version')
14338
14339 // otherwise, assume a network object (or default to bitcoin)
14340 } else {
14341 network = network || NETWORKS.bitcoin
14342
14343 if (version !== network.wif) throw new Error('Invalid network version')
14344 }
14345
14346 var d = BigInteger.fromBuffer(decoded.privateKey)
14347
14348 return new ECPair(d, null, {
14349 compressed: decoded.compressed,
14350 network: network
14351 })
14352}
14353
14354ECPair.makeRandom = function (options) {
14355 options = options || {}
14356
14357 var rng = options.rng || randomBytes
14358
14359 var d
14360 do {
14361 var buffer = rng(32)
14362 typeforce(types.Buffer256bit, buffer)
14363
14364 d = BigInteger.fromBuffer(buffer)
14365 } while (d.signum() <= 0 || d.compareTo(secp256k1.n) >= 0)
14366
14367 return new ECPair(d, null, options)
14368}
14369
14370ECPair.prototype.getAddress = function () {
14371 return baddress.toBase58Check(bcrypto.hash160(this.getPublicKeyBuffer()), this.getNetwork().pubKeyHash)
14372}
14373
14374ECPair.prototype.getNetwork = function () {
14375 return this.network
14376}
14377
14378ECPair.prototype.getPublicKeyBuffer = function () {
14379 return this.Q.getEncoded(this.compressed)
14380}
14381
14382ECPair.prototype.sign = function (hash) {
14383 if (!this.d) throw new Error('Missing private key')
14384
14385 return ecdsa.sign(hash, this.d)
14386}
14387
14388ECPair.prototype.toWIF = function () {
14389 if (!this.d) throw new Error('Missing private key')
14390
14391 return wif.encode(this.network.wif, this.d.toBuffer(32), this.compressed)
14392}
14393
14394ECPair.prototype.verify = function (hash, signature) {
14395 return ecdsa.verify(hash, signature, this.Q)
14396}
14397
14398module.exports = ECPair
14399
14400},{"./address":71,"./crypto":74,"./ecdsa":75,"./networks":80,"./types":107,"bigi":63,"ecurve":257,"randombytes":724,"typeforce":816,"wif":832}],77:[function(require,module,exports){
14401(function (Buffer){
14402var bip66 = require('bip66')
14403var typeforce = require('typeforce')
14404var types = require('./types')
14405
14406var BigInteger = require('bigi')
14407
14408function ECSignature (r, s) {
14409 typeforce(types.tuple(types.BigInt, types.BigInt), arguments)
14410
14411 this.r = r
14412 this.s = s
14413}
14414
14415ECSignature.parseCompact = function (buffer) {
14416 typeforce(types.BufferN(65), buffer)
14417
14418 var flagByte = buffer.readUInt8(0) - 27
14419 if (flagByte !== (flagByte & 7)) throw new Error('Invalid signature parameter')
14420
14421 var compressed = !!(flagByte & 4)
14422 var recoveryParam = flagByte & 3
14423 var signature = ECSignature.fromRSBuffer(buffer.slice(1))
14424
14425 return {
14426 compressed: compressed,
14427 i: recoveryParam,
14428 signature: signature
14429 }
14430}
14431
14432ECSignature.fromRSBuffer = function (buffer) {
14433 typeforce(types.BufferN(64), buffer)
14434
14435 var r = BigInteger.fromBuffer(buffer.slice(0, 32))
14436 var s = BigInteger.fromBuffer(buffer.slice(32, 64))
14437 return new ECSignature(r, s)
14438}
14439
14440ECSignature.fromDER = function (buffer) {
14441 var decode = bip66.decode(buffer)
14442 var r = BigInteger.fromDERInteger(decode.r)
14443 var s = BigInteger.fromDERInteger(decode.s)
14444
14445 return new ECSignature(r, s)
14446}
14447
14448// BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)
14449ECSignature.parseScriptSignature = function (buffer) {
14450 var hashType = buffer.readUInt8(buffer.length - 1)
14451 var hashTypeMod = hashType & ~0x80
14452
14453 if (hashTypeMod <= 0x00 || hashTypeMod >= 0x04) throw new Error('Invalid hashType ' + hashType)
14454
14455 return {
14456 signature: ECSignature.fromDER(buffer.slice(0, -1)),
14457 hashType: hashType
14458 }
14459}
14460
14461ECSignature.prototype.toCompact = function (i, compressed) {
14462 if (compressed) {
14463 i += 4
14464 }
14465
14466 i += 27
14467
14468 var buffer = Buffer.alloc(65)
14469 buffer.writeUInt8(i, 0)
14470 this.toRSBuffer(buffer, 1)
14471 return buffer
14472}
14473
14474ECSignature.prototype.toDER = function () {
14475 var r = Buffer.from(this.r.toDERInteger())
14476 var s = Buffer.from(this.s.toDERInteger())
14477
14478 return bip66.encode(r, s)
14479}
14480
14481ECSignature.prototype.toRSBuffer = function (buffer, offset) {
14482 buffer = buffer || Buffer.alloc(64)
14483 this.r.toBuffer(32).copy(buffer, offset)
14484 this.s.toBuffer(32).copy(buffer, offset + 32)
14485 return buffer
14486}
14487
14488ECSignature.prototype.toScriptSignature = function (hashType) {
14489 var hashTypeMod = hashType & ~0x80
14490 if (hashTypeMod <= 0 || hashTypeMod >= 4) throw new Error('Invalid hashType ' + hashType)
14491
14492 var hashTypeBuffer = Buffer.alloc(1)
14493 hashTypeBuffer.writeUInt8(hashType, 0)
14494
14495 return Buffer.concat([this.toDER(), hashTypeBuffer])
14496}
14497
14498module.exports = ECSignature
14499
14500}).call(this,require("buffer").Buffer)
14501},{"./types":107,"bigi":63,"bip66":68,"buffer":146,"typeforce":816}],78:[function(require,module,exports){
14502var Buffer = require('safe-buffer').Buffer
14503var base58check = require('bs58check')
14504var bcrypto = require('./crypto')
14505var createHmac = require('create-hmac')
14506var typeforce = require('typeforce')
14507var types = require('./types')
14508var NETWORKS = require('./networks')
14509
14510var BigInteger = require('bigi')
14511var ECPair = require('./ecpair')
14512
14513var ecurve = require('ecurve')
14514var curve = ecurve.getCurveByName('secp256k1')
14515
14516function HDNode (keyPair, chainCode) {
14517 typeforce(types.tuple('ECPair', types.Buffer256bit), arguments)
14518
14519 if (!keyPair.compressed) throw new TypeError('BIP32 only allows compressed keyPairs')
14520
14521 this.keyPair = keyPair
14522 this.chainCode = chainCode
14523 this.depth = 0
14524 this.index = 0
14525 this.parentFingerprint = 0x00000000
14526}
14527
14528HDNode.HIGHEST_BIT = 0x80000000
14529HDNode.LENGTH = 78
14530HDNode.MASTER_SECRET = Buffer.from('Bitcoin seed', 'utf8')
14531
14532HDNode.fromSeedBuffer = function (seed, network) {
14533 typeforce(types.tuple(types.Buffer, types.maybe(types.Network)), arguments)
14534
14535 if (seed.length < 16) throw new TypeError('Seed should be at least 128 bits')
14536 if (seed.length > 64) throw new TypeError('Seed should be at most 512 bits')
14537
14538 var I = createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()
14539 var IL = I.slice(0, 32)
14540 var IR = I.slice(32)
14541
14542 // In case IL is 0 or >= n, the master key is invalid
14543 // This is handled by the ECPair constructor
14544 var pIL = BigInteger.fromBuffer(IL)
14545 var keyPair = new ECPair(pIL, null, {
14546 network: network
14547 })
14548
14549 return new HDNode(keyPair, IR)
14550}
14551
14552HDNode.fromSeedHex = function (hex, network) {
14553 return HDNode.fromSeedBuffer(Buffer.from(hex, 'hex'), network)
14554}
14555
14556HDNode.fromBase58 = function (string, networks) {
14557 var buffer = base58check.decode(string)
14558 if (buffer.length !== 78) throw new Error('Invalid buffer length')
14559
14560 // 4 bytes: version bytes
14561 var version = buffer.readUInt32BE(0)
14562 var network
14563
14564 // list of networks?
14565 if (Array.isArray(networks)) {
14566 network = networks.filter(function (x) {
14567 return version === x.bip32.private ||
14568 version === x.bip32.public
14569 }).pop()
14570
14571 if (!network) throw new Error('Unknown network version')
14572
14573 // otherwise, assume a network object (or default to bitcoin)
14574 } else {
14575 network = networks || NETWORKS.bitcoin
14576 }
14577
14578 if (version !== network.bip32.private &&
14579 version !== network.bip32.public) throw new Error('Invalid network version')
14580
14581 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...
14582 var depth = buffer[4]
14583
14584 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
14585 var parentFingerprint = buffer.readUInt32BE(5)
14586 if (depth === 0) {
14587 if (parentFingerprint !== 0x00000000) throw new Error('Invalid parent fingerprint')
14588 }
14589
14590 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
14591 // This is encoded in MSB order. (0x00000000 if master key)
14592 var index = buffer.readUInt32BE(9)
14593 if (depth === 0 && index !== 0) throw new Error('Invalid index')
14594
14595 // 32 bytes: the chain code
14596 var chainCode = buffer.slice(13, 45)
14597 var keyPair
14598
14599 // 33 bytes: private key data (0x00 + k)
14600 if (version === network.bip32.private) {
14601 if (buffer.readUInt8(45) !== 0x00) throw new Error('Invalid private key')
14602
14603 var d = BigInteger.fromBuffer(buffer.slice(46, 78))
14604 keyPair = new ECPair(d, null, { network: network })
14605
14606 // 33 bytes: public key data (0x02 + X or 0x03 + X)
14607 } else {
14608 var Q = ecurve.Point.decodeFrom(curve, buffer.slice(45, 78))
14609 // Q.compressed is assumed, if somehow this assumption is broken, `new HDNode` will throw
14610
14611 // Verify that the X coordinate in the public point corresponds to a point on the curve.
14612 // If not, the extended public key is invalid.
14613 curve.validate(Q)
14614
14615 keyPair = new ECPair(null, Q, { network: network })
14616 }
14617
14618 var hd = new HDNode(keyPair, chainCode)
14619 hd.depth = depth
14620 hd.index = index
14621 hd.parentFingerprint = parentFingerprint
14622
14623 return hd
14624}
14625
14626HDNode.prototype.getAddress = function () {
14627 return this.keyPair.getAddress()
14628}
14629
14630HDNode.prototype.getIdentifier = function () {
14631 return bcrypto.hash160(this.keyPair.getPublicKeyBuffer())
14632}
14633
14634HDNode.prototype.getFingerprint = function () {
14635 return this.getIdentifier().slice(0, 4)
14636}
14637
14638HDNode.prototype.getNetwork = function () {
14639 return this.keyPair.getNetwork()
14640}
14641
14642HDNode.prototype.getPublicKeyBuffer = function () {
14643 return this.keyPair.getPublicKeyBuffer()
14644}
14645
14646HDNode.prototype.neutered = function () {
14647 var neuteredKeyPair = new ECPair(null, this.keyPair.Q, {
14648 network: this.keyPair.network
14649 })
14650
14651 var neutered = new HDNode(neuteredKeyPair, this.chainCode)
14652 neutered.depth = this.depth
14653 neutered.index = this.index
14654 neutered.parentFingerprint = this.parentFingerprint
14655
14656 return neutered
14657}
14658
14659HDNode.prototype.sign = function (hash) {
14660 return this.keyPair.sign(hash)
14661}
14662
14663HDNode.prototype.verify = function (hash, signature) {
14664 return this.keyPair.verify(hash, signature)
14665}
14666
14667HDNode.prototype.toBase58 = function (__isPrivate) {
14668 if (__isPrivate !== undefined) throw new TypeError('Unsupported argument in 2.0.0')
14669
14670 // Version
14671 var network = this.keyPair.network
14672 var version = (!this.isNeutered()) ? network.bip32.private : network.bip32.public
14673 var buffer = Buffer.allocUnsafe(78)
14674
14675 // 4 bytes: version bytes
14676 buffer.writeUInt32BE(version, 0)
14677
14678 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ....
14679 buffer.writeUInt8(this.depth, 4)
14680
14681 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
14682 buffer.writeUInt32BE(this.parentFingerprint, 5)
14683
14684 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
14685 // This is encoded in big endian. (0x00000000 if master key)
14686 buffer.writeUInt32BE(this.index, 9)
14687
14688 // 32 bytes: the chain code
14689 this.chainCode.copy(buffer, 13)
14690
14691 // 33 bytes: the public key or private key data
14692 if (!this.isNeutered()) {
14693 // 0x00 + k for private keys
14694 buffer.writeUInt8(0, 45)
14695 this.keyPair.d.toBuffer(32).copy(buffer, 46)
14696
14697 // 33 bytes: the public key
14698 } else {
14699 // X9.62 encoding for public keys
14700 this.keyPair.getPublicKeyBuffer().copy(buffer, 45)
14701 }
14702
14703 return base58check.encode(buffer)
14704}
14705
14706// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions
14707HDNode.prototype.derive = function (index) {
14708 typeforce(types.UInt32, index)
14709
14710 var isHardened = index >= HDNode.HIGHEST_BIT
14711 var data = Buffer.allocUnsafe(37)
14712
14713 // Hardened child
14714 if (isHardened) {
14715 if (this.isNeutered()) throw new TypeError('Could not derive hardened child key')
14716
14717 // data = 0x00 || ser256(kpar) || ser32(index)
14718 data[0] = 0x00
14719 this.keyPair.d.toBuffer(32).copy(data, 1)
14720 data.writeUInt32BE(index, 33)
14721
14722 // Normal child
14723 } else {
14724 // data = serP(point(kpar)) || ser32(index)
14725 // = serP(Kpar) || ser32(index)
14726 this.keyPair.getPublicKeyBuffer().copy(data, 0)
14727 data.writeUInt32BE(index, 33)
14728 }
14729
14730 var I = createHmac('sha512', this.chainCode).update(data).digest()
14731 var IL = I.slice(0, 32)
14732 var IR = I.slice(32)
14733
14734 var pIL = BigInteger.fromBuffer(IL)
14735
14736 // In case parse256(IL) >= n, proceed with the next value for i
14737 if (pIL.compareTo(curve.n) >= 0) {
14738 return this.derive(index + 1)
14739 }
14740
14741 // Private parent key -> private child key
14742 var derivedKeyPair
14743 if (!this.isNeutered()) {
14744 // ki = parse256(IL) + kpar (mod n)
14745 var ki = pIL.add(this.keyPair.d).mod(curve.n)
14746
14747 // In case ki == 0, proceed with the next value for i
14748 if (ki.signum() === 0) {
14749 return this.derive(index + 1)
14750 }
14751
14752 derivedKeyPair = new ECPair(ki, null, {
14753 network: this.keyPair.network
14754 })
14755
14756 // Public parent key -> public child key
14757 } else {
14758 // Ki = point(parse256(IL)) + Kpar
14759 // = G*IL + Kpar
14760 var Ki = curve.G.multiply(pIL).add(this.keyPair.Q)
14761
14762 // In case Ki is the point at infinity, proceed with the next value for i
14763 if (curve.isInfinity(Ki)) {
14764 return this.derive(index + 1)
14765 }
14766
14767 derivedKeyPair = new ECPair(null, Ki, {
14768 network: this.keyPair.network
14769 })
14770 }
14771
14772 var hd = new HDNode(derivedKeyPair, IR)
14773 hd.depth = this.depth + 1
14774 hd.index = index
14775 hd.parentFingerprint = this.getFingerprint().readUInt32BE(0)
14776
14777 return hd
14778}
14779
14780HDNode.prototype.deriveHardened = function (index) {
14781 typeforce(types.UInt31, index)
14782
14783 // Only derives hardened private keys by default
14784 return this.derive(index + HDNode.HIGHEST_BIT)
14785}
14786
14787// Private === not neutered
14788// Public === neutered
14789HDNode.prototype.isNeutered = function () {
14790 return !(this.keyPair.d)
14791}
14792
14793HDNode.prototype.derivePath = function (path) {
14794 typeforce(types.BIP32Path, path)
14795
14796 var splitPath = path.split('/')
14797 if (splitPath[0] === 'm') {
14798 if (this.parentFingerprint) {
14799 throw new Error('Not a master node')
14800 }
14801
14802 splitPath = splitPath.slice(1)
14803 }
14804
14805 return splitPath.reduce(function (prevHd, indexStr) {
14806 var index
14807 if (indexStr.slice(-1) === "'") {
14808 index = parseInt(indexStr.slice(0, -1), 10)
14809 return prevHd.deriveHardened(index)
14810 } else {
14811 index = parseInt(indexStr, 10)
14812 return prevHd.derive(index)
14813 }
14814 }, this)
14815}
14816
14817module.exports = HDNode
14818
14819},{"./crypto":74,"./ecpair":76,"./networks":80,"./types":107,"bigi":63,"bs58check":140,"create-hmac":241,"ecurve":257,"safe-buffer":742,"typeforce":816}],79:[function(require,module,exports){
14820var script = require('./script')
14821
14822var templates = require('./templates')
14823for (var key in templates) {
14824 script[key] = templates[key]
14825}
14826
14827module.exports = {
14828 bufferutils: require('./bufferutils'), // TODO: remove in 4.0.0
14829
14830 Block: require('./block'),
14831 ECPair: require('./ecpair'),
14832 ECSignature: require('./ecsignature'),
14833 HDNode: require('./hdnode'),
14834 Transaction: require('./transaction'),
14835 TransactionBuilder: require('./transaction_builder'),
14836
14837 address: require('./address'),
14838 crypto: require('./crypto'),
14839 networks: require('./networks'),
14840 opcodes: require('bitcoin-ops'),
14841 script: script
14842}
14843
14844},{"./address":71,"./block":72,"./bufferutils":73,"./crypto":74,"./ecpair":76,"./ecsignature":77,"./hdnode":78,"./networks":80,"./script":81,"./templates":83,"./transaction":105,"./transaction_builder":106,"bitcoin-ops":69}],80:[function(require,module,exports){
14845// https://en.bitcoin.it/wiki/List_of_address_prefixes
14846// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731
14847
14848module.exports = {
14849 bitcoin: {
14850 messagePrefix: '\x18Bitcoin Signed Message:\n',
14851 bech32: 'bc',
14852 bip32: {
14853 public: 0x0488b21e,
14854 private: 0x0488ade4
14855 },
14856 pubKeyHash: 0x00,
14857 scriptHash: 0x05,
14858 wif: 0x80
14859 },
14860 testnet: {
14861 messagePrefix: '\x18Bitcoin Signed Message:\n',
14862 bech32: 'tb',
14863 bip32: {
14864 public: 0x043587cf,
14865 private: 0x04358394
14866 },
14867 pubKeyHash: 0x6f,
14868 scriptHash: 0xc4,
14869 wif: 0xef
14870 },
14871 litecoin: {
14872 messagePrefix: '\x19Litecoin Signed Message:\n',
14873 bip32: {
14874 public: 0x019da462,
14875 private: 0x019d9cfe
14876 },
14877 pubKeyHash: 0x30,
14878 scriptHash: 0x32,
14879 wif: 0xb0
14880 }
14881}
14882
14883},{}],81:[function(require,module,exports){
14884var Buffer = require('safe-buffer').Buffer
14885var bip66 = require('bip66')
14886var pushdata = require('pushdata-bitcoin')
14887var typeforce = require('typeforce')
14888var types = require('./types')
14889var scriptNumber = require('./script_number')
14890
14891var OPS = require('bitcoin-ops')
14892var REVERSE_OPS = require('bitcoin-ops/map')
14893var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
14894
14895function isOPInt (value) {
14896 return types.Number(value) &&
14897 ((value === OPS.OP_0) ||
14898 (value >= OPS.OP_1 && value <= OPS.OP_16) ||
14899 (value === OPS.OP_1NEGATE))
14900}
14901
14902function isPushOnlyChunk (value) {
14903 return types.Buffer(value) || isOPInt(value)
14904}
14905
14906function isPushOnly (value) {
14907 return types.Array(value) && value.every(isPushOnlyChunk)
14908}
14909
14910function asMinimalOP (buffer) {
14911 if (buffer.length === 0) return OPS.OP_0
14912 if (buffer.length !== 1) return
14913 if (buffer[0] >= 1 && buffer[0] <= 16) return OP_INT_BASE + buffer[0]
14914 if (buffer[0] === 0x81) return OPS.OP_1NEGATE
14915}
14916
14917function compile (chunks) {
14918 // TODO: remove me
14919 if (Buffer.isBuffer(chunks)) return chunks
14920
14921 typeforce(types.Array, chunks)
14922
14923 var bufferSize = chunks.reduce(function (accum, chunk) {
14924 // data chunk
14925 if (Buffer.isBuffer(chunk)) {
14926 // adhere to BIP62.3, minimal push policy
14927 if (chunk.length === 1 && asMinimalOP(chunk) !== undefined) {
14928 return accum + 1
14929 }
14930
14931 return accum + pushdata.encodingLength(chunk.length) + chunk.length
14932 }
14933
14934 // opcode
14935 return accum + 1
14936 }, 0.0)
14937
14938 var buffer = Buffer.allocUnsafe(bufferSize)
14939 var offset = 0
14940
14941 chunks.forEach(function (chunk) {
14942 // data chunk
14943 if (Buffer.isBuffer(chunk)) {
14944 // adhere to BIP62.3, minimal push policy
14945 var opcode = asMinimalOP(chunk)
14946 if (opcode !== undefined) {
14947 buffer.writeUInt8(opcode, offset)
14948 offset += 1
14949 return
14950 }
14951
14952 offset += pushdata.encode(buffer, chunk.length, offset)
14953 chunk.copy(buffer, offset)
14954 offset += chunk.length
14955
14956 // opcode
14957 } else {
14958 buffer.writeUInt8(chunk, offset)
14959 offset += 1
14960 }
14961 })
14962
14963 if (offset !== buffer.length) throw new Error('Could not decode chunks')
14964 return buffer
14965}
14966
14967function decompile (buffer) {
14968 // TODO: remove me
14969 if (types.Array(buffer)) return buffer
14970
14971 typeforce(types.Buffer, buffer)
14972
14973 var chunks = []
14974 var i = 0
14975
14976 while (i < buffer.length) {
14977 var opcode = buffer[i]
14978
14979 // data chunk
14980 if ((opcode > OPS.OP_0) && (opcode <= OPS.OP_PUSHDATA4)) {
14981 var d = pushdata.decode(buffer, i)
14982
14983 // did reading a pushDataInt fail? empty script
14984 if (d === null) return []
14985 i += d.size
14986
14987 // attempt to read too much data? empty script
14988 if (i + d.number > buffer.length) return []
14989
14990 var data = buffer.slice(i, i + d.number)
14991 i += d.number
14992
14993 // decompile minimally
14994 var op = asMinimalOP(data)
14995 if (op !== undefined) {
14996 chunks.push(op)
14997 } else {
14998 chunks.push(data)
14999 }
15000
15001 // opcode
15002 } else {
15003 chunks.push(opcode)
15004
15005 i += 1
15006 }
15007 }
15008
15009 return chunks
15010}
15011
15012function toASM (chunks) {
15013 if (Buffer.isBuffer(chunks)) {
15014 chunks = decompile(chunks)
15015 }
15016
15017 return chunks.map(function (chunk) {
15018 // data?
15019 if (Buffer.isBuffer(chunk)) {
15020 var op = asMinimalOP(chunk)
15021 if (op === undefined) return chunk.toString('hex')
15022 chunk = op
15023 }
15024
15025 // opcode!
15026 return REVERSE_OPS[chunk]
15027 }).join(' ')
15028}
15029
15030function fromASM (asm) {
15031 typeforce(types.String, asm)
15032
15033 return compile(asm.split(' ').map(function (chunkStr) {
15034 // opcode?
15035 if (OPS[chunkStr] !== undefined) return OPS[chunkStr]
15036 typeforce(types.Hex, chunkStr)
15037
15038 // data!
15039 return Buffer.from(chunkStr, 'hex')
15040 }))
15041}
15042
15043function toStack (chunks) {
15044 chunks = decompile(chunks)
15045 typeforce(isPushOnly, chunks)
15046
15047 return chunks.map(function (op) {
15048 if (Buffer.isBuffer(op)) return op
15049 if (op === OPS.OP_0) return Buffer.allocUnsafe(0)
15050
15051 return scriptNumber.encode(op - OP_INT_BASE)
15052 })
15053}
15054
15055function isCanonicalPubKey (buffer) {
15056 if (!Buffer.isBuffer(buffer)) return false
15057 if (buffer.length < 33) return false
15058
15059 switch (buffer[0]) {
15060 case 0x02:
15061 case 0x03:
15062 return buffer.length === 33
15063 case 0x04:
15064 return buffer.length === 65
15065 }
15066
15067 return false
15068}
15069
15070function isDefinedHashType (hashType) {
15071 var hashTypeMod = hashType & ~0x80
15072
15073// return hashTypeMod > SIGHASH_ALL && hashTypeMod < SIGHASH_SINGLE
15074 return hashTypeMod > 0x00 && hashTypeMod < 0x04
15075}
15076
15077function isCanonicalSignature (buffer) {
15078 if (!Buffer.isBuffer(buffer)) return false
15079 if (!isDefinedHashType(buffer[buffer.length - 1])) return false
15080
15081 return bip66.check(buffer.slice(0, -1))
15082}
15083
15084module.exports = {
15085 compile: compile,
15086 decompile: decompile,
15087 fromASM: fromASM,
15088 toASM: toASM,
15089 toStack: toStack,
15090
15091 number: require('./script_number'),
15092
15093 isCanonicalPubKey: isCanonicalPubKey,
15094 isCanonicalSignature: isCanonicalSignature,
15095 isPushOnly: isPushOnly,
15096 isDefinedHashType: isDefinedHashType
15097}
15098
15099},{"./script_number":82,"./types":107,"bip66":68,"bitcoin-ops":69,"bitcoin-ops/map":70,"pushdata-bitcoin":720,"safe-buffer":742,"typeforce":816}],82:[function(require,module,exports){
15100var Buffer = require('safe-buffer').Buffer
15101
15102function decode (buffer, maxLength, minimal) {
15103 maxLength = maxLength || 4
15104 minimal = minimal === undefined ? true : minimal
15105
15106 var length = buffer.length
15107 if (length === 0) return 0
15108 if (length > maxLength) throw new TypeError('Script number overflow')
15109 if (minimal) {
15110 if ((buffer[length - 1] & 0x7f) === 0) {
15111 if (length <= 1 || (buffer[length - 2] & 0x80) === 0) throw new Error('Non-minimally encoded script number')
15112 }
15113 }
15114
15115 // 40-bit
15116 if (length === 5) {
15117 var a = buffer.readUInt32LE(0)
15118 var b = buffer.readUInt8(4)
15119
15120 if (b & 0x80) return -(((b & ~0x80) * 0x100000000) + a)
15121 return (b * 0x100000000) + a
15122 }
15123
15124 var result = 0
15125
15126 // 32-bit / 24-bit / 16-bit / 8-bit
15127 for (var i = 0; i < length; ++i) {
15128 result |= buffer[i] << (8 * i)
15129 }
15130
15131 if (buffer[length - 1] & 0x80) return -(result & ~(0x80 << (8 * (length - 1))))
15132 return result
15133}
15134
15135function scriptNumSize (i) {
15136 return i > 0x7fffffff ? 5
15137 : i > 0x7fffff ? 4
15138 : i > 0x7fff ? 3
15139 : i > 0x7f ? 2
15140 : i > 0x00 ? 1
15141 : 0
15142}
15143
15144function encode (number) {
15145 var value = Math.abs(number)
15146 var size = scriptNumSize(value)
15147 var buffer = Buffer.allocUnsafe(size)
15148 var negative = number < 0
15149
15150 for (var i = 0; i < size; ++i) {
15151 buffer.writeUInt8(value & 0xff, i)
15152 value >>= 8
15153 }
15154
15155 if (buffer[size - 1] & 0x80) {
15156 buffer.writeUInt8(negative ? 0x80 : 0x00, size - 1)
15157 } else if (negative) {
15158 buffer[size - 1] |= 0x80
15159 }
15160
15161 return buffer
15162}
15163
15164module.exports = {
15165 decode: decode,
15166 encode: encode
15167}
15168
15169},{"safe-buffer":742}],83:[function(require,module,exports){
15170var decompile = require('../script').decompile
15171var multisig = require('./multisig')
15172var nullData = require('./nulldata')
15173var pubKey = require('./pubkey')
15174var pubKeyHash = require('./pubkeyhash')
15175var scriptHash = require('./scripthash')
15176var witnessPubKeyHash = require('./witnesspubkeyhash')
15177var witnessScriptHash = require('./witnessscripthash')
15178var witnessCommitment = require('./witnesscommitment')
15179
15180var types = {
15181 MULTISIG: 'multisig',
15182 NONSTANDARD: 'nonstandard',
15183 NULLDATA: 'nulldata',
15184 P2PK: 'pubkey',
15185 P2PKH: 'pubkeyhash',
15186 P2SH: 'scripthash',
15187 P2WPKH: 'witnesspubkeyhash',
15188 P2WSH: 'witnessscripthash',
15189 WITNESS_COMMITMENT: 'witnesscommitment'
15190}
15191
15192function classifyOutput (script) {
15193 if (witnessPubKeyHash.output.check(script)) return types.P2WPKH
15194 if (witnessScriptHash.output.check(script)) return types.P2WSH
15195 if (pubKeyHash.output.check(script)) return types.P2PKH
15196 if (scriptHash.output.check(script)) return types.P2SH
15197
15198 // XXX: optimization, below functions .decompile before use
15199 var chunks = decompile(script)
15200 if (multisig.output.check(chunks)) return types.MULTISIG
15201 if (pubKey.output.check(chunks)) return types.P2PK
15202 if (witnessCommitment.output.check(chunks)) return types.WITNESS_COMMITMENT
15203 if (nullData.output.check(chunks)) return types.NULLDATA
15204
15205 return types.NONSTANDARD
15206}
15207
15208function classifyInput (script, allowIncomplete) {
15209 // XXX: optimization, below functions .decompile before use
15210 var chunks = decompile(script)
15211
15212 if (pubKeyHash.input.check(chunks)) return types.P2PKH
15213 if (scriptHash.input.check(chunks, allowIncomplete)) return types.P2SH
15214 if (multisig.input.check(chunks, allowIncomplete)) return types.MULTISIG
15215 if (pubKey.input.check(chunks)) return types.P2PK
15216
15217 return types.NONSTANDARD
15218}
15219
15220function classifyWitness (script, allowIncomplete) {
15221 // XXX: optimization, below functions .decompile before use
15222 var chunks = decompile(script)
15223
15224 if (witnessPubKeyHash.input.check(chunks)) return types.P2WPKH
15225 if (witnessScriptHash.input.check(chunks, allowIncomplete)) return types.P2WSH
15226
15227 return types.NONSTANDARD
15228}
15229
15230module.exports = {
15231 classifyInput: classifyInput,
15232 classifyOutput: classifyOutput,
15233 classifyWitness: classifyWitness,
15234 multisig: multisig,
15235 nullData: nullData,
15236 pubKey: pubKey,
15237 pubKeyHash: pubKeyHash,
15238 scriptHash: scriptHash,
15239 witnessPubKeyHash: witnessPubKeyHash,
15240 witnessScriptHash: witnessScriptHash,
15241 witnessCommitment: witnessCommitment,
15242 types: types
15243}
15244
15245},{"../script":81,"./multisig":84,"./nulldata":87,"./pubkey":88,"./pubkeyhash":91,"./scripthash":94,"./witnesscommitment":97,"./witnesspubkeyhash":99,"./witnessscripthash":102}],84:[function(require,module,exports){
15246module.exports = {
15247 input: require('./input'),
15248 output: require('./output')
15249}
15250
15251},{"./input":85,"./output":86}],85:[function(require,module,exports){
15252// OP_0 [signatures ...]
15253
15254var Buffer = require('safe-buffer').Buffer
15255var bscript = require('../../script')
15256var p2mso = require('./output')
15257var typeforce = require('typeforce')
15258var OPS = require('bitcoin-ops')
15259
15260function partialSignature (value) {
15261 return value === OPS.OP_0 || bscript.isCanonicalSignature(value)
15262}
15263
15264function check (script, allowIncomplete) {
15265 var chunks = bscript.decompile(script)
15266 if (chunks.length < 2) return false
15267 if (chunks[0] !== OPS.OP_0) return false
15268
15269 if (allowIncomplete) {
15270 return chunks.slice(1).every(partialSignature)
15271 }
15272
15273 return chunks.slice(1).every(bscript.isCanonicalSignature)
15274}
15275check.toJSON = function () { return 'multisig input' }
15276
15277var EMPTY_BUFFER = Buffer.allocUnsafe(0)
15278
15279function encodeStack (signatures, scriptPubKey) {
15280 typeforce([partialSignature], signatures)
15281
15282 if (scriptPubKey) {
15283 var scriptData = p2mso.decode(scriptPubKey)
15284
15285 if (signatures.length < scriptData.m) {
15286 throw new TypeError('Not enough signatures provided')
15287 }
15288
15289 if (signatures.length > scriptData.pubKeys.length) {
15290 throw new TypeError('Too many signatures provided')
15291 }
15292 }
15293
15294 return [].concat(EMPTY_BUFFER, signatures.map(function (sig) {
15295 if (sig === OPS.OP_0) {
15296 return EMPTY_BUFFER
15297 }
15298 return sig
15299 }))
15300}
15301
15302function encode (signatures, scriptPubKey) {
15303 return bscript.compile(encodeStack(signatures, scriptPubKey))
15304}
15305
15306function decodeStack (stack, allowIncomplete) {
15307 typeforce(typeforce.Array, stack)
15308 typeforce(check, stack, allowIncomplete)
15309 return stack.slice(1)
15310}
15311
15312function decode (buffer, allowIncomplete) {
15313 var stack = bscript.decompile(buffer)
15314 return decodeStack(stack, allowIncomplete)
15315}
15316
15317module.exports = {
15318 check: check,
15319 decode: decode,
15320 decodeStack: decodeStack,
15321 encode: encode,
15322 encodeStack: encodeStack
15323}
15324
15325},{"../../script":81,"./output":86,"bitcoin-ops":69,"safe-buffer":742,"typeforce":816}],86:[function(require,module,exports){
15326// m [pubKeys ...] n OP_CHECKMULTISIG
15327
15328var bscript = require('../../script')
15329var types = require('../../types')
15330var typeforce = require('typeforce')
15331var OPS = require('bitcoin-ops')
15332var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
15333
15334function check (script, allowIncomplete) {
15335 var chunks = bscript.decompile(script)
15336
15337 if (chunks.length < 4) return false
15338 if (chunks[chunks.length - 1] !== OPS.OP_CHECKMULTISIG) return false
15339 if (!types.Number(chunks[0])) return false
15340 if (!types.Number(chunks[chunks.length - 2])) return false
15341 var m = chunks[0] - OP_INT_BASE
15342 var n = chunks[chunks.length - 2] - OP_INT_BASE
15343
15344 if (m <= 0) return false
15345 if (n > 16) return false
15346 if (m > n) return false
15347 if (n !== chunks.length - 3) return false
15348 if (allowIncomplete) return true
15349
15350 var keys = chunks.slice(1, -2)
15351 return keys.every(bscript.isCanonicalPubKey)
15352}
15353check.toJSON = function () { return 'multi-sig output' }
15354
15355function encode (m, pubKeys) {
15356 typeforce({
15357 m: types.Number,
15358 pubKeys: [bscript.isCanonicalPubKey]
15359 }, {
15360 m: m,
15361 pubKeys: pubKeys
15362 })
15363
15364 var n = pubKeys.length
15365 if (n < m) throw new TypeError('Not enough pubKeys provided')
15366
15367 return bscript.compile([].concat(
15368 OP_INT_BASE + m,
15369 pubKeys,
15370 OP_INT_BASE + n,
15371 OPS.OP_CHECKMULTISIG
15372 ))
15373}
15374
15375function decode (buffer, allowIncomplete) {
15376 var chunks = bscript.decompile(buffer)
15377 typeforce(check, chunks, allowIncomplete)
15378
15379 return {
15380 m: chunks[0] - OP_INT_BASE,
15381 pubKeys: chunks.slice(1, -2)
15382 }
15383}
15384
15385module.exports = {
15386 check: check,
15387 decode: decode,
15388 encode: encode
15389}
15390
15391},{"../../script":81,"../../types":107,"bitcoin-ops":69,"typeforce":816}],87:[function(require,module,exports){
15392// OP_RETURN {data}
15393
15394var bscript = require('../script')
15395var types = require('../types')
15396var typeforce = require('typeforce')
15397var OPS = require('bitcoin-ops')
15398
15399function check (script) {
15400 var buffer = bscript.compile(script)
15401
15402 return buffer.length > 1 &&
15403 buffer[0] === OPS.OP_RETURN
15404}
15405check.toJSON = function () { return 'null data output' }
15406
15407function encode (data) {
15408 typeforce(types.Buffer, data)
15409
15410 return bscript.compile([OPS.OP_RETURN, data])
15411}
15412
15413function decode (buffer) {
15414 typeforce(check, buffer)
15415
15416 return buffer.slice(2)
15417}
15418
15419module.exports = {
15420 output: {
15421 check: check,
15422 decode: decode,
15423 encode: encode
15424 }
15425}
15426
15427},{"../script":81,"../types":107,"bitcoin-ops":69,"typeforce":816}],88:[function(require,module,exports){
15428arguments[4][84][0].apply(exports,arguments)
15429},{"./input":89,"./output":90,"dup":84}],89:[function(require,module,exports){
15430// {signature}
15431
15432var bscript = require('../../script')
15433var typeforce = require('typeforce')
15434
15435function check (script) {
15436 var chunks = bscript.decompile(script)
15437
15438 return chunks.length === 1 &&
15439 bscript.isCanonicalSignature(chunks[0])
15440}
15441check.toJSON = function () { return 'pubKey input' }
15442
15443function encodeStack (signature) {
15444 typeforce(bscript.isCanonicalSignature, signature)
15445 return [signature]
15446}
15447
15448function encode (signature) {
15449 return bscript.compile(encodeStack(signature))
15450}
15451
15452function decodeStack (stack) {
15453 typeforce(typeforce.Array, stack)
15454 typeforce(check, stack)
15455 return stack[0]
15456}
15457
15458function decode (buffer) {
15459 var stack = bscript.decompile(buffer)
15460 return decodeStack(stack)
15461}
15462
15463module.exports = {
15464 check: check,
15465 decode: decode,
15466 decodeStack: decodeStack,
15467 encode: encode,
15468 encodeStack: encodeStack
15469}
15470
15471},{"../../script":81,"typeforce":816}],90:[function(require,module,exports){
15472// {pubKey} OP_CHECKSIG
15473
15474var bscript = require('../../script')
15475var typeforce = require('typeforce')
15476var OPS = require('bitcoin-ops')
15477
15478function check (script) {
15479 var chunks = bscript.decompile(script)
15480
15481 return chunks.length === 2 &&
15482 bscript.isCanonicalPubKey(chunks[0]) &&
15483 chunks[1] === OPS.OP_CHECKSIG
15484}
15485check.toJSON = function () { return 'pubKey output' }
15486
15487function encode (pubKey) {
15488 typeforce(bscript.isCanonicalPubKey, pubKey)
15489
15490 return bscript.compile([pubKey, OPS.OP_CHECKSIG])
15491}
15492
15493function decode (buffer) {
15494 var chunks = bscript.decompile(buffer)
15495 typeforce(check, chunks)
15496
15497 return chunks[0]
15498}
15499
15500module.exports = {
15501 check: check,
15502 decode: decode,
15503 encode: encode
15504}
15505
15506},{"../../script":81,"bitcoin-ops":69,"typeforce":816}],91:[function(require,module,exports){
15507arguments[4][84][0].apply(exports,arguments)
15508},{"./input":92,"./output":93,"dup":84}],92:[function(require,module,exports){
15509// {signature} {pubKey}
15510
15511var bscript = require('../../script')
15512var typeforce = require('typeforce')
15513
15514function check (script) {
15515 var chunks = bscript.decompile(script)
15516
15517 return chunks.length === 2 &&
15518 bscript.isCanonicalSignature(chunks[0]) &&
15519 bscript.isCanonicalPubKey(chunks[1])
15520}
15521check.toJSON = function () { return 'pubKeyHash input' }
15522
15523function encodeStack (signature, pubKey) {
15524 typeforce({
15525 signature: bscript.isCanonicalSignature,
15526 pubKey: bscript.isCanonicalPubKey
15527 }, {
15528 signature: signature,
15529 pubKey: pubKey
15530 })
15531
15532 return [signature, pubKey]
15533}
15534
15535function encode (signature, pubKey) {
15536 return bscript.compile(encodeStack(signature, pubKey))
15537}
15538
15539function decodeStack (stack) {
15540 typeforce(typeforce.Array, stack)
15541 typeforce(check, stack)
15542
15543 return {
15544 signature: stack[0],
15545 pubKey: stack[1]
15546 }
15547}
15548
15549function decode (buffer) {
15550 var stack = bscript.decompile(buffer)
15551 return decodeStack(stack)
15552}
15553
15554module.exports = {
15555 check: check,
15556 decode: decode,
15557 decodeStack: decodeStack,
15558 encode: encode,
15559 encodeStack: encodeStack
15560}
15561
15562},{"../../script":81,"typeforce":816}],93:[function(require,module,exports){
15563// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
15564
15565var bscript = require('../../script')
15566var types = require('../../types')
15567var typeforce = require('typeforce')
15568var OPS = require('bitcoin-ops')
15569
15570function check (script) {
15571 var buffer = bscript.compile(script)
15572
15573 return buffer.length === 25 &&
15574 buffer[0] === OPS.OP_DUP &&
15575 buffer[1] === OPS.OP_HASH160 &&
15576 buffer[2] === 0x14 &&
15577 buffer[23] === OPS.OP_EQUALVERIFY &&
15578 buffer[24] === OPS.OP_CHECKSIG
15579}
15580check.toJSON = function () { return 'pubKeyHash output' }
15581
15582function encode (pubKeyHash) {
15583 typeforce(types.Hash160bit, pubKeyHash)
15584
15585 return bscript.compile([
15586 OPS.OP_DUP,
15587 OPS.OP_HASH160,
15588 pubKeyHash,
15589 OPS.OP_EQUALVERIFY,
15590 OPS.OP_CHECKSIG
15591 ])
15592}
15593
15594function decode (buffer) {
15595 typeforce(check, buffer)
15596
15597 return buffer.slice(3, 23)
15598}
15599
15600module.exports = {
15601 check: check,
15602 decode: decode,
15603 encode: encode
15604}
15605
15606},{"../../script":81,"../../types":107,"bitcoin-ops":69,"typeforce":816}],94:[function(require,module,exports){
15607arguments[4][84][0].apply(exports,arguments)
15608},{"./input":95,"./output":96,"dup":84}],95:[function(require,module,exports){
15609// <scriptSig> {serialized scriptPubKey script}
15610
15611var Buffer = require('safe-buffer').Buffer
15612var bscript = require('../../script')
15613var typeforce = require('typeforce')
15614
15615var p2ms = require('../multisig/')
15616var p2pk = require('../pubkey/')
15617var p2pkh = require('../pubkeyhash/')
15618var p2wpkho = require('../witnesspubkeyhash/output')
15619var p2wsho = require('../witnessscripthash/output')
15620
15621function check (script, allowIncomplete) {
15622 var chunks = bscript.decompile(script)
15623 if (chunks.length < 1) return false
15624
15625 var lastChunk = chunks[chunks.length - 1]
15626 if (!Buffer.isBuffer(lastChunk)) return false
15627
15628 var scriptSigChunks = bscript.decompile(bscript.compile(chunks.slice(0, -1)))
15629 var redeemScriptChunks = bscript.decompile(lastChunk)
15630
15631 // is redeemScript a valid script?
15632 if (redeemScriptChunks.length === 0) return false
15633
15634 // is redeemScriptSig push only?
15635 if (!bscript.isPushOnly(scriptSigChunks)) return false
15636
15637 // is witness?
15638 if (chunks.length === 1) {
15639 return p2wsho.check(redeemScriptChunks) ||
15640 p2wpkho.check(redeemScriptChunks)
15641 }
15642
15643 // match types
15644 if (p2pkh.input.check(scriptSigChunks) &&
15645 p2pkh.output.check(redeemScriptChunks)) return true
15646
15647 if (p2ms.input.check(scriptSigChunks, allowIncomplete) &&
15648 p2ms.output.check(redeemScriptChunks)) return true
15649
15650 if (p2pk.input.check(scriptSigChunks) &&
15651 p2pk.output.check(redeemScriptChunks)) return true
15652
15653 return false
15654}
15655check.toJSON = function () { return 'scriptHash input' }
15656
15657function encodeStack (redeemScriptStack, redeemScript) {
15658 var serializedScriptPubKey = bscript.compile(redeemScript)
15659
15660 return [].concat(redeemScriptStack, serializedScriptPubKey)
15661}
15662
15663function encode (redeemScriptSig, redeemScript) {
15664 var redeemScriptStack = bscript.decompile(redeemScriptSig)
15665
15666 return bscript.compile(encodeStack(redeemScriptStack, redeemScript))
15667}
15668
15669function decodeStack (stack) {
15670 typeforce(typeforce.Array, stack)
15671 typeforce(check, stack)
15672
15673 return {
15674 redeemScriptStack: stack.slice(0, -1),
15675 redeemScript: stack[stack.length - 1]
15676 }
15677}
15678
15679function decode (buffer) {
15680 var stack = bscript.decompile(buffer)
15681 var result = decodeStack(stack)
15682 result.redeemScriptSig = bscript.compile(result.redeemScriptStack)
15683 delete result.redeemScriptStack
15684 return result
15685}
15686
15687module.exports = {
15688 check: check,
15689 decode: decode,
15690 decodeStack: decodeStack,
15691 encode: encode,
15692 encodeStack: encodeStack
15693}
15694
15695},{"../../script":81,"../multisig/":84,"../pubkey/":88,"../pubkeyhash/":91,"../witnesspubkeyhash/output":101,"../witnessscripthash/output":104,"safe-buffer":742,"typeforce":816}],96:[function(require,module,exports){
15696// OP_HASH160 {scriptHash} OP_EQUAL
15697
15698var bscript = require('../../script')
15699var types = require('../../types')
15700var typeforce = require('typeforce')
15701var OPS = require('bitcoin-ops')
15702
15703function check (script) {
15704 var buffer = bscript.compile(script)
15705
15706 return buffer.length === 23 &&
15707 buffer[0] === OPS.OP_HASH160 &&
15708 buffer[1] === 0x14 &&
15709 buffer[22] === OPS.OP_EQUAL
15710}
15711check.toJSON = function () { return 'scriptHash output' }
15712
15713function encode (scriptHash) {
15714 typeforce(types.Hash160bit, scriptHash)
15715
15716 return bscript.compile([OPS.OP_HASH160, scriptHash, OPS.OP_EQUAL])
15717}
15718
15719function decode (buffer) {
15720 typeforce(check, buffer)
15721
15722 return buffer.slice(2, 22)
15723}
15724
15725module.exports = {
15726 check: check,
15727 decode: decode,
15728 encode: encode
15729}
15730
15731},{"../../script":81,"../../types":107,"bitcoin-ops":69,"typeforce":816}],97:[function(require,module,exports){
15732module.exports = {
15733 output: require('./output')
15734}
15735
15736},{"./output":98}],98:[function(require,module,exports){
15737// OP_RETURN {aa21a9ed} {commitment}
15738
15739var Buffer = require('safe-buffer').Buffer
15740var bscript = require('../../script')
15741var types = require('../../types')
15742var typeforce = require('typeforce')
15743var OPS = require('bitcoin-ops')
15744
15745var HEADER = Buffer.from('aa21a9ed', 'hex')
15746
15747function check (script) {
15748 var buffer = bscript.compile(script)
15749
15750 return buffer.length > 37 &&
15751 buffer[0] === OPS.OP_RETURN &&
15752 buffer[1] === 0x24 &&
15753 buffer.slice(2, 6).equals(HEADER)
15754}
15755
15756check.toJSON = function () { return 'Witness commitment output' }
15757
15758function encode (commitment) {
15759 typeforce(types.Hash256bit, commitment)
15760
15761 var buffer = Buffer.allocUnsafe(36)
15762 HEADER.copy(buffer, 0)
15763 commitment.copy(buffer, 4)
15764
15765 return bscript.compile([OPS.OP_RETURN, buffer])
15766}
15767
15768function decode (buffer) {
15769 typeforce(check, buffer)
15770
15771 return bscript.decompile(buffer)[1].slice(4, 36)
15772}
15773
15774module.exports = {
15775 check: check,
15776 decode: decode,
15777 encode: encode
15778}
15779
15780},{"../../script":81,"../../types":107,"bitcoin-ops":69,"safe-buffer":742,"typeforce":816}],99:[function(require,module,exports){
15781arguments[4][84][0].apply(exports,arguments)
15782},{"./input":100,"./output":101,"dup":84}],100:[function(require,module,exports){
15783// {signature} {pubKey}
15784
15785var bscript = require('../../script')
15786var typeforce = require('typeforce')
15787
15788function isCompressedCanonicalPubKey (pubKey) {
15789 return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33
15790}
15791
15792function check (script) {
15793 var chunks = bscript.decompile(script)
15794
15795 return chunks.length === 2 &&
15796 bscript.isCanonicalSignature(chunks[0]) &&
15797 isCompressedCanonicalPubKey(chunks[1])
15798}
15799check.toJSON = function () { return 'witnessPubKeyHash input' }
15800
15801function encodeStack (signature, pubKey) {
15802 typeforce({
15803 signature: bscript.isCanonicalSignature,
15804 pubKey: isCompressedCanonicalPubKey
15805 }, {
15806 signature: signature,
15807 pubKey: pubKey
15808 })
15809
15810 return [signature, pubKey]
15811}
15812
15813function decodeStack (stack) {
15814 typeforce(typeforce.Array, stack)
15815 typeforce(check, stack)
15816
15817 return {
15818 signature: stack[0],
15819 pubKey: stack[1]
15820 }
15821}
15822
15823module.exports = {
15824 check: check,
15825 decodeStack: decodeStack,
15826 encodeStack: encodeStack
15827}
15828
15829},{"../../script":81,"typeforce":816}],101:[function(require,module,exports){
15830// OP_0 {pubKeyHash}
15831
15832var bscript = require('../../script')
15833var types = require('../../types')
15834var typeforce = require('typeforce')
15835var OPS = require('bitcoin-ops')
15836
15837function check (script) {
15838 var buffer = bscript.compile(script)
15839
15840 return buffer.length === 22 &&
15841 buffer[0] === OPS.OP_0 &&
15842 buffer[1] === 0x14
15843}
15844check.toJSON = function () { return 'Witness pubKeyHash output' }
15845
15846function encode (pubKeyHash) {
15847 typeforce(types.Hash160bit, pubKeyHash)
15848
15849 return bscript.compile([OPS.OP_0, pubKeyHash])
15850}
15851
15852function decode (buffer) {
15853 typeforce(check, buffer)
15854
15855 return buffer.slice(2)
15856}
15857
15858module.exports = {
15859 check: check,
15860 decode: decode,
15861 encode: encode
15862}
15863
15864},{"../../script":81,"../../types":107,"bitcoin-ops":69,"typeforce":816}],102:[function(require,module,exports){
15865arguments[4][84][0].apply(exports,arguments)
15866},{"./input":103,"./output":104,"dup":84}],103:[function(require,module,exports){
15867(function (Buffer){
15868// <scriptSig> {serialized scriptPubKey script}
15869
15870var bscript = require('../../script')
15871var types = require('../../types')
15872var typeforce = require('typeforce')
15873
15874var p2ms = require('../multisig/')
15875var p2pk = require('../pubkey/')
15876var p2pkh = require('../pubkeyhash/')
15877
15878function check (chunks, allowIncomplete) {
15879 typeforce(types.Array, chunks)
15880 if (chunks.length < 1) return false
15881
15882 var witnessScript = chunks[chunks.length - 1]
15883 if (!Buffer.isBuffer(witnessScript)) return false
15884
15885 var witnessScriptChunks = bscript.decompile(witnessScript)
15886
15887 // is witnessScript a valid script?
15888 if (witnessScriptChunks.length === 0) return false
15889
15890 var witnessRawScriptSig = bscript.compile(chunks.slice(0, -1))
15891
15892 // match types
15893 if (p2pkh.input.check(witnessRawScriptSig) &&
15894 p2pkh.output.check(witnessScriptChunks)) return true
15895
15896 if (p2ms.input.check(witnessRawScriptSig, allowIncomplete) &&
15897 p2ms.output.check(witnessScriptChunks)) return true
15898
15899 if (p2pk.input.check(witnessRawScriptSig) &&
15900 p2pk.output.check(witnessScriptChunks)) return true
15901
15902 return false
15903}
15904check.toJSON = function () { return 'witnessScriptHash input' }
15905
15906function encodeStack (witnessData, witnessScript) {
15907 typeforce({
15908 witnessData: [types.Buffer],
15909 witnessScript: types.Buffer
15910 }, {
15911 witnessData: witnessData,
15912 witnessScript: witnessScript
15913 })
15914
15915 return [].concat(witnessData, witnessScript)
15916}
15917
15918function decodeStack (stack) {
15919 typeforce(typeforce.Array, stack)
15920 typeforce(check, stack)
15921 return {
15922 witnessData: stack.slice(0, -1),
15923 witnessScript: stack[stack.length - 1]
15924 }
15925}
15926
15927module.exports = {
15928 check: check,
15929 decodeStack: decodeStack,
15930 encodeStack: encodeStack
15931}
15932
15933}).call(this,{"isBuffer":require("../../../../insert-module-globals/node_modules/is-buffer/index.js")})
15934},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":397,"../../script":81,"../../types":107,"../multisig/":84,"../pubkey/":88,"../pubkeyhash/":91,"typeforce":816}],104:[function(require,module,exports){
15935// OP_0 {scriptHash}
15936
15937var bscript = require('../../script')
15938var types = require('../../types')
15939var typeforce = require('typeforce')
15940var OPS = require('bitcoin-ops')
15941
15942function check (script) {
15943 var buffer = bscript.compile(script)
15944
15945 return buffer.length === 34 &&
15946 buffer[0] === OPS.OP_0 &&
15947 buffer[1] === 0x20
15948}
15949check.toJSON = function () { return 'Witness scriptHash output' }
15950
15951function encode (scriptHash) {
15952 typeforce(types.Hash256bit, scriptHash)
15953
15954 return bscript.compile([OPS.OP_0, scriptHash])
15955}
15956
15957function decode (buffer) {
15958 typeforce(check, buffer)
15959
15960 return buffer.slice(2)
15961}
15962
15963module.exports = {
15964 check: check,
15965 decode: decode,
15966 encode: encode
15967}
15968
15969},{"../../script":81,"../../types":107,"bitcoin-ops":69,"typeforce":816}],105:[function(require,module,exports){
15970var Buffer = require('safe-buffer').Buffer
15971var bcrypto = require('./crypto')
15972var bscript = require('./script')
15973var bufferutils = require('./bufferutils')
15974var opcodes = require('bitcoin-ops')
15975var typeforce = require('typeforce')
15976var types = require('./types')
15977var varuint = require('varuint-bitcoin')
15978
15979function varSliceSize (someScript) {
15980 var length = someScript.length
15981
15982 return varuint.encodingLength(length) + length
15983}
15984
15985function vectorSize (someVector) {
15986 var length = someVector.length
15987
15988 return varuint.encodingLength(length) + someVector.reduce(function (sum, witness) {
15989 return sum + varSliceSize(witness)
15990 }, 0)
15991}
15992
15993function Transaction () {
15994 this.version = 1
15995 this.locktime = 0
15996 this.ins = []
15997 this.outs = []
15998}
15999
16000Transaction.DEFAULT_SEQUENCE = 0xffffffff
16001Transaction.SIGHASH_ALL = 0x01
16002Transaction.SIGHASH_NONE = 0x02
16003Transaction.SIGHASH_SINGLE = 0x03
16004Transaction.SIGHASH_ANYONECANPAY = 0x80
16005Transaction.ADVANCED_TRANSACTION_MARKER = 0x00
16006Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
16007
16008var EMPTY_SCRIPT = Buffer.allocUnsafe(0)
16009var EMPTY_WITNESS = []
16010var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
16011var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
16012var VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
16013var BLANK_OUTPUT = {
16014 script: EMPTY_SCRIPT,
16015 valueBuffer: VALUE_UINT64_MAX
16016}
16017
16018Transaction.fromBuffer = function (buffer, __noStrict) {
16019 var offset = 0
16020 function readSlice (n) {
16021 offset += n
16022 return buffer.slice(offset - n, offset)
16023 }
16024
16025 function readUInt32 () {
16026 var i = buffer.readUInt32LE(offset)
16027 offset += 4
16028 return i
16029 }
16030
16031 function readInt32 () {
16032 var i = buffer.readInt32LE(offset)
16033 offset += 4
16034 return i
16035 }
16036
16037 function readUInt64 () {
16038 var i = bufferutils.readUInt64LE(buffer, offset)
16039 offset += 8
16040 return i
16041 }
16042
16043 function readVarInt () {
16044 var vi = varuint.decode(buffer, offset)
16045 offset += varuint.decode.bytes
16046 return vi
16047 }
16048
16049 function readVarSlice () {
16050 return readSlice(readVarInt())
16051 }
16052
16053 function readVector () {
16054 var count = readVarInt()
16055 var vector = []
16056 for (var i = 0; i < count; i++) vector.push(readVarSlice())
16057 return vector
16058 }
16059
16060 var tx = new Transaction()
16061 tx.version = readInt32()
16062
16063 var marker = buffer.readUInt8(offset)
16064 var flag = buffer.readUInt8(offset + 1)
16065
16066 var hasWitnesses = false
16067 if (marker === Transaction.ADVANCED_TRANSACTION_MARKER &&
16068 flag === Transaction.ADVANCED_TRANSACTION_FLAG) {
16069 offset += 2
16070 hasWitnesses = true
16071 }
16072
16073 var vinLen = readVarInt()
16074 for (var i = 0; i < vinLen; ++i) {
16075 tx.ins.push({
16076 hash: readSlice(32),
16077 index: readUInt32(),
16078 script: readVarSlice(),
16079 sequence: readUInt32(),
16080 witness: EMPTY_WITNESS
16081 })
16082 }
16083
16084 var voutLen = readVarInt()
16085 for (i = 0; i < voutLen; ++i) {
16086 tx.outs.push({
16087 value: readUInt64(),
16088 script: readVarSlice()
16089 })
16090 }
16091
16092 if (hasWitnesses) {
16093 for (i = 0; i < vinLen; ++i) {
16094 tx.ins[i].witness = readVector()
16095 }
16096
16097 // was this pointless?
16098 if (!tx.hasWitnesses()) throw new Error('Transaction has superfluous witness data')
16099 }
16100
16101 tx.locktime = readUInt32()
16102
16103 if (__noStrict) return tx
16104 if (offset !== buffer.length) throw new Error('Transaction has unexpected data')
16105
16106 return tx
16107}
16108
16109Transaction.fromHex = function (hex) {
16110 return Transaction.fromBuffer(Buffer.from(hex, 'hex'))
16111}
16112
16113Transaction.isCoinbaseHash = function (buffer) {
16114 typeforce(types.Hash256bit, buffer)
16115 for (var i = 0; i < 32; ++i) {
16116 if (buffer[i] !== 0) return false
16117 }
16118 return true
16119}
16120
16121Transaction.prototype.isCoinbase = function () {
16122 return this.ins.length === 1 && Transaction.isCoinbaseHash(this.ins[0].hash)
16123}
16124
16125Transaction.prototype.addInput = function (hash, index, sequence, scriptSig) {
16126 typeforce(types.tuple(
16127 types.Hash256bit,
16128 types.UInt32,
16129 types.maybe(types.UInt32),
16130 types.maybe(types.Buffer)
16131 ), arguments)
16132
16133 if (types.Null(sequence)) {
16134 sequence = Transaction.DEFAULT_SEQUENCE
16135 }
16136
16137 // Add the input and return the input's index
16138 return (this.ins.push({
16139 hash: hash,
16140 index: index,
16141 script: scriptSig || EMPTY_SCRIPT,
16142 sequence: sequence,
16143 witness: EMPTY_WITNESS
16144 }) - 1)
16145}
16146
16147Transaction.prototype.addOutput = function (scriptPubKey, value) {
16148 typeforce(types.tuple(types.Buffer, types.Satoshi), arguments)
16149
16150 // Add the output and return the output's index
16151 return (this.outs.push({
16152 script: scriptPubKey,
16153 value: value
16154 }) - 1)
16155}
16156
16157Transaction.prototype.hasWitnesses = function () {
16158 return this.ins.some(function (x) {
16159 return x.witness.length !== 0
16160 })
16161}
16162
16163Transaction.prototype.weight = function () {
16164 var base = this.__byteLength(false)
16165 var total = this.__byteLength(true)
16166 return base * 3 + total
16167}
16168
16169Transaction.prototype.virtualSize = function () {
16170 return Math.ceil(this.weight() / 4)
16171}
16172
16173Transaction.prototype.byteLength = function () {
16174 return this.__byteLength(true)
16175}
16176
16177Transaction.prototype.__byteLength = function (__allowWitness) {
16178 var hasWitnesses = __allowWitness && this.hasWitnesses()
16179
16180 return (
16181 (hasWitnesses ? 10 : 8) +
16182 varuint.encodingLength(this.ins.length) +
16183 varuint.encodingLength(this.outs.length) +
16184 this.ins.reduce(function (sum, input) { return sum + 40 + varSliceSize(input.script) }, 0) +
16185 this.outs.reduce(function (sum, output) { return sum + 8 + varSliceSize(output.script) }, 0) +
16186 (hasWitnesses ? this.ins.reduce(function (sum, input) { return sum + vectorSize(input.witness) }, 0) : 0)
16187 )
16188}
16189
16190Transaction.prototype.clone = function () {
16191 var newTx = new Transaction()
16192 newTx.version = this.version
16193 newTx.locktime = this.locktime
16194
16195 newTx.ins = this.ins.map(function (txIn) {
16196 return {
16197 hash: txIn.hash,
16198 index: txIn.index,
16199 script: txIn.script,
16200 sequence: txIn.sequence,
16201 witness: txIn.witness
16202 }
16203 })
16204
16205 newTx.outs = this.outs.map(function (txOut) {
16206 return {
16207 script: txOut.script,
16208 value: txOut.value
16209 }
16210 })
16211
16212 return newTx
16213}
16214
16215/**
16216 * Hash transaction for signing a specific input.
16217 *
16218 * Bitcoin uses a different hash for each signed transaction input.
16219 * This method copies the transaction, makes the necessary changes based on the
16220 * hashType, and then hashes the result.
16221 * This hash can then be used to sign the provided transaction input.
16222 */
16223Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {
16224 typeforce(types.tuple(types.UInt32, types.Buffer, /* types.UInt8 */ types.Number), arguments)
16225
16226 // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L29
16227 if (inIndex >= this.ins.length) return ONE
16228
16229 // ignore OP_CODESEPARATOR
16230 var ourScript = bscript.compile(bscript.decompile(prevOutScript).filter(function (x) {
16231 return x !== opcodes.OP_CODESEPARATOR
16232 }))
16233
16234 var txTmp = this.clone()
16235
16236 // SIGHASH_NONE: ignore all outputs? (wildcard payee)
16237 if ((hashType & 0x1f) === Transaction.SIGHASH_NONE) {
16238 txTmp.outs = []
16239
16240 // ignore sequence numbers (except at inIndex)
16241 txTmp.ins.forEach(function (input, i) {
16242 if (i === inIndex) return
16243
16244 input.sequence = 0
16245 })
16246
16247 // SIGHASH_SINGLE: ignore all outputs, except at the same index?
16248 } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE) {
16249 // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L60
16250 if (inIndex >= this.outs.length) return ONE
16251
16252 // truncate outputs after
16253 txTmp.outs.length = inIndex + 1
16254
16255 // "blank" outputs before
16256 for (var i = 0; i < inIndex; i++) {
16257 txTmp.outs[i] = BLANK_OUTPUT
16258 }
16259
16260 // ignore sequence numbers (except at inIndex)
16261 txTmp.ins.forEach(function (input, y) {
16262 if (y === inIndex) return
16263
16264 input.sequence = 0
16265 })
16266 }
16267
16268 // SIGHASH_ANYONECANPAY: ignore inputs entirely?
16269 if (hashType & Transaction.SIGHASH_ANYONECANPAY) {
16270 txTmp.ins = [txTmp.ins[inIndex]]
16271 txTmp.ins[0].script = ourScript
16272
16273 // SIGHASH_ALL: only ignore input scripts
16274 } else {
16275 // "blank" others input scripts
16276 txTmp.ins.forEach(function (input) { input.script = EMPTY_SCRIPT })
16277 txTmp.ins[inIndex].script = ourScript
16278 }
16279
16280 // serialize and hash
16281 var buffer = Buffer.allocUnsafe(txTmp.__byteLength(false) + 4)
16282 buffer.writeInt32LE(hashType, buffer.length - 4)
16283 txTmp.__toBuffer(buffer, 0, false)
16284
16285 return bcrypto.hash256(buffer)
16286}
16287
16288Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value, hashType) {
16289 typeforce(types.tuple(types.UInt32, types.Buffer, types.Satoshi, types.UInt32), arguments)
16290
16291 var tbuffer, toffset
16292 function writeSlice (slice) { toffset += slice.copy(tbuffer, toffset) }
16293 function writeUInt32 (i) { toffset = tbuffer.writeUInt32LE(i, toffset) }
16294 function writeUInt64 (i) { toffset = bufferutils.writeUInt64LE(tbuffer, i, toffset) }
16295 function writeVarInt (i) {
16296 varuint.encode(i, tbuffer, toffset)
16297 toffset += varuint.encode.bytes
16298 }
16299 function writeVarSlice (slice) { writeVarInt(slice.length); writeSlice(slice) }
16300
16301 var hashOutputs = ZERO
16302 var hashPrevouts = ZERO
16303 var hashSequence = ZERO
16304
16305 if (!(hashType & Transaction.SIGHASH_ANYONECANPAY)) {
16306 tbuffer = Buffer.allocUnsafe(36 * this.ins.length)
16307 toffset = 0
16308
16309 this.ins.forEach(function (txIn) {
16310 writeSlice(txIn.hash)
16311 writeUInt32(txIn.index)
16312 })
16313
16314 hashPrevouts = bcrypto.hash256(tbuffer)
16315 }
16316
16317 if (!(hashType & Transaction.SIGHASH_ANYONECANPAY) &&
16318 (hashType & 0x1f) !== Transaction.SIGHASH_SINGLE &&
16319 (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
16320 tbuffer = Buffer.allocUnsafe(4 * this.ins.length)
16321 toffset = 0
16322
16323 this.ins.forEach(function (txIn) {
16324 writeUInt32(txIn.sequence)
16325 })
16326
16327 hashSequence = bcrypto.hash256(tbuffer)
16328 }
16329
16330 if ((hashType & 0x1f) !== Transaction.SIGHASH_SINGLE &&
16331 (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
16332 var txOutsSize = this.outs.reduce(function (sum, output) {
16333 return sum + 8 + varSliceSize(output.script)
16334 }, 0)
16335
16336 tbuffer = Buffer.allocUnsafe(txOutsSize)
16337 toffset = 0
16338
16339 this.outs.forEach(function (out) {
16340 writeUInt64(out.value)
16341 writeVarSlice(out.script)
16342 })
16343
16344 hashOutputs = bcrypto.hash256(tbuffer)
16345 } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE && inIndex < this.outs.length) {
16346 var output = this.outs[inIndex]
16347
16348 tbuffer = Buffer.allocUnsafe(8 + varSliceSize(output.script))
16349 toffset = 0
16350 writeUInt64(output.value)
16351 writeVarSlice(output.script)
16352
16353 hashOutputs = bcrypto.hash256(tbuffer)
16354 }
16355
16356 tbuffer = Buffer.allocUnsafe(156 + varSliceSize(prevOutScript))
16357 toffset = 0
16358
16359 var input = this.ins[inIndex]
16360 writeUInt32(this.version)
16361 writeSlice(hashPrevouts)
16362 writeSlice(hashSequence)
16363 writeSlice(input.hash)
16364 writeUInt32(input.index)
16365 writeVarSlice(prevOutScript)
16366 writeUInt64(value)
16367 writeUInt32(input.sequence)
16368 writeSlice(hashOutputs)
16369 writeUInt32(this.locktime)
16370 writeUInt32(hashType)
16371 return bcrypto.hash256(tbuffer)
16372}
16373
16374Transaction.prototype.getHash = function () {
16375 return bcrypto.hash256(this.__toBuffer(undefined, undefined, false))
16376}
16377
16378Transaction.prototype.getId = function () {
16379 // transaction hash's are displayed in reverse order
16380 return this.getHash().reverse().toString('hex')
16381}
16382
16383Transaction.prototype.toBuffer = function (buffer, initialOffset) {
16384 return this.__toBuffer(buffer, initialOffset, true)
16385}
16386
16387Transaction.prototype.__toBuffer = function (buffer, initialOffset, __allowWitness) {
16388 if (!buffer) buffer = Buffer.allocUnsafe(this.__byteLength(__allowWitness))
16389
16390 var offset = initialOffset || 0
16391 function writeSlice (slice) { offset += slice.copy(buffer, offset) }
16392 function writeUInt8 (i) { offset = buffer.writeUInt8(i, offset) }
16393 function writeUInt32 (i) { offset = buffer.writeUInt32LE(i, offset) }
16394 function writeInt32 (i) { offset = buffer.writeInt32LE(i, offset) }
16395 function writeUInt64 (i) { offset = bufferutils.writeUInt64LE(buffer, i, offset) }
16396 function writeVarInt (i) {
16397 varuint.encode(i, buffer, offset)
16398 offset += varuint.encode.bytes
16399 }
16400 function writeVarSlice (slice) { writeVarInt(slice.length); writeSlice(slice) }
16401 function writeVector (vector) { writeVarInt(vector.length); vector.forEach(writeVarSlice) }
16402
16403 writeInt32(this.version)
16404
16405 var hasWitnesses = __allowWitness && this.hasWitnesses()
16406
16407 if (hasWitnesses) {
16408 writeUInt8(Transaction.ADVANCED_TRANSACTION_MARKER)
16409 writeUInt8(Transaction.ADVANCED_TRANSACTION_FLAG)
16410 }
16411
16412 writeVarInt(this.ins.length)
16413
16414 this.ins.forEach(function (txIn) {
16415 writeSlice(txIn.hash)
16416 writeUInt32(txIn.index)
16417 writeVarSlice(txIn.script)
16418 writeUInt32(txIn.sequence)
16419 })
16420
16421 writeVarInt(this.outs.length)
16422 this.outs.forEach(function (txOut) {
16423 if (!txOut.valueBuffer) {
16424 writeUInt64(txOut.value)
16425 } else {
16426 writeSlice(txOut.valueBuffer)
16427 }
16428
16429 writeVarSlice(txOut.script)
16430 })
16431
16432 if (hasWitnesses) {
16433 this.ins.forEach(function (input) {
16434 writeVector(input.witness)
16435 })
16436 }
16437
16438 writeUInt32(this.locktime)
16439
16440 // avoid slicing unless necessary
16441 if (initialOffset !== undefined) return buffer.slice(initialOffset, offset)
16442 return buffer
16443}
16444
16445Transaction.prototype.toHex = function () {
16446 return this.toBuffer().toString('hex')
16447}
16448
16449Transaction.prototype.setInputScript = function (index, scriptSig) {
16450 typeforce(types.tuple(types.Number, types.Buffer), arguments)
16451
16452 this.ins[index].script = scriptSig
16453}
16454
16455Transaction.prototype.setWitness = function (index, witness) {
16456 typeforce(types.tuple(types.Number, [types.Buffer]), arguments)
16457
16458 this.ins[index].witness = witness
16459}
16460
16461module.exports = Transaction
16462
16463},{"./bufferutils":73,"./crypto":74,"./script":81,"./types":107,"bitcoin-ops":69,"safe-buffer":742,"typeforce":816,"varuint-bitcoin":830}],106:[function(require,module,exports){
16464var Buffer = require('safe-buffer').Buffer
16465var baddress = require('./address')
16466var bcrypto = require('./crypto')
16467var bscript = require('./script')
16468var btemplates = require('./templates')
16469var networks = require('./networks')
16470var ops = require('bitcoin-ops')
16471var typeforce = require('typeforce')
16472var types = require('./types')
16473var scriptTypes = btemplates.types
16474var SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG]
16475var P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH])
16476
16477var ECPair = require('./ecpair')
16478var ECSignature = require('./ecsignature')
16479var Transaction = require('./transaction')
16480
16481function supportedType (type) {
16482 return SIGNABLE.indexOf(type) !== -1
16483}
16484
16485function supportedP2SHType (type) {
16486 return P2SH.indexOf(type) !== -1
16487}
16488
16489function extractChunks (type, chunks, script) {
16490 var pubKeys = []
16491 var signatures = []
16492 switch (type) {
16493 case scriptTypes.P2PKH:
16494 // if (redeemScript) throw new Error('Nonstandard... P2SH(P2PKH)')
16495 pubKeys = chunks.slice(1)
16496 signatures = chunks.slice(0, 1)
16497 break
16498
16499 case scriptTypes.P2PK:
16500 pubKeys[0] = script ? btemplates.pubKey.output.decode(script) : undefined
16501 signatures = chunks.slice(0, 1)
16502 break
16503
16504 case scriptTypes.MULTISIG:
16505 if (script) {
16506 var multisig = btemplates.multisig.output.decode(script)
16507 pubKeys = multisig.pubKeys
16508 }
16509
16510 signatures = chunks.slice(1).map(function (chunk) {
16511 return chunk.length === 0 ? undefined : chunk
16512 })
16513 break
16514 }
16515
16516 return {
16517 pubKeys: pubKeys,
16518 signatures: signatures
16519 }
16520}
16521function expandInput (scriptSig, witnessStack) {
16522 if (scriptSig.length === 0 && witnessStack.length === 0) return {}
16523
16524 var prevOutScript
16525 var prevOutType
16526 var scriptType
16527 var script
16528 var redeemScript
16529 var witnessScript
16530 var witnessScriptType
16531 var redeemScriptType
16532 var witness = false
16533 var p2wsh = false
16534 var p2sh = false
16535 var witnessProgram
16536 var chunks
16537
16538 var scriptSigChunks = bscript.decompile(scriptSig)
16539 var sigType = btemplates.classifyInput(scriptSigChunks, true)
16540 if (sigType === scriptTypes.P2SH) {
16541 p2sh = true
16542 redeemScript = scriptSigChunks[scriptSigChunks.length - 1]
16543 redeemScriptType = btemplates.classifyOutput(redeemScript)
16544 prevOutScript = btemplates.scriptHash.output.encode(bcrypto.hash160(redeemScript))
16545 prevOutType = scriptTypes.P2SH
16546 script = redeemScript
16547 }
16548
16549 var classifyWitness = btemplates.classifyWitness(witnessStack, true)
16550 if (classifyWitness === scriptTypes.P2WSH) {
16551 witnessScript = witnessStack[witnessStack.length - 1]
16552 witnessScriptType = btemplates.classifyOutput(witnessScript)
16553 p2wsh = true
16554 witness = true
16555 if (scriptSig.length === 0) {
16556 prevOutScript = btemplates.witnessScriptHash.output.encode(bcrypto.sha256(witnessScript))
16557 prevOutType = scriptTypes.P2WSH
16558 if (redeemScript !== undefined) {
16559 throw new Error('Redeem script given when unnecessary')
16560 }
16561 // bare witness
16562 } else {
16563 if (!redeemScript) {
16564 throw new Error('No redeemScript provided for P2WSH, but scriptSig non-empty')
16565 }
16566 witnessProgram = btemplates.witnessScriptHash.output.encode(bcrypto.sha256(witnessScript))
16567 if (!redeemScript.equals(witnessProgram)) {
16568 throw new Error('Redeem script didn\'t match witnessScript')
16569 }
16570 }
16571
16572 if (!supportedType(btemplates.classifyOutput(witnessScript))) {
16573 throw new Error('unsupported witness script')
16574 }
16575
16576 script = witnessScript
16577 scriptType = witnessScriptType
16578 chunks = witnessStack.slice(0, -1)
16579 } else if (classifyWitness === scriptTypes.P2WPKH) {
16580 witness = true
16581 var key = witnessStack[witnessStack.length - 1]
16582 var keyHash = bcrypto.hash160(key)
16583 if (scriptSig.length === 0) {
16584 prevOutScript = btemplates.witnessPubKeyHash.output.encode(keyHash)
16585 prevOutType = scriptTypes.P2WPKH
16586 if (typeof redeemScript !== 'undefined') {
16587 throw new Error('Redeem script given when unnecessary')
16588 }
16589 } else {
16590 if (!redeemScript) {
16591 throw new Error('No redeemScript provided for P2WPKH, but scriptSig wasn\'t empty')
16592 }
16593 witnessProgram = btemplates.witnessPubKeyHash.output.encode(keyHash)
16594 if (!redeemScript.equals(witnessProgram)) {
16595 throw new Error('Redeem script did not have the right witness program')
16596 }
16597 }
16598
16599 scriptType = scriptTypes.P2PKH
16600 chunks = witnessStack
16601 } else if (redeemScript) {
16602 if (!supportedP2SHType(redeemScriptType)) {
16603 throw new Error('Bad redeemscript!')
16604 }
16605
16606 script = redeemScript
16607 scriptType = redeemScriptType
16608 chunks = scriptSigChunks.slice(0, -1)
16609 } else {
16610 prevOutType = scriptType = btemplates.classifyInput(scriptSig)
16611 chunks = scriptSigChunks
16612 }
16613
16614 var expanded = extractChunks(scriptType, chunks, script)
16615
16616 var result = {
16617 pubKeys: expanded.pubKeys,
16618 signatures: expanded.signatures,
16619 prevOutScript: prevOutScript,
16620 prevOutType: prevOutType,
16621 signType: scriptType,
16622 signScript: script,
16623 witness: Boolean(witness)
16624 }
16625
16626 if (p2sh) {
16627 result.redeemScript = redeemScript
16628 result.redeemScriptType = redeemScriptType
16629 }
16630
16631 if (p2wsh) {
16632 result.witnessScript = witnessScript
16633 result.witnessScriptType = witnessScriptType
16634 }
16635
16636 return result
16637}
16638
16639// could be done in expandInput, but requires the original Transaction for hashForSignature
16640function fixMultisigOrder (input, transaction, vin) {
16641 if (input.redeemScriptType !== scriptTypes.MULTISIG || !input.redeemScript) return
16642 if (input.pubKeys.length === input.signatures.length) return
16643
16644 var unmatched = input.signatures.concat()
16645
16646 input.signatures = input.pubKeys.map(function (pubKey) {
16647 var keyPair = ECPair.fromPublicKeyBuffer(pubKey)
16648 var match
16649
16650 // check for a signature
16651 unmatched.some(function (signature, i) {
16652 // skip if undefined || OP_0
16653 if (!signature) return false
16654
16655 // TODO: avoid O(n) hashForSignature
16656 var parsed = ECSignature.parseScriptSignature(signature)
16657 var hash = transaction.hashForSignature(vin, input.redeemScript, parsed.hashType)
16658
16659 // skip if signature does not match pubKey
16660 if (!keyPair.verify(hash, parsed.signature)) return false
16661
16662 // remove matched signature from unmatched
16663 unmatched[i] = undefined
16664 match = signature
16665
16666 return true
16667 })
16668
16669 return match
16670 })
16671}
16672
16673function expandOutput (script, scriptType, ourPubKey) {
16674 typeforce(types.Buffer, script)
16675
16676 var scriptChunks = bscript.decompile(script)
16677 if (!scriptType) {
16678 scriptType = btemplates.classifyOutput(script)
16679 }
16680
16681 var pubKeys = []
16682
16683 switch (scriptType) {
16684 // does our hash160(pubKey) match the output scripts?
16685 case scriptTypes.P2PKH:
16686 if (!ourPubKey) break
16687
16688 var pkh1 = scriptChunks[2]
16689 var pkh2 = bcrypto.hash160(ourPubKey)
16690 if (pkh1.equals(pkh2)) pubKeys = [ourPubKey]
16691 break
16692
16693 // does our hash160(pubKey) match the output scripts?
16694 case scriptTypes.P2WPKH:
16695 if (!ourPubKey) break
16696
16697 var wpkh1 = scriptChunks[1]
16698 var wpkh2 = bcrypto.hash160(ourPubKey)
16699 if (wpkh1.equals(wpkh2)) pubKeys = [ourPubKey]
16700 break
16701
16702 case scriptTypes.P2PK:
16703 pubKeys = scriptChunks.slice(0, 1)
16704 break
16705
16706 case scriptTypes.MULTISIG:
16707 pubKeys = scriptChunks.slice(1, -2)
16708 break
16709
16710 default: return { scriptType: scriptType }
16711 }
16712
16713 return {
16714 pubKeys: pubKeys,
16715 scriptType: scriptType,
16716 signatures: pubKeys.map(function () { return undefined })
16717 }
16718}
16719
16720function checkP2SHInput (input, redeemScriptHash) {
16721 if (input.prevOutType) {
16722 if (input.prevOutType !== scriptTypes.P2SH) throw new Error('PrevOutScript must be P2SH')
16723
16724 var prevOutScriptScriptHash = bscript.decompile(input.prevOutScript)[1]
16725 if (!prevOutScriptScriptHash.equals(redeemScriptHash)) throw new Error('Inconsistent hash160(RedeemScript)')
16726 }
16727}
16728
16729function checkP2WSHInput (input, witnessScriptHash) {
16730 if (input.prevOutType) {
16731 if (input.prevOutType !== scriptTypes.P2WSH) throw new Error('PrevOutScript must be P2WSH')
16732
16733 var scriptHash = bscript.decompile(input.prevOutScript)[1]
16734 if (!scriptHash.equals(witnessScriptHash)) throw new Error('Inconsistent sha25(WitnessScript)')
16735 }
16736}
16737
16738function prepareInput (input, kpPubKey, redeemScript, witnessValue, witnessScript) {
16739 var expanded
16740 var prevOutType
16741 var prevOutScript
16742
16743 var p2sh = false
16744 var p2shType
16745 var redeemScriptHash
16746
16747 var witness = false
16748 var p2wsh = false
16749 var witnessType
16750 var witnessScriptHash
16751
16752 var signType
16753 var signScript
16754
16755 if (redeemScript && witnessScript) {
16756 redeemScriptHash = bcrypto.hash160(redeemScript)
16757 witnessScriptHash = bcrypto.sha256(witnessScript)
16758 checkP2SHInput(input, redeemScriptHash)
16759
16760 if (!redeemScript.equals(btemplates.witnessScriptHash.output.encode(witnessScriptHash))) throw new Error('Witness script inconsistent with redeem script')
16761
16762 expanded = expandOutput(witnessScript, undefined, kpPubKey)
16763 if (!expanded.pubKeys) throw new Error('WitnessScript not supported "' + bscript.toASM(redeemScript) + '"')
16764
16765 prevOutType = btemplates.types.P2SH
16766 prevOutScript = btemplates.scriptHash.output.encode(redeemScriptHash)
16767 p2sh = witness = p2wsh = true
16768 p2shType = btemplates.types.P2WSH
16769 signType = witnessType = expanded.scriptType
16770 signScript = witnessScript
16771 } else if (redeemScript) {
16772 redeemScriptHash = bcrypto.hash160(redeemScript)
16773 checkP2SHInput(input, redeemScriptHash)
16774
16775 expanded = expandOutput(redeemScript, undefined, kpPubKey)
16776 if (!expanded.pubKeys) throw new Error('RedeemScript not supported "' + bscript.toASM(redeemScript) + '"')
16777
16778 prevOutType = btemplates.types.P2SH
16779 prevOutScript = btemplates.scriptHash.output.encode(redeemScriptHash)
16780 p2sh = true
16781 signType = p2shType = expanded.scriptType
16782 signScript = redeemScript
16783 witness = signType === btemplates.types.P2WPKH
16784 } else if (witnessScript) {
16785 witnessScriptHash = bcrypto.sha256(witnessScript)
16786 checkP2WSHInput(input, witnessScriptHash)
16787
16788 expanded = expandOutput(witnessScript, undefined, kpPubKey)
16789 if (!expanded.pubKeys) throw new Error('WitnessScript not supported "' + bscript.toASM(redeemScript) + '"')
16790
16791 prevOutType = btemplates.types.P2WSH
16792 prevOutScript = btemplates.witnessScriptHash.output.encode(witnessScriptHash)
16793 witness = p2wsh = true
16794 signType = witnessType = expanded.scriptType
16795 signScript = witnessScript
16796 } else if (input.prevOutType) {
16797 // embedded scripts are not possible without a redeemScript
16798 if (input.prevOutType === scriptTypes.P2SH ||
16799 input.prevOutType === scriptTypes.P2WSH) {
16800 throw new Error('PrevOutScript is ' + input.prevOutType + ', requires redeemScript')
16801 }
16802
16803 prevOutType = input.prevOutType
16804 prevOutScript = input.prevOutScript
16805 expanded = expandOutput(input.prevOutScript, input.prevOutType, kpPubKey)
16806 if (!expanded.pubKeys) return
16807
16808 witness = (input.prevOutType === scriptTypes.P2WPKH)
16809 signType = prevOutType
16810 signScript = prevOutScript
16811 } else {
16812 prevOutScript = btemplates.pubKeyHash.output.encode(bcrypto.hash160(kpPubKey))
16813 expanded = expandOutput(prevOutScript, scriptTypes.P2PKH, kpPubKey)
16814
16815 prevOutType = scriptTypes.P2PKH
16816 witness = false
16817 signType = prevOutType
16818 signScript = prevOutScript
16819 }
16820
16821 if (signType === scriptTypes.P2WPKH) {
16822 signScript = btemplates.pubKeyHash.output.encode(btemplates.witnessPubKeyHash.output.decode(signScript))
16823 }
16824
16825 if (p2sh) {
16826 input.redeemScript = redeemScript
16827 input.redeemScriptType = p2shType
16828 }
16829
16830 if (p2wsh) {
16831 input.witnessScript = witnessScript
16832 input.witnessScriptType = witnessType
16833 }
16834
16835 input.pubKeys = expanded.pubKeys
16836 input.signatures = expanded.signatures
16837 input.signScript = signScript
16838 input.signType = signType
16839 input.prevOutScript = prevOutScript
16840 input.prevOutType = prevOutType
16841 input.witness = witness
16842}
16843
16844function buildStack (type, signatures, pubKeys, allowIncomplete) {
16845 if (type === scriptTypes.P2PKH) {
16846 if (signatures.length === 1 && Buffer.isBuffer(signatures[0]) && pubKeys.length === 1) return btemplates.pubKeyHash.input.encodeStack(signatures[0], pubKeys[0])
16847 } else if (type === scriptTypes.P2PK) {
16848 if (signatures.length === 1 && Buffer.isBuffer(signatures[0])) return btemplates.pubKey.input.encodeStack(signatures[0])
16849 } else if (type === scriptTypes.MULTISIG) {
16850 if (signatures.length > 0) {
16851 signatures = signatures.map(function (signature) {
16852 return signature || ops.OP_0
16853 })
16854 if (!allowIncomplete) {
16855 // remove blank signatures
16856 signatures = signatures.filter(function (x) { return x !== ops.OP_0 })
16857 }
16858
16859 return btemplates.multisig.input.encodeStack(signatures)
16860 }
16861 } else {
16862 throw new Error('Not yet supported')
16863 }
16864
16865 if (!allowIncomplete) throw new Error('Not enough signatures provided')
16866 return []
16867}
16868
16869function buildInput (input, allowIncomplete) {
16870 var scriptType = input.prevOutType
16871 var sig = []
16872 var witness = []
16873
16874 if (supportedType(scriptType)) {
16875 sig = buildStack(scriptType, input.signatures, input.pubKeys, allowIncomplete)
16876 }
16877
16878 var p2sh = false
16879 if (scriptType === btemplates.types.P2SH) {
16880 // We can remove this error later when we have a guarantee prepareInput
16881 // rejects unsignable scripts - it MUST be signable at this point.
16882 if (!allowIncomplete && !supportedP2SHType(input.redeemScriptType)) {
16883 throw new Error('Impossible to sign this type')
16884 }
16885
16886 if (supportedType(input.redeemScriptType)) {
16887 sig = buildStack(input.redeemScriptType, input.signatures, input.pubKeys, allowIncomplete)
16888 }
16889
16890 // If it wasn't SIGNABLE, it's witness, defer to that
16891 if (input.redeemScriptType) {
16892 p2sh = true
16893 scriptType = input.redeemScriptType
16894 }
16895 }
16896
16897 switch (scriptType) {
16898 // P2WPKH is a special case of P2PKH
16899 case btemplates.types.P2WPKH:
16900 witness = buildStack(btemplates.types.P2PKH, input.signatures, input.pubKeys, allowIncomplete)
16901 break
16902
16903 case btemplates.types.P2WSH:
16904 // We can remove this check later
16905 if (!allowIncomplete && !supportedType(input.witnessScriptType)) {
16906 throw new Error('Impossible to sign this type')
16907 }
16908
16909 if (supportedType(input.witnessScriptType)) {
16910 witness = buildStack(input.witnessScriptType, input.signatures, input.pubKeys, allowIncomplete)
16911 witness.push(input.witnessScript)
16912 scriptType = input.witnessScriptType
16913 }
16914
16915 break
16916 }
16917
16918 // append redeemScript if necessary
16919 if (p2sh) {
16920 sig.push(input.redeemScript)
16921 }
16922
16923 return {
16924 type: scriptType,
16925 script: bscript.compile(sig),
16926 witness: witness
16927 }
16928}
16929
16930function TransactionBuilder (network, maximumFeeRate) {
16931 this.prevTxMap = {}
16932 this.network = network || networks.bitcoin
16933
16934 // WARNING: This is __NOT__ to be relied on, its just another potential safety mechanism (safety in-depth)
16935 this.maximumFeeRate = maximumFeeRate || 2500
16936
16937 this.inputs = []
16938 this.tx = new Transaction()
16939}
16940
16941TransactionBuilder.prototype.setLockTime = function (locktime) {
16942 typeforce(types.UInt32, locktime)
16943
16944 // if any signatures exist, throw
16945 if (this.inputs.some(function (input) {
16946 if (!input.signatures) return false
16947
16948 return input.signatures.some(function (s) { return s })
16949 })) {
16950 throw new Error('No, this would invalidate signatures')
16951 }
16952
16953 this.tx.locktime = locktime
16954}
16955
16956TransactionBuilder.prototype.setVersion = function (version) {
16957 typeforce(types.UInt32, version)
16958
16959 // XXX: this might eventually become more complex depending on what the versions represent
16960 this.tx.version = version
16961}
16962
16963TransactionBuilder.fromTransaction = function (transaction, network) {
16964 var txb = new TransactionBuilder(network)
16965
16966 // Copy transaction fields
16967 txb.setVersion(transaction.version)
16968 txb.setLockTime(transaction.locktime)
16969
16970 // Copy outputs (done first to avoid signature invalidation)
16971 transaction.outs.forEach(function (txOut) {
16972 txb.addOutput(txOut.script, txOut.value)
16973 })
16974
16975 // Copy inputs
16976 transaction.ins.forEach(function (txIn) {
16977 txb.__addInputUnsafe(txIn.hash, txIn.index, {
16978 sequence: txIn.sequence,
16979 script: txIn.script,
16980 witness: txIn.witness
16981 })
16982 })
16983
16984 // fix some things not possible through the public API
16985 txb.inputs.forEach(function (input, i) {
16986 fixMultisigOrder(input, transaction, i)
16987 })
16988
16989 return txb
16990}
16991
16992TransactionBuilder.prototype.addInput = function (txHash, vout, sequence, prevOutScript) {
16993 if (!this.__canModifyInputs()) {
16994 throw new Error('No, this would invalidate signatures')
16995 }
16996
16997 var value
16998
16999 // is it a hex string?
17000 if (typeof txHash === 'string') {
17001 // transaction hashs's are displayed in reverse order, un-reverse it
17002 txHash = Buffer.from(txHash, 'hex').reverse()
17003
17004 // is it a Transaction object?
17005 } else if (txHash instanceof Transaction) {
17006 var txOut = txHash.outs[vout]
17007 prevOutScript = txOut.script
17008 value = txOut.value
17009
17010 txHash = txHash.getHash()
17011 }
17012
17013 return this.__addInputUnsafe(txHash, vout, {
17014 sequence: sequence,
17015 prevOutScript: prevOutScript,
17016 value: value
17017 })
17018}
17019
17020TransactionBuilder.prototype.__addInputUnsafe = function (txHash, vout, options) {
17021 if (Transaction.isCoinbaseHash(txHash)) {
17022 throw new Error('coinbase inputs not supported')
17023 }
17024
17025 var prevTxOut = txHash.toString('hex') + ':' + vout
17026 if (this.prevTxMap[prevTxOut] !== undefined) throw new Error('Duplicate TxOut: ' + prevTxOut)
17027
17028 var input = {}
17029
17030 // derive what we can from the scriptSig
17031 if (options.script !== undefined) {
17032 input = expandInput(options.script, options.witness || [])
17033 }
17034
17035 // if an input value was given, retain it
17036 if (options.value !== undefined) {
17037 input.value = options.value
17038 }
17039
17040 // derive what we can from the previous transactions output script
17041 if (!input.prevOutScript && options.prevOutScript) {
17042 var prevOutType
17043
17044 if (!input.pubKeys && !input.signatures) {
17045 var expanded = expandOutput(options.prevOutScript)
17046
17047 if (expanded.pubKeys) {
17048 input.pubKeys = expanded.pubKeys
17049 input.signatures = expanded.signatures
17050 }
17051
17052 prevOutType = expanded.scriptType
17053 }
17054
17055 input.prevOutScript = options.prevOutScript
17056 input.prevOutType = prevOutType || btemplates.classifyOutput(options.prevOutScript)
17057 }
17058
17059 var vin = this.tx.addInput(txHash, vout, options.sequence, options.scriptSig)
17060 this.inputs[vin] = input
17061 this.prevTxMap[prevTxOut] = vin
17062 return vin
17063}
17064
17065TransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {
17066 if (!this.__canModifyOutputs()) {
17067 throw new Error('No, this would invalidate signatures')
17068 }
17069
17070 // Attempt to get a script if it's a base58 address string
17071 if (typeof scriptPubKey === 'string') {
17072 scriptPubKey = baddress.toOutputScript(scriptPubKey, this.network)
17073 }
17074
17075 return this.tx.addOutput(scriptPubKey, value)
17076}
17077
17078TransactionBuilder.prototype.build = function () {
17079 return this.__build(false)
17080}
17081TransactionBuilder.prototype.buildIncomplete = function () {
17082 return this.__build(true)
17083}
17084
17085TransactionBuilder.prototype.__build = function (allowIncomplete) {
17086 if (!allowIncomplete) {
17087 if (!this.tx.ins.length) throw new Error('Transaction has no inputs')
17088 if (!this.tx.outs.length) throw new Error('Transaction has no outputs')
17089 }
17090
17091 var tx = this.tx.clone()
17092 // Create script signatures from inputs
17093 this.inputs.forEach(function (input, i) {
17094 var scriptType = input.witnessScriptType || input.redeemScriptType || input.prevOutType
17095 if (!scriptType && !allowIncomplete) throw new Error('Transaction is not complete')
17096 var result = buildInput(input, allowIncomplete)
17097
17098 // skip if no result
17099 if (!allowIncomplete) {
17100 if (!supportedType(result.type) && result.type !== btemplates.types.P2WPKH) {
17101 throw new Error(result.type + ' not supported')
17102 }
17103 }
17104
17105 tx.setInputScript(i, result.script)
17106 tx.setWitness(i, result.witness)
17107 })
17108
17109 if (!allowIncomplete) {
17110 // do not rely on this, its merely a last resort
17111 if (this.__overMaximumFees(tx.virtualSize())) {
17112 throw new Error('Transaction has absurd fees')
17113 }
17114 }
17115
17116 return tx
17117}
17118
17119function canSign (input) {
17120 return input.prevOutScript !== undefined &&
17121 input.signScript !== undefined &&
17122 input.pubKeys !== undefined &&
17123 input.signatures !== undefined &&
17124 input.signatures.length === input.pubKeys.length &&
17125 input.pubKeys.length > 0 &&
17126 (
17127 input.witness === false ||
17128 (input.witness === true && input.value !== undefined)
17129 )
17130}
17131
17132TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashType, witnessValue, witnessScript) {
17133 // TODO: remove keyPair.network matching in 4.0.0
17134 if (keyPair.network && keyPair.network !== this.network) throw new TypeError('Inconsistent network')
17135 if (!this.inputs[vin]) throw new Error('No input at index: ' + vin)
17136 hashType = hashType || Transaction.SIGHASH_ALL
17137
17138 var input = this.inputs[vin]
17139
17140 // if redeemScript was previously provided, enforce consistency
17141 if (input.redeemScript !== undefined &&
17142 redeemScript &&
17143 !input.redeemScript.equals(redeemScript)) {
17144 throw new Error('Inconsistent redeemScript')
17145 }
17146
17147 var kpPubKey = keyPair.publicKey || keyPair.getPublicKeyBuffer()
17148 if (!canSign(input)) {
17149 if (witnessValue !== undefined) {
17150 if (input.value !== undefined && input.value !== witnessValue) throw new Error('Input didn\'t match witnessValue')
17151 typeforce(types.Satoshi, witnessValue)
17152 input.value = witnessValue
17153 }
17154
17155 if (!canSign(input)) prepareInput(input, kpPubKey, redeemScript, witnessValue, witnessScript)
17156 if (!canSign(input)) throw Error(input.prevOutType + ' not supported')
17157 }
17158
17159 // ready to sign
17160 var signatureHash
17161 if (input.witness) {
17162 signatureHash = this.tx.hashForWitnessV0(vin, input.signScript, input.value, hashType)
17163 } else {
17164 signatureHash = this.tx.hashForSignature(vin, input.signScript, hashType)
17165 }
17166
17167 // enforce in order signing of public keys
17168 var signed = input.pubKeys.some(function (pubKey, i) {
17169 if (!kpPubKey.equals(pubKey)) return false
17170 if (input.signatures[i]) throw new Error('Signature already exists')
17171 if (kpPubKey.length !== 33 &&
17172 input.signType === scriptTypes.P2WPKH) throw new Error('BIP143 rejects uncompressed public keys in P2WPKH or P2WSH')
17173
17174 var signature = keyPair.sign(signatureHash)
17175 if (Buffer.isBuffer(signature)) signature = ECSignature.fromRSBuffer(signature)
17176
17177 input.signatures[i] = signature.toScriptSignature(hashType)
17178 return true
17179 })
17180
17181 if (!signed) throw new Error('Key pair cannot sign for this input')
17182}
17183
17184function signatureHashType (buffer) {
17185 return buffer.readUInt8(buffer.length - 1)
17186}
17187
17188TransactionBuilder.prototype.__canModifyInputs = function () {
17189 return this.inputs.every(function (input) {
17190 // any signatures?
17191 if (input.signatures === undefined) return true
17192
17193 return input.signatures.every(function (signature) {
17194 if (!signature) return true
17195 var hashType = signatureHashType(signature)
17196
17197 // if SIGHASH_ANYONECANPAY is set, signatures would not
17198 // be invalidated by more inputs
17199 return hashType & Transaction.SIGHASH_ANYONECANPAY
17200 })
17201 })
17202}
17203
17204TransactionBuilder.prototype.__canModifyOutputs = function () {
17205 var nInputs = this.tx.ins.length
17206 var nOutputs = this.tx.outs.length
17207
17208 return this.inputs.every(function (input) {
17209 if (input.signatures === undefined) return true
17210
17211 return input.signatures.every(function (signature) {
17212 if (!signature) return true
17213 var hashType = signatureHashType(signature)
17214
17215 var hashTypeMod = hashType & 0x1f
17216 if (hashTypeMod === Transaction.SIGHASH_NONE) return true
17217 if (hashTypeMod === Transaction.SIGHASH_SINGLE) {
17218 // if SIGHASH_SINGLE is set, and nInputs > nOutputs
17219 // some signatures would be invalidated by the addition
17220 // of more outputs
17221 return nInputs <= nOutputs
17222 }
17223 })
17224 })
17225}
17226
17227TransactionBuilder.prototype.__overMaximumFees = function (bytes) {
17228 // not all inputs will have .value defined
17229 var incoming = this.inputs.reduce(function (a, x) { return a + (x.value >>> 0) }, 0)
17230
17231 // but all outputs do, and if we have any input value
17232 // we can immediately determine if the outputs are too small
17233 var outgoing = this.tx.outs.reduce(function (a, x) { return a + x.value }, 0)
17234 var fee = incoming - outgoing
17235 var feeRate = fee / bytes
17236
17237 return feeRate > this.maximumFeeRate
17238}
17239
17240module.exports = TransactionBuilder
17241
17242},{"./address":71,"./crypto":74,"./ecpair":76,"./ecsignature":77,"./networks":80,"./script":81,"./templates":83,"./transaction":105,"./types":107,"bitcoin-ops":69,"safe-buffer":742,"typeforce":816}],107:[function(require,module,exports){
17243var typeforce = require('typeforce')
17244
17245var UINT31_MAX = Math.pow(2, 31) - 1
17246function UInt31 (value) {
17247 return typeforce.UInt32(value) && value <= UINT31_MAX
17248}
17249
17250function BIP32Path (value) {
17251 return typeforce.String(value) && value.match(/^(m\/)?(\d+'?\/)*\d+'?$/)
17252}
17253BIP32Path.toJSON = function () { return 'BIP32 derivation path' }
17254
17255var SATOSHI_MAX = 21 * 1e14
17256function Satoshi (value) {
17257 return typeforce.UInt53(value) && value <= SATOSHI_MAX
17258}
17259
17260// external dependent types
17261var BigInt = typeforce.quacksLike('BigInteger')
17262var ECPoint = typeforce.quacksLike('Point')
17263
17264// exposed, external API
17265var ECSignature = typeforce.compile({ r: BigInt, s: BigInt })
17266var Network = typeforce.compile({
17267 messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String),
17268 bip32: {
17269 public: typeforce.UInt32,
17270 private: typeforce.UInt32
17271 },
17272 // see https://github.com/iancoleman/bip39/pull/212
17273 pubKeyHash: typeforce.oneOf(typeforce.UInt8, typeforce.UInt16),
17274 scriptHash: typeforce.oneOf(typeforce.UInt8, typeforce.UInt16),
17275 wif: typeforce.UInt8
17276})
17277
17278// extend typeforce types with ours
17279var types = {
17280 BigInt: BigInt,
17281 BIP32Path: BIP32Path,
17282 Buffer256bit: typeforce.BufferN(32),
17283 ECPoint: ECPoint,
17284 ECSignature: ECSignature,
17285 Hash160bit: typeforce.BufferN(20),
17286 Hash256bit: typeforce.BufferN(32),
17287 Network: Network,
17288 Satoshi: Satoshi,
17289 UInt31: UInt31
17290}
17291
17292for (var typeName in typeforce) {
17293 types[typeName] = typeforce[typeName]
17294}
17295
17296module.exports = types
17297
17298},{"typeforce":816}],108:[function(require,module,exports){
17299(function (module, exports) {
17300 'use strict';
17301
17302 // Utils
17303 function assert (val, msg) {
17304 if (!val) throw new Error(msg || 'Assertion failed');
17305 }
17306
17307 // Could use `inherits` module, but don't want to move from single file
17308 // architecture yet.
17309 function inherits (ctor, superCtor) {
17310 ctor.super_ = superCtor;
17311 var TempCtor = function () {};
17312 TempCtor.prototype = superCtor.prototype;
17313 ctor.prototype = new TempCtor();
17314 ctor.prototype.constructor = ctor;
17315 }
17316
17317 // BN
17318
17319 function BN (number, base, endian) {
17320 if (BN.isBN(number)) {
17321 return number;
17322 }
17323
17324 this.negative = 0;
17325 this.words = null;
17326 this.length = 0;
17327
17328 // Reduction context
17329 this.red = null;
17330
17331 if (number !== null) {
17332 if (base === 'le' || base === 'be') {
17333 endian = base;
17334 base = 10;
17335 }
17336
17337 this._init(number || 0, base || 10, endian || 'be');
17338 }
17339 }
17340 if (typeof module === 'object') {
17341 module.exports = BN;
17342 } else {
17343 exports.BN = BN;
17344 }
17345
17346 BN.BN = BN;
17347 BN.wordSize = 26;
17348
17349 var Buffer;
17350 try {
17351 Buffer = require('buffer').Buffer;
17352 } catch (e) {
17353 }
17354
17355 BN.isBN = function isBN (num) {
17356 if (num instanceof BN) {
17357 return true;
17358 }
17359
17360 return num !== null && typeof num === 'object' &&
17361 num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
17362 };
17363
17364 BN.max = function max (left, right) {
17365 if (left.cmp(right) > 0) return left;
17366 return right;
17367 };
17368
17369 BN.min = function min (left, right) {
17370 if (left.cmp(right) < 0) return left;
17371 return right;
17372 };
17373
17374 BN.prototype._init = function init (number, base, endian) {
17375 if (typeof number === 'number') {
17376 return this._initNumber(number, base, endian);
17377 }
17378
17379 if (typeof number === 'object') {
17380 return this._initArray(number, base, endian);
17381 }
17382
17383 if (base === 'hex') {
17384 base = 16;
17385 }
17386 assert(base === (base | 0) && base >= 2 && base <= 36);
17387
17388 number = number.toString().replace(/\s+/g, '');
17389 var start = 0;
17390 if (number[0] === '-') {
17391 start++;
17392 }
17393
17394 if (base === 16) {
17395 this._parseHex(number, start);
17396 } else {
17397 this._parseBase(number, base, start);
17398 }
17399
17400 if (number[0] === '-') {
17401 this.negative = 1;
17402 }
17403
17404 this.strip();
17405
17406 if (endian !== 'le') return;
17407
17408 this._initArray(this.toArray(), base, endian);
17409 };
17410
17411 BN.prototype._initNumber = function _initNumber (number, base, endian) {
17412 if (number < 0) {
17413 this.negative = 1;
17414 number = -number;
17415 }
17416 if (number < 0x4000000) {
17417 this.words = [ number & 0x3ffffff ];
17418 this.length = 1;
17419 } else if (number < 0x10000000000000) {
17420 this.words = [
17421 number & 0x3ffffff,
17422 (number / 0x4000000) & 0x3ffffff
17423 ];
17424 this.length = 2;
17425 } else {
17426 assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
17427 this.words = [
17428 number & 0x3ffffff,
17429 (number / 0x4000000) & 0x3ffffff,
17430 1
17431 ];
17432 this.length = 3;
17433 }
17434
17435 if (endian !== 'le') return;
17436
17437 // Reverse the bytes
17438 this._initArray(this.toArray(), base, endian);
17439 };
17440
17441 BN.prototype._initArray = function _initArray (number, base, endian) {
17442 // Perhaps a Uint8Array
17443 assert(typeof number.length === 'number');
17444 if (number.length <= 0) {
17445 this.words = [ 0 ];
17446 this.length = 1;
17447 return this;
17448 }
17449
17450 this.length = Math.ceil(number.length / 3);
17451 this.words = new Array(this.length);
17452 for (var i = 0; i < this.length; i++) {
17453 this.words[i] = 0;
17454 }
17455
17456 var j, w;
17457 var off = 0;
17458 if (endian === 'be') {
17459 for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
17460 w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
17461 this.words[j] |= (w << off) & 0x3ffffff;
17462 this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
17463 off += 24;
17464 if (off >= 26) {
17465 off -= 26;
17466 j++;
17467 }
17468 }
17469 } else if (endian === 'le') {
17470 for (i = 0, j = 0; i < number.length; i += 3) {
17471 w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
17472 this.words[j] |= (w << off) & 0x3ffffff;
17473 this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
17474 off += 24;
17475 if (off >= 26) {
17476 off -= 26;
17477 j++;
17478 }
17479 }
17480 }
17481 return this.strip();
17482 };
17483
17484 function parseHex (str, start, end) {
17485 var r = 0;
17486 var len = Math.min(str.length, end);
17487 for (var i = start; i < len; i++) {
17488 var c = str.charCodeAt(i) - 48;
17489
17490 r <<= 4;
17491
17492 // 'a' - 'f'
17493 if (c >= 49 && c <= 54) {
17494 r |= c - 49 + 0xa;
17495
17496 // 'A' - 'F'
17497 } else if (c >= 17 && c <= 22) {
17498 r |= c - 17 + 0xa;
17499
17500 // '0' - '9'
17501 } else {
17502 r |= c & 0xf;
17503 }
17504 }
17505 return r;
17506 }
17507
17508 BN.prototype._parseHex = function _parseHex (number, start) {
17509 // Create possibly bigger array to ensure that it fits the number
17510 this.length = Math.ceil((number.length - start) / 6);
17511 this.words = new Array(this.length);
17512 for (var i = 0; i < this.length; i++) {
17513 this.words[i] = 0;
17514 }
17515
17516 var j, w;
17517 // Scan 24-bit chunks and add them to the number
17518 var off = 0;
17519 for (i = number.length - 6, j = 0; i >= start; i -= 6) {
17520 w = parseHex(number, i, i + 6);
17521 this.words[j] |= (w << off) & 0x3ffffff;
17522 // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
17523 this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
17524 off += 24;
17525 if (off >= 26) {
17526 off -= 26;
17527 j++;
17528 }
17529 }
17530 if (i + 6 !== start) {
17531 w = parseHex(number, start, i + 6);
17532 this.words[j] |= (w << off) & 0x3ffffff;
17533 this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
17534 }
17535 this.strip();
17536 };
17537
17538 function parseBase (str, start, end, mul) {
17539 var r = 0;
17540 var len = Math.min(str.length, end);
17541 for (var i = start; i < len; i++) {
17542 var c = str.charCodeAt(i) - 48;
17543
17544 r *= mul;
17545
17546 // 'a'
17547 if (c >= 49) {
17548 r += c - 49 + 0xa;
17549
17550 // 'A'
17551 } else if (c >= 17) {
17552 r += c - 17 + 0xa;
17553
17554 // '0' - '9'
17555 } else {
17556 r += c;
17557 }
17558 }
17559 return r;
17560 }
17561
17562 BN.prototype._parseBase = function _parseBase (number, base, start) {
17563 // Initialize as zero
17564 this.words = [ 0 ];
17565 this.length = 1;
17566
17567 // Find length of limb in base
17568 for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
17569 limbLen++;
17570 }
17571 limbLen--;
17572 limbPow = (limbPow / base) | 0;
17573
17574 var total = number.length - start;
17575 var mod = total % limbLen;
17576 var end = Math.min(total, total - mod) + start;
17577
17578 var word = 0;
17579 for (var i = start; i < end; i += limbLen) {
17580 word = parseBase(number, i, i + limbLen, base);
17581
17582 this.imuln(limbPow);
17583 if (this.words[0] + word < 0x4000000) {
17584 this.words[0] += word;
17585 } else {
17586 this._iaddn(word);
17587 }
17588 }
17589
17590 if (mod !== 0) {
17591 var pow = 1;
17592 word = parseBase(number, i, number.length, base);
17593
17594 for (i = 0; i < mod; i++) {
17595 pow *= base;
17596 }
17597
17598 this.imuln(pow);
17599 if (this.words[0] + word < 0x4000000) {
17600 this.words[0] += word;
17601 } else {
17602 this._iaddn(word);
17603 }
17604 }
17605 };
17606
17607 BN.prototype.copy = function copy (dest) {
17608 dest.words = new Array(this.length);
17609 for (var i = 0; i < this.length; i++) {
17610 dest.words[i] = this.words[i];
17611 }
17612 dest.length = this.length;
17613 dest.negative = this.negative;
17614 dest.red = this.red;
17615 };
17616
17617 BN.prototype.clone = function clone () {
17618 var r = new BN(null);
17619 this.copy(r);
17620 return r;
17621 };
17622
17623 BN.prototype._expand = function _expand (size) {
17624 while (this.length < size) {
17625 this.words[this.length++] = 0;
17626 }
17627 return this;
17628 };
17629
17630 // Remove leading `0` from `this`
17631 BN.prototype.strip = function strip () {
17632 while (this.length > 1 && this.words[this.length - 1] === 0) {
17633 this.length--;
17634 }
17635 return this._normSign();
17636 };
17637
17638 BN.prototype._normSign = function _normSign () {
17639 // -0 = 0
17640 if (this.length === 1 && this.words[0] === 0) {
17641 this.negative = 0;
17642 }
17643 return this;
17644 };
17645
17646 BN.prototype.inspect = function inspect () {
17647 return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
17648 };
17649
17650 /*
17651
17652 var zeros = [];
17653 var groupSizes = [];
17654 var groupBases = [];
17655
17656 var s = '';
17657 var i = -1;
17658 while (++i < BN.wordSize) {
17659 zeros[i] = s;
17660 s += '0';
17661 }
17662 groupSizes[0] = 0;
17663 groupSizes[1] = 0;
17664 groupBases[0] = 0;
17665 groupBases[1] = 0;
17666 var base = 2 - 1;
17667 while (++base < 36 + 1) {
17668 var groupSize = 0;
17669 var groupBase = 1;
17670 while (groupBase < (1 << BN.wordSize) / base) {
17671 groupBase *= base;
17672 groupSize += 1;
17673 }
17674 groupSizes[base] = groupSize;
17675 groupBases[base] = groupBase;
17676 }
17677
17678 */
17679
17680 var zeros = [
17681 '',
17682 '0',
17683 '00',
17684 '000',
17685 '0000',
17686 '00000',
17687 '000000',
17688 '0000000',
17689 '00000000',
17690 '000000000',
17691 '0000000000',
17692 '00000000000',
17693 '000000000000',
17694 '0000000000000',
17695 '00000000000000',
17696 '000000000000000',
17697 '0000000000000000',
17698 '00000000000000000',
17699 '000000000000000000',
17700 '0000000000000000000',
17701 '00000000000000000000',
17702 '000000000000000000000',
17703 '0000000000000000000000',
17704 '00000000000000000000000',
17705 '000000000000000000000000',
17706 '0000000000000000000000000'
17707 ];
17708
17709 var groupSizes = [
17710 0, 0,
17711 25, 16, 12, 11, 10, 9, 8,
17712 8, 7, 7, 7, 7, 6, 6,
17713 6, 6, 6, 6, 6, 5, 5,
17714 5, 5, 5, 5, 5, 5, 5,
17715 5, 5, 5, 5, 5, 5, 5
17716 ];
17717
17718 var groupBases = [
17719 0, 0,
17720 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
17721 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
17722 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
17723 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
17724 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
17725 ];
17726
17727 BN.prototype.toString = function toString (base, padding) {
17728 base = base || 10;
17729 padding = padding | 0 || 1;
17730
17731 var out;
17732 if (base === 16 || base === 'hex') {
17733 out = '';
17734 var off = 0;
17735 var carry = 0;
17736 for (var i = 0; i < this.length; i++) {
17737 var w = this.words[i];
17738 var word = (((w << off) | carry) & 0xffffff).toString(16);
17739 carry = (w >>> (24 - off)) & 0xffffff;
17740 if (carry !== 0 || i !== this.length - 1) {
17741 out = zeros[6 - word.length] + word + out;
17742 } else {
17743 out = word + out;
17744 }
17745 off += 2;
17746 if (off >= 26) {
17747 off -= 26;
17748 i--;
17749 }
17750 }
17751 if (carry !== 0) {
17752 out = carry.toString(16) + out;
17753 }
17754 while (out.length % padding !== 0) {
17755 out = '0' + out;
17756 }
17757 if (this.negative !== 0) {
17758 out = '-' + out;
17759 }
17760 return out;
17761 }
17762
17763 if (base === (base | 0) && base >= 2 && base <= 36) {
17764 // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
17765 var groupSize = groupSizes[base];
17766 // var groupBase = Math.pow(base, groupSize);
17767 var groupBase = groupBases[base];
17768 out = '';
17769 var c = this.clone();
17770 c.negative = 0;
17771 while (!c.isZero()) {
17772 var r = c.modn(groupBase).toString(base);
17773 c = c.idivn(groupBase);
17774
17775 if (!c.isZero()) {
17776 out = zeros[groupSize - r.length] + r + out;
17777 } else {
17778 out = r + out;
17779 }
17780 }
17781 if (this.isZero()) {
17782 out = '0' + out;
17783 }
17784 while (out.length % padding !== 0) {
17785 out = '0' + out;
17786 }
17787 if (this.negative !== 0) {
17788 out = '-' + out;
17789 }
17790 return out;
17791 }
17792
17793 assert(false, 'Base should be between 2 and 36');
17794 };
17795
17796 BN.prototype.toNumber = function toNumber () {
17797 var ret = this.words[0];
17798 if (this.length === 2) {
17799 ret += this.words[1] * 0x4000000;
17800 } else if (this.length === 3 && this.words[2] === 0x01) {
17801 // NOTE: at this stage it is known that the top bit is set
17802 ret += 0x10000000000000 + (this.words[1] * 0x4000000);
17803 } else if (this.length > 2) {
17804 assert(false, 'Number can only safely store up to 53 bits');
17805 }
17806 return (this.negative !== 0) ? -ret : ret;
17807 };
17808
17809 BN.prototype.toJSON = function toJSON () {
17810 return this.toString(16);
17811 };
17812
17813 BN.prototype.toBuffer = function toBuffer (endian, length) {
17814 assert(typeof Buffer !== 'undefined');
17815 return this.toArrayLike(Buffer, endian, length);
17816 };
17817
17818 BN.prototype.toArray = function toArray (endian, length) {
17819 return this.toArrayLike(Array, endian, length);
17820 };
17821
17822 BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
17823 var byteLength = this.byteLength();
17824 var reqLength = length || Math.max(1, byteLength);
17825 assert(byteLength <= reqLength, 'byte array longer than desired length');
17826 assert(reqLength > 0, 'Requested array length <= 0');
17827
17828 this.strip();
17829 var littleEndian = endian === 'le';
17830 var res = new ArrayType(reqLength);
17831
17832 var b, i;
17833 var q = this.clone();
17834 if (!littleEndian) {
17835 // Assume big-endian
17836 for (i = 0; i < reqLength - byteLength; i++) {
17837 res[i] = 0;
17838 }
17839
17840 for (i = 0; !q.isZero(); i++) {
17841 b = q.andln(0xff);
17842 q.iushrn(8);
17843
17844 res[reqLength - i - 1] = b;
17845 }
17846 } else {
17847 for (i = 0; !q.isZero(); i++) {
17848 b = q.andln(0xff);
17849 q.iushrn(8);
17850
17851 res[i] = b;
17852 }
17853
17854 for (; i < reqLength; i++) {
17855 res[i] = 0;
17856 }
17857 }
17858
17859 return res;
17860 };
17861
17862 if (Math.clz32) {
17863 BN.prototype._countBits = function _countBits (w) {
17864 return 32 - Math.clz32(w);
17865 };
17866 } else {
17867 BN.prototype._countBits = function _countBits (w) {
17868 var t = w;
17869 var r = 0;
17870 if (t >= 0x1000) {
17871 r += 13;
17872 t >>>= 13;
17873 }
17874 if (t >= 0x40) {
17875 r += 7;
17876 t >>>= 7;
17877 }
17878 if (t >= 0x8) {
17879 r += 4;
17880 t >>>= 4;
17881 }
17882 if (t >= 0x02) {
17883 r += 2;
17884 t >>>= 2;
17885 }
17886 return r + t;
17887 };
17888 }
17889
17890 BN.prototype._zeroBits = function _zeroBits (w) {
17891 // Short-cut
17892 if (w === 0) return 26;
17893
17894 var t = w;
17895 var r = 0;
17896 if ((t & 0x1fff) === 0) {
17897 r += 13;
17898 t >>>= 13;
17899 }
17900 if ((t & 0x7f) === 0) {
17901 r += 7;
17902 t >>>= 7;
17903 }
17904 if ((t & 0xf) === 0) {
17905 r += 4;
17906 t >>>= 4;
17907 }
17908 if ((t & 0x3) === 0) {
17909 r += 2;
17910 t >>>= 2;
17911 }
17912 if ((t & 0x1) === 0) {
17913 r++;
17914 }
17915 return r;
17916 };
17917
17918 // Return number of used bits in a BN
17919 BN.prototype.bitLength = function bitLength () {
17920 var w = this.words[this.length - 1];
17921 var hi = this._countBits(w);
17922 return (this.length - 1) * 26 + hi;
17923 };
17924
17925 function toBitArray (num) {
17926 var w = new Array(num.bitLength());
17927
17928 for (var bit = 0; bit < w.length; bit++) {
17929 var off = (bit / 26) | 0;
17930 var wbit = bit % 26;
17931
17932 w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
17933 }
17934
17935 return w;
17936 }
17937
17938 // Number of trailing zero bits
17939 BN.prototype.zeroBits = function zeroBits () {
17940 if (this.isZero()) return 0;
17941
17942 var r = 0;
17943 for (var i = 0; i < this.length; i++) {
17944 var b = this._zeroBits(this.words[i]);
17945 r += b;
17946 if (b !== 26) break;
17947 }
17948 return r;
17949 };
17950
17951 BN.prototype.byteLength = function byteLength () {
17952 return Math.ceil(this.bitLength() / 8);
17953 };
17954
17955 BN.prototype.toTwos = function toTwos (width) {
17956 if (this.negative !== 0) {
17957 return this.abs().inotn(width).iaddn(1);
17958 }
17959 return this.clone();
17960 };
17961
17962 BN.prototype.fromTwos = function fromTwos (width) {
17963 if (this.testn(width - 1)) {
17964 return this.notn(width).iaddn(1).ineg();
17965 }
17966 return this.clone();
17967 };
17968
17969 BN.prototype.isNeg = function isNeg () {
17970 return this.negative !== 0;
17971 };
17972
17973 // Return negative clone of `this`
17974 BN.prototype.neg = function neg () {
17975 return this.clone().ineg();
17976 };
17977
17978 BN.prototype.ineg = function ineg () {
17979 if (!this.isZero()) {
17980 this.negative ^= 1;
17981 }
17982
17983 return this;
17984 };
17985
17986 // Or `num` with `this` in-place
17987 BN.prototype.iuor = function iuor (num) {
17988 while (this.length < num.length) {
17989 this.words[this.length++] = 0;
17990 }
17991
17992 for (var i = 0; i < num.length; i++) {
17993 this.words[i] = this.words[i] | num.words[i];
17994 }
17995
17996 return this.strip();
17997 };
17998
17999 BN.prototype.ior = function ior (num) {
18000 assert((this.negative | num.negative) === 0);
18001 return this.iuor(num);
18002 };
18003
18004 // Or `num` with `this`
18005 BN.prototype.or = function or (num) {
18006 if (this.length > num.length) return this.clone().ior(num);
18007 return num.clone().ior(this);
18008 };
18009
18010 BN.prototype.uor = function uor (num) {
18011 if (this.length > num.length) return this.clone().iuor(num);
18012 return num.clone().iuor(this);
18013 };
18014
18015 // And `num` with `this` in-place
18016 BN.prototype.iuand = function iuand (num) {
18017 // b = min-length(num, this)
18018 var b;
18019 if (this.length > num.length) {
18020 b = num;
18021 } else {
18022 b = this;
18023 }
18024
18025 for (var i = 0; i < b.length; i++) {
18026 this.words[i] = this.words[i] & num.words[i];
18027 }
18028
18029 this.length = b.length;
18030
18031 return this.strip();
18032 };
18033
18034 BN.prototype.iand = function iand (num) {
18035 assert((this.negative | num.negative) === 0);
18036 return this.iuand(num);
18037 };
18038
18039 // And `num` with `this`
18040 BN.prototype.and = function and (num) {
18041 if (this.length > num.length) return this.clone().iand(num);
18042 return num.clone().iand(this);
18043 };
18044
18045 BN.prototype.uand = function uand (num) {
18046 if (this.length > num.length) return this.clone().iuand(num);
18047 return num.clone().iuand(this);
18048 };
18049
18050 // Xor `num` with `this` in-place
18051 BN.prototype.iuxor = function iuxor (num) {
18052 // a.length > b.length
18053 var a;
18054 var b;
18055 if (this.length > num.length) {
18056 a = this;
18057 b = num;
18058 } else {
18059 a = num;
18060 b = this;
18061 }
18062
18063 for (var i = 0; i < b.length; i++) {
18064 this.words[i] = a.words[i] ^ b.words[i];
18065 }
18066
18067 if (this !== a) {
18068 for (; i < a.length; i++) {
18069 this.words[i] = a.words[i];
18070 }
18071 }
18072
18073 this.length = a.length;
18074
18075 return this.strip();
18076 };
18077
18078 BN.prototype.ixor = function ixor (num) {
18079 assert((this.negative | num.negative) === 0);
18080 return this.iuxor(num);
18081 };
18082
18083 // Xor `num` with `this`
18084 BN.prototype.xor = function xor (num) {
18085 if (this.length > num.length) return this.clone().ixor(num);
18086 return num.clone().ixor(this);
18087 };
18088
18089 BN.prototype.uxor = function uxor (num) {
18090 if (this.length > num.length) return this.clone().iuxor(num);
18091 return num.clone().iuxor(this);
18092 };
18093
18094 // Not ``this`` with ``width`` bitwidth
18095 BN.prototype.inotn = function inotn (width) {
18096 assert(typeof width === 'number' && width >= 0);
18097
18098 var bytesNeeded = Math.ceil(width / 26) | 0;
18099 var bitsLeft = width % 26;
18100
18101 // Extend the buffer with leading zeroes
18102 this._expand(bytesNeeded);
18103
18104 if (bitsLeft > 0) {
18105 bytesNeeded--;
18106 }
18107
18108 // Handle complete words
18109 for (var i = 0; i < bytesNeeded; i++) {
18110 this.words[i] = ~this.words[i] & 0x3ffffff;
18111 }
18112
18113 // Handle the residue
18114 if (bitsLeft > 0) {
18115 this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
18116 }
18117
18118 // And remove leading zeroes
18119 return this.strip();
18120 };
18121
18122 BN.prototype.notn = function notn (width) {
18123 return this.clone().inotn(width);
18124 };
18125
18126 // Set `bit` of `this`
18127 BN.prototype.setn = function setn (bit, val) {
18128 assert(typeof bit === 'number' && bit >= 0);
18129
18130 var off = (bit / 26) | 0;
18131 var wbit = bit % 26;
18132
18133 this._expand(off + 1);
18134
18135 if (val) {
18136 this.words[off] = this.words[off] | (1 << wbit);
18137 } else {
18138 this.words[off] = this.words[off] & ~(1 << wbit);
18139 }
18140
18141 return this.strip();
18142 };
18143
18144 // Add `num` to `this` in-place
18145 BN.prototype.iadd = function iadd (num) {
18146 var r;
18147
18148 // negative + positive
18149 if (this.negative !== 0 && num.negative === 0) {
18150 this.negative = 0;
18151 r = this.isub(num);
18152 this.negative ^= 1;
18153 return this._normSign();
18154
18155 // positive + negative
18156 } else if (this.negative === 0 && num.negative !== 0) {
18157 num.negative = 0;
18158 r = this.isub(num);
18159 num.negative = 1;
18160 return r._normSign();
18161 }
18162
18163 // a.length > b.length
18164 var a, b;
18165 if (this.length > num.length) {
18166 a = this;
18167 b = num;
18168 } else {
18169 a = num;
18170 b = this;
18171 }
18172
18173 var carry = 0;
18174 for (var i = 0; i < b.length; i++) {
18175 r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
18176 this.words[i] = r & 0x3ffffff;
18177 carry = r >>> 26;
18178 }
18179 for (; carry !== 0 && i < a.length; i++) {
18180 r = (a.words[i] | 0) + carry;
18181 this.words[i] = r & 0x3ffffff;
18182 carry = r >>> 26;
18183 }
18184
18185 this.length = a.length;
18186 if (carry !== 0) {
18187 this.words[this.length] = carry;
18188 this.length++;
18189 // Copy the rest of the words
18190 } else if (a !== this) {
18191 for (; i < a.length; i++) {
18192 this.words[i] = a.words[i];
18193 }
18194 }
18195
18196 return this;
18197 };
18198
18199 // Add `num` to `this`
18200 BN.prototype.add = function add (num) {
18201 var res;
18202 if (num.negative !== 0 && this.negative === 0) {
18203 num.negative = 0;
18204 res = this.sub(num);
18205 num.negative ^= 1;
18206 return res;
18207 } else if (num.negative === 0 && this.negative !== 0) {
18208 this.negative = 0;
18209 res = num.sub(this);
18210 this.negative = 1;
18211 return res;
18212 }
18213
18214 if (this.length > num.length) return this.clone().iadd(num);
18215
18216 return num.clone().iadd(this);
18217 };
18218
18219 // Subtract `num` from `this` in-place
18220 BN.prototype.isub = function isub (num) {
18221 // this - (-num) = this + num
18222 if (num.negative !== 0) {
18223 num.negative = 0;
18224 var r = this.iadd(num);
18225 num.negative = 1;
18226 return r._normSign();
18227
18228 // -this - num = -(this + num)
18229 } else if (this.negative !== 0) {
18230 this.negative = 0;
18231 this.iadd(num);
18232 this.negative = 1;
18233 return this._normSign();
18234 }
18235
18236 // At this point both numbers are positive
18237 var cmp = this.cmp(num);
18238
18239 // Optimization - zeroify
18240 if (cmp === 0) {
18241 this.negative = 0;
18242 this.length = 1;
18243 this.words[0] = 0;
18244 return this;
18245 }
18246
18247 // a > b
18248 var a, b;
18249 if (cmp > 0) {
18250 a = this;
18251 b = num;
18252 } else {
18253 a = num;
18254 b = this;
18255 }
18256
18257 var carry = 0;
18258 for (var i = 0; i < b.length; i++) {
18259 r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
18260 carry = r >> 26;
18261 this.words[i] = r & 0x3ffffff;
18262 }
18263 for (; carry !== 0 && i < a.length; i++) {
18264 r = (a.words[i] | 0) + carry;
18265 carry = r >> 26;
18266 this.words[i] = r & 0x3ffffff;
18267 }
18268
18269 // Copy rest of the words
18270 if (carry === 0 && i < a.length && a !== this) {
18271 for (; i < a.length; i++) {
18272 this.words[i] = a.words[i];
18273 }
18274 }
18275
18276 this.length = Math.max(this.length, i);
18277
18278 if (a !== this) {
18279 this.negative = 1;
18280 }
18281
18282 return this.strip();
18283 };
18284
18285 // Subtract `num` from `this`
18286 BN.prototype.sub = function sub (num) {
18287 return this.clone().isub(num);
18288 };
18289
18290 function smallMulTo (self, num, out) {
18291 out.negative = num.negative ^ self.negative;
18292 var len = (self.length + num.length) | 0;
18293 out.length = len;
18294 len = (len - 1) | 0;
18295
18296 // Peel one iteration (compiler can't do it, because of code complexity)
18297 var a = self.words[0] | 0;
18298 var b = num.words[0] | 0;
18299 var r = a * b;
18300
18301 var lo = r & 0x3ffffff;
18302 var carry = (r / 0x4000000) | 0;
18303 out.words[0] = lo;
18304
18305 for (var k = 1; k < len; k++) {
18306 // Sum all words with the same `i + j = k` and accumulate `ncarry`,
18307 // note that ncarry could be >= 0x3ffffff
18308 var ncarry = carry >>> 26;
18309 var rword = carry & 0x3ffffff;
18310 var maxJ = Math.min(k, num.length - 1);
18311 for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
18312 var i = (k - j) | 0;
18313 a = self.words[i] | 0;
18314 b = num.words[j] | 0;
18315 r = a * b + rword;
18316 ncarry += (r / 0x4000000) | 0;
18317 rword = r & 0x3ffffff;
18318 }
18319 out.words[k] = rword | 0;
18320 carry = ncarry | 0;
18321 }
18322 if (carry !== 0) {
18323 out.words[k] = carry | 0;
18324 } else {
18325 out.length--;
18326 }
18327
18328 return out.strip();
18329 }
18330
18331 // TODO(indutny): it may be reasonable to omit it for users who don't need
18332 // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
18333 // multiplication (like elliptic secp256k1).
18334 var comb10MulTo = function comb10MulTo (self, num, out) {
18335 var a = self.words;
18336 var b = num.words;
18337 var o = out.words;
18338 var c = 0;
18339 var lo;
18340 var mid;
18341 var hi;
18342 var a0 = a[0] | 0;
18343 var al0 = a0 & 0x1fff;
18344 var ah0 = a0 >>> 13;
18345 var a1 = a[1] | 0;
18346 var al1 = a1 & 0x1fff;
18347 var ah1 = a1 >>> 13;
18348 var a2 = a[2] | 0;
18349 var al2 = a2 & 0x1fff;
18350 var ah2 = a2 >>> 13;
18351 var a3 = a[3] | 0;
18352 var al3 = a3 & 0x1fff;
18353 var ah3 = a3 >>> 13;
18354 var a4 = a[4] | 0;
18355 var al4 = a4 & 0x1fff;
18356 var ah4 = a4 >>> 13;
18357 var a5 = a[5] | 0;
18358 var al5 = a5 & 0x1fff;
18359 var ah5 = a5 >>> 13;
18360 var a6 = a[6] | 0;
18361 var al6 = a6 & 0x1fff;
18362 var ah6 = a6 >>> 13;
18363 var a7 = a[7] | 0;
18364 var al7 = a7 & 0x1fff;
18365 var ah7 = a7 >>> 13;
18366 var a8 = a[8] | 0;
18367 var al8 = a8 & 0x1fff;
18368 var ah8 = a8 >>> 13;
18369 var a9 = a[9] | 0;
18370 var al9 = a9 & 0x1fff;
18371 var ah9 = a9 >>> 13;
18372 var b0 = b[0] | 0;
18373 var bl0 = b0 & 0x1fff;
18374 var bh0 = b0 >>> 13;
18375 var b1 = b[1] | 0;
18376 var bl1 = b1 & 0x1fff;
18377 var bh1 = b1 >>> 13;
18378 var b2 = b[2] | 0;
18379 var bl2 = b2 & 0x1fff;
18380 var bh2 = b2 >>> 13;
18381 var b3 = b[3] | 0;
18382 var bl3 = b3 & 0x1fff;
18383 var bh3 = b3 >>> 13;
18384 var b4 = b[4] | 0;
18385 var bl4 = b4 & 0x1fff;
18386 var bh4 = b4 >>> 13;
18387 var b5 = b[5] | 0;
18388 var bl5 = b5 & 0x1fff;
18389 var bh5 = b5 >>> 13;
18390 var b6 = b[6] | 0;
18391 var bl6 = b6 & 0x1fff;
18392 var bh6 = b6 >>> 13;
18393 var b7 = b[7] | 0;
18394 var bl7 = b7 & 0x1fff;
18395 var bh7 = b7 >>> 13;
18396 var b8 = b[8] | 0;
18397 var bl8 = b8 & 0x1fff;
18398 var bh8 = b8 >>> 13;
18399 var b9 = b[9] | 0;
18400 var bl9 = b9 & 0x1fff;
18401 var bh9 = b9 >>> 13;
18402
18403 out.negative = self.negative ^ num.negative;
18404 out.length = 19;
18405 /* k = 0 */
18406 lo = Math.imul(al0, bl0);
18407 mid = Math.imul(al0, bh0);
18408 mid = (mid + Math.imul(ah0, bl0)) | 0;
18409 hi = Math.imul(ah0, bh0);
18410 var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18411 c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
18412 w0 &= 0x3ffffff;
18413 /* k = 1 */
18414 lo = Math.imul(al1, bl0);
18415 mid = Math.imul(al1, bh0);
18416 mid = (mid + Math.imul(ah1, bl0)) | 0;
18417 hi = Math.imul(ah1, bh0);
18418 lo = (lo + Math.imul(al0, bl1)) | 0;
18419 mid = (mid + Math.imul(al0, bh1)) | 0;
18420 mid = (mid + Math.imul(ah0, bl1)) | 0;
18421 hi = (hi + Math.imul(ah0, bh1)) | 0;
18422 var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18423 c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
18424 w1 &= 0x3ffffff;
18425 /* k = 2 */
18426 lo = Math.imul(al2, bl0);
18427 mid = Math.imul(al2, bh0);
18428 mid = (mid + Math.imul(ah2, bl0)) | 0;
18429 hi = Math.imul(ah2, bh0);
18430 lo = (lo + Math.imul(al1, bl1)) | 0;
18431 mid = (mid + Math.imul(al1, bh1)) | 0;
18432 mid = (mid + Math.imul(ah1, bl1)) | 0;
18433 hi = (hi + Math.imul(ah1, bh1)) | 0;
18434 lo = (lo + Math.imul(al0, bl2)) | 0;
18435 mid = (mid + Math.imul(al0, bh2)) | 0;
18436 mid = (mid + Math.imul(ah0, bl2)) | 0;
18437 hi = (hi + Math.imul(ah0, bh2)) | 0;
18438 var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18439 c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
18440 w2 &= 0x3ffffff;
18441 /* k = 3 */
18442 lo = Math.imul(al3, bl0);
18443 mid = Math.imul(al3, bh0);
18444 mid = (mid + Math.imul(ah3, bl0)) | 0;
18445 hi = Math.imul(ah3, bh0);
18446 lo = (lo + Math.imul(al2, bl1)) | 0;
18447 mid = (mid + Math.imul(al2, bh1)) | 0;
18448 mid = (mid + Math.imul(ah2, bl1)) | 0;
18449 hi = (hi + Math.imul(ah2, bh1)) | 0;
18450 lo = (lo + Math.imul(al1, bl2)) | 0;
18451 mid = (mid + Math.imul(al1, bh2)) | 0;
18452 mid = (mid + Math.imul(ah1, bl2)) | 0;
18453 hi = (hi + Math.imul(ah1, bh2)) | 0;
18454 lo = (lo + Math.imul(al0, bl3)) | 0;
18455 mid = (mid + Math.imul(al0, bh3)) | 0;
18456 mid = (mid + Math.imul(ah0, bl3)) | 0;
18457 hi = (hi + Math.imul(ah0, bh3)) | 0;
18458 var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18459 c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
18460 w3 &= 0x3ffffff;
18461 /* k = 4 */
18462 lo = Math.imul(al4, bl0);
18463 mid = Math.imul(al4, bh0);
18464 mid = (mid + Math.imul(ah4, bl0)) | 0;
18465 hi = Math.imul(ah4, bh0);
18466 lo = (lo + Math.imul(al3, bl1)) | 0;
18467 mid = (mid + Math.imul(al3, bh1)) | 0;
18468 mid = (mid + Math.imul(ah3, bl1)) | 0;
18469 hi = (hi + Math.imul(ah3, bh1)) | 0;
18470 lo = (lo + Math.imul(al2, bl2)) | 0;
18471 mid = (mid + Math.imul(al2, bh2)) | 0;
18472 mid = (mid + Math.imul(ah2, bl2)) | 0;
18473 hi = (hi + Math.imul(ah2, bh2)) | 0;
18474 lo = (lo + Math.imul(al1, bl3)) | 0;
18475 mid = (mid + Math.imul(al1, bh3)) | 0;
18476 mid = (mid + Math.imul(ah1, bl3)) | 0;
18477 hi = (hi + Math.imul(ah1, bh3)) | 0;
18478 lo = (lo + Math.imul(al0, bl4)) | 0;
18479 mid = (mid + Math.imul(al0, bh4)) | 0;
18480 mid = (mid + Math.imul(ah0, bl4)) | 0;
18481 hi = (hi + Math.imul(ah0, bh4)) | 0;
18482 var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18483 c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
18484 w4 &= 0x3ffffff;
18485 /* k = 5 */
18486 lo = Math.imul(al5, bl0);
18487 mid = Math.imul(al5, bh0);
18488 mid = (mid + Math.imul(ah5, bl0)) | 0;
18489 hi = Math.imul(ah5, bh0);
18490 lo = (lo + Math.imul(al4, bl1)) | 0;
18491 mid = (mid + Math.imul(al4, bh1)) | 0;
18492 mid = (mid + Math.imul(ah4, bl1)) | 0;
18493 hi = (hi + Math.imul(ah4, bh1)) | 0;
18494 lo = (lo + Math.imul(al3, bl2)) | 0;
18495 mid = (mid + Math.imul(al3, bh2)) | 0;
18496 mid = (mid + Math.imul(ah3, bl2)) | 0;
18497 hi = (hi + Math.imul(ah3, bh2)) | 0;
18498 lo = (lo + Math.imul(al2, bl3)) | 0;
18499 mid = (mid + Math.imul(al2, bh3)) | 0;
18500 mid = (mid + Math.imul(ah2, bl3)) | 0;
18501 hi = (hi + Math.imul(ah2, bh3)) | 0;
18502 lo = (lo + Math.imul(al1, bl4)) | 0;
18503 mid = (mid + Math.imul(al1, bh4)) | 0;
18504 mid = (mid + Math.imul(ah1, bl4)) | 0;
18505 hi = (hi + Math.imul(ah1, bh4)) | 0;
18506 lo = (lo + Math.imul(al0, bl5)) | 0;
18507 mid = (mid + Math.imul(al0, bh5)) | 0;
18508 mid = (mid + Math.imul(ah0, bl5)) | 0;
18509 hi = (hi + Math.imul(ah0, bh5)) | 0;
18510 var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18511 c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
18512 w5 &= 0x3ffffff;
18513 /* k = 6 */
18514 lo = Math.imul(al6, bl0);
18515 mid = Math.imul(al6, bh0);
18516 mid = (mid + Math.imul(ah6, bl0)) | 0;
18517 hi = Math.imul(ah6, bh0);
18518 lo = (lo + Math.imul(al5, bl1)) | 0;
18519 mid = (mid + Math.imul(al5, bh1)) | 0;
18520 mid = (mid + Math.imul(ah5, bl1)) | 0;
18521 hi = (hi + Math.imul(ah5, bh1)) | 0;
18522 lo = (lo + Math.imul(al4, bl2)) | 0;
18523 mid = (mid + Math.imul(al4, bh2)) | 0;
18524 mid = (mid + Math.imul(ah4, bl2)) | 0;
18525 hi = (hi + Math.imul(ah4, bh2)) | 0;
18526 lo = (lo + Math.imul(al3, bl3)) | 0;
18527 mid = (mid + Math.imul(al3, bh3)) | 0;
18528 mid = (mid + Math.imul(ah3, bl3)) | 0;
18529 hi = (hi + Math.imul(ah3, bh3)) | 0;
18530 lo = (lo + Math.imul(al2, bl4)) | 0;
18531 mid = (mid + Math.imul(al2, bh4)) | 0;
18532 mid = (mid + Math.imul(ah2, bl4)) | 0;
18533 hi = (hi + Math.imul(ah2, bh4)) | 0;
18534 lo = (lo + Math.imul(al1, bl5)) | 0;
18535 mid = (mid + Math.imul(al1, bh5)) | 0;
18536 mid = (mid + Math.imul(ah1, bl5)) | 0;
18537 hi = (hi + Math.imul(ah1, bh5)) | 0;
18538 lo = (lo + Math.imul(al0, bl6)) | 0;
18539 mid = (mid + Math.imul(al0, bh6)) | 0;
18540 mid = (mid + Math.imul(ah0, bl6)) | 0;
18541 hi = (hi + Math.imul(ah0, bh6)) | 0;
18542 var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18543 c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
18544 w6 &= 0x3ffffff;
18545 /* k = 7 */
18546 lo = Math.imul(al7, bl0);
18547 mid = Math.imul(al7, bh0);
18548 mid = (mid + Math.imul(ah7, bl0)) | 0;
18549 hi = Math.imul(ah7, bh0);
18550 lo = (lo + Math.imul(al6, bl1)) | 0;
18551 mid = (mid + Math.imul(al6, bh1)) | 0;
18552 mid = (mid + Math.imul(ah6, bl1)) | 0;
18553 hi = (hi + Math.imul(ah6, bh1)) | 0;
18554 lo = (lo + Math.imul(al5, bl2)) | 0;
18555 mid = (mid + Math.imul(al5, bh2)) | 0;
18556 mid = (mid + Math.imul(ah5, bl2)) | 0;
18557 hi = (hi + Math.imul(ah5, bh2)) | 0;
18558 lo = (lo + Math.imul(al4, bl3)) | 0;
18559 mid = (mid + Math.imul(al4, bh3)) | 0;
18560 mid = (mid + Math.imul(ah4, bl3)) | 0;
18561 hi = (hi + Math.imul(ah4, bh3)) | 0;
18562 lo = (lo + Math.imul(al3, bl4)) | 0;
18563 mid = (mid + Math.imul(al3, bh4)) | 0;
18564 mid = (mid + Math.imul(ah3, bl4)) | 0;
18565 hi = (hi + Math.imul(ah3, bh4)) | 0;
18566 lo = (lo + Math.imul(al2, bl5)) | 0;
18567 mid = (mid + Math.imul(al2, bh5)) | 0;
18568 mid = (mid + Math.imul(ah2, bl5)) | 0;
18569 hi = (hi + Math.imul(ah2, bh5)) | 0;
18570 lo = (lo + Math.imul(al1, bl6)) | 0;
18571 mid = (mid + Math.imul(al1, bh6)) | 0;
18572 mid = (mid + Math.imul(ah1, bl6)) | 0;
18573 hi = (hi + Math.imul(ah1, bh6)) | 0;
18574 lo = (lo + Math.imul(al0, bl7)) | 0;
18575 mid = (mid + Math.imul(al0, bh7)) | 0;
18576 mid = (mid + Math.imul(ah0, bl7)) | 0;
18577 hi = (hi + Math.imul(ah0, bh7)) | 0;
18578 var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18579 c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
18580 w7 &= 0x3ffffff;
18581 /* k = 8 */
18582 lo = Math.imul(al8, bl0);
18583 mid = Math.imul(al8, bh0);
18584 mid = (mid + Math.imul(ah8, bl0)) | 0;
18585 hi = Math.imul(ah8, bh0);
18586 lo = (lo + Math.imul(al7, bl1)) | 0;
18587 mid = (mid + Math.imul(al7, bh1)) | 0;
18588 mid = (mid + Math.imul(ah7, bl1)) | 0;
18589 hi = (hi + Math.imul(ah7, bh1)) | 0;
18590 lo = (lo + Math.imul(al6, bl2)) | 0;
18591 mid = (mid + Math.imul(al6, bh2)) | 0;
18592 mid = (mid + Math.imul(ah6, bl2)) | 0;
18593 hi = (hi + Math.imul(ah6, bh2)) | 0;
18594 lo = (lo + Math.imul(al5, bl3)) | 0;
18595 mid = (mid + Math.imul(al5, bh3)) | 0;
18596 mid = (mid + Math.imul(ah5, bl3)) | 0;
18597 hi = (hi + Math.imul(ah5, bh3)) | 0;
18598 lo = (lo + Math.imul(al4, bl4)) | 0;
18599 mid = (mid + Math.imul(al4, bh4)) | 0;
18600 mid = (mid + Math.imul(ah4, bl4)) | 0;
18601 hi = (hi + Math.imul(ah4, bh4)) | 0;
18602 lo = (lo + Math.imul(al3, bl5)) | 0;
18603 mid = (mid + Math.imul(al3, bh5)) | 0;
18604 mid = (mid + Math.imul(ah3, bl5)) | 0;
18605 hi = (hi + Math.imul(ah3, bh5)) | 0;
18606 lo = (lo + Math.imul(al2, bl6)) | 0;
18607 mid = (mid + Math.imul(al2, bh6)) | 0;
18608 mid = (mid + Math.imul(ah2, bl6)) | 0;
18609 hi = (hi + Math.imul(ah2, bh6)) | 0;
18610 lo = (lo + Math.imul(al1, bl7)) | 0;
18611 mid = (mid + Math.imul(al1, bh7)) | 0;
18612 mid = (mid + Math.imul(ah1, bl7)) | 0;
18613 hi = (hi + Math.imul(ah1, bh7)) | 0;
18614 lo = (lo + Math.imul(al0, bl8)) | 0;
18615 mid = (mid + Math.imul(al0, bh8)) | 0;
18616 mid = (mid + Math.imul(ah0, bl8)) | 0;
18617 hi = (hi + Math.imul(ah0, bh8)) | 0;
18618 var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18619 c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
18620 w8 &= 0x3ffffff;
18621 /* k = 9 */
18622 lo = Math.imul(al9, bl0);
18623 mid = Math.imul(al9, bh0);
18624 mid = (mid + Math.imul(ah9, bl0)) | 0;
18625 hi = Math.imul(ah9, bh0);
18626 lo = (lo + Math.imul(al8, bl1)) | 0;
18627 mid = (mid + Math.imul(al8, bh1)) | 0;
18628 mid = (mid + Math.imul(ah8, bl1)) | 0;
18629 hi = (hi + Math.imul(ah8, bh1)) | 0;
18630 lo = (lo + Math.imul(al7, bl2)) | 0;
18631 mid = (mid + Math.imul(al7, bh2)) | 0;
18632 mid = (mid + Math.imul(ah7, bl2)) | 0;
18633 hi = (hi + Math.imul(ah7, bh2)) | 0;
18634 lo = (lo + Math.imul(al6, bl3)) | 0;
18635 mid = (mid + Math.imul(al6, bh3)) | 0;
18636 mid = (mid + Math.imul(ah6, bl3)) | 0;
18637 hi = (hi + Math.imul(ah6, bh3)) | 0;
18638 lo = (lo + Math.imul(al5, bl4)) | 0;
18639 mid = (mid + Math.imul(al5, bh4)) | 0;
18640 mid = (mid + Math.imul(ah5, bl4)) | 0;
18641 hi = (hi + Math.imul(ah5, bh4)) | 0;
18642 lo = (lo + Math.imul(al4, bl5)) | 0;
18643 mid = (mid + Math.imul(al4, bh5)) | 0;
18644 mid = (mid + Math.imul(ah4, bl5)) | 0;
18645 hi = (hi + Math.imul(ah4, bh5)) | 0;
18646 lo = (lo + Math.imul(al3, bl6)) | 0;
18647 mid = (mid + Math.imul(al3, bh6)) | 0;
18648 mid = (mid + Math.imul(ah3, bl6)) | 0;
18649 hi = (hi + Math.imul(ah3, bh6)) | 0;
18650 lo = (lo + Math.imul(al2, bl7)) | 0;
18651 mid = (mid + Math.imul(al2, bh7)) | 0;
18652 mid = (mid + Math.imul(ah2, bl7)) | 0;
18653 hi = (hi + Math.imul(ah2, bh7)) | 0;
18654 lo = (lo + Math.imul(al1, bl8)) | 0;
18655 mid = (mid + Math.imul(al1, bh8)) | 0;
18656 mid = (mid + Math.imul(ah1, bl8)) | 0;
18657 hi = (hi + Math.imul(ah1, bh8)) | 0;
18658 lo = (lo + Math.imul(al0, bl9)) | 0;
18659 mid = (mid + Math.imul(al0, bh9)) | 0;
18660 mid = (mid + Math.imul(ah0, bl9)) | 0;
18661 hi = (hi + Math.imul(ah0, bh9)) | 0;
18662 var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18663 c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
18664 w9 &= 0x3ffffff;
18665 /* k = 10 */
18666 lo = Math.imul(al9, bl1);
18667 mid = Math.imul(al9, bh1);
18668 mid = (mid + Math.imul(ah9, bl1)) | 0;
18669 hi = Math.imul(ah9, bh1);
18670 lo = (lo + Math.imul(al8, bl2)) | 0;
18671 mid = (mid + Math.imul(al8, bh2)) | 0;
18672 mid = (mid + Math.imul(ah8, bl2)) | 0;
18673 hi = (hi + Math.imul(ah8, bh2)) | 0;
18674 lo = (lo + Math.imul(al7, bl3)) | 0;
18675 mid = (mid + Math.imul(al7, bh3)) | 0;
18676 mid = (mid + Math.imul(ah7, bl3)) | 0;
18677 hi = (hi + Math.imul(ah7, bh3)) | 0;
18678 lo = (lo + Math.imul(al6, bl4)) | 0;
18679 mid = (mid + Math.imul(al6, bh4)) | 0;
18680 mid = (mid + Math.imul(ah6, bl4)) | 0;
18681 hi = (hi + Math.imul(ah6, bh4)) | 0;
18682 lo = (lo + Math.imul(al5, bl5)) | 0;
18683 mid = (mid + Math.imul(al5, bh5)) | 0;
18684 mid = (mid + Math.imul(ah5, bl5)) | 0;
18685 hi = (hi + Math.imul(ah5, bh5)) | 0;
18686 lo = (lo + Math.imul(al4, bl6)) | 0;
18687 mid = (mid + Math.imul(al4, bh6)) | 0;
18688 mid = (mid + Math.imul(ah4, bl6)) | 0;
18689 hi = (hi + Math.imul(ah4, bh6)) | 0;
18690 lo = (lo + Math.imul(al3, bl7)) | 0;
18691 mid = (mid + Math.imul(al3, bh7)) | 0;
18692 mid = (mid + Math.imul(ah3, bl7)) | 0;
18693 hi = (hi + Math.imul(ah3, bh7)) | 0;
18694 lo = (lo + Math.imul(al2, bl8)) | 0;
18695 mid = (mid + Math.imul(al2, bh8)) | 0;
18696 mid = (mid + Math.imul(ah2, bl8)) | 0;
18697 hi = (hi + Math.imul(ah2, bh8)) | 0;
18698 lo = (lo + Math.imul(al1, bl9)) | 0;
18699 mid = (mid + Math.imul(al1, bh9)) | 0;
18700 mid = (mid + Math.imul(ah1, bl9)) | 0;
18701 hi = (hi + Math.imul(ah1, bh9)) | 0;
18702 var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18703 c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
18704 w10 &= 0x3ffffff;
18705 /* k = 11 */
18706 lo = Math.imul(al9, bl2);
18707 mid = Math.imul(al9, bh2);
18708 mid = (mid + Math.imul(ah9, bl2)) | 0;
18709 hi = Math.imul(ah9, bh2);
18710 lo = (lo + Math.imul(al8, bl3)) | 0;
18711 mid = (mid + Math.imul(al8, bh3)) | 0;
18712 mid = (mid + Math.imul(ah8, bl3)) | 0;
18713 hi = (hi + Math.imul(ah8, bh3)) | 0;
18714 lo = (lo + Math.imul(al7, bl4)) | 0;
18715 mid = (mid + Math.imul(al7, bh4)) | 0;
18716 mid = (mid + Math.imul(ah7, bl4)) | 0;
18717 hi = (hi + Math.imul(ah7, bh4)) | 0;
18718 lo = (lo + Math.imul(al6, bl5)) | 0;
18719 mid = (mid + Math.imul(al6, bh5)) | 0;
18720 mid = (mid + Math.imul(ah6, bl5)) | 0;
18721 hi = (hi + Math.imul(ah6, bh5)) | 0;
18722 lo = (lo + Math.imul(al5, bl6)) | 0;
18723 mid = (mid + Math.imul(al5, bh6)) | 0;
18724 mid = (mid + Math.imul(ah5, bl6)) | 0;
18725 hi = (hi + Math.imul(ah5, bh6)) | 0;
18726 lo = (lo + Math.imul(al4, bl7)) | 0;
18727 mid = (mid + Math.imul(al4, bh7)) | 0;
18728 mid = (mid + Math.imul(ah4, bl7)) | 0;
18729 hi = (hi + Math.imul(ah4, bh7)) | 0;
18730 lo = (lo + Math.imul(al3, bl8)) | 0;
18731 mid = (mid + Math.imul(al3, bh8)) | 0;
18732 mid = (mid + Math.imul(ah3, bl8)) | 0;
18733 hi = (hi + Math.imul(ah3, bh8)) | 0;
18734 lo = (lo + Math.imul(al2, bl9)) | 0;
18735 mid = (mid + Math.imul(al2, bh9)) | 0;
18736 mid = (mid + Math.imul(ah2, bl9)) | 0;
18737 hi = (hi + Math.imul(ah2, bh9)) | 0;
18738 var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18739 c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
18740 w11 &= 0x3ffffff;
18741 /* k = 12 */
18742 lo = Math.imul(al9, bl3);
18743 mid = Math.imul(al9, bh3);
18744 mid = (mid + Math.imul(ah9, bl3)) | 0;
18745 hi = Math.imul(ah9, bh3);
18746 lo = (lo + Math.imul(al8, bl4)) | 0;
18747 mid = (mid + Math.imul(al8, bh4)) | 0;
18748 mid = (mid + Math.imul(ah8, bl4)) | 0;
18749 hi = (hi + Math.imul(ah8, bh4)) | 0;
18750 lo = (lo + Math.imul(al7, bl5)) | 0;
18751 mid = (mid + Math.imul(al7, bh5)) | 0;
18752 mid = (mid + Math.imul(ah7, bl5)) | 0;
18753 hi = (hi + Math.imul(ah7, bh5)) | 0;
18754 lo = (lo + Math.imul(al6, bl6)) | 0;
18755 mid = (mid + Math.imul(al6, bh6)) | 0;
18756 mid = (mid + Math.imul(ah6, bl6)) | 0;
18757 hi = (hi + Math.imul(ah6, bh6)) | 0;
18758 lo = (lo + Math.imul(al5, bl7)) | 0;
18759 mid = (mid + Math.imul(al5, bh7)) | 0;
18760 mid = (mid + Math.imul(ah5, bl7)) | 0;
18761 hi = (hi + Math.imul(ah5, bh7)) | 0;
18762 lo = (lo + Math.imul(al4, bl8)) | 0;
18763 mid = (mid + Math.imul(al4, bh8)) | 0;
18764 mid = (mid + Math.imul(ah4, bl8)) | 0;
18765 hi = (hi + Math.imul(ah4, bh8)) | 0;
18766 lo = (lo + Math.imul(al3, bl9)) | 0;
18767 mid = (mid + Math.imul(al3, bh9)) | 0;
18768 mid = (mid + Math.imul(ah3, bl9)) | 0;
18769 hi = (hi + Math.imul(ah3, bh9)) | 0;
18770 var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18771 c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
18772 w12 &= 0x3ffffff;
18773 /* k = 13 */
18774 lo = Math.imul(al9, bl4);
18775 mid = Math.imul(al9, bh4);
18776 mid = (mid + Math.imul(ah9, bl4)) | 0;
18777 hi = Math.imul(ah9, bh4);
18778 lo = (lo + Math.imul(al8, bl5)) | 0;
18779 mid = (mid + Math.imul(al8, bh5)) | 0;
18780 mid = (mid + Math.imul(ah8, bl5)) | 0;
18781 hi = (hi + Math.imul(ah8, bh5)) | 0;
18782 lo = (lo + Math.imul(al7, bl6)) | 0;
18783 mid = (mid + Math.imul(al7, bh6)) | 0;
18784 mid = (mid + Math.imul(ah7, bl6)) | 0;
18785 hi = (hi + Math.imul(ah7, bh6)) | 0;
18786 lo = (lo + Math.imul(al6, bl7)) | 0;
18787 mid = (mid + Math.imul(al6, bh7)) | 0;
18788 mid = (mid + Math.imul(ah6, bl7)) | 0;
18789 hi = (hi + Math.imul(ah6, bh7)) | 0;
18790 lo = (lo + Math.imul(al5, bl8)) | 0;
18791 mid = (mid + Math.imul(al5, bh8)) | 0;
18792 mid = (mid + Math.imul(ah5, bl8)) | 0;
18793 hi = (hi + Math.imul(ah5, bh8)) | 0;
18794 lo = (lo + Math.imul(al4, bl9)) | 0;
18795 mid = (mid + Math.imul(al4, bh9)) | 0;
18796 mid = (mid + Math.imul(ah4, bl9)) | 0;
18797 hi = (hi + Math.imul(ah4, bh9)) | 0;
18798 var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18799 c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
18800 w13 &= 0x3ffffff;
18801 /* k = 14 */
18802 lo = Math.imul(al9, bl5);
18803 mid = Math.imul(al9, bh5);
18804 mid = (mid + Math.imul(ah9, bl5)) | 0;
18805 hi = Math.imul(ah9, bh5);
18806 lo = (lo + Math.imul(al8, bl6)) | 0;
18807 mid = (mid + Math.imul(al8, bh6)) | 0;
18808 mid = (mid + Math.imul(ah8, bl6)) | 0;
18809 hi = (hi + Math.imul(ah8, bh6)) | 0;
18810 lo = (lo + Math.imul(al7, bl7)) | 0;
18811 mid = (mid + Math.imul(al7, bh7)) | 0;
18812 mid = (mid + Math.imul(ah7, bl7)) | 0;
18813 hi = (hi + Math.imul(ah7, bh7)) | 0;
18814 lo = (lo + Math.imul(al6, bl8)) | 0;
18815 mid = (mid + Math.imul(al6, bh8)) | 0;
18816 mid = (mid + Math.imul(ah6, bl8)) | 0;
18817 hi = (hi + Math.imul(ah6, bh8)) | 0;
18818 lo = (lo + Math.imul(al5, bl9)) | 0;
18819 mid = (mid + Math.imul(al5, bh9)) | 0;
18820 mid = (mid + Math.imul(ah5, bl9)) | 0;
18821 hi = (hi + Math.imul(ah5, bh9)) | 0;
18822 var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18823 c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
18824 w14 &= 0x3ffffff;
18825 /* k = 15 */
18826 lo = Math.imul(al9, bl6);
18827 mid = Math.imul(al9, bh6);
18828 mid = (mid + Math.imul(ah9, bl6)) | 0;
18829 hi = Math.imul(ah9, bh6);
18830 lo = (lo + Math.imul(al8, bl7)) | 0;
18831 mid = (mid + Math.imul(al8, bh7)) | 0;
18832 mid = (mid + Math.imul(ah8, bl7)) | 0;
18833 hi = (hi + Math.imul(ah8, bh7)) | 0;
18834 lo = (lo + Math.imul(al7, bl8)) | 0;
18835 mid = (mid + Math.imul(al7, bh8)) | 0;
18836 mid = (mid + Math.imul(ah7, bl8)) | 0;
18837 hi = (hi + Math.imul(ah7, bh8)) | 0;
18838 lo = (lo + Math.imul(al6, bl9)) | 0;
18839 mid = (mid + Math.imul(al6, bh9)) | 0;
18840 mid = (mid + Math.imul(ah6, bl9)) | 0;
18841 hi = (hi + Math.imul(ah6, bh9)) | 0;
18842 var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18843 c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
18844 w15 &= 0x3ffffff;
18845 /* k = 16 */
18846 lo = Math.imul(al9, bl7);
18847 mid = Math.imul(al9, bh7);
18848 mid = (mid + Math.imul(ah9, bl7)) | 0;
18849 hi = Math.imul(ah9, bh7);
18850 lo = (lo + Math.imul(al8, bl8)) | 0;
18851 mid = (mid + Math.imul(al8, bh8)) | 0;
18852 mid = (mid + Math.imul(ah8, bl8)) | 0;
18853 hi = (hi + Math.imul(ah8, bh8)) | 0;
18854 lo = (lo + Math.imul(al7, bl9)) | 0;
18855 mid = (mid + Math.imul(al7, bh9)) | 0;
18856 mid = (mid + Math.imul(ah7, bl9)) | 0;
18857 hi = (hi + Math.imul(ah7, bh9)) | 0;
18858 var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18859 c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
18860 w16 &= 0x3ffffff;
18861 /* k = 17 */
18862 lo = Math.imul(al9, bl8);
18863 mid = Math.imul(al9, bh8);
18864 mid = (mid + Math.imul(ah9, bl8)) | 0;
18865 hi = Math.imul(ah9, bh8);
18866 lo = (lo + Math.imul(al8, bl9)) | 0;
18867 mid = (mid + Math.imul(al8, bh9)) | 0;
18868 mid = (mid + Math.imul(ah8, bl9)) | 0;
18869 hi = (hi + Math.imul(ah8, bh9)) | 0;
18870 var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18871 c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
18872 w17 &= 0x3ffffff;
18873 /* k = 18 */
18874 lo = Math.imul(al9, bl9);
18875 mid = Math.imul(al9, bh9);
18876 mid = (mid + Math.imul(ah9, bl9)) | 0;
18877 hi = Math.imul(ah9, bh9);
18878 var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
18879 c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
18880 w18 &= 0x3ffffff;
18881 o[0] = w0;
18882 o[1] = w1;
18883 o[2] = w2;
18884 o[3] = w3;
18885 o[4] = w4;
18886 o[5] = w5;
18887 o[6] = w6;
18888 o[7] = w7;
18889 o[8] = w8;
18890 o[9] = w9;
18891 o[10] = w10;
18892 o[11] = w11;
18893 o[12] = w12;
18894 o[13] = w13;
18895 o[14] = w14;
18896 o[15] = w15;
18897 o[16] = w16;
18898 o[17] = w17;
18899 o[18] = w18;
18900 if (c !== 0) {
18901 o[19] = c;
18902 out.length++;
18903 }
18904 return out;
18905 };
18906
18907 // Polyfill comb
18908 if (!Math.imul) {
18909 comb10MulTo = smallMulTo;
18910 }
18911
18912 function bigMulTo (self, num, out) {
18913 out.negative = num.negative ^ self.negative;
18914 out.length = self.length + num.length;
18915
18916 var carry = 0;
18917 var hncarry = 0;
18918 for (var k = 0; k < out.length - 1; k++) {
18919 // Sum all words with the same `i + j = k` and accumulate `ncarry`,
18920 // note that ncarry could be >= 0x3ffffff
18921 var ncarry = hncarry;
18922 hncarry = 0;
18923 var rword = carry & 0x3ffffff;
18924 var maxJ = Math.min(k, num.length - 1);
18925 for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
18926 var i = k - j;
18927 var a = self.words[i] | 0;
18928 var b = num.words[j] | 0;
18929 var r = a * b;
18930
18931 var lo = r & 0x3ffffff;
18932 ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
18933 lo = (lo + rword) | 0;
18934 rword = lo & 0x3ffffff;
18935 ncarry = (ncarry + (lo >>> 26)) | 0;
18936
18937 hncarry += ncarry >>> 26;
18938 ncarry &= 0x3ffffff;
18939 }
18940 out.words[k] = rword;
18941 carry = ncarry;
18942 ncarry = hncarry;
18943 }
18944 if (carry !== 0) {
18945 out.words[k] = carry;
18946 } else {
18947 out.length--;
18948 }
18949
18950 return out.strip();
18951 }
18952
18953 function jumboMulTo (self, num, out) {
18954 var fftm = new FFTM();
18955 return fftm.mulp(self, num, out);
18956 }
18957
18958 BN.prototype.mulTo = function mulTo (num, out) {
18959 var res;
18960 var len = this.length + num.length;
18961 if (this.length === 10 && num.length === 10) {
18962 res = comb10MulTo(this, num, out);
18963 } else if (len < 63) {
18964 res = smallMulTo(this, num, out);
18965 } else if (len < 1024) {
18966 res = bigMulTo(this, num, out);
18967 } else {
18968 res = jumboMulTo(this, num, out);
18969 }
18970
18971 return res;
18972 };
18973
18974 // Cooley-Tukey algorithm for FFT
18975 // slightly revisited to rely on looping instead of recursion
18976
18977 function FFTM (x, y) {
18978 this.x = x;
18979 this.y = y;
18980 }
18981
18982 FFTM.prototype.makeRBT = function makeRBT (N) {
18983 var t = new Array(N);
18984 var l = BN.prototype._countBits(N) - 1;
18985 for (var i = 0; i < N; i++) {
18986 t[i] = this.revBin(i, l, N);
18987 }
18988
18989 return t;
18990 };
18991
18992 // Returns binary-reversed representation of `x`
18993 FFTM.prototype.revBin = function revBin (x, l, N) {
18994 if (x === 0 || x === N - 1) return x;
18995
18996 var rb = 0;
18997 for (var i = 0; i < l; i++) {
18998 rb |= (x & 1) << (l - i - 1);
18999 x >>= 1;
19000 }
19001
19002 return rb;
19003 };
19004
19005 // Performs "tweedling" phase, therefore 'emulating'
19006 // behaviour of the recursive algorithm
19007 FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
19008 for (var i = 0; i < N; i++) {
19009 rtws[i] = rws[rbt[i]];
19010 itws[i] = iws[rbt[i]];
19011 }
19012 };
19013
19014 FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
19015 this.permute(rbt, rws, iws, rtws, itws, N);
19016
19017 for (var s = 1; s < N; s <<= 1) {
19018 var l = s << 1;
19019
19020 var rtwdf = Math.cos(2 * Math.PI / l);
19021 var itwdf = Math.sin(2 * Math.PI / l);
19022
19023 for (var p = 0; p < N; p += l) {
19024 var rtwdf_ = rtwdf;
19025 var itwdf_ = itwdf;
19026
19027 for (var j = 0; j < s; j++) {
19028 var re = rtws[p + j];
19029 var ie = itws[p + j];
19030
19031 var ro = rtws[p + j + s];
19032 var io = itws[p + j + s];
19033
19034 var rx = rtwdf_ * ro - itwdf_ * io;
19035
19036 io = rtwdf_ * io + itwdf_ * ro;
19037 ro = rx;
19038
19039 rtws[p + j] = re + ro;
19040 itws[p + j] = ie + io;
19041
19042 rtws[p + j + s] = re - ro;
19043 itws[p + j + s] = ie - io;
19044
19045 /* jshint maxdepth : false */
19046 if (j !== l) {
19047 rx = rtwdf * rtwdf_ - itwdf * itwdf_;
19048
19049 itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
19050 rtwdf_ = rx;
19051 }
19052 }
19053 }
19054 }
19055 };
19056
19057 FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
19058 var N = Math.max(m, n) | 1;
19059 var odd = N & 1;
19060 var i = 0;
19061 for (N = N / 2 | 0; N; N = N >>> 1) {
19062 i++;
19063 }
19064
19065 return 1 << i + 1 + odd;
19066 };
19067
19068 FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
19069 if (N <= 1) return;
19070
19071 for (var i = 0; i < N / 2; i++) {
19072 var t = rws[i];
19073
19074 rws[i] = rws[N - i - 1];
19075 rws[N - i - 1] = t;
19076
19077 t = iws[i];
19078
19079 iws[i] = -iws[N - i - 1];
19080 iws[N - i - 1] = -t;
19081 }
19082 };
19083
19084 FFTM.prototype.normalize13b = function normalize13b (ws, N) {
19085 var carry = 0;
19086 for (var i = 0; i < N / 2; i++) {
19087 var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
19088 Math.round(ws[2 * i] / N) +
19089 carry;
19090
19091 ws[i] = w & 0x3ffffff;
19092
19093 if (w < 0x4000000) {
19094 carry = 0;
19095 } else {
19096 carry = w / 0x4000000 | 0;
19097 }
19098 }
19099
19100 return ws;
19101 };
19102
19103 FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
19104 var carry = 0;
19105 for (var i = 0; i < len; i++) {
19106 carry = carry + (ws[i] | 0);
19107
19108 rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
19109 rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
19110 }
19111
19112 // Pad with zeroes
19113 for (i = 2 * len; i < N; ++i) {
19114 rws[i] = 0;
19115 }
19116
19117 assert(carry === 0);
19118 assert((carry & ~0x1fff) === 0);
19119 };
19120
19121 FFTM.prototype.stub = function stub (N) {
19122 var ph = new Array(N);
19123 for (var i = 0; i < N; i++) {
19124 ph[i] = 0;
19125 }
19126
19127 return ph;
19128 };
19129
19130 FFTM.prototype.mulp = function mulp (x, y, out) {
19131 var N = 2 * this.guessLen13b(x.length, y.length);
19132
19133 var rbt = this.makeRBT(N);
19134
19135 var _ = this.stub(N);
19136
19137 var rws = new Array(N);
19138 var rwst = new Array(N);
19139 var iwst = new Array(N);
19140
19141 var nrws = new Array(N);
19142 var nrwst = new Array(N);
19143 var niwst = new Array(N);
19144
19145 var rmws = out.words;
19146 rmws.length = N;
19147
19148 this.convert13b(x.words, x.length, rws, N);
19149 this.convert13b(y.words, y.length, nrws, N);
19150
19151 this.transform(rws, _, rwst, iwst, N, rbt);
19152 this.transform(nrws, _, nrwst, niwst, N, rbt);
19153
19154 for (var i = 0; i < N; i++) {
19155 var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
19156 iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
19157 rwst[i] = rx;
19158 }
19159
19160 this.conjugate(rwst, iwst, N);
19161 this.transform(rwst, iwst, rmws, _, N, rbt);
19162 this.conjugate(rmws, _, N);
19163 this.normalize13b(rmws, N);
19164
19165 out.negative = x.negative ^ y.negative;
19166 out.length = x.length + y.length;
19167 return out.strip();
19168 };
19169
19170 // Multiply `this` by `num`
19171 BN.prototype.mul = function mul (num) {
19172 var out = new BN(null);
19173 out.words = new Array(this.length + num.length);
19174 return this.mulTo(num, out);
19175 };
19176
19177 // Multiply employing FFT
19178 BN.prototype.mulf = function mulf (num) {
19179 var out = new BN(null);
19180 out.words = new Array(this.length + num.length);
19181 return jumboMulTo(this, num, out);
19182 };
19183
19184 // In-place Multiplication
19185 BN.prototype.imul = function imul (num) {
19186 return this.clone().mulTo(num, this);
19187 };
19188
19189 BN.prototype.imuln = function imuln (num) {
19190 assert(typeof num === 'number');
19191 assert(num < 0x4000000);
19192
19193 // Carry
19194 var carry = 0;
19195 for (var i = 0; i < this.length; i++) {
19196 var w = (this.words[i] | 0) * num;
19197 var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
19198 carry >>= 26;
19199 carry += (w / 0x4000000) | 0;
19200 // NOTE: lo is 27bit maximum
19201 carry += lo >>> 26;
19202 this.words[i] = lo & 0x3ffffff;
19203 }
19204
19205 if (carry !== 0) {
19206 this.words[i] = carry;
19207 this.length++;
19208 }
19209
19210 return this;
19211 };
19212
19213 BN.prototype.muln = function muln (num) {
19214 return this.clone().imuln(num);
19215 };
19216
19217 // `this` * `this`
19218 BN.prototype.sqr = function sqr () {
19219 return this.mul(this);
19220 };
19221
19222 // `this` * `this` in-place
19223 BN.prototype.isqr = function isqr () {
19224 return this.imul(this.clone());
19225 };
19226
19227 // Math.pow(`this`, `num`)
19228 BN.prototype.pow = function pow (num) {
19229 var w = toBitArray(num);
19230 if (w.length === 0) return new BN(1);
19231
19232 // Skip leading zeroes
19233 var res = this;
19234 for (var i = 0; i < w.length; i++, res = res.sqr()) {
19235 if (w[i] !== 0) break;
19236 }
19237
19238 if (++i < w.length) {
19239 for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
19240 if (w[i] === 0) continue;
19241
19242 res = res.mul(q);
19243 }
19244 }
19245
19246 return res;
19247 };
19248
19249 // Shift-left in-place
19250 BN.prototype.iushln = function iushln (bits) {
19251 assert(typeof bits === 'number' && bits >= 0);
19252 var r = bits % 26;
19253 var s = (bits - r) / 26;
19254 var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
19255 var i;
19256
19257 if (r !== 0) {
19258 var carry = 0;
19259
19260 for (i = 0; i < this.length; i++) {
19261 var newCarry = this.words[i] & carryMask;
19262 var c = ((this.words[i] | 0) - newCarry) << r;
19263 this.words[i] = c | carry;
19264 carry = newCarry >>> (26 - r);
19265 }
19266
19267 if (carry) {
19268 this.words[i] = carry;
19269 this.length++;
19270 }
19271 }
19272
19273 if (s !== 0) {
19274 for (i = this.length - 1; i >= 0; i--) {
19275 this.words[i + s] = this.words[i];
19276 }
19277
19278 for (i = 0; i < s; i++) {
19279 this.words[i] = 0;
19280 }
19281
19282 this.length += s;
19283 }
19284
19285 return this.strip();
19286 };
19287
19288 BN.prototype.ishln = function ishln (bits) {
19289 // TODO(indutny): implement me
19290 assert(this.negative === 0);
19291 return this.iushln(bits);
19292 };
19293
19294 // Shift-right in-place
19295 // NOTE: `hint` is a lowest bit before trailing zeroes
19296 // NOTE: if `extended` is present - it will be filled with destroyed bits
19297 BN.prototype.iushrn = function iushrn (bits, hint, extended) {
19298 assert(typeof bits === 'number' && bits >= 0);
19299 var h;
19300 if (hint) {
19301 h = (hint - (hint % 26)) / 26;
19302 } else {
19303 h = 0;
19304 }
19305
19306 var r = bits % 26;
19307 var s = Math.min((bits - r) / 26, this.length);
19308 var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
19309 var maskedWords = extended;
19310
19311 h -= s;
19312 h = Math.max(0, h);
19313
19314 // Extended mode, copy masked part
19315 if (maskedWords) {
19316 for (var i = 0; i < s; i++) {
19317 maskedWords.words[i] = this.words[i];
19318 }
19319 maskedWords.length = s;
19320 }
19321
19322 if (s === 0) {
19323 // No-op, we should not move anything at all
19324 } else if (this.length > s) {
19325 this.length -= s;
19326 for (i = 0; i < this.length; i++) {
19327 this.words[i] = this.words[i + s];
19328 }
19329 } else {
19330 this.words[0] = 0;
19331 this.length = 1;
19332 }
19333
19334 var carry = 0;
19335 for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
19336 var word = this.words[i] | 0;
19337 this.words[i] = (carry << (26 - r)) | (word >>> r);
19338 carry = word & mask;
19339 }
19340
19341 // Push carried bits as a mask
19342 if (maskedWords && carry !== 0) {
19343 maskedWords.words[maskedWords.length++] = carry;
19344 }
19345
19346 if (this.length === 0) {
19347 this.words[0] = 0;
19348 this.length = 1;
19349 }
19350
19351 return this.strip();
19352 };
19353
19354 BN.prototype.ishrn = function ishrn (bits, hint, extended) {
19355 // TODO(indutny): implement me
19356 assert(this.negative === 0);
19357 return this.iushrn(bits, hint, extended);
19358 };
19359
19360 // Shift-left
19361 BN.prototype.shln = function shln (bits) {
19362 return this.clone().ishln(bits);
19363 };
19364
19365 BN.prototype.ushln = function ushln (bits) {
19366 return this.clone().iushln(bits);
19367 };
19368
19369 // Shift-right
19370 BN.prototype.shrn = function shrn (bits) {
19371 return this.clone().ishrn(bits);
19372 };
19373
19374 BN.prototype.ushrn = function ushrn (bits) {
19375 return this.clone().iushrn(bits);
19376 };
19377
19378 // Test if n bit is set
19379 BN.prototype.testn = function testn (bit) {
19380 assert(typeof bit === 'number' && bit >= 0);
19381 var r = bit % 26;
19382 var s = (bit - r) / 26;
19383 var q = 1 << r;
19384
19385 // Fast case: bit is much higher than all existing words
19386 if (this.length <= s) return false;
19387
19388 // Check bit and return
19389 var w = this.words[s];
19390
19391 return !!(w & q);
19392 };
19393
19394 // Return only lowers bits of number (in-place)
19395 BN.prototype.imaskn = function imaskn (bits) {
19396 assert(typeof bits === 'number' && bits >= 0);
19397 var r = bits % 26;
19398 var s = (bits - r) / 26;
19399
19400 assert(this.negative === 0, 'imaskn works only with positive numbers');
19401
19402 if (this.length <= s) {
19403 return this;
19404 }
19405
19406 if (r !== 0) {
19407 s++;
19408 }
19409 this.length = Math.min(s, this.length);
19410
19411 if (r !== 0) {
19412 var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
19413 this.words[this.length - 1] &= mask;
19414 }
19415
19416 return this.strip();
19417 };
19418
19419 // Return only lowers bits of number
19420 BN.prototype.maskn = function maskn (bits) {
19421 return this.clone().imaskn(bits);
19422 };
19423
19424 // Add plain number `num` to `this`
19425 BN.prototype.iaddn = function iaddn (num) {
19426 assert(typeof num === 'number');
19427 assert(num < 0x4000000);
19428 if (num < 0) return this.isubn(-num);
19429
19430 // Possible sign change
19431 if (this.negative !== 0) {
19432 if (this.length === 1 && (this.words[0] | 0) < num) {
19433 this.words[0] = num - (this.words[0] | 0);
19434 this.negative = 0;
19435 return this;
19436 }
19437
19438 this.negative = 0;
19439 this.isubn(num);
19440 this.negative = 1;
19441 return this;
19442 }
19443
19444 // Add without checks
19445 return this._iaddn(num);
19446 };
19447
19448 BN.prototype._iaddn = function _iaddn (num) {
19449 this.words[0] += num;
19450
19451 // Carry
19452 for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
19453 this.words[i] -= 0x4000000;
19454 if (i === this.length - 1) {
19455 this.words[i + 1] = 1;
19456 } else {
19457 this.words[i + 1]++;
19458 }
19459 }
19460 this.length = Math.max(this.length, i + 1);
19461
19462 return this;
19463 };
19464
19465 // Subtract plain number `num` from `this`
19466 BN.prototype.isubn = function isubn (num) {
19467 assert(typeof num === 'number');
19468 assert(num < 0x4000000);
19469 if (num < 0) return this.iaddn(-num);
19470
19471 if (this.negative !== 0) {
19472 this.negative = 0;
19473 this.iaddn(num);
19474 this.negative = 1;
19475 return this;
19476 }
19477
19478 this.words[0] -= num;
19479
19480 if (this.length === 1 && this.words[0] < 0) {
19481 this.words[0] = -this.words[0];
19482 this.negative = 1;
19483 } else {
19484 // Carry
19485 for (var i = 0; i < this.length && this.words[i] < 0; i++) {
19486 this.words[i] += 0x4000000;
19487 this.words[i + 1] -= 1;
19488 }
19489 }
19490
19491 return this.strip();
19492 };
19493
19494 BN.prototype.addn = function addn (num) {
19495 return this.clone().iaddn(num);
19496 };
19497
19498 BN.prototype.subn = function subn (num) {
19499 return this.clone().isubn(num);
19500 };
19501
19502 BN.prototype.iabs = function iabs () {
19503 this.negative = 0;
19504
19505 return this;
19506 };
19507
19508 BN.prototype.abs = function abs () {
19509 return this.clone().iabs();
19510 };
19511
19512 BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
19513 var len = num.length + shift;
19514 var i;
19515
19516 this._expand(len);
19517
19518 var w;
19519 var carry = 0;
19520 for (i = 0; i < num.length; i++) {
19521 w = (this.words[i + shift] | 0) + carry;
19522 var right = (num.words[i] | 0) * mul;
19523 w -= right & 0x3ffffff;
19524 carry = (w >> 26) - ((right / 0x4000000) | 0);
19525 this.words[i + shift] = w & 0x3ffffff;
19526 }
19527 for (; i < this.length - shift; i++) {
19528 w = (this.words[i + shift] | 0) + carry;
19529 carry = w >> 26;
19530 this.words[i + shift] = w & 0x3ffffff;
19531 }
19532
19533 if (carry === 0) return this.strip();
19534
19535 // Subtraction overflow
19536 assert(carry === -1);
19537 carry = 0;
19538 for (i = 0; i < this.length; i++) {
19539 w = -(this.words[i] | 0) + carry;
19540 carry = w >> 26;
19541 this.words[i] = w & 0x3ffffff;
19542 }
19543 this.negative = 1;
19544
19545 return this.strip();
19546 };
19547
19548 BN.prototype._wordDiv = function _wordDiv (num, mode) {
19549 var shift = this.length - num.length;
19550
19551 var a = this.clone();
19552 var b = num;
19553
19554 // Normalize
19555 var bhi = b.words[b.length - 1] | 0;
19556 var bhiBits = this._countBits(bhi);
19557 shift = 26 - bhiBits;
19558 if (shift !== 0) {
19559 b = b.ushln(shift);
19560 a.iushln(shift);
19561 bhi = b.words[b.length - 1] | 0;
19562 }
19563
19564 // Initialize quotient
19565 var m = a.length - b.length;
19566 var q;
19567
19568 if (mode !== 'mod') {
19569 q = new BN(null);
19570 q.length = m + 1;
19571 q.words = new Array(q.length);
19572 for (var i = 0; i < q.length; i++) {
19573 q.words[i] = 0;
19574 }
19575 }
19576
19577 var diff = a.clone()._ishlnsubmul(b, 1, m);
19578 if (diff.negative === 0) {
19579 a = diff;
19580 if (q) {
19581 q.words[m] = 1;
19582 }
19583 }
19584
19585 for (var j = m - 1; j >= 0; j--) {
19586 var qj = (a.words[b.length + j] | 0) * 0x4000000 +
19587 (a.words[b.length + j - 1] | 0);
19588
19589 // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
19590 // (0x7ffffff)
19591 qj = Math.min((qj / bhi) | 0, 0x3ffffff);
19592
19593 a._ishlnsubmul(b, qj, j);
19594 while (a.negative !== 0) {
19595 qj--;
19596 a.negative = 0;
19597 a._ishlnsubmul(b, 1, j);
19598 if (!a.isZero()) {
19599 a.negative ^= 1;
19600 }
19601 }
19602 if (q) {
19603 q.words[j] = qj;
19604 }
19605 }
19606 if (q) {
19607 q.strip();
19608 }
19609 a.strip();
19610
19611 // Denormalize
19612 if (mode !== 'div' && shift !== 0) {
19613 a.iushrn(shift);
19614 }
19615
19616 return {
19617 div: q || null,
19618 mod: a
19619 };
19620 };
19621
19622 // NOTE: 1) `mode` can be set to `mod` to request mod only,
19623 // to `div` to request div only, or be absent to
19624 // request both div & mod
19625 // 2) `positive` is true if unsigned mod is requested
19626 BN.prototype.divmod = function divmod (num, mode, positive) {
19627 assert(!num.isZero());
19628
19629 if (this.isZero()) {
19630 return {
19631 div: new BN(0),
19632 mod: new BN(0)
19633 };
19634 }
19635
19636 var div, mod, res;
19637 if (this.negative !== 0 && num.negative === 0) {
19638 res = this.neg().divmod(num, mode);
19639
19640 if (mode !== 'mod') {
19641 div = res.div.neg();
19642 }
19643
19644 if (mode !== 'div') {
19645 mod = res.mod.neg();
19646 if (positive && mod.negative !== 0) {
19647 mod.iadd(num);
19648 }
19649 }
19650
19651 return {
19652 div: div,
19653 mod: mod
19654 };
19655 }
19656
19657 if (this.negative === 0 && num.negative !== 0) {
19658 res = this.divmod(num.neg(), mode);
19659
19660 if (mode !== 'mod') {
19661 div = res.div.neg();
19662 }
19663
19664 return {
19665 div: div,
19666 mod: res.mod
19667 };
19668 }
19669
19670 if ((this.negative & num.negative) !== 0) {
19671 res = this.neg().divmod(num.neg(), mode);
19672
19673 if (mode !== 'div') {
19674 mod = res.mod.neg();
19675 if (positive && mod.negative !== 0) {
19676 mod.isub(num);
19677 }
19678 }
19679
19680 return {
19681 div: res.div,
19682 mod: mod
19683 };
19684 }
19685
19686 // Both numbers are positive at this point
19687
19688 // Strip both numbers to approximate shift value
19689 if (num.length > this.length || this.cmp(num) < 0) {
19690 return {
19691 div: new BN(0),
19692 mod: this
19693 };
19694 }
19695
19696 // Very short reduction
19697 if (num.length === 1) {
19698 if (mode === 'div') {
19699 return {
19700 div: this.divn(num.words[0]),
19701 mod: null
19702 };
19703 }
19704
19705 if (mode === 'mod') {
19706 return {
19707 div: null,
19708 mod: new BN(this.modn(num.words[0]))
19709 };
19710 }
19711
19712 return {
19713 div: this.divn(num.words[0]),
19714 mod: new BN(this.modn(num.words[0]))
19715 };
19716 }
19717
19718 return this._wordDiv(num, mode);
19719 };
19720
19721 // Find `this` / `num`
19722 BN.prototype.div = function div (num) {
19723 return this.divmod(num, 'div', false).div;
19724 };
19725
19726 // Find `this` % `num`
19727 BN.prototype.mod = function mod (num) {
19728 return this.divmod(num, 'mod', false).mod;
19729 };
19730
19731 BN.prototype.umod = function umod (num) {
19732 return this.divmod(num, 'mod', true).mod;
19733 };
19734
19735 // Find Round(`this` / `num`)
19736 BN.prototype.divRound = function divRound (num) {
19737 var dm = this.divmod(num);
19738
19739 // Fast case - exact division
19740 if (dm.mod.isZero()) return dm.div;
19741
19742 var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
19743
19744 var half = num.ushrn(1);
19745 var r2 = num.andln(1);
19746 var cmp = mod.cmp(half);
19747
19748 // Round down
19749 if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
19750
19751 // Round up
19752 return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
19753 };
19754
19755 BN.prototype.modn = function modn (num) {
19756 assert(num <= 0x3ffffff);
19757 var p = (1 << 26) % num;
19758
19759 var acc = 0;
19760 for (var i = this.length - 1; i >= 0; i--) {
19761 acc = (p * acc + (this.words[i] | 0)) % num;
19762 }
19763
19764 return acc;
19765 };
19766
19767 // In-place division by number
19768 BN.prototype.idivn = function idivn (num) {
19769 assert(num <= 0x3ffffff);
19770
19771 var carry = 0;
19772 for (var i = this.length - 1; i >= 0; i--) {
19773 var w = (this.words[i] | 0) + carry * 0x4000000;
19774 this.words[i] = (w / num) | 0;
19775 carry = w % num;
19776 }
19777
19778 return this.strip();
19779 };
19780
19781 BN.prototype.divn = function divn (num) {
19782 return this.clone().idivn(num);
19783 };
19784
19785 BN.prototype.egcd = function egcd (p) {
19786 assert(p.negative === 0);
19787 assert(!p.isZero());
19788
19789 var x = this;
19790 var y = p.clone();
19791
19792 if (x.negative !== 0) {
19793 x = x.umod(p);
19794 } else {
19795 x = x.clone();
19796 }
19797
19798 // A * x + B * y = x
19799 var A = new BN(1);
19800 var B = new BN(0);
19801
19802 // C * x + D * y = y
19803 var C = new BN(0);
19804 var D = new BN(1);
19805
19806 var g = 0;
19807
19808 while (x.isEven() && y.isEven()) {
19809 x.iushrn(1);
19810 y.iushrn(1);
19811 ++g;
19812 }
19813
19814 var yp = y.clone();
19815 var xp = x.clone();
19816
19817 while (!x.isZero()) {
19818 for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
19819 if (i > 0) {
19820 x.iushrn(i);
19821 while (i-- > 0) {
19822 if (A.isOdd() || B.isOdd()) {
19823 A.iadd(yp);
19824 B.isub(xp);
19825 }
19826
19827 A.iushrn(1);
19828 B.iushrn(1);
19829 }
19830 }
19831
19832 for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
19833 if (j > 0) {
19834 y.iushrn(j);
19835 while (j-- > 0) {
19836 if (C.isOdd() || D.isOdd()) {
19837 C.iadd(yp);
19838 D.isub(xp);
19839 }
19840
19841 C.iushrn(1);
19842 D.iushrn(1);
19843 }
19844 }
19845
19846 if (x.cmp(y) >= 0) {
19847 x.isub(y);
19848 A.isub(C);
19849 B.isub(D);
19850 } else {
19851 y.isub(x);
19852 C.isub(A);
19853 D.isub(B);
19854 }
19855 }
19856
19857 return {
19858 a: C,
19859 b: D,
19860 gcd: y.iushln(g)
19861 };
19862 };
19863
19864 // This is reduced incarnation of the binary EEA
19865 // above, designated to invert members of the
19866 // _prime_ fields F(p) at a maximal speed
19867 BN.prototype._invmp = function _invmp (p) {
19868 assert(p.negative === 0);
19869 assert(!p.isZero());
19870
19871 var a = this;
19872 var b = p.clone();
19873
19874 if (a.negative !== 0) {
19875 a = a.umod(p);
19876 } else {
19877 a = a.clone();
19878 }
19879
19880 var x1 = new BN(1);
19881 var x2 = new BN(0);
19882
19883 var delta = b.clone();
19884
19885 while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
19886 for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
19887 if (i > 0) {
19888 a.iushrn(i);
19889 while (i-- > 0) {
19890 if (x1.isOdd()) {
19891 x1.iadd(delta);
19892 }
19893
19894 x1.iushrn(1);
19895 }
19896 }
19897
19898 for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
19899 if (j > 0) {
19900 b.iushrn(j);
19901 while (j-- > 0) {
19902 if (x2.isOdd()) {
19903 x2.iadd(delta);
19904 }
19905
19906 x2.iushrn(1);
19907 }
19908 }
19909
19910 if (a.cmp(b) >= 0) {
19911 a.isub(b);
19912 x1.isub(x2);
19913 } else {
19914 b.isub(a);
19915 x2.isub(x1);
19916 }
19917 }
19918
19919 var res;
19920 if (a.cmpn(1) === 0) {
19921 res = x1;
19922 } else {
19923 res = x2;
19924 }
19925
19926 if (res.cmpn(0) < 0) {
19927 res.iadd(p);
19928 }
19929
19930 return res;
19931 };
19932
19933 BN.prototype.gcd = function gcd (num) {
19934 if (this.isZero()) return num.abs();
19935 if (num.isZero()) return this.abs();
19936
19937 var a = this.clone();
19938 var b = num.clone();
19939 a.negative = 0;
19940 b.negative = 0;
19941
19942 // Remove common factor of two
19943 for (var shift = 0; a.isEven() && b.isEven(); shift++) {
19944 a.iushrn(1);
19945 b.iushrn(1);
19946 }
19947
19948 do {
19949 while (a.isEven()) {
19950 a.iushrn(1);
19951 }
19952 while (b.isEven()) {
19953 b.iushrn(1);
19954 }
19955
19956 var r = a.cmp(b);
19957 if (r < 0) {
19958 // Swap `a` and `b` to make `a` always bigger than `b`
19959 var t = a;
19960 a = b;
19961 b = t;
19962 } else if (r === 0 || b.cmpn(1) === 0) {
19963 break;
19964 }
19965
19966 a.isub(b);
19967 } while (true);
19968
19969 return b.iushln(shift);
19970 };
19971
19972 // Invert number in the field F(num)
19973 BN.prototype.invm = function invm (num) {
19974 return this.egcd(num).a.umod(num);
19975 };
19976
19977 BN.prototype.isEven = function isEven () {
19978 return (this.words[0] & 1) === 0;
19979 };
19980
19981 BN.prototype.isOdd = function isOdd () {
19982 return (this.words[0] & 1) === 1;
19983 };
19984
19985 // And first word and num
19986 BN.prototype.andln = function andln (num) {
19987 return this.words[0] & num;
19988 };
19989
19990 // Increment at the bit position in-line
19991 BN.prototype.bincn = function bincn (bit) {
19992 assert(typeof bit === 'number');
19993 var r = bit % 26;
19994 var s = (bit - r) / 26;
19995 var q = 1 << r;
19996
19997 // Fast case: bit is much higher than all existing words
19998 if (this.length <= s) {
19999 this._expand(s + 1);
20000 this.words[s] |= q;
20001 return this;
20002 }
20003
20004 // Add bit and propagate, if needed
20005 var carry = q;
20006 for (var i = s; carry !== 0 && i < this.length; i++) {
20007 var w = this.words[i] | 0;
20008 w += carry;
20009 carry = w >>> 26;
20010 w &= 0x3ffffff;
20011 this.words[i] = w;
20012 }
20013 if (carry !== 0) {
20014 this.words[i] = carry;
20015 this.length++;
20016 }
20017 return this;
20018 };
20019
20020 BN.prototype.isZero = function isZero () {
20021 return this.length === 1 && this.words[0] === 0;
20022 };
20023
20024 BN.prototype.cmpn = function cmpn (num) {
20025 var negative = num < 0;
20026
20027 if (this.negative !== 0 && !negative) return -1;
20028 if (this.negative === 0 && negative) return 1;
20029
20030 this.strip();
20031
20032 var res;
20033 if (this.length > 1) {
20034 res = 1;
20035 } else {
20036 if (negative) {
20037 num = -num;
20038 }
20039
20040 assert(num <= 0x3ffffff, 'Number is too big');
20041
20042 var w = this.words[0] | 0;
20043 res = w === num ? 0 : w < num ? -1 : 1;
20044 }
20045 if (this.negative !== 0) return -res | 0;
20046 return res;
20047 };
20048
20049 // Compare two numbers and return:
20050 // 1 - if `this` > `num`
20051 // 0 - if `this` == `num`
20052 // -1 - if `this` < `num`
20053 BN.prototype.cmp = function cmp (num) {
20054 if (this.negative !== 0 && num.negative === 0) return -1;
20055 if (this.negative === 0 && num.negative !== 0) return 1;
20056
20057 var res = this.ucmp(num);
20058 if (this.negative !== 0) return -res | 0;
20059 return res;
20060 };
20061
20062 // Unsigned comparison
20063 BN.prototype.ucmp = function ucmp (num) {
20064 // At this point both numbers have the same sign
20065 if (this.length > num.length) return 1;
20066 if (this.length < num.length) return -1;
20067
20068 var res = 0;
20069 for (var i = this.length - 1; i >= 0; i--) {
20070 var a = this.words[i] | 0;
20071 var b = num.words[i] | 0;
20072
20073 if (a === b) continue;
20074 if (a < b) {
20075 res = -1;
20076 } else if (a > b) {
20077 res = 1;
20078 }
20079 break;
20080 }
20081 return res;
20082 };
20083
20084 BN.prototype.gtn = function gtn (num) {
20085 return this.cmpn(num) === 1;
20086 };
20087
20088 BN.prototype.gt = function gt (num) {
20089 return this.cmp(num) === 1;
20090 };
20091
20092 BN.prototype.gten = function gten (num) {
20093 return this.cmpn(num) >= 0;
20094 };
20095
20096 BN.prototype.gte = function gte (num) {
20097 return this.cmp(num) >= 0;
20098 };
20099
20100 BN.prototype.ltn = function ltn (num) {
20101 return this.cmpn(num) === -1;
20102 };
20103
20104 BN.prototype.lt = function lt (num) {
20105 return this.cmp(num) === -1;
20106 };
20107
20108 BN.prototype.lten = function lten (num) {
20109 return this.cmpn(num) <= 0;
20110 };
20111
20112 BN.prototype.lte = function lte (num) {
20113 return this.cmp(num) <= 0;
20114 };
20115
20116 BN.prototype.eqn = function eqn (num) {
20117 return this.cmpn(num) === 0;
20118 };
20119
20120 BN.prototype.eq = function eq (num) {
20121 return this.cmp(num) === 0;
20122 };
20123
20124 //
20125 // A reduce context, could be using montgomery or something better, depending
20126 // on the `m` itself.
20127 //
20128 BN.red = function red (num) {
20129 return new Red(num);
20130 };
20131
20132 BN.prototype.toRed = function toRed (ctx) {
20133 assert(!this.red, 'Already a number in reduction context');
20134 assert(this.negative === 0, 'red works only with positives');
20135 return ctx.convertTo(this)._forceRed(ctx);
20136 };
20137
20138 BN.prototype.fromRed = function fromRed () {
20139 assert(this.red, 'fromRed works only with numbers in reduction context');
20140 return this.red.convertFrom(this);
20141 };
20142
20143 BN.prototype._forceRed = function _forceRed (ctx) {
20144 this.red = ctx;
20145 return this;
20146 };
20147
20148 BN.prototype.forceRed = function forceRed (ctx) {
20149 assert(!this.red, 'Already a number in reduction context');
20150 return this._forceRed(ctx);
20151 };
20152
20153 BN.prototype.redAdd = function redAdd (num) {
20154 assert(this.red, 'redAdd works only with red numbers');
20155 return this.red.add(this, num);
20156 };
20157
20158 BN.prototype.redIAdd = function redIAdd (num) {
20159 assert(this.red, 'redIAdd works only with red numbers');
20160 return this.red.iadd(this, num);
20161 };
20162
20163 BN.prototype.redSub = function redSub (num) {
20164 assert(this.red, 'redSub works only with red numbers');
20165 return this.red.sub(this, num);
20166 };
20167
20168 BN.prototype.redISub = function redISub (num) {
20169 assert(this.red, 'redISub works only with red numbers');
20170 return this.red.isub(this, num);
20171 };
20172
20173 BN.prototype.redShl = function redShl (num) {
20174 assert(this.red, 'redShl works only with red numbers');
20175 return this.red.shl(this, num);
20176 };
20177
20178 BN.prototype.redMul = function redMul (num) {
20179 assert(this.red, 'redMul works only with red numbers');
20180 this.red._verify2(this, num);
20181 return this.red.mul(this, num);
20182 };
20183
20184 BN.prototype.redIMul = function redIMul (num) {
20185 assert(this.red, 'redMul works only with red numbers');
20186 this.red._verify2(this, num);
20187 return this.red.imul(this, num);
20188 };
20189
20190 BN.prototype.redSqr = function redSqr () {
20191 assert(this.red, 'redSqr works only with red numbers');
20192 this.red._verify1(this);
20193 return this.red.sqr(this);
20194 };
20195
20196 BN.prototype.redISqr = function redISqr () {
20197 assert(this.red, 'redISqr works only with red numbers');
20198 this.red._verify1(this);
20199 return this.red.isqr(this);
20200 };
20201
20202 // Square root over p
20203 BN.prototype.redSqrt = function redSqrt () {
20204 assert(this.red, 'redSqrt works only with red numbers');
20205 this.red._verify1(this);
20206 return this.red.sqrt(this);
20207 };
20208
20209 BN.prototype.redInvm = function redInvm () {
20210 assert(this.red, 'redInvm works only with red numbers');
20211 this.red._verify1(this);
20212 return this.red.invm(this);
20213 };
20214
20215 // Return negative clone of `this` % `red modulo`
20216 BN.prototype.redNeg = function redNeg () {
20217 assert(this.red, 'redNeg works only with red numbers');
20218 this.red._verify1(this);
20219 return this.red.neg(this);
20220 };
20221
20222 BN.prototype.redPow = function redPow (num) {
20223 assert(this.red && !num.red, 'redPow(normalNum)');
20224 this.red._verify1(this);
20225 return this.red.pow(this, num);
20226 };
20227
20228 // Prime numbers with efficient reduction
20229 var primes = {
20230 k256: null,
20231 p224: null,
20232 p192: null,
20233 p25519: null
20234 };
20235
20236 // Pseudo-Mersenne prime
20237 function MPrime (name, p) {
20238 // P = 2 ^ N - K
20239 this.name = name;
20240 this.p = new BN(p, 16);
20241 this.n = this.p.bitLength();
20242 this.k = new BN(1).iushln(this.n).isub(this.p);
20243
20244 this.tmp = this._tmp();
20245 }
20246
20247 MPrime.prototype._tmp = function _tmp () {
20248 var tmp = new BN(null);
20249 tmp.words = new Array(Math.ceil(this.n / 13));
20250 return tmp;
20251 };
20252
20253 MPrime.prototype.ireduce = function ireduce (num) {
20254 // Assumes that `num` is less than `P^2`
20255 // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
20256 var r = num;
20257 var rlen;
20258
20259 do {
20260 this.split(r, this.tmp);
20261 r = this.imulK(r);
20262 r = r.iadd(this.tmp);
20263 rlen = r.bitLength();
20264 } while (rlen > this.n);
20265
20266 var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
20267 if (cmp === 0) {
20268 r.words[0] = 0;
20269 r.length = 1;
20270 } else if (cmp > 0) {
20271 r.isub(this.p);
20272 } else {
20273 r.strip();
20274 }
20275
20276 return r;
20277 };
20278
20279 MPrime.prototype.split = function split (input, out) {
20280 input.iushrn(this.n, 0, out);
20281 };
20282
20283 MPrime.prototype.imulK = function imulK (num) {
20284 return num.imul(this.k);
20285 };
20286
20287 function K256 () {
20288 MPrime.call(
20289 this,
20290 'k256',
20291 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
20292 }
20293 inherits(K256, MPrime);
20294
20295 K256.prototype.split = function split (input, output) {
20296 // 256 = 9 * 26 + 22
20297 var mask = 0x3fffff;
20298
20299 var outLen = Math.min(input.length, 9);
20300 for (var i = 0; i < outLen; i++) {
20301 output.words[i] = input.words[i];
20302 }
20303 output.length = outLen;
20304
20305 if (input.length <= 9) {
20306 input.words[0] = 0;
20307 input.length = 1;
20308 return;
20309 }
20310
20311 // Shift by 9 limbs
20312 var prev = input.words[9];
20313 output.words[output.length++] = prev & mask;
20314
20315 for (i = 10; i < input.length; i++) {
20316 var next = input.words[i] | 0;
20317 input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
20318 prev = next;
20319 }
20320 prev >>>= 22;
20321 input.words[i - 10] = prev;
20322 if (prev === 0 && input.length > 10) {
20323 input.length -= 10;
20324 } else {
20325 input.length -= 9;
20326 }
20327 };
20328
20329 K256.prototype.imulK = function imulK (num) {
20330 // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
20331 num.words[num.length] = 0;
20332 num.words[num.length + 1] = 0;
20333 num.length += 2;
20334
20335 // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
20336 var lo = 0;
20337 for (var i = 0; i < num.length; i++) {
20338 var w = num.words[i] | 0;
20339 lo += w * 0x3d1;
20340 num.words[i] = lo & 0x3ffffff;
20341 lo = w * 0x40 + ((lo / 0x4000000) | 0);
20342 }
20343
20344 // Fast length reduction
20345 if (num.words[num.length - 1] === 0) {
20346 num.length--;
20347 if (num.words[num.length - 1] === 0) {
20348 num.length--;
20349 }
20350 }
20351 return num;
20352 };
20353
20354 function P224 () {
20355 MPrime.call(
20356 this,
20357 'p224',
20358 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
20359 }
20360 inherits(P224, MPrime);
20361
20362 function P192 () {
20363 MPrime.call(
20364 this,
20365 'p192',
20366 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
20367 }
20368 inherits(P192, MPrime);
20369
20370 function P25519 () {
20371 // 2 ^ 255 - 19
20372 MPrime.call(
20373 this,
20374 '25519',
20375 '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
20376 }
20377 inherits(P25519, MPrime);
20378
20379 P25519.prototype.imulK = function imulK (num) {
20380 // K = 0x13
20381 var carry = 0;
20382 for (var i = 0; i < num.length; i++) {
20383 var hi = (num.words[i] | 0) * 0x13 + carry;
20384 var lo = hi & 0x3ffffff;
20385 hi >>>= 26;
20386
20387 num.words[i] = lo;
20388 carry = hi;
20389 }
20390 if (carry !== 0) {
20391 num.words[num.length++] = carry;
20392 }
20393 return num;
20394 };
20395
20396 // Exported mostly for testing purposes, use plain name instead
20397 BN._prime = function prime (name) {
20398 // Cached version of prime
20399 if (primes[name]) return primes[name];
20400
20401 var prime;
20402 if (name === 'k256') {
20403 prime = new K256();
20404 } else if (name === 'p224') {
20405 prime = new P224();
20406 } else if (name === 'p192') {
20407 prime = new P192();
20408 } else if (name === 'p25519') {
20409 prime = new P25519();
20410 } else {
20411 throw new Error('Unknown prime ' + name);
20412 }
20413 primes[name] = prime;
20414
20415 return prime;
20416 };
20417
20418 //
20419 // Base reduction engine
20420 //
20421 function Red (m) {
20422 if (typeof m === 'string') {
20423 var prime = BN._prime(m);
20424 this.m = prime.p;
20425 this.prime = prime;
20426 } else {
20427 assert(m.gtn(1), 'modulus must be greater than 1');
20428 this.m = m;
20429 this.prime = null;
20430 }
20431 }
20432
20433 Red.prototype._verify1 = function _verify1 (a) {
20434 assert(a.negative === 0, 'red works only with positives');
20435 assert(a.red, 'red works only with red numbers');
20436 };
20437
20438 Red.prototype._verify2 = function _verify2 (a, b) {
20439 assert((a.negative | b.negative) === 0, 'red works only with positives');
20440 assert(a.red && a.red === b.red,
20441 'red works only with red numbers');
20442 };
20443
20444 Red.prototype.imod = function imod (a) {
20445 if (this.prime) return this.prime.ireduce(a)._forceRed(this);
20446 return a.umod(this.m)._forceRed(this);
20447 };
20448
20449 Red.prototype.neg = function neg (a) {
20450 if (a.isZero()) {
20451 return a.clone();
20452 }
20453
20454 return this.m.sub(a)._forceRed(this);
20455 };
20456
20457 Red.prototype.add = function add (a, b) {
20458 this._verify2(a, b);
20459
20460 var res = a.add(b);
20461 if (res.cmp(this.m) >= 0) {
20462 res.isub(this.m);
20463 }
20464 return res._forceRed(this);
20465 };
20466
20467 Red.prototype.iadd = function iadd (a, b) {
20468 this._verify2(a, b);
20469
20470 var res = a.iadd(b);
20471 if (res.cmp(this.m) >= 0) {
20472 res.isub(this.m);
20473 }
20474 return res;
20475 };
20476
20477 Red.prototype.sub = function sub (a, b) {
20478 this._verify2(a, b);
20479
20480 var res = a.sub(b);
20481 if (res.cmpn(0) < 0) {
20482 res.iadd(this.m);
20483 }
20484 return res._forceRed(this);
20485 };
20486
20487 Red.prototype.isub = function isub (a, b) {
20488 this._verify2(a, b);
20489
20490 var res = a.isub(b);
20491 if (res.cmpn(0) < 0) {
20492 res.iadd(this.m);
20493 }
20494 return res;
20495 };
20496
20497 Red.prototype.shl = function shl (a, num) {
20498 this._verify1(a);
20499 return this.imod(a.ushln(num));
20500 };
20501
20502 Red.prototype.imul = function imul (a, b) {
20503 this._verify2(a, b);
20504 return this.imod(a.imul(b));
20505 };
20506
20507 Red.prototype.mul = function mul (a, b) {
20508 this._verify2(a, b);
20509 return this.imod(a.mul(b));
20510 };
20511
20512 Red.prototype.isqr = function isqr (a) {
20513 return this.imul(a, a.clone());
20514 };
20515
20516 Red.prototype.sqr = function sqr (a) {
20517 return this.mul(a, a);
20518 };
20519
20520 Red.prototype.sqrt = function sqrt (a) {
20521 if (a.isZero()) return a.clone();
20522
20523 var mod3 = this.m.andln(3);
20524 assert(mod3 % 2 === 1);
20525
20526 // Fast case
20527 if (mod3 === 3) {
20528 var pow = this.m.add(new BN(1)).iushrn(2);
20529 return this.pow(a, pow);
20530 }
20531
20532 // Tonelli-Shanks algorithm (Totally unoptimized and slow)
20533 //
20534 // Find Q and S, that Q * 2 ^ S = (P - 1)
20535 var q = this.m.subn(1);
20536 var s = 0;
20537 while (!q.isZero() && q.andln(1) === 0) {
20538 s++;
20539 q.iushrn(1);
20540 }
20541 assert(!q.isZero());
20542
20543 var one = new BN(1).toRed(this);
20544 var nOne = one.redNeg();
20545
20546 // Find quadratic non-residue
20547 // NOTE: Max is such because of generalized Riemann hypothesis.
20548 var lpow = this.m.subn(1).iushrn(1);
20549 var z = this.m.bitLength();
20550 z = new BN(2 * z * z).toRed(this);
20551
20552 while (this.pow(z, lpow).cmp(nOne) !== 0) {
20553 z.redIAdd(nOne);
20554 }
20555
20556 var c = this.pow(z, q);
20557 var r = this.pow(a, q.addn(1).iushrn(1));
20558 var t = this.pow(a, q);
20559 var m = s;
20560 while (t.cmp(one) !== 0) {
20561 var tmp = t;
20562 for (var i = 0; tmp.cmp(one) !== 0; i++) {
20563 tmp = tmp.redSqr();
20564 }
20565 assert(i < m);
20566 var b = this.pow(c, new BN(1).iushln(m - i - 1));
20567
20568 r = r.redMul(b);
20569 c = b.redSqr();
20570 t = t.redMul(c);
20571 m = i;
20572 }
20573
20574 return r;
20575 };
20576
20577 Red.prototype.invm = function invm (a) {
20578 var inv = a._invmp(this.m);
20579 if (inv.negative !== 0) {
20580 inv.negative = 0;
20581 return this.imod(inv).redNeg();
20582 } else {
20583 return this.imod(inv);
20584 }
20585 };
20586
20587 Red.prototype.pow = function pow (a, num) {
20588 if (num.isZero()) return new BN(1).toRed(this);
20589 if (num.cmpn(1) === 0) return a.clone();
20590
20591 var windowSize = 4;
20592 var wnd = new Array(1 << windowSize);
20593 wnd[0] = new BN(1).toRed(this);
20594 wnd[1] = a;
20595 for (var i = 2; i < wnd.length; i++) {
20596 wnd[i] = this.mul(wnd[i - 1], a);
20597 }
20598
20599 var res = wnd[0];
20600 var current = 0;
20601 var currentLen = 0;
20602 var start = num.bitLength() % 26;
20603 if (start === 0) {
20604 start = 26;
20605 }
20606
20607 for (i = num.length - 1; i >= 0; i--) {
20608 var word = num.words[i];
20609 for (var j = start - 1; j >= 0; j--) {
20610 var bit = (word >> j) & 1;
20611 if (res !== wnd[0]) {
20612 res = this.sqr(res);
20613 }
20614
20615 if (bit === 0 && current === 0) {
20616 currentLen = 0;
20617 continue;
20618 }
20619
20620 current <<= 1;
20621 current |= bit;
20622 currentLen++;
20623 if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
20624
20625 res = this.mul(res, wnd[current]);
20626 currentLen = 0;
20627 current = 0;
20628 }
20629 start = 26;
20630 }
20631
20632 return res;
20633 };
20634
20635 Red.prototype.convertTo = function convertTo (num) {
20636 var r = num.umod(this.m);
20637
20638 return r === num ? r.clone() : r;
20639 };
20640
20641 Red.prototype.convertFrom = function convertFrom (num) {
20642 var res = num.clone();
20643 res.red = null;
20644 return res;
20645 };
20646
20647 //
20648 // Montgomery method engine
20649 //
20650
20651 BN.mont = function mont (num) {
20652 return new Mont(num);
20653 };
20654
20655 function Mont (m) {
20656 Red.call(this, m);
20657
20658 this.shift = this.m.bitLength();
20659 if (this.shift % 26 !== 0) {
20660 this.shift += 26 - (this.shift % 26);
20661 }
20662
20663 this.r = new BN(1).iushln(this.shift);
20664 this.r2 = this.imod(this.r.sqr());
20665 this.rinv = this.r._invmp(this.m);
20666
20667 this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
20668 this.minv = this.minv.umod(this.r);
20669 this.minv = this.r.sub(this.minv);
20670 }
20671 inherits(Mont, Red);
20672
20673 Mont.prototype.convertTo = function convertTo (num) {
20674 return this.imod(num.ushln(this.shift));
20675 };
20676
20677 Mont.prototype.convertFrom = function convertFrom (num) {
20678 var r = this.imod(num.mul(this.rinv));
20679 r.red = null;
20680 return r;
20681 };
20682
20683 Mont.prototype.imul = function imul (a, b) {
20684 if (a.isZero() || b.isZero()) {
20685 a.words[0] = 0;
20686 a.length = 1;
20687 return a;
20688 }
20689
20690 var t = a.imul(b);
20691 var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
20692 var u = t.isub(c).iushrn(this.shift);
20693 var res = u;
20694
20695 if (u.cmp(this.m) >= 0) {
20696 res = u.isub(this.m);
20697 } else if (u.cmpn(0) < 0) {
20698 res = u.iadd(this.m);
20699 }
20700
20701 return res._forceRed(this);
20702 };
20703
20704 Mont.prototype.mul = function mul (a, b) {
20705 if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
20706
20707 var t = a.mul(b);
20708 var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
20709 var u = t.isub(c).iushrn(this.shift);
20710 var res = u;
20711 if (u.cmp(this.m) >= 0) {
20712 res = u.isub(this.m);
20713 } else if (u.cmpn(0) < 0) {
20714 res = u.iadd(this.m);
20715 }
20716
20717 return res._forceRed(this);
20718 };
20719
20720 Mont.prototype.invm = function invm (a) {
20721 // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
20722 var res = this.imod(a._invmp(this.m).mul(this.r2));
20723 return res._forceRed(this);
20724 };
20725})(typeof module === 'undefined' || module, this);
20726
20727},{"buffer":110}],109:[function(require,module,exports){
20728var r;
20729
20730module.exports = function rand(len) {
20731 if (!r)
20732 r = new Rand(null);
20733
20734 return r.generate(len);
20735};
20736
20737function Rand(rand) {
20738 this.rand = rand;
20739}
20740module.exports.Rand = Rand;
20741
20742Rand.prototype.generate = function generate(len) {
20743 return this._rand(len);
20744};
20745
20746// Emulate crypto API using randy
20747Rand.prototype._rand = function _rand(n) {
20748 if (this.rand.getBytes)
20749 return this.rand.getBytes(n);
20750
20751 var res = new Uint8Array(n);
20752 for (var i = 0; i < res.length; i++)
20753 res[i] = this.rand.getByte();
20754 return res;
20755};
20756
20757if (typeof self === 'object') {
20758 if (self.crypto && self.crypto.getRandomValues) {
20759 // Modern browsers
20760 Rand.prototype._rand = function _rand(n) {
20761 var arr = new Uint8Array(n);
20762 self.crypto.getRandomValues(arr);
20763 return arr;
20764 };
20765 } else if (self.msCrypto && self.msCrypto.getRandomValues) {
20766 // IE
20767 Rand.prototype._rand = function _rand(n) {
20768 var arr = new Uint8Array(n);
20769 self.msCrypto.getRandomValues(arr);
20770 return arr;
20771 };
20772
20773 // Safari's WebWorkers do not have `crypto`
20774 } else if (typeof window === 'object') {
20775 // Old junk
20776 Rand.prototype._rand = function() {
20777 throw new Error('Not implemented yet');
20778 };
20779 }
20780} else {
20781 // Node.js or Web worker with no crypto support
20782 try {
20783 var crypto = require('crypto');
20784 if (typeof crypto.randomBytes !== 'function')
20785 throw new Error('Not supported');
20786
20787 Rand.prototype._rand = function _rand(n) {
20788 return crypto.randomBytes(n);
20789 };
20790 } catch (e) {
20791 }
20792}
20793
20794},{"crypto":110}],110:[function(require,module,exports){
20795
20796},{}],111:[function(require,module,exports){
20797// based on the aes implimentation in triple sec
20798// https://github.com/keybase/triplesec
20799// which is in turn based on the one from crypto-js
20800// https://code.google.com/p/crypto-js/
20801
20802var Buffer = require('safe-buffer').Buffer
20803
20804function asUInt32Array (buf) {
20805 if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
20806
20807 var len = (buf.length / 4) | 0
20808 var out = new Array(len)
20809
20810 for (var i = 0; i < len; i++) {
20811 out[i] = buf.readUInt32BE(i * 4)
20812 }
20813
20814 return out
20815}
20816
20817function scrubVec (v) {
20818 for (var i = 0; i < v.length; v++) {
20819 v[i] = 0
20820 }
20821}
20822
20823function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
20824 var SUB_MIX0 = SUB_MIX[0]
20825 var SUB_MIX1 = SUB_MIX[1]
20826 var SUB_MIX2 = SUB_MIX[2]
20827 var SUB_MIX3 = SUB_MIX[3]
20828
20829 var s0 = M[0] ^ keySchedule[0]
20830 var s1 = M[1] ^ keySchedule[1]
20831 var s2 = M[2] ^ keySchedule[2]
20832 var s3 = M[3] ^ keySchedule[3]
20833 var t0, t1, t2, t3
20834 var ksRow = 4
20835
20836 for (var round = 1; round < nRounds; round++) {
20837 t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
20838 t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
20839 t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
20840 t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
20841 s0 = t0
20842 s1 = t1
20843 s2 = t2
20844 s3 = t3
20845 }
20846
20847 t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
20848 t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
20849 t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
20850 t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
20851 t0 = t0 >>> 0
20852 t1 = t1 >>> 0
20853 t2 = t2 >>> 0
20854 t3 = t3 >>> 0
20855
20856 return [t0, t1, t2, t3]
20857}
20858
20859// AES constants
20860var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
20861var G = (function () {
20862 // Compute double table
20863 var d = new Array(256)
20864 for (var j = 0; j < 256; j++) {
20865 if (j < 128) {
20866 d[j] = j << 1
20867 } else {
20868 d[j] = (j << 1) ^ 0x11b
20869 }
20870 }
20871
20872 var SBOX = []
20873 var INV_SBOX = []
20874 var SUB_MIX = [[], [], [], []]
20875 var INV_SUB_MIX = [[], [], [], []]
20876
20877 // Walk GF(2^8)
20878 var x = 0
20879 var xi = 0
20880 for (var i = 0; i < 256; ++i) {
20881 // Compute sbox
20882 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
20883 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
20884 SBOX[x] = sx
20885 INV_SBOX[sx] = x
20886
20887 // Compute multiplication
20888 var x2 = d[x]
20889 var x4 = d[x2]
20890 var x8 = d[x4]
20891
20892 // Compute sub bytes, mix columns tables
20893 var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
20894 SUB_MIX[0][x] = (t << 24) | (t >>> 8)
20895 SUB_MIX[1][x] = (t << 16) | (t >>> 16)
20896 SUB_MIX[2][x] = (t << 8) | (t >>> 24)
20897 SUB_MIX[3][x] = t
20898
20899 // Compute inv sub bytes, inv mix columns tables
20900 t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
20901 INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
20902 INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
20903 INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
20904 INV_SUB_MIX[3][sx] = t
20905
20906 if (x === 0) {
20907 x = xi = 1
20908 } else {
20909 x = x2 ^ d[d[d[x8 ^ x2]]]
20910 xi ^= d[d[xi]]
20911 }
20912 }
20913
20914 return {
20915 SBOX: SBOX,
20916 INV_SBOX: INV_SBOX,
20917 SUB_MIX: SUB_MIX,
20918 INV_SUB_MIX: INV_SUB_MIX
20919 }
20920})()
20921
20922function AES (key) {
20923 this._key = asUInt32Array(key)
20924 this._reset()
20925}
20926
20927AES.blockSize = 4 * 4
20928AES.keySize = 256 / 8
20929AES.prototype.blockSize = AES.blockSize
20930AES.prototype.keySize = AES.keySize
20931AES.prototype._reset = function () {
20932 var keyWords = this._key
20933 var keySize = keyWords.length
20934 var nRounds = keySize + 6
20935 var ksRows = (nRounds + 1) * 4
20936
20937 var keySchedule = []
20938 for (var k = 0; k < keySize; k++) {
20939 keySchedule[k] = keyWords[k]
20940 }
20941
20942 for (k = keySize; k < ksRows; k++) {
20943 var t = keySchedule[k - 1]
20944
20945 if (k % keySize === 0) {
20946 t = (t << 8) | (t >>> 24)
20947 t =
20948 (G.SBOX[t >>> 24] << 24) |
20949 (G.SBOX[(t >>> 16) & 0xff] << 16) |
20950 (G.SBOX[(t >>> 8) & 0xff] << 8) |
20951 (G.SBOX[t & 0xff])
20952
20953 t ^= RCON[(k / keySize) | 0] << 24
20954 } else if (keySize > 6 && k % keySize === 4) {
20955 t =
20956 (G.SBOX[t >>> 24] << 24) |
20957 (G.SBOX[(t >>> 16) & 0xff] << 16) |
20958 (G.SBOX[(t >>> 8) & 0xff] << 8) |
20959 (G.SBOX[t & 0xff])
20960 }
20961
20962 keySchedule[k] = keySchedule[k - keySize] ^ t
20963 }
20964
20965 var invKeySchedule = []
20966 for (var ik = 0; ik < ksRows; ik++) {
20967 var ksR = ksRows - ik
20968 var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
20969
20970 if (ik < 4 || ksR <= 4) {
20971 invKeySchedule[ik] = tt
20972 } else {
20973 invKeySchedule[ik] =
20974 G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
20975 G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
20976 G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
20977 G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
20978 }
20979 }
20980
20981 this._nRounds = nRounds
20982 this._keySchedule = keySchedule
20983 this._invKeySchedule = invKeySchedule
20984}
20985
20986AES.prototype.encryptBlockRaw = function (M) {
20987 M = asUInt32Array(M)
20988 return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
20989}
20990
20991AES.prototype.encryptBlock = function (M) {
20992 var out = this.encryptBlockRaw(M)
20993 var buf = Buffer.allocUnsafe(16)
20994 buf.writeUInt32BE(out[0], 0)
20995 buf.writeUInt32BE(out[1], 4)
20996 buf.writeUInt32BE(out[2], 8)
20997 buf.writeUInt32BE(out[3], 12)
20998 return buf
20999}
21000
21001AES.prototype.decryptBlock = function (M) {
21002 M = asUInt32Array(M)
21003
21004 // swap
21005 var m1 = M[1]
21006 M[1] = M[3]
21007 M[3] = m1
21008
21009 var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
21010 var buf = Buffer.allocUnsafe(16)
21011 buf.writeUInt32BE(out[0], 0)
21012 buf.writeUInt32BE(out[3], 4)
21013 buf.writeUInt32BE(out[2], 8)
21014 buf.writeUInt32BE(out[1], 12)
21015 return buf
21016}
21017
21018AES.prototype.scrub = function () {
21019 scrubVec(this._keySchedule)
21020 scrubVec(this._invKeySchedule)
21021 scrubVec(this._key)
21022}
21023
21024module.exports.AES = AES
21025
21026},{"safe-buffer":742}],112:[function(require,module,exports){
21027var aes = require('./aes')
21028var Buffer = require('safe-buffer').Buffer
21029var Transform = require('cipher-base')
21030var inherits = require('inherits')
21031var GHASH = require('./ghash')
21032var xor = require('buffer-xor')
21033var incr32 = require('./incr32')
21034
21035function xorTest (a, b) {
21036 var out = 0
21037 if (a.length !== b.length) out++
21038
21039 var len = Math.min(a.length, b.length)
21040 for (var i = 0; i < len; ++i) {
21041 out += (a[i] ^ b[i])
21042 }
21043
21044 return out
21045}
21046
21047function calcIv (self, iv, ck) {
21048 if (iv.length === 12) {
21049 self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
21050 return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
21051 }
21052 var ghash = new GHASH(ck)
21053 var len = iv.length
21054 var toPad = len % 16
21055 ghash.update(iv)
21056 if (toPad) {
21057 toPad = 16 - toPad
21058 ghash.update(Buffer.alloc(toPad, 0))
21059 }
21060 ghash.update(Buffer.alloc(8, 0))
21061 var ivBits = len * 8
21062 var tail = Buffer.alloc(8)
21063 tail.writeUIntBE(ivBits, 0, 8)
21064 ghash.update(tail)
21065 self._finID = ghash.state
21066 var out = Buffer.from(self._finID)
21067 incr32(out)
21068 return out
21069}
21070function StreamCipher (mode, key, iv, decrypt) {
21071 Transform.call(this)
21072
21073 var h = Buffer.alloc(4, 0)
21074
21075 this._cipher = new aes.AES(key)
21076 var ck = this._cipher.encryptBlock(h)
21077 this._ghash = new GHASH(ck)
21078 iv = calcIv(this, iv, ck)
21079
21080 this._prev = Buffer.from(iv)
21081 this._cache = Buffer.allocUnsafe(0)
21082 this._secCache = Buffer.allocUnsafe(0)
21083 this._decrypt = decrypt
21084 this._alen = 0
21085 this._len = 0
21086 this._mode = mode
21087
21088 this._authTag = null
21089 this._called = false
21090}
21091
21092inherits(StreamCipher, Transform)
21093
21094StreamCipher.prototype._update = function (chunk) {
21095 if (!this._called && this._alen) {
21096 var rump = 16 - (this._alen % 16)
21097 if (rump < 16) {
21098 rump = Buffer.alloc(rump, 0)
21099 this._ghash.update(rump)
21100 }
21101 }
21102
21103 this._called = true
21104 var out = this._mode.encrypt(this, chunk)
21105 if (this._decrypt) {
21106 this._ghash.update(chunk)
21107 } else {
21108 this._ghash.update(out)
21109 }
21110 this._len += chunk.length
21111 return out
21112}
21113
21114StreamCipher.prototype._final = function () {
21115 if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
21116
21117 var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
21118 if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
21119
21120 this._authTag = tag
21121 this._cipher.scrub()
21122}
21123
21124StreamCipher.prototype.getAuthTag = function getAuthTag () {
21125 if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
21126
21127 return this._authTag
21128}
21129
21130StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
21131 if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
21132
21133 this._authTag = tag
21134}
21135
21136StreamCipher.prototype.setAAD = function setAAD (buf) {
21137 if (this._called) throw new Error('Attempting to set AAD in unsupported state')
21138
21139 this._ghash.update(buf)
21140 this._alen += buf.length
21141}
21142
21143module.exports = StreamCipher
21144
21145},{"./aes":111,"./ghash":116,"./incr32":117,"buffer-xor":144,"cipher-base":155,"inherits":396,"safe-buffer":742}],113:[function(require,module,exports){
21146var ciphers = require('./encrypter')
21147var deciphers = require('./decrypter')
21148var modes = require('./modes/list.json')
21149
21150function getCiphers () {
21151 return Object.keys(modes)
21152}
21153
21154exports.createCipher = exports.Cipher = ciphers.createCipher
21155exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
21156exports.createDecipher = exports.Decipher = deciphers.createDecipher
21157exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
21158exports.listCiphers = exports.getCiphers = getCiphers
21159
21160},{"./decrypter":114,"./encrypter":115,"./modes/list.json":125}],114:[function(require,module,exports){
21161var AuthCipher = require('./authCipher')
21162var Buffer = require('safe-buffer').Buffer
21163var MODES = require('./modes')
21164var StreamCipher = require('./streamCipher')
21165var Transform = require('cipher-base')
21166var aes = require('./aes')
21167var ebtk = require('evp_bytestokey')
21168var inherits = require('inherits')
21169
21170function Decipher (mode, key, iv) {
21171 Transform.call(this)
21172
21173 this._cache = new Splitter()
21174 this._last = void 0
21175 this._cipher = new aes.AES(key)
21176 this._prev = Buffer.from(iv)
21177 this._mode = mode
21178 this._autopadding = true
21179}
21180
21181inherits(Decipher, Transform)
21182
21183Decipher.prototype._update = function (data) {
21184 this._cache.add(data)
21185 var chunk
21186 var thing
21187 var out = []
21188 while ((chunk = this._cache.get(this._autopadding))) {
21189 thing = this._mode.decrypt(this, chunk)
21190 out.push(thing)
21191 }
21192 return Buffer.concat(out)
21193}
21194
21195Decipher.prototype._final = function () {
21196 var chunk = this._cache.flush()
21197 if (this._autopadding) {
21198 return unpad(this._mode.decrypt(this, chunk))
21199 } else if (chunk) {
21200 throw new Error('data not multiple of block length')
21201 }
21202}
21203
21204Decipher.prototype.setAutoPadding = function (setTo) {
21205 this._autopadding = !!setTo
21206 return this
21207}
21208
21209function Splitter () {
21210 this.cache = Buffer.allocUnsafe(0)
21211}
21212
21213Splitter.prototype.add = function (data) {
21214 this.cache = Buffer.concat([this.cache, data])
21215}
21216
21217Splitter.prototype.get = function (autoPadding) {
21218 var out
21219 if (autoPadding) {
21220 if (this.cache.length > 16) {
21221 out = this.cache.slice(0, 16)
21222 this.cache = this.cache.slice(16)
21223 return out
21224 }
21225 } else {
21226 if (this.cache.length >= 16) {
21227 out = this.cache.slice(0, 16)
21228 this.cache = this.cache.slice(16)
21229 return out
21230 }
21231 }
21232
21233 return null
21234}
21235
21236Splitter.prototype.flush = function () {
21237 if (this.cache.length) return this.cache
21238}
21239
21240function unpad (last) {
21241 var padded = last[15]
21242 if (padded < 1 || padded > 16) {
21243 throw new Error('unable to decrypt data')
21244 }
21245 var i = -1
21246 while (++i < padded) {
21247 if (last[(i + (16 - padded))] !== padded) {
21248 throw new Error('unable to decrypt data')
21249 }
21250 }
21251 if (padded === 16) return
21252
21253 return last.slice(0, 16 - padded)
21254}
21255
21256function createDecipheriv (suite, password, iv) {
21257 var config = MODES[suite.toLowerCase()]
21258 if (!config) throw new TypeError('invalid suite type')
21259
21260 if (typeof iv === 'string') iv = Buffer.from(iv)
21261 if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
21262
21263 if (typeof password === 'string') password = Buffer.from(password)
21264 if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
21265
21266 if (config.type === 'stream') {
21267 return new StreamCipher(config.module, password, iv, true)
21268 } else if (config.type === 'auth') {
21269 return new AuthCipher(config.module, password, iv, true)
21270 }
21271
21272 return new Decipher(config.module, password, iv)
21273}
21274
21275function createDecipher (suite, password) {
21276 var config = MODES[suite.toLowerCase()]
21277 if (!config) throw new TypeError('invalid suite type')
21278
21279 var keys = ebtk(password, false, config.key, config.iv)
21280 return createDecipheriv(suite, keys.key, keys.iv)
21281}
21282
21283exports.createDecipher = createDecipher
21284exports.createDecipheriv = createDecipheriv
21285
21286},{"./aes":111,"./authCipher":112,"./modes":124,"./streamCipher":127,"cipher-base":155,"evp_bytestokey":336,"inherits":396,"safe-buffer":742}],115:[function(require,module,exports){
21287var MODES = require('./modes')
21288var AuthCipher = require('./authCipher')
21289var Buffer = require('safe-buffer').Buffer
21290var StreamCipher = require('./streamCipher')
21291var Transform = require('cipher-base')
21292var aes = require('./aes')
21293var ebtk = require('evp_bytestokey')
21294var inherits = require('inherits')
21295
21296function Cipher (mode, key, iv) {
21297 Transform.call(this)
21298
21299 this._cache = new Splitter()
21300 this._cipher = new aes.AES(key)
21301 this._prev = Buffer.from(iv)
21302 this._mode = mode
21303 this._autopadding = true
21304}
21305
21306inherits(Cipher, Transform)
21307
21308Cipher.prototype._update = function (data) {
21309 this._cache.add(data)
21310 var chunk
21311 var thing
21312 var out = []
21313
21314 while ((chunk = this._cache.get())) {
21315 thing = this._mode.encrypt(this, chunk)
21316 out.push(thing)
21317 }
21318
21319 return Buffer.concat(out)
21320}
21321
21322var PADDING = Buffer.alloc(16, 0x10)
21323
21324Cipher.prototype._final = function () {
21325 var chunk = this._cache.flush()
21326 if (this._autopadding) {
21327 chunk = this._mode.encrypt(this, chunk)
21328 this._cipher.scrub()
21329 return chunk
21330 }
21331
21332 if (!chunk.equals(PADDING)) {
21333 this._cipher.scrub()
21334 throw new Error('data not multiple of block length')
21335 }
21336}
21337
21338Cipher.prototype.setAutoPadding = function (setTo) {
21339 this._autopadding = !!setTo
21340 return this
21341}
21342
21343function Splitter () {
21344 this.cache = Buffer.allocUnsafe(0)
21345}
21346
21347Splitter.prototype.add = function (data) {
21348 this.cache = Buffer.concat([this.cache, data])
21349}
21350
21351Splitter.prototype.get = function () {
21352 if (this.cache.length > 15) {
21353 var out = this.cache.slice(0, 16)
21354 this.cache = this.cache.slice(16)
21355 return out
21356 }
21357 return null
21358}
21359
21360Splitter.prototype.flush = function () {
21361 var len = 16 - this.cache.length
21362 var padBuff = Buffer.allocUnsafe(len)
21363
21364 var i = -1
21365 while (++i < len) {
21366 padBuff.writeUInt8(len, i)
21367 }
21368
21369 return Buffer.concat([this.cache, padBuff])
21370}
21371
21372function createCipheriv (suite, password, iv) {
21373 var config = MODES[suite.toLowerCase()]
21374 if (!config) throw new TypeError('invalid suite type')
21375
21376 if (typeof password === 'string') password = Buffer.from(password)
21377 if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
21378
21379 if (typeof iv === 'string') iv = Buffer.from(iv)
21380 if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
21381
21382 if (config.type === 'stream') {
21383 return new StreamCipher(config.module, password, iv)
21384 } else if (config.type === 'auth') {
21385 return new AuthCipher(config.module, password, iv)
21386 }
21387
21388 return new Cipher(config.module, password, iv)
21389}
21390
21391function createCipher (suite, password) {
21392 var config = MODES[suite.toLowerCase()]
21393 if (!config) throw new TypeError('invalid suite type')
21394
21395 var keys = ebtk(password, false, config.key, config.iv)
21396 return createCipheriv(suite, keys.key, keys.iv)
21397}
21398
21399exports.createCipheriv = createCipheriv
21400exports.createCipher = createCipher
21401
21402},{"./aes":111,"./authCipher":112,"./modes":124,"./streamCipher":127,"cipher-base":155,"evp_bytestokey":336,"inherits":396,"safe-buffer":742}],116:[function(require,module,exports){
21403var Buffer = require('safe-buffer').Buffer
21404var ZEROES = Buffer.alloc(16, 0)
21405
21406function toArray (buf) {
21407 return [
21408 buf.readUInt32BE(0),
21409 buf.readUInt32BE(4),
21410 buf.readUInt32BE(8),
21411 buf.readUInt32BE(12)
21412 ]
21413}
21414
21415function fromArray (out) {
21416 var buf = Buffer.allocUnsafe(16)
21417 buf.writeUInt32BE(out[0] >>> 0, 0)
21418 buf.writeUInt32BE(out[1] >>> 0, 4)
21419 buf.writeUInt32BE(out[2] >>> 0, 8)
21420 buf.writeUInt32BE(out[3] >>> 0, 12)
21421 return buf
21422}
21423
21424function GHASH (key) {
21425 this.h = key
21426 this.state = Buffer.alloc(16, 0)
21427 this.cache = Buffer.allocUnsafe(0)
21428}
21429
21430// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
21431// by Juho Vähä-Herttua
21432GHASH.prototype.ghash = function (block) {
21433 var i = -1
21434 while (++i < block.length) {
21435 this.state[i] ^= block[i]
21436 }
21437 this._multiply()
21438}
21439
21440GHASH.prototype._multiply = function () {
21441 var Vi = toArray(this.h)
21442 var Zi = [0, 0, 0, 0]
21443 var j, xi, lsbVi
21444 var i = -1
21445 while (++i < 128) {
21446 xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
21447 if (xi) {
21448 // Z_i+1 = Z_i ^ V_i
21449 Zi[0] ^= Vi[0]
21450 Zi[1] ^= Vi[1]
21451 Zi[2] ^= Vi[2]
21452 Zi[3] ^= Vi[3]
21453 }
21454
21455 // Store the value of LSB(V_i)
21456 lsbVi = (Vi[3] & 1) !== 0
21457
21458 // V_i+1 = V_i >> 1
21459 for (j = 3; j > 0; j--) {
21460 Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
21461 }
21462 Vi[0] = Vi[0] >>> 1
21463
21464 // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
21465 if (lsbVi) {
21466 Vi[0] = Vi[0] ^ (0xe1 << 24)
21467 }
21468 }
21469 this.state = fromArray(Zi)
21470}
21471
21472GHASH.prototype.update = function (buf) {
21473 this.cache = Buffer.concat([this.cache, buf])
21474 var chunk
21475 while (this.cache.length >= 16) {
21476 chunk = this.cache.slice(0, 16)
21477 this.cache = this.cache.slice(16)
21478 this.ghash(chunk)
21479 }
21480}
21481
21482GHASH.prototype.final = function (abl, bl) {
21483 if (this.cache.length) {
21484 this.ghash(Buffer.concat([this.cache, ZEROES], 16))
21485 }
21486
21487 this.ghash(fromArray([0, abl, 0, bl]))
21488 return this.state
21489}
21490
21491module.exports = GHASH
21492
21493},{"safe-buffer":742}],117:[function(require,module,exports){
21494function incr32 (iv) {
21495 var len = iv.length
21496 var item
21497 while (len--) {
21498 item = iv.readUInt8(len)
21499 if (item === 255) {
21500 iv.writeUInt8(0, len)
21501 } else {
21502 item++
21503 iv.writeUInt8(item, len)
21504 break
21505 }
21506 }
21507}
21508module.exports = incr32
21509
21510},{}],118:[function(require,module,exports){
21511var xor = require('buffer-xor')
21512
21513exports.encrypt = function (self, block) {
21514 var data = xor(block, self._prev)
21515
21516 self._prev = self._cipher.encryptBlock(data)
21517 return self._prev
21518}
21519
21520exports.decrypt = function (self, block) {
21521 var pad = self._prev
21522
21523 self._prev = block
21524 var out = self._cipher.decryptBlock(block)
21525
21526 return xor(out, pad)
21527}
21528
21529},{"buffer-xor":144}],119:[function(require,module,exports){
21530var Buffer = require('safe-buffer').Buffer
21531var xor = require('buffer-xor')
21532
21533function encryptStart (self, data, decrypt) {
21534 var len = data.length
21535 var out = xor(data, self._cache)
21536 self._cache = self._cache.slice(len)
21537 self._prev = Buffer.concat([self._prev, decrypt ? data : out])
21538 return out
21539}
21540
21541exports.encrypt = function (self, data, decrypt) {
21542 var out = Buffer.allocUnsafe(0)
21543 var len
21544
21545 while (data.length) {
21546 if (self._cache.length === 0) {
21547 self._cache = self._cipher.encryptBlock(self._prev)
21548 self._prev = Buffer.allocUnsafe(0)
21549 }
21550
21551 if (self._cache.length <= data.length) {
21552 len = self._cache.length
21553 out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
21554 data = data.slice(len)
21555 } else {
21556 out = Buffer.concat([out, encryptStart(self, data, decrypt)])
21557 break
21558 }
21559 }
21560
21561 return out
21562}
21563
21564},{"buffer-xor":144,"safe-buffer":742}],120:[function(require,module,exports){
21565var Buffer = require('safe-buffer').Buffer
21566
21567function encryptByte (self, byteParam, decrypt) {
21568 var pad
21569 var i = -1
21570 var len = 8
21571 var out = 0
21572 var bit, value
21573 while (++i < len) {
21574 pad = self._cipher.encryptBlock(self._prev)
21575 bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
21576 value = pad[0] ^ bit
21577 out += ((value & 0x80) >> (i % 8))
21578 self._prev = shiftIn(self._prev, decrypt ? bit : value)
21579 }
21580 return out
21581}
21582
21583function shiftIn (buffer, value) {
21584 var len = buffer.length
21585 var i = -1
21586 var out = Buffer.allocUnsafe(buffer.length)
21587 buffer = Buffer.concat([buffer, Buffer.from([value])])
21588
21589 while (++i < len) {
21590 out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
21591 }
21592
21593 return out
21594}
21595
21596exports.encrypt = function (self, chunk, decrypt) {
21597 var len = chunk.length
21598 var out = Buffer.allocUnsafe(len)
21599 var i = -1
21600
21601 while (++i < len) {
21602 out[i] = encryptByte(self, chunk[i], decrypt)
21603 }
21604
21605 return out
21606}
21607
21608},{"safe-buffer":742}],121:[function(require,module,exports){
21609var Buffer = require('safe-buffer').Buffer
21610
21611function encryptByte (self, byteParam, decrypt) {
21612 var pad = self._cipher.encryptBlock(self._prev)
21613 var out = pad[0] ^ byteParam
21614
21615 self._prev = Buffer.concat([
21616 self._prev.slice(1),
21617 Buffer.from([decrypt ? byteParam : out])
21618 ])
21619
21620 return out
21621}
21622
21623exports.encrypt = function (self, chunk, decrypt) {
21624 var len = chunk.length
21625 var out = Buffer.allocUnsafe(len)
21626 var i = -1
21627
21628 while (++i < len) {
21629 out[i] = encryptByte(self, chunk[i], decrypt)
21630 }
21631
21632 return out
21633}
21634
21635},{"safe-buffer":742}],122:[function(require,module,exports){
21636var xor = require('buffer-xor')
21637var Buffer = require('safe-buffer').Buffer
21638var incr32 = require('../incr32')
21639
21640function getBlock (self) {
21641 var out = self._cipher.encryptBlockRaw(self._prev)
21642 incr32(self._prev)
21643 return out
21644}
21645
21646var blockSize = 16
21647exports.encrypt = function (self, chunk) {
21648 var chunkNum = Math.ceil(chunk.length / blockSize)
21649 var start = self._cache.length
21650 self._cache = Buffer.concat([
21651 self._cache,
21652 Buffer.allocUnsafe(chunkNum * blockSize)
21653 ])
21654 for (var i = 0; i < chunkNum; i++) {
21655 var out = getBlock(self)
21656 var offset = start + i * blockSize
21657 self._cache.writeUInt32BE(out[0], offset + 0)
21658 self._cache.writeUInt32BE(out[1], offset + 4)
21659 self._cache.writeUInt32BE(out[2], offset + 8)
21660 self._cache.writeUInt32BE(out[3], offset + 12)
21661 }
21662 var pad = self._cache.slice(0, chunk.length)
21663 self._cache = self._cache.slice(chunk.length)
21664 return xor(chunk, pad)
21665}
21666
21667},{"../incr32":117,"buffer-xor":144,"safe-buffer":742}],123:[function(require,module,exports){
21668exports.encrypt = function (self, block) {
21669 return self._cipher.encryptBlock(block)
21670}
21671
21672exports.decrypt = function (self, block) {
21673 return self._cipher.decryptBlock(block)
21674}
21675
21676},{}],124:[function(require,module,exports){
21677var modeModules = {
21678 ECB: require('./ecb'),
21679 CBC: require('./cbc'),
21680 CFB: require('./cfb'),
21681 CFB8: require('./cfb8'),
21682 CFB1: require('./cfb1'),
21683 OFB: require('./ofb'),
21684 CTR: require('./ctr'),
21685 GCM: require('./ctr')
21686}
21687
21688var modes = require('./list.json')
21689
21690for (var key in modes) {
21691 modes[key].module = modeModules[modes[key].mode]
21692}
21693
21694module.exports = modes
21695
21696},{"./cbc":118,"./cfb":119,"./cfb1":120,"./cfb8":121,"./ctr":122,"./ecb":123,"./list.json":125,"./ofb":126}],125:[function(require,module,exports){
21697module.exports={
21698 "aes-128-ecb": {
21699 "cipher": "AES",
21700 "key": 128,
21701 "iv": 0,
21702 "mode": "ECB",
21703 "type": "block"
21704 },
21705 "aes-192-ecb": {
21706 "cipher": "AES",
21707 "key": 192,
21708 "iv": 0,
21709 "mode": "ECB",
21710 "type": "block"
21711 },
21712 "aes-256-ecb": {
21713 "cipher": "AES",
21714 "key": 256,
21715 "iv": 0,
21716 "mode": "ECB",
21717 "type": "block"
21718 },
21719 "aes-128-cbc": {
21720 "cipher": "AES",
21721 "key": 128,
21722 "iv": 16,
21723 "mode": "CBC",
21724 "type": "block"
21725 },
21726 "aes-192-cbc": {
21727 "cipher": "AES",
21728 "key": 192,
21729 "iv": 16,
21730 "mode": "CBC",
21731 "type": "block"
21732 },
21733 "aes-256-cbc": {
21734 "cipher": "AES",
21735 "key": 256,
21736 "iv": 16,
21737 "mode": "CBC",
21738 "type": "block"
21739 },
21740 "aes128": {
21741 "cipher": "AES",
21742 "key": 128,
21743 "iv": 16,
21744 "mode": "CBC",
21745 "type": "block"
21746 },
21747 "aes192": {
21748 "cipher": "AES",
21749 "key": 192,
21750 "iv": 16,
21751 "mode": "CBC",
21752 "type": "block"
21753 },
21754 "aes256": {
21755 "cipher": "AES",
21756 "key": 256,
21757 "iv": 16,
21758 "mode": "CBC",
21759 "type": "block"
21760 },
21761 "aes-128-cfb": {
21762 "cipher": "AES",
21763 "key": 128,
21764 "iv": 16,
21765 "mode": "CFB",
21766 "type": "stream"
21767 },
21768 "aes-192-cfb": {
21769 "cipher": "AES",
21770 "key": 192,
21771 "iv": 16,
21772 "mode": "CFB",
21773 "type": "stream"
21774 },
21775 "aes-256-cfb": {
21776 "cipher": "AES",
21777 "key": 256,
21778 "iv": 16,
21779 "mode": "CFB",
21780 "type": "stream"
21781 },
21782 "aes-128-cfb8": {
21783 "cipher": "AES",
21784 "key": 128,
21785 "iv": 16,
21786 "mode": "CFB8",
21787 "type": "stream"
21788 },
21789 "aes-192-cfb8": {
21790 "cipher": "AES",
21791 "key": 192,
21792 "iv": 16,
21793 "mode": "CFB8",
21794 "type": "stream"
21795 },
21796 "aes-256-cfb8": {
21797 "cipher": "AES",
21798 "key": 256,
21799 "iv": 16,
21800 "mode": "CFB8",
21801 "type": "stream"
21802 },
21803 "aes-128-cfb1": {
21804 "cipher": "AES",
21805 "key": 128,
21806 "iv": 16,
21807 "mode": "CFB1",
21808 "type": "stream"
21809 },
21810 "aes-192-cfb1": {
21811 "cipher": "AES",
21812 "key": 192,
21813 "iv": 16,
21814 "mode": "CFB1",
21815 "type": "stream"
21816 },
21817 "aes-256-cfb1": {
21818 "cipher": "AES",
21819 "key": 256,
21820 "iv": 16,
21821 "mode": "CFB1",
21822 "type": "stream"
21823 },
21824 "aes-128-ofb": {
21825 "cipher": "AES",
21826 "key": 128,
21827 "iv": 16,
21828 "mode": "OFB",
21829 "type": "stream"
21830 },
21831 "aes-192-ofb": {
21832 "cipher": "AES",
21833 "key": 192,
21834 "iv": 16,
21835 "mode": "OFB",
21836 "type": "stream"
21837 },
21838 "aes-256-ofb": {
21839 "cipher": "AES",
21840 "key": 256,
21841 "iv": 16,
21842 "mode": "OFB",
21843 "type": "stream"
21844 },
21845 "aes-128-ctr": {
21846 "cipher": "AES",
21847 "key": 128,
21848 "iv": 16,
21849 "mode": "CTR",
21850 "type": "stream"
21851 },
21852 "aes-192-ctr": {
21853 "cipher": "AES",
21854 "key": 192,
21855 "iv": 16,
21856 "mode": "CTR",
21857 "type": "stream"
21858 },
21859 "aes-256-ctr": {
21860 "cipher": "AES",
21861 "key": 256,
21862 "iv": 16,
21863 "mode": "CTR",
21864 "type": "stream"
21865 },
21866 "aes-128-gcm": {
21867 "cipher": "AES",
21868 "key": 128,
21869 "iv": 12,
21870 "mode": "GCM",
21871 "type": "auth"
21872 },
21873 "aes-192-gcm": {
21874 "cipher": "AES",
21875 "key": 192,
21876 "iv": 12,
21877 "mode": "GCM",
21878 "type": "auth"
21879 },
21880 "aes-256-gcm": {
21881 "cipher": "AES",
21882 "key": 256,
21883 "iv": 12,
21884 "mode": "GCM",
21885 "type": "auth"
21886 }
21887}
21888
21889},{}],126:[function(require,module,exports){
21890(function (Buffer){
21891var xor = require('buffer-xor')
21892
21893function getBlock (self) {
21894 self._prev = self._cipher.encryptBlock(self._prev)
21895 return self._prev
21896}
21897
21898exports.encrypt = function (self, chunk) {
21899 while (self._cache.length < chunk.length) {
21900 self._cache = Buffer.concat([self._cache, getBlock(self)])
21901 }
21902
21903 var pad = self._cache.slice(0, chunk.length)
21904 self._cache = self._cache.slice(chunk.length)
21905 return xor(chunk, pad)
21906}
21907
21908}).call(this,require("buffer").Buffer)
21909},{"buffer":146,"buffer-xor":144}],127:[function(require,module,exports){
21910var aes = require('./aes')
21911var Buffer = require('safe-buffer').Buffer
21912var Transform = require('cipher-base')
21913var inherits = require('inherits')
21914
21915function StreamCipher (mode, key, iv, decrypt) {
21916 Transform.call(this)
21917
21918 this._cipher = new aes.AES(key)
21919 this._prev = Buffer.from(iv)
21920 this._cache = Buffer.allocUnsafe(0)
21921 this._secCache = Buffer.allocUnsafe(0)
21922 this._decrypt = decrypt
21923 this._mode = mode
21924}
21925
21926inherits(StreamCipher, Transform)
21927
21928StreamCipher.prototype._update = function (chunk) {
21929 return this._mode.encrypt(this, chunk, this._decrypt)
21930}
21931
21932StreamCipher.prototype._final = function () {
21933 this._cipher.scrub()
21934}
21935
21936module.exports = StreamCipher
21937
21938},{"./aes":111,"cipher-base":155,"inherits":396,"safe-buffer":742}],128:[function(require,module,exports){
21939var DES = require('browserify-des')
21940var aes = require('browserify-aes/browser')
21941var aesModes = require('browserify-aes/modes')
21942var desModes = require('browserify-des/modes')
21943var ebtk = require('evp_bytestokey')
21944
21945function createCipher (suite, password) {
21946 suite = suite.toLowerCase()
21947
21948 var keyLen, ivLen
21949 if (aesModes[suite]) {
21950 keyLen = aesModes[suite].key
21951 ivLen = aesModes[suite].iv
21952 } else if (desModes[suite]) {
21953 keyLen = desModes[suite].key * 8
21954 ivLen = desModes[suite].iv
21955 } else {
21956 throw new TypeError('invalid suite type')
21957 }
21958
21959 var keys = ebtk(password, false, keyLen, ivLen)
21960 return createCipheriv(suite, keys.key, keys.iv)
21961}
21962
21963function createDecipher (suite, password) {
21964 suite = suite.toLowerCase()
21965
21966 var keyLen, ivLen
21967 if (aesModes[suite]) {
21968 keyLen = aesModes[suite].key
21969 ivLen = aesModes[suite].iv
21970 } else if (desModes[suite]) {
21971 keyLen = desModes[suite].key * 8
21972 ivLen = desModes[suite].iv
21973 } else {
21974 throw new TypeError('invalid suite type')
21975 }
21976
21977 var keys = ebtk(password, false, keyLen, ivLen)
21978 return createDecipheriv(suite, keys.key, keys.iv)
21979}
21980
21981function createCipheriv (suite, key, iv) {
21982 suite = suite.toLowerCase()
21983 if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
21984 if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
21985
21986 throw new TypeError('invalid suite type')
21987}
21988
21989function createDecipheriv (suite, key, iv) {
21990 suite = suite.toLowerCase()
21991 if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
21992 if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
21993
21994 throw new TypeError('invalid suite type')
21995}
21996
21997function getCiphers () {
21998 return Object.keys(desModes).concat(aes.getCiphers())
21999}
22000
22001exports.createCipher = exports.Cipher = createCipher
22002exports.createCipheriv = exports.Cipheriv = createCipheriv
22003exports.createDecipher = exports.Decipher = createDecipher
22004exports.createDecipheriv = exports.Decipheriv = createDecipheriv
22005exports.listCiphers = exports.getCiphers = getCiphers
22006
22007},{"browserify-aes/browser":113,"browserify-aes/modes":124,"browserify-des":129,"browserify-des/modes":130,"evp_bytestokey":336}],129:[function(require,module,exports){
22008var CipherBase = require('cipher-base')
22009var des = require('des.js')
22010var inherits = require('inherits')
22011var Buffer = require('safe-buffer').Buffer
22012
22013var modes = {
22014 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
22015 'des-ede3': des.EDE,
22016 'des-ede-cbc': des.CBC.instantiate(des.EDE),
22017 'des-ede': des.EDE,
22018 'des-cbc': des.CBC.instantiate(des.DES),
22019 'des-ecb': des.DES
22020}
22021modes.des = modes['des-cbc']
22022modes.des3 = modes['des-ede3-cbc']
22023module.exports = DES
22024inherits(DES, CipherBase)
22025function DES (opts) {
22026 CipherBase.call(this)
22027 var modeName = opts.mode.toLowerCase()
22028 var mode = modes[modeName]
22029 var type
22030 if (opts.decrypt) {
22031 type = 'decrypt'
22032 } else {
22033 type = 'encrypt'
22034 }
22035 var key = opts.key
22036 if (!Buffer.isBuffer(key)) {
22037 key = Buffer.from(key)
22038 }
22039 if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
22040 key = Buffer.concat([key, key.slice(0, 8)])
22041 }
22042 var iv = opts.iv
22043 if (!Buffer.isBuffer(iv)) {
22044 iv = Buffer.from(iv)
22045 }
22046 this._des = mode.create({
22047 key: key,
22048 iv: iv,
22049 type: type
22050 })
22051}
22052DES.prototype._update = function (data) {
22053 return Buffer.from(this._des.update(data))
22054}
22055DES.prototype._final = function () {
22056 return Buffer.from(this._des.final())
22057}
22058
22059},{"cipher-base":155,"des.js":245,"inherits":396,"safe-buffer":742}],130:[function(require,module,exports){
22060exports['des-ecb'] = {
22061 key: 8,
22062 iv: 0
22063}
22064exports['des-cbc'] = exports.des = {
22065 key: 8,
22066 iv: 8
22067}
22068exports['des-ede3-cbc'] = exports.des3 = {
22069 key: 24,
22070 iv: 8
22071}
22072exports['des-ede3'] = {
22073 key: 24,
22074 iv: 0
22075}
22076exports['des-ede-cbc'] = {
22077 key: 16,
22078 iv: 8
22079}
22080exports['des-ede'] = {
22081 key: 16,
22082 iv: 0
22083}
22084
22085},{}],131:[function(require,module,exports){
22086(function (Buffer){
22087var bn = require('bn.js');
22088var randomBytes = require('randombytes');
22089module.exports = crt;
22090function blind(priv) {
22091 var r = getr(priv);
22092 var blinder = r.toRed(bn.mont(priv.modulus))
22093 .redPow(new bn(priv.publicExponent)).fromRed();
22094 return {
22095 blinder: blinder,
22096 unblinder:r.invm(priv.modulus)
22097 };
22098}
22099function crt(msg, priv) {
22100 var blinds = blind(priv);
22101 var len = priv.modulus.byteLength();
22102 var mod = bn.mont(priv.modulus);
22103 var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
22104 var c1 = blinded.toRed(bn.mont(priv.prime1));
22105 var c2 = blinded.toRed(bn.mont(priv.prime2));
22106 var qinv = priv.coefficient;
22107 var p = priv.prime1;
22108 var q = priv.prime2;
22109 var m1 = c1.redPow(priv.exponent1);
22110 var m2 = c2.redPow(priv.exponent2);
22111 m1 = m1.fromRed();
22112 m2 = m2.fromRed();
22113 var h = m1.isub(m2).imul(qinv).umod(p);
22114 h.imul(q);
22115 m2.iadd(h);
22116 return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
22117}
22118crt.getr = getr;
22119function getr(priv) {
22120 var len = priv.modulus.byteLength();
22121 var r = new bn(randomBytes(len));
22122 while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
22123 r = new bn(randomBytes(len));
22124 }
22125 return r;
22126}
22127
22128}).call(this,require("buffer").Buffer)
22129},{"bn.js":108,"buffer":146,"randombytes":724}],132:[function(require,module,exports){
22130module.exports = require('./browser/algorithms.json')
22131
22132},{"./browser/algorithms.json":133}],133:[function(require,module,exports){
22133module.exports={
22134 "sha224WithRSAEncryption": {
22135 "sign": "rsa",
22136 "hash": "sha224",
22137 "id": "302d300d06096086480165030402040500041c"
22138 },
22139 "RSA-SHA224": {
22140 "sign": "ecdsa/rsa",
22141 "hash": "sha224",
22142 "id": "302d300d06096086480165030402040500041c"
22143 },
22144 "sha256WithRSAEncryption": {
22145 "sign": "rsa",
22146 "hash": "sha256",
22147 "id": "3031300d060960864801650304020105000420"
22148 },
22149 "RSA-SHA256": {
22150 "sign": "ecdsa/rsa",
22151 "hash": "sha256",
22152 "id": "3031300d060960864801650304020105000420"
22153 },
22154 "sha384WithRSAEncryption": {
22155 "sign": "rsa",
22156 "hash": "sha384",
22157 "id": "3041300d060960864801650304020205000430"
22158 },
22159 "RSA-SHA384": {
22160 "sign": "ecdsa/rsa",
22161 "hash": "sha384",
22162 "id": "3041300d060960864801650304020205000430"
22163 },
22164 "sha512WithRSAEncryption": {
22165 "sign": "rsa",
22166 "hash": "sha512",
22167 "id": "3051300d060960864801650304020305000440"
22168 },
22169 "RSA-SHA512": {
22170 "sign": "ecdsa/rsa",
22171 "hash": "sha512",
22172 "id": "3051300d060960864801650304020305000440"
22173 },
22174 "RSA-SHA1": {
22175 "sign": "rsa",
22176 "hash": "sha1",
22177 "id": "3021300906052b0e03021a05000414"
22178 },
22179 "ecdsa-with-SHA1": {
22180 "sign": "ecdsa",
22181 "hash": "sha1",
22182 "id": ""
22183 },
22184 "sha256": {
22185 "sign": "ecdsa",
22186 "hash": "sha256",
22187 "id": ""
22188 },
22189 "sha224": {
22190 "sign": "ecdsa",
22191 "hash": "sha224",
22192 "id": ""
22193 },
22194 "sha384": {
22195 "sign": "ecdsa",
22196 "hash": "sha384",
22197 "id": ""
22198 },
22199 "sha512": {
22200 "sign": "ecdsa",
22201 "hash": "sha512",
22202 "id": ""
22203 },
22204 "DSA-SHA": {
22205 "sign": "dsa",
22206 "hash": "sha1",
22207 "id": ""
22208 },
22209 "DSA-SHA1": {
22210 "sign": "dsa",
22211 "hash": "sha1",
22212 "id": ""
22213 },
22214 "DSA": {
22215 "sign": "dsa",
22216 "hash": "sha1",
22217 "id": ""
22218 },
22219 "DSA-WITH-SHA224": {
22220 "sign": "dsa",
22221 "hash": "sha224",
22222 "id": ""
22223 },
22224 "DSA-SHA224": {
22225 "sign": "dsa",
22226 "hash": "sha224",
22227 "id": ""
22228 },
22229 "DSA-WITH-SHA256": {
22230 "sign": "dsa",
22231 "hash": "sha256",
22232 "id": ""
22233 },
22234 "DSA-SHA256": {
22235 "sign": "dsa",
22236 "hash": "sha256",
22237 "id": ""
22238 },
22239 "DSA-WITH-SHA384": {
22240 "sign": "dsa",
22241 "hash": "sha384",
22242 "id": ""
22243 },
22244 "DSA-SHA384": {
22245 "sign": "dsa",
22246 "hash": "sha384",
22247 "id": ""
22248 },
22249 "DSA-WITH-SHA512": {
22250 "sign": "dsa",
22251 "hash": "sha512",
22252 "id": ""
22253 },
22254 "DSA-SHA512": {
22255 "sign": "dsa",
22256 "hash": "sha512",
22257 "id": ""
22258 },
22259 "DSA-RIPEMD160": {
22260 "sign": "dsa",
22261 "hash": "rmd160",
22262 "id": ""
22263 },
22264 "ripemd160WithRSA": {
22265 "sign": "rsa",
22266 "hash": "rmd160",
22267 "id": "3021300906052b2403020105000414"
22268 },
22269 "RSA-RIPEMD160": {
22270 "sign": "rsa",
22271 "hash": "rmd160",
22272 "id": "3021300906052b2403020105000414"
22273 },
22274 "md5WithRSAEncryption": {
22275 "sign": "rsa",
22276 "hash": "md5",
22277 "id": "3020300c06082a864886f70d020505000410"
22278 },
22279 "RSA-MD5": {
22280 "sign": "rsa",
22281 "hash": "md5",
22282 "id": "3020300c06082a864886f70d020505000410"
22283 }
22284}
22285
22286},{}],134:[function(require,module,exports){
22287module.exports={
22288 "1.3.132.0.10": "secp256k1",
22289 "1.3.132.0.33": "p224",
22290 "1.2.840.10045.3.1.1": "p192",
22291 "1.2.840.10045.3.1.7": "p256",
22292 "1.3.132.0.34": "p384",
22293 "1.3.132.0.35": "p521"
22294}
22295
22296},{}],135:[function(require,module,exports){
22297(function (Buffer){
22298var createHash = require('create-hash')
22299var stream = require('stream')
22300var inherits = require('inherits')
22301var sign = require('./sign')
22302var verify = require('./verify')
22303
22304var algorithms = require('./algorithms.json')
22305Object.keys(algorithms).forEach(function (key) {
22306 algorithms[key].id = new Buffer(algorithms[key].id, 'hex')
22307 algorithms[key.toLowerCase()] = algorithms[key]
22308})
22309
22310function Sign (algorithm) {
22311 stream.Writable.call(this)
22312
22313 var data = algorithms[algorithm]
22314 if (!data) throw new Error('Unknown message digest')
22315
22316 this._hashType = data.hash
22317 this._hash = createHash(data.hash)
22318 this._tag = data.id
22319 this._signType = data.sign
22320}
22321inherits(Sign, stream.Writable)
22322
22323Sign.prototype._write = function _write (data, _, done) {
22324 this._hash.update(data)
22325 done()
22326}
22327
22328Sign.prototype.update = function update (data, enc) {
22329 if (typeof data === 'string') data = new Buffer(data, enc)
22330
22331 this._hash.update(data)
22332 return this
22333}
22334
22335Sign.prototype.sign = function signMethod (key, enc) {
22336 this.end()
22337 var hash = this._hash.digest()
22338 var sig = sign(hash, key, this._hashType, this._signType, this._tag)
22339
22340 return enc ? sig.toString(enc) : sig
22341}
22342
22343function Verify (algorithm) {
22344 stream.Writable.call(this)
22345
22346 var data = algorithms[algorithm]
22347 if (!data) throw new Error('Unknown message digest')
22348
22349 this._hash = createHash(data.hash)
22350 this._tag = data.id
22351 this._signType = data.sign
22352}
22353inherits(Verify, stream.Writable)
22354
22355Verify.prototype._write = function _write (data, _, done) {
22356 this._hash.update(data)
22357 done()
22358}
22359
22360Verify.prototype.update = function update (data, enc) {
22361 if (typeof data === 'string') data = new Buffer(data, enc)
22362
22363 this._hash.update(data)
22364 return this
22365}
22366
22367Verify.prototype.verify = function verifyMethod (key, sig, enc) {
22368 if (typeof sig === 'string') sig = new Buffer(sig, enc)
22369
22370 this.end()
22371 var hash = this._hash.digest()
22372 return verify(sig, hash, key, this._signType, this._tag)
22373}
22374
22375function createSign (algorithm) {
22376 return new Sign(algorithm)
22377}
22378
22379function createVerify (algorithm) {
22380 return new Verify(algorithm)
22381}
22382
22383module.exports = {
22384 Sign: createSign,
22385 Verify: createVerify,
22386 createSign: createSign,
22387 createVerify: createVerify
22388}
22389
22390}).call(this,require("buffer").Buffer)
22391},{"./algorithms.json":133,"./sign":136,"./verify":137,"buffer":146,"create-hash":239,"inherits":396,"stream":808}],136:[function(require,module,exports){
22392(function (Buffer){
22393// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
22394var createHmac = require('create-hmac')
22395var crt = require('browserify-rsa')
22396var EC = require('elliptic').ec
22397var BN = require('bn.js')
22398var parseKeys = require('parse-asn1')
22399var curves = require('./curves.json')
22400
22401function sign (hash, key, hashType, signType, tag) {
22402 var priv = parseKeys(key)
22403 if (priv.curve) {
22404 // rsa keys can be interpreted as ecdsa ones in openssl
22405 if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
22406 return ecSign(hash, priv)
22407 } else if (priv.type === 'dsa') {
22408 if (signType !== 'dsa') throw new Error('wrong private key type')
22409 return dsaSign(hash, priv, hashType)
22410 } else {
22411 if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
22412 }
22413 hash = Buffer.concat([tag, hash])
22414 var len = priv.modulus.byteLength()
22415 var pad = [ 0, 1 ]
22416 while (hash.length + pad.length + 1 < len) pad.push(0xff)
22417 pad.push(0x00)
22418 var i = -1
22419 while (++i < hash.length) pad.push(hash[i])
22420
22421 var out = crt(pad, priv)
22422 return out
22423}
22424
22425function ecSign (hash, priv) {
22426 var curveId = curves[priv.curve.join('.')]
22427 if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
22428
22429 var curve = new EC(curveId)
22430 var key = curve.keyFromPrivate(priv.privateKey)
22431 var out = key.sign(hash)
22432
22433 return new Buffer(out.toDER())
22434}
22435
22436function dsaSign (hash, priv, algo) {
22437 var x = priv.params.priv_key
22438 var p = priv.params.p
22439 var q = priv.params.q
22440 var g = priv.params.g
22441 var r = new BN(0)
22442 var k
22443 var H = bits2int(hash, q).mod(q)
22444 var s = false
22445 var kv = getKey(x, q, hash, algo)
22446 while (s === false) {
22447 k = makeKey(q, kv, algo)
22448 r = makeR(g, k, p, q)
22449 s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
22450 if (s.cmpn(0) === 0) {
22451 s = false
22452 r = new BN(0)
22453 }
22454 }
22455 return toDER(r, s)
22456}
22457
22458function toDER (r, s) {
22459 r = r.toArray()
22460 s = s.toArray()
22461
22462 // Pad values
22463 if (r[0] & 0x80) r = [ 0 ].concat(r)
22464 if (s[0] & 0x80) s = [ 0 ].concat(s)
22465
22466 var total = r.length + s.length + 4
22467 var res = [ 0x30, total, 0x02, r.length ]
22468 res = res.concat(r, [ 0x02, s.length ], s)
22469 return new Buffer(res)
22470}
22471
22472function getKey (x, q, hash, algo) {
22473 x = new Buffer(x.toArray())
22474 if (x.length < q.byteLength()) {
22475 var zeros = new Buffer(q.byteLength() - x.length)
22476 zeros.fill(0)
22477 x = Buffer.concat([ zeros, x ])
22478 }
22479 var hlen = hash.length
22480 var hbits = bits2octets(hash, q)
22481 var v = new Buffer(hlen)
22482 v.fill(1)
22483 var k = new Buffer(hlen)
22484 k.fill(0)
22485 k = createHmac(algo, k).update(v).update(new Buffer([ 0 ])).update(x).update(hbits).digest()
22486 v = createHmac(algo, k).update(v).digest()
22487 k = createHmac(algo, k).update(v).update(new Buffer([ 1 ])).update(x).update(hbits).digest()
22488 v = createHmac(algo, k).update(v).digest()
22489 return { k: k, v: v }
22490}
22491
22492function bits2int (obits, q) {
22493 var bits = new BN(obits)
22494 var shift = (obits.length << 3) - q.bitLength()
22495 if (shift > 0) bits.ishrn(shift)
22496 return bits
22497}
22498
22499function bits2octets (bits, q) {
22500 bits = bits2int(bits, q)
22501 bits = bits.mod(q)
22502 var out = new Buffer(bits.toArray())
22503 if (out.length < q.byteLength()) {
22504 var zeros = new Buffer(q.byteLength() - out.length)
22505 zeros.fill(0)
22506 out = Buffer.concat([ zeros, out ])
22507 }
22508 return out
22509}
22510
22511function makeKey (q, kv, algo) {
22512 var t
22513 var k
22514
22515 do {
22516 t = new Buffer(0)
22517
22518 while (t.length * 8 < q.bitLength()) {
22519 kv.v = createHmac(algo, kv.k).update(kv.v).digest()
22520 t = Buffer.concat([ t, kv.v ])
22521 }
22522
22523 k = bits2int(t, q)
22524 kv.k = createHmac(algo, kv.k).update(kv.v).update(new Buffer([ 0 ])).digest()
22525 kv.v = createHmac(algo, kv.k).update(kv.v).digest()
22526 } while (k.cmp(q) !== -1)
22527
22528 return k
22529}
22530
22531function makeR (g, k, p, q) {
22532 return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
22533}
22534
22535module.exports = sign
22536module.exports.getKey = getKey
22537module.exports.makeKey = makeKey
22538
22539}).call(this,require("buffer").Buffer)
22540},{"./curves.json":134,"bn.js":108,"browserify-rsa":131,"buffer":146,"create-hmac":241,"elliptic":317,"parse-asn1":670}],137:[function(require,module,exports){
22541(function (Buffer){
22542// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
22543var BN = require('bn.js')
22544var EC = require('elliptic').ec
22545var parseKeys = require('parse-asn1')
22546var curves = require('./curves.json')
22547
22548function verify (sig, hash, key, signType, tag) {
22549 var pub = parseKeys(key)
22550 if (pub.type === 'ec') {
22551 // rsa keys can be interpreted as ecdsa ones in openssl
22552 if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
22553 return ecVerify(sig, hash, pub)
22554 } else if (pub.type === 'dsa') {
22555 if (signType !== 'dsa') throw new Error('wrong public key type')
22556 return dsaVerify(sig, hash, pub)
22557 } else {
22558 if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
22559 }
22560 hash = Buffer.concat([tag, hash])
22561 var len = pub.modulus.byteLength()
22562 var pad = [ 1 ]
22563 var padNum = 0
22564 while (hash.length + pad.length + 2 < len) {
22565 pad.push(0xff)
22566 padNum++
22567 }
22568 pad.push(0x00)
22569 var i = -1
22570 while (++i < hash.length) {
22571 pad.push(hash[i])
22572 }
22573 pad = new Buffer(pad)
22574 var red = BN.mont(pub.modulus)
22575 sig = new BN(sig).toRed(red)
22576
22577 sig = sig.redPow(new BN(pub.publicExponent))
22578 sig = new Buffer(sig.fromRed().toArray())
22579 var out = padNum < 8 ? 1 : 0
22580 len = Math.min(sig.length, pad.length)
22581 if (sig.length !== pad.length) out = 1
22582
22583 i = -1
22584 while (++i < len) out |= sig[i] ^ pad[i]
22585 return out === 0
22586}
22587
22588function ecVerify (sig, hash, pub) {
22589 var curveId = curves[pub.data.algorithm.curve.join('.')]
22590 if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
22591
22592 var curve = new EC(curveId)
22593 var pubkey = pub.data.subjectPrivateKey.data
22594
22595 return curve.verify(hash, sig, pubkey)
22596}
22597
22598function dsaVerify (sig, hash, pub) {
22599 var p = pub.data.p
22600 var q = pub.data.q
22601 var g = pub.data.g
22602 var y = pub.data.pub_key
22603 var unpacked = parseKeys.signature.decode(sig, 'der')
22604 var s = unpacked.s
22605 var r = unpacked.r
22606 checkValue(s, q)
22607 checkValue(r, q)
22608 var montp = BN.mont(p)
22609 var w = s.invm(q)
22610 var v = g.toRed(montp)
22611 .redPow(new BN(hash).mul(w).mod(q))
22612 .fromRed()
22613 .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
22614 .mod(p)
22615 .mod(q)
22616 return v.cmp(r) === 0
22617}
22618
22619function checkValue (b, q) {
22620 if (b.cmpn(0) <= 0) throw new Error('invalid sig')
22621 if (b.cmp(q) >= q) throw new Error('invalid sig')
22622}
22623
22624module.exports = verify
22625
22626}).call(this,require("buffer").Buffer)
22627},{"./curves.json":134,"bn.js":108,"buffer":146,"elliptic":317,"parse-asn1":670}],138:[function(require,module,exports){
22628var basex = require('base-x')
22629var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
22630
22631module.exports = basex(ALPHABET)
22632
22633},{"base-x":54}],139:[function(require,module,exports){
22634'use strict'
22635
22636var base58 = require('bs58')
22637var Buffer = require('safe-buffer').Buffer
22638
22639module.exports = function (checksumFn) {
22640 // Encode a buffer as a base58-check encoded string
22641 function encode (payload) {
22642 var checksum = checksumFn(payload)
22643
22644 return base58.encode(Buffer.concat([
22645 payload,
22646 checksum
22647 ], payload.length + 4))
22648 }
22649
22650 function decodeRaw (buffer) {
22651 var payload = buffer.slice(0, -4)
22652 var checksum = buffer.slice(-4)
22653 var newChecksum = checksumFn(payload)
22654
22655 if (checksum[0] ^ newChecksum[0] |
22656 checksum[1] ^ newChecksum[1] |
22657 checksum[2] ^ newChecksum[2] |
22658 checksum[3] ^ newChecksum[3]) return
22659
22660 return payload
22661 }
22662
22663 // Decode a base58-check encoded string to a buffer, no result if checksum is wrong
22664 function decodeUnsafe (string) {
22665 var buffer = base58.decodeUnsafe(string)
22666 if (!buffer) return
22667
22668 return decodeRaw(buffer)
22669 }
22670
22671 function decode (string) {
22672 var buffer = base58.decode(string)
22673 var payload = decodeRaw(buffer, checksumFn)
22674 if (!payload) throw new Error('Invalid checksum')
22675 return payload
22676 }
22677
22678 return {
22679 encode: encode,
22680 decode: decode,
22681 decodeUnsafe: decodeUnsafe
22682 }
22683}
22684
22685},{"bs58":138,"safe-buffer":742}],140:[function(require,module,exports){
22686'use strict'
22687
22688var createHash = require('create-hash')
22689var bs58checkBase = require('./base')
22690
22691// SHA256(SHA256(buffer))
22692function sha256x2 (buffer) {
22693 var tmp = createHash('sha256').update(buffer).digest()
22694 return createHash('sha256').update(tmp).digest()
22695}
22696
22697module.exports = bs58checkBase(sha256x2)
22698
22699},{"./base":139,"create-hash":239}],141:[function(require,module,exports){
22700arguments[4][139][0].apply(exports,arguments)
22701},{"bs58":138,"dup":139,"safe-buffer":742}],142:[function(require,module,exports){
22702(function (Buffer){
22703'use strict'
22704
22705var createHash = require('create-hash')
22706var bs58grscheckBase = require('./base')
22707var groestlhash = require('groestl-hash-js')
22708
22709// GROESTL512(GROESTL512(buffer))
22710function groestl (buffer) {
22711 return Buffer(groestlhash.groestl_2(buffer, 1, 1))
22712}
22713
22714module.exports = bs58grscheckBase(groestl)
22715
22716}).call(this,require("buffer").Buffer)
22717},{"./base":141,"buffer":146,"create-hash":239,"groestl-hash-js":339}],143:[function(require,module,exports){
22718module.exports = function(a, b) {
22719 if (typeof a.compare === 'function') return a.compare(b)
22720 if (a === b) return 0
22721
22722 var x = a.length
22723 var y = b.length
22724
22725 var i = 0
22726 var len = Math.min(x, y)
22727 while (i < len) {
22728 if (a[i] !== b[i]) break
22729
22730 ++i
22731 }
22732
22733 if (i !== len) {
22734 x = a[i]
22735 y = b[i]
22736 }
22737
22738 if (x < y) return -1
22739 if (y < x) return 1
22740 return 0
22741}
22742
22743
22744},{}],144:[function(require,module,exports){
22745(function (Buffer){
22746module.exports = function xor (a, b) {
22747 var length = Math.min(a.length, b.length)
22748 var buffer = new Buffer(length)
22749
22750 for (var i = 0; i < length; ++i) {
22751 buffer[i] = a[i] ^ b[i]
22752 }
22753
22754 return buffer
22755}
22756
22757}).call(this,require("buffer").Buffer)
22758},{"buffer":146}],145:[function(require,module,exports){
22759module.exports = function xorInplace (a, b) {
22760 var length = Math.min(a.length, b.length)
22761
22762 for (var i = 0; i < length; ++i) {
22763 a[i] = a[i] ^ b[i]
22764 }
22765
22766 return a.slice(0, length)
22767}
22768
22769},{}],146:[function(require,module,exports){
22770(function (Buffer){
22771/*!
22772 * The buffer module from node.js, for the browser.
22773 *
22774 * @author Feross Aboukhadijeh <https://feross.org>
22775 * @license MIT
22776 */
22777/* eslint-disable no-proto */
22778
22779'use strict'
22780
22781var base64 = require('base64-js')
22782var ieee754 = require('ieee754')
22783var customInspectSymbol =
22784 (typeof Symbol === 'function' && typeof Symbol.for === 'function')
22785 ? Symbol.for('nodejs.util.inspect.custom')
22786 : null
22787
22788exports.Buffer = Buffer
22789exports.SlowBuffer = SlowBuffer
22790exports.INSPECT_MAX_BYTES = 50
22791
22792var K_MAX_LENGTH = 0x7fffffff
22793exports.kMaxLength = K_MAX_LENGTH
22794
22795/**
22796 * If `Buffer.TYPED_ARRAY_SUPPORT`:
22797 * === true Use Uint8Array implementation (fastest)
22798 * === false Print warning and recommend using `buffer` v4.x which has an Object
22799 * implementation (most compatible, even IE6)
22800 *
22801 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
22802 * Opera 11.6+, iOS 4.2+.
22803 *
22804 * We report that the browser does not support typed arrays if the are not subclassable
22805 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
22806 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
22807 * for __proto__ and has a buggy typed array implementation.
22808 */
22809Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
22810
22811if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
22812 typeof console.error === 'function') {
22813 console.error(
22814 'This browser lacks typed array (Uint8Array) support which is required by ' +
22815 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
22816 )
22817}
22818
22819function typedArraySupport () {
22820 // Can typed array instances can be augmented?
22821 try {
22822 var arr = new Uint8Array(1)
22823 var proto = { foo: function () { return 42 } }
22824 Object.setPrototypeOf(proto, Uint8Array.prototype)
22825 Object.setPrototypeOf(arr, proto)
22826 return arr.foo() === 42
22827 } catch (e) {
22828 return false
22829 }
22830}
22831
22832Object.defineProperty(Buffer.prototype, 'parent', {
22833 enumerable: true,
22834 get: function () {
22835 if (!Buffer.isBuffer(this)) return undefined
22836 return this.buffer
22837 }
22838})
22839
22840Object.defineProperty(Buffer.prototype, 'offset', {
22841 enumerable: true,
22842 get: function () {
22843 if (!Buffer.isBuffer(this)) return undefined
22844 return this.byteOffset
22845 }
22846})
22847
22848function createBuffer (length) {
22849 if (length > K_MAX_LENGTH) {
22850 throw new RangeError('The value "' + length + '" is invalid for option "size"')
22851 }
22852 // Return an augmented `Uint8Array` instance
22853 var buf = new Uint8Array(length)
22854 Object.setPrototypeOf(buf, Buffer.prototype)
22855 return buf
22856}
22857
22858/**
22859 * The Buffer constructor returns instances of `Uint8Array` that have their
22860 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
22861 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
22862 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
22863 * returns a single octet.
22864 *
22865 * The `Uint8Array` prototype remains unmodified.
22866 */
22867
22868function Buffer (arg, encodingOrOffset, length) {
22869 // Common case.
22870 if (typeof arg === 'number') {
22871 if (typeof encodingOrOffset === 'string') {
22872 throw new TypeError(
22873 'The "string" argument must be of type string. Received type number'
22874 )
22875 }
22876 return allocUnsafe(arg)
22877 }
22878 return from(arg, encodingOrOffset, length)
22879}
22880
22881// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
22882if (typeof Symbol !== 'undefined' && Symbol.species != null &&
22883 Buffer[Symbol.species] === Buffer) {
22884 Object.defineProperty(Buffer, Symbol.species, {
22885 value: null,
22886 configurable: true,
22887 enumerable: false,
22888 writable: false
22889 })
22890}
22891
22892Buffer.poolSize = 8192 // not used by this implementation
22893
22894function from (value, encodingOrOffset, length) {
22895 if (typeof value === 'string') {
22896 return fromString(value, encodingOrOffset)
22897 }
22898
22899 if (ArrayBuffer.isView(value)) {
22900 return fromArrayLike(value)
22901 }
22902
22903 if (value == null) {
22904 throw new TypeError(
22905 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
22906 'or Array-like Object. Received type ' + (typeof value)
22907 )
22908 }
22909
22910 if (isInstance(value, ArrayBuffer) ||
22911 (value && isInstance(value.buffer, ArrayBuffer))) {
22912 return fromArrayBuffer(value, encodingOrOffset, length)
22913 }
22914
22915 if (typeof value === 'number') {
22916 throw new TypeError(
22917 'The "value" argument must not be of type number. Received type number'
22918 )
22919 }
22920
22921 var valueOf = value.valueOf && value.valueOf()
22922 if (valueOf != null && valueOf !== value) {
22923 return Buffer.from(valueOf, encodingOrOffset, length)
22924 }
22925
22926 var b = fromObject(value)
22927 if (b) return b
22928
22929 if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
22930 typeof value[Symbol.toPrimitive] === 'function') {
22931 return Buffer.from(
22932 value[Symbol.toPrimitive]('string'), encodingOrOffset, length
22933 )
22934 }
22935
22936 throw new TypeError(
22937 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
22938 'or Array-like Object. Received type ' + (typeof value)
22939 )
22940}
22941
22942/**
22943 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
22944 * if value is a number.
22945 * Buffer.from(str[, encoding])
22946 * Buffer.from(array)
22947 * Buffer.from(buffer)
22948 * Buffer.from(arrayBuffer[, byteOffset[, length]])
22949 **/
22950Buffer.from = function (value, encodingOrOffset, length) {
22951 return from(value, encodingOrOffset, length)
22952}
22953
22954// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
22955// https://github.com/feross/buffer/pull/148
22956Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
22957Object.setPrototypeOf(Buffer, Uint8Array)
22958
22959function assertSize (size) {
22960 if (typeof size !== 'number') {
22961 throw new TypeError('"size" argument must be of type number')
22962 } else if (size < 0) {
22963 throw new RangeError('The value "' + size + '" is invalid for option "size"')
22964 }
22965}
22966
22967function alloc (size, fill, encoding) {
22968 assertSize(size)
22969 if (size <= 0) {
22970 return createBuffer(size)
22971 }
22972 if (fill !== undefined) {
22973 // Only pay attention to encoding if it's a string. This
22974 // prevents accidentally sending in a number that would
22975 // be interpretted as a start offset.
22976 return typeof encoding === 'string'
22977 ? createBuffer(size).fill(fill, encoding)
22978 : createBuffer(size).fill(fill)
22979 }
22980 return createBuffer(size)
22981}
22982
22983/**
22984 * Creates a new filled Buffer instance.
22985 * alloc(size[, fill[, encoding]])
22986 **/
22987Buffer.alloc = function (size, fill, encoding) {
22988 return alloc(size, fill, encoding)
22989}
22990
22991function allocUnsafe (size) {
22992 assertSize(size)
22993 return createBuffer(size < 0 ? 0 : checked(size) | 0)
22994}
22995
22996/**
22997 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
22998 * */
22999Buffer.allocUnsafe = function (size) {
23000 return allocUnsafe(size)
23001}
23002/**
23003 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
23004 */
23005Buffer.allocUnsafeSlow = function (size) {
23006 return allocUnsafe(size)
23007}
23008
23009function fromString (string, encoding) {
23010 if (typeof encoding !== 'string' || encoding === '') {
23011 encoding = 'utf8'
23012 }
23013
23014 if (!Buffer.isEncoding(encoding)) {
23015 throw new TypeError('Unknown encoding: ' + encoding)
23016 }
23017
23018 var length = byteLength(string, encoding) | 0
23019 var buf = createBuffer(length)
23020
23021 var actual = buf.write(string, encoding)
23022
23023 if (actual !== length) {
23024 // Writing a hex string, for example, that contains invalid characters will
23025 // cause everything after the first invalid character to be ignored. (e.g.
23026 // 'abxxcd' will be treated as 'ab')
23027 buf = buf.slice(0, actual)
23028 }
23029
23030 return buf
23031}
23032
23033function fromArrayLike (array) {
23034 var length = array.length < 0 ? 0 : checked(array.length) | 0
23035 var buf = createBuffer(length)
23036 for (var i = 0; i < length; i += 1) {
23037 buf[i] = array[i] & 255
23038 }
23039 return buf
23040}
23041
23042function fromArrayBuffer (array, byteOffset, length) {
23043 if (byteOffset < 0 || array.byteLength < byteOffset) {
23044 throw new RangeError('"offset" is outside of buffer bounds')
23045 }
23046
23047 if (array.byteLength < byteOffset + (length || 0)) {
23048 throw new RangeError('"length" is outside of buffer bounds')
23049 }
23050
23051 var buf
23052 if (byteOffset === undefined && length === undefined) {
23053 buf = new Uint8Array(array)
23054 } else if (length === undefined) {
23055 buf = new Uint8Array(array, byteOffset)
23056 } else {
23057 buf = new Uint8Array(array, byteOffset, length)
23058 }
23059
23060 // Return an augmented `Uint8Array` instance
23061 Object.setPrototypeOf(buf, Buffer.prototype)
23062
23063 return buf
23064}
23065
23066function fromObject (obj) {
23067 if (Buffer.isBuffer(obj)) {
23068 var len = checked(obj.length) | 0
23069 var buf = createBuffer(len)
23070
23071 if (buf.length === 0) {
23072 return buf
23073 }
23074
23075 obj.copy(buf, 0, 0, len)
23076 return buf
23077 }
23078
23079 if (obj.length !== undefined) {
23080 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
23081 return createBuffer(0)
23082 }
23083 return fromArrayLike(obj)
23084 }
23085
23086 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
23087 return fromArrayLike(obj.data)
23088 }
23089}
23090
23091function checked (length) {
23092 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
23093 // length is NaN (which is otherwise coerced to zero.)
23094 if (length >= K_MAX_LENGTH) {
23095 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
23096 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
23097 }
23098 return length | 0
23099}
23100
23101function SlowBuffer (length) {
23102 if (+length != length) { // eslint-disable-line eqeqeq
23103 length = 0
23104 }
23105 return Buffer.alloc(+length)
23106}
23107
23108Buffer.isBuffer = function isBuffer (b) {
23109 return b != null && b._isBuffer === true &&
23110 b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
23111}
23112
23113Buffer.compare = function compare (a, b) {
23114 if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
23115 if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
23116 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
23117 throw new TypeError(
23118 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
23119 )
23120 }
23121
23122 if (a === b) return 0
23123
23124 var x = a.length
23125 var y = b.length
23126
23127 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
23128 if (a[i] !== b[i]) {
23129 x = a[i]
23130 y = b[i]
23131 break
23132 }
23133 }
23134
23135 if (x < y) return -1
23136 if (y < x) return 1
23137 return 0
23138}
23139
23140Buffer.isEncoding = function isEncoding (encoding) {
23141 switch (String(encoding).toLowerCase()) {
23142 case 'hex':
23143 case 'utf8':
23144 case 'utf-8':
23145 case 'ascii':
23146 case 'latin1':
23147 case 'binary':
23148 case 'base64':
23149 case 'ucs2':
23150 case 'ucs-2':
23151 case 'utf16le':
23152 case 'utf-16le':
23153 return true
23154 default:
23155 return false
23156 }
23157}
23158
23159Buffer.concat = function concat (list, length) {
23160 if (!Array.isArray(list)) {
23161 throw new TypeError('"list" argument must be an Array of Buffers')
23162 }
23163
23164 if (list.length === 0) {
23165 return Buffer.alloc(0)
23166 }
23167
23168 var i
23169 if (length === undefined) {
23170 length = 0
23171 for (i = 0; i < list.length; ++i) {
23172 length += list[i].length
23173 }
23174 }
23175
23176 var buffer = Buffer.allocUnsafe(length)
23177 var pos = 0
23178 for (i = 0; i < list.length; ++i) {
23179 var buf = list[i]
23180 if (isInstance(buf, Uint8Array)) {
23181 buf = Buffer.from(buf)
23182 }
23183 if (!Buffer.isBuffer(buf)) {
23184 throw new TypeError('"list" argument must be an Array of Buffers')
23185 }
23186 buf.copy(buffer, pos)
23187 pos += buf.length
23188 }
23189 return buffer
23190}
23191
23192function byteLength (string, encoding) {
23193 if (Buffer.isBuffer(string)) {
23194 return string.length
23195 }
23196 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
23197 return string.byteLength
23198 }
23199 if (typeof string !== 'string') {
23200 throw new TypeError(
23201 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
23202 'Received type ' + typeof string
23203 )
23204 }
23205
23206 var len = string.length
23207 var mustMatch = (arguments.length > 2 && arguments[2] === true)
23208 if (!mustMatch && len === 0) return 0
23209
23210 // Use a for loop to avoid recursion
23211 var loweredCase = false
23212 for (;;) {
23213 switch (encoding) {
23214 case 'ascii':
23215 case 'latin1':
23216 case 'binary':
23217 return len
23218 case 'utf8':
23219 case 'utf-8':
23220 return utf8ToBytes(string).length
23221 case 'ucs2':
23222 case 'ucs-2':
23223 case 'utf16le':
23224 case 'utf-16le':
23225 return len * 2
23226 case 'hex':
23227 return len >>> 1
23228 case 'base64':
23229 return base64ToBytes(string).length
23230 default:
23231 if (loweredCase) {
23232 return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
23233 }
23234 encoding = ('' + encoding).toLowerCase()
23235 loweredCase = true
23236 }
23237 }
23238}
23239Buffer.byteLength = byteLength
23240
23241function slowToString (encoding, start, end) {
23242 var loweredCase = false
23243
23244 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
23245 // property of a typed array.
23246
23247 // This behaves neither like String nor Uint8Array in that we set start/end
23248 // to their upper/lower bounds if the value passed is out of range.
23249 // undefined is handled specially as per ECMA-262 6th Edition,
23250 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
23251 if (start === undefined || start < 0) {
23252 start = 0
23253 }
23254 // Return early if start > this.length. Done here to prevent potential uint32
23255 // coercion fail below.
23256 if (start > this.length) {
23257 return ''
23258 }
23259
23260 if (end === undefined || end > this.length) {
23261 end = this.length
23262 }
23263
23264 if (end <= 0) {
23265 return ''
23266 }
23267
23268 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
23269 end >>>= 0
23270 start >>>= 0
23271
23272 if (end <= start) {
23273 return ''
23274 }
23275
23276 if (!encoding) encoding = 'utf8'
23277
23278 while (true) {
23279 switch (encoding) {
23280 case 'hex':
23281 return hexSlice(this, start, end)
23282
23283 case 'utf8':
23284 case 'utf-8':
23285 return utf8Slice(this, start, end)
23286
23287 case 'ascii':
23288 return asciiSlice(this, start, end)
23289
23290 case 'latin1':
23291 case 'binary':
23292 return latin1Slice(this, start, end)
23293
23294 case 'base64':
23295 return base64Slice(this, start, end)
23296
23297 case 'ucs2':
23298 case 'ucs-2':
23299 case 'utf16le':
23300 case 'utf-16le':
23301 return utf16leSlice(this, start, end)
23302
23303 default:
23304 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
23305 encoding = (encoding + '').toLowerCase()
23306 loweredCase = true
23307 }
23308 }
23309}
23310
23311// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
23312// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
23313// reliably in a browserify context because there could be multiple different
23314// copies of the 'buffer' package in use. This method works even for Buffer
23315// instances that were created from another copy of the `buffer` package.
23316// See: https://github.com/feross/buffer/issues/154
23317Buffer.prototype._isBuffer = true
23318
23319function swap (b, n, m) {
23320 var i = b[n]
23321 b[n] = b[m]
23322 b[m] = i
23323}
23324
23325Buffer.prototype.swap16 = function swap16 () {
23326 var len = this.length
23327 if (len % 2 !== 0) {
23328 throw new RangeError('Buffer size must be a multiple of 16-bits')
23329 }
23330 for (var i = 0; i < len; i += 2) {
23331 swap(this, i, i + 1)
23332 }
23333 return this
23334}
23335
23336Buffer.prototype.swap32 = function swap32 () {
23337 var len = this.length
23338 if (len % 4 !== 0) {
23339 throw new RangeError('Buffer size must be a multiple of 32-bits')
23340 }
23341 for (var i = 0; i < len; i += 4) {
23342 swap(this, i, i + 3)
23343 swap(this, i + 1, i + 2)
23344 }
23345 return this
23346}
23347
23348Buffer.prototype.swap64 = function swap64 () {
23349 var len = this.length
23350 if (len % 8 !== 0) {
23351 throw new RangeError('Buffer size must be a multiple of 64-bits')
23352 }
23353 for (var i = 0; i < len; i += 8) {
23354 swap(this, i, i + 7)
23355 swap(this, i + 1, i + 6)
23356 swap(this, i + 2, i + 5)
23357 swap(this, i + 3, i + 4)
23358 }
23359 return this
23360}
23361
23362Buffer.prototype.toString = function toString () {
23363 var length = this.length
23364 if (length === 0) return ''
23365 if (arguments.length === 0) return utf8Slice(this, 0, length)
23366 return slowToString.apply(this, arguments)
23367}
23368
23369Buffer.prototype.toLocaleString = Buffer.prototype.toString
23370
23371Buffer.prototype.equals = function equals (b) {
23372 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
23373 if (this === b) return true
23374 return Buffer.compare(this, b) === 0
23375}
23376
23377Buffer.prototype.inspect = function inspect () {
23378 var str = ''
23379 var max = exports.INSPECT_MAX_BYTES
23380 str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
23381 if (this.length > max) str += ' ... '
23382 return '<Buffer ' + str + '>'
23383}
23384if (customInspectSymbol) {
23385 Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
23386}
23387
23388Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
23389 if (isInstance(target, Uint8Array)) {
23390 target = Buffer.from(target, target.offset, target.byteLength)
23391 }
23392 if (!Buffer.isBuffer(target)) {
23393 throw new TypeError(
23394 'The "target" argument must be one of type Buffer or Uint8Array. ' +
23395 'Received type ' + (typeof target)
23396 )
23397 }
23398
23399 if (start === undefined) {
23400 start = 0
23401 }
23402 if (end === undefined) {
23403 end = target ? target.length : 0
23404 }
23405 if (thisStart === undefined) {
23406 thisStart = 0
23407 }
23408 if (thisEnd === undefined) {
23409 thisEnd = this.length
23410 }
23411
23412 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
23413 throw new RangeError('out of range index')
23414 }
23415
23416 if (thisStart >= thisEnd && start >= end) {
23417 return 0
23418 }
23419 if (thisStart >= thisEnd) {
23420 return -1
23421 }
23422 if (start >= end) {
23423 return 1
23424 }
23425
23426 start >>>= 0
23427 end >>>= 0
23428 thisStart >>>= 0
23429 thisEnd >>>= 0
23430
23431 if (this === target) return 0
23432
23433 var x = thisEnd - thisStart
23434 var y = end - start
23435 var len = Math.min(x, y)
23436
23437 var thisCopy = this.slice(thisStart, thisEnd)
23438 var targetCopy = target.slice(start, end)
23439
23440 for (var i = 0; i < len; ++i) {
23441 if (thisCopy[i] !== targetCopy[i]) {
23442 x = thisCopy[i]
23443 y = targetCopy[i]
23444 break
23445 }
23446 }
23447
23448 if (x < y) return -1
23449 if (y < x) return 1
23450 return 0
23451}
23452
23453// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
23454// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
23455//
23456// Arguments:
23457// - buffer - a Buffer to search
23458// - val - a string, Buffer, or number
23459// - byteOffset - an index into `buffer`; will be clamped to an int32
23460// - encoding - an optional encoding, relevant is val is a string
23461// - dir - true for indexOf, false for lastIndexOf
23462function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
23463 // Empty buffer means no match
23464 if (buffer.length === 0) return -1
23465
23466 // Normalize byteOffset
23467 if (typeof byteOffset === 'string') {
23468 encoding = byteOffset
23469 byteOffset = 0
23470 } else if (byteOffset > 0x7fffffff) {
23471 byteOffset = 0x7fffffff
23472 } else if (byteOffset < -0x80000000) {
23473 byteOffset = -0x80000000
23474 }
23475 byteOffset = +byteOffset // Coerce to Number.
23476 if (numberIsNaN(byteOffset)) {
23477 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
23478 byteOffset = dir ? 0 : (buffer.length - 1)
23479 }
23480
23481 // Normalize byteOffset: negative offsets start from the end of the buffer
23482 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
23483 if (byteOffset >= buffer.length) {
23484 if (dir) return -1
23485 else byteOffset = buffer.length - 1
23486 } else if (byteOffset < 0) {
23487 if (dir) byteOffset = 0
23488 else return -1
23489 }
23490
23491 // Normalize val
23492 if (typeof val === 'string') {
23493 val = Buffer.from(val, encoding)
23494 }
23495
23496 // Finally, search either indexOf (if dir is true) or lastIndexOf
23497 if (Buffer.isBuffer(val)) {
23498 // Special case: looking for empty string/buffer always fails
23499 if (val.length === 0) {
23500 return -1
23501 }
23502 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
23503 } else if (typeof val === 'number') {
23504 val = val & 0xFF // Search for a byte value [0-255]
23505 if (typeof Uint8Array.prototype.indexOf === 'function') {
23506 if (dir) {
23507 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
23508 } else {
23509 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
23510 }
23511 }
23512 return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
23513 }
23514
23515 throw new TypeError('val must be string, number or Buffer')
23516}
23517
23518function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
23519 var indexSize = 1
23520 var arrLength = arr.length
23521 var valLength = val.length
23522
23523 if (encoding !== undefined) {
23524 encoding = String(encoding).toLowerCase()
23525 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
23526 encoding === 'utf16le' || encoding === 'utf-16le') {
23527 if (arr.length < 2 || val.length < 2) {
23528 return -1
23529 }
23530 indexSize = 2
23531 arrLength /= 2
23532 valLength /= 2
23533 byteOffset /= 2
23534 }
23535 }
23536
23537 function read (buf, i) {
23538 if (indexSize === 1) {
23539 return buf[i]
23540 } else {
23541 return buf.readUInt16BE(i * indexSize)
23542 }
23543 }
23544
23545 var i
23546 if (dir) {
23547 var foundIndex = -1
23548 for (i = byteOffset; i < arrLength; i++) {
23549 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
23550 if (foundIndex === -1) foundIndex = i
23551 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
23552 } else {
23553 if (foundIndex !== -1) i -= i - foundIndex
23554 foundIndex = -1
23555 }
23556 }
23557 } else {
23558 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
23559 for (i = byteOffset; i >= 0; i--) {
23560 var found = true
23561 for (var j = 0; j < valLength; j++) {
23562 if (read(arr, i + j) !== read(val, j)) {
23563 found = false
23564 break
23565 }
23566 }
23567 if (found) return i
23568 }
23569 }
23570
23571 return -1
23572}
23573
23574Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
23575 return this.indexOf(val, byteOffset, encoding) !== -1
23576}
23577
23578Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
23579 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
23580}
23581
23582Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
23583 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
23584}
23585
23586function hexWrite (buf, string, offset, length) {
23587 offset = Number(offset) || 0
23588 var remaining = buf.length - offset
23589 if (!length) {
23590 length = remaining
23591 } else {
23592 length = Number(length)
23593 if (length > remaining) {
23594 length = remaining
23595 }
23596 }
23597
23598 var strLen = string.length
23599
23600 if (length > strLen / 2) {
23601 length = strLen / 2
23602 }
23603 for (var i = 0; i < length; ++i) {
23604 var parsed = parseInt(string.substr(i * 2, 2), 16)
23605 if (numberIsNaN(parsed)) return i
23606 buf[offset + i] = parsed
23607 }
23608 return i
23609}
23610
23611function utf8Write (buf, string, offset, length) {
23612 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
23613}
23614
23615function asciiWrite (buf, string, offset, length) {
23616 return blitBuffer(asciiToBytes(string), buf, offset, length)
23617}
23618
23619function latin1Write (buf, string, offset, length) {
23620 return asciiWrite(buf, string, offset, length)
23621}
23622
23623function base64Write (buf, string, offset, length) {
23624 return blitBuffer(base64ToBytes(string), buf, offset, length)
23625}
23626
23627function ucs2Write (buf, string, offset, length) {
23628 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
23629}
23630
23631Buffer.prototype.write = function write (string, offset, length, encoding) {
23632 // Buffer#write(string)
23633 if (offset === undefined) {
23634 encoding = 'utf8'
23635 length = this.length
23636 offset = 0
23637 // Buffer#write(string, encoding)
23638 } else if (length === undefined && typeof offset === 'string') {
23639 encoding = offset
23640 length = this.length
23641 offset = 0
23642 // Buffer#write(string, offset[, length][, encoding])
23643 } else if (isFinite(offset)) {
23644 offset = offset >>> 0
23645 if (isFinite(length)) {
23646 length = length >>> 0
23647 if (encoding === undefined) encoding = 'utf8'
23648 } else {
23649 encoding = length
23650 length = undefined
23651 }
23652 } else {
23653 throw new Error(
23654 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
23655 )
23656 }
23657
23658 var remaining = this.length - offset
23659 if (length === undefined || length > remaining) length = remaining
23660
23661 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
23662 throw new RangeError('Attempt to write outside buffer bounds')
23663 }
23664
23665 if (!encoding) encoding = 'utf8'
23666
23667 var loweredCase = false
23668 for (;;) {
23669 switch (encoding) {
23670 case 'hex':
23671 return hexWrite(this, string, offset, length)
23672
23673 case 'utf8':
23674 case 'utf-8':
23675 return utf8Write(this, string, offset, length)
23676
23677 case 'ascii':
23678 return asciiWrite(this, string, offset, length)
23679
23680 case 'latin1':
23681 case 'binary':
23682 return latin1Write(this, string, offset, length)
23683
23684 case 'base64':
23685 // Warning: maxLength not taken into account in base64Write
23686 return base64Write(this, string, offset, length)
23687
23688 case 'ucs2':
23689 case 'ucs-2':
23690 case 'utf16le':
23691 case 'utf-16le':
23692 return ucs2Write(this, string, offset, length)
23693
23694 default:
23695 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
23696 encoding = ('' + encoding).toLowerCase()
23697 loweredCase = true
23698 }
23699 }
23700}
23701
23702Buffer.prototype.toJSON = function toJSON () {
23703 return {
23704 type: 'Buffer',
23705 data: Array.prototype.slice.call(this._arr || this, 0)
23706 }
23707}
23708
23709function base64Slice (buf, start, end) {
23710 if (start === 0 && end === buf.length) {
23711 return base64.fromByteArray(buf)
23712 } else {
23713 return base64.fromByteArray(buf.slice(start, end))
23714 }
23715}
23716
23717function utf8Slice (buf, start, end) {
23718 end = Math.min(buf.length, end)
23719 var res = []
23720
23721 var i = start
23722 while (i < end) {
23723 var firstByte = buf[i]
23724 var codePoint = null
23725 var bytesPerSequence = (firstByte > 0xEF) ? 4
23726 : (firstByte > 0xDF) ? 3
23727 : (firstByte > 0xBF) ? 2
23728 : 1
23729
23730 if (i + bytesPerSequence <= end) {
23731 var secondByte, thirdByte, fourthByte, tempCodePoint
23732
23733 switch (bytesPerSequence) {
23734 case 1:
23735 if (firstByte < 0x80) {
23736 codePoint = firstByte
23737 }
23738 break
23739 case 2:
23740 secondByte = buf[i + 1]
23741 if ((secondByte & 0xC0) === 0x80) {
23742 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
23743 if (tempCodePoint > 0x7F) {
23744 codePoint = tempCodePoint
23745 }
23746 }
23747 break
23748 case 3:
23749 secondByte = buf[i + 1]
23750 thirdByte = buf[i + 2]
23751 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
23752 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
23753 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
23754 codePoint = tempCodePoint
23755 }
23756 }
23757 break
23758 case 4:
23759 secondByte = buf[i + 1]
23760 thirdByte = buf[i + 2]
23761 fourthByte = buf[i + 3]
23762 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
23763 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
23764 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
23765 codePoint = tempCodePoint
23766 }
23767 }
23768 }
23769 }
23770
23771 if (codePoint === null) {
23772 // we did not generate a valid codePoint so insert a
23773 // replacement char (U+FFFD) and advance only 1 byte
23774 codePoint = 0xFFFD
23775 bytesPerSequence = 1
23776 } else if (codePoint > 0xFFFF) {
23777 // encode to utf16 (surrogate pair dance)
23778 codePoint -= 0x10000
23779 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
23780 codePoint = 0xDC00 | codePoint & 0x3FF
23781 }
23782
23783 res.push(codePoint)
23784 i += bytesPerSequence
23785 }
23786
23787 return decodeCodePointsArray(res)
23788}
23789
23790// Based on http://stackoverflow.com/a/22747272/680742, the browser with
23791// the lowest limit is Chrome, with 0x10000 args.
23792// We go 1 magnitude less, for safety
23793var MAX_ARGUMENTS_LENGTH = 0x1000
23794
23795function decodeCodePointsArray (codePoints) {
23796 var len = codePoints.length
23797 if (len <= MAX_ARGUMENTS_LENGTH) {
23798 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
23799 }
23800
23801 // Decode in chunks to avoid "call stack size exceeded".
23802 var res = ''
23803 var i = 0
23804 while (i < len) {
23805 res += String.fromCharCode.apply(
23806 String,
23807 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
23808 )
23809 }
23810 return res
23811}
23812
23813function asciiSlice (buf, start, end) {
23814 var ret = ''
23815 end = Math.min(buf.length, end)
23816
23817 for (var i = start; i < end; ++i) {
23818 ret += String.fromCharCode(buf[i] & 0x7F)
23819 }
23820 return ret
23821}
23822
23823function latin1Slice (buf, start, end) {
23824 var ret = ''
23825 end = Math.min(buf.length, end)
23826
23827 for (var i = start; i < end; ++i) {
23828 ret += String.fromCharCode(buf[i])
23829 }
23830 return ret
23831}
23832
23833function hexSlice (buf, start, end) {
23834 var len = buf.length
23835
23836 if (!start || start < 0) start = 0
23837 if (!end || end < 0 || end > len) end = len
23838
23839 var out = ''
23840 for (var i = start; i < end; ++i) {
23841 out += hexSliceLookupTable[buf[i]]
23842 }
23843 return out
23844}
23845
23846function utf16leSlice (buf, start, end) {
23847 var bytes = buf.slice(start, end)
23848 var res = ''
23849 for (var i = 0; i < bytes.length; i += 2) {
23850 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
23851 }
23852 return res
23853}
23854
23855Buffer.prototype.slice = function slice (start, end) {
23856 var len = this.length
23857 start = ~~start
23858 end = end === undefined ? len : ~~end
23859
23860 if (start < 0) {
23861 start += len
23862 if (start < 0) start = 0
23863 } else if (start > len) {
23864 start = len
23865 }
23866
23867 if (end < 0) {
23868 end += len
23869 if (end < 0) end = 0
23870 } else if (end > len) {
23871 end = len
23872 }
23873
23874 if (end < start) end = start
23875
23876 var newBuf = this.subarray(start, end)
23877 // Return an augmented `Uint8Array` instance
23878 Object.setPrototypeOf(newBuf, Buffer.prototype)
23879
23880 return newBuf
23881}
23882
23883/*
23884 * Need to make sure that buffer isn't trying to write out of bounds.
23885 */
23886function checkOffset (offset, ext, length) {
23887 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
23888 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
23889}
23890
23891Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
23892 offset = offset >>> 0
23893 byteLength = byteLength >>> 0
23894 if (!noAssert) checkOffset(offset, byteLength, this.length)
23895
23896 var val = this[offset]
23897 var mul = 1
23898 var i = 0
23899 while (++i < byteLength && (mul *= 0x100)) {
23900 val += this[offset + i] * mul
23901 }
23902
23903 return val
23904}
23905
23906Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
23907 offset = offset >>> 0
23908 byteLength = byteLength >>> 0
23909 if (!noAssert) {
23910 checkOffset(offset, byteLength, this.length)
23911 }
23912
23913 var val = this[offset + --byteLength]
23914 var mul = 1
23915 while (byteLength > 0 && (mul *= 0x100)) {
23916 val += this[offset + --byteLength] * mul
23917 }
23918
23919 return val
23920}
23921
23922Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
23923 offset = offset >>> 0
23924 if (!noAssert) checkOffset(offset, 1, this.length)
23925 return this[offset]
23926}
23927
23928Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
23929 offset = offset >>> 0
23930 if (!noAssert) checkOffset(offset, 2, this.length)
23931 return this[offset] | (this[offset + 1] << 8)
23932}
23933
23934Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
23935 offset = offset >>> 0
23936 if (!noAssert) checkOffset(offset, 2, this.length)
23937 return (this[offset] << 8) | this[offset + 1]
23938}
23939
23940Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
23941 offset = offset >>> 0
23942 if (!noAssert) checkOffset(offset, 4, this.length)
23943
23944 return ((this[offset]) |
23945 (this[offset + 1] << 8) |
23946 (this[offset + 2] << 16)) +
23947 (this[offset + 3] * 0x1000000)
23948}
23949
23950Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
23951 offset = offset >>> 0
23952 if (!noAssert) checkOffset(offset, 4, this.length)
23953
23954 return (this[offset] * 0x1000000) +
23955 ((this[offset + 1] << 16) |
23956 (this[offset + 2] << 8) |
23957 this[offset + 3])
23958}
23959
23960Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
23961 offset = offset >>> 0
23962 byteLength = byteLength >>> 0
23963 if (!noAssert) checkOffset(offset, byteLength, this.length)
23964
23965 var val = this[offset]
23966 var mul = 1
23967 var i = 0
23968 while (++i < byteLength && (mul *= 0x100)) {
23969 val += this[offset + i] * mul
23970 }
23971 mul *= 0x80
23972
23973 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
23974
23975 return val
23976}
23977
23978Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
23979 offset = offset >>> 0
23980 byteLength = byteLength >>> 0
23981 if (!noAssert) checkOffset(offset, byteLength, this.length)
23982
23983 var i = byteLength
23984 var mul = 1
23985 var val = this[offset + --i]
23986 while (i > 0 && (mul *= 0x100)) {
23987 val += this[offset + --i] * mul
23988 }
23989 mul *= 0x80
23990
23991 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
23992
23993 return val
23994}
23995
23996Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
23997 offset = offset >>> 0
23998 if (!noAssert) checkOffset(offset, 1, this.length)
23999 if (!(this[offset] & 0x80)) return (this[offset])
24000 return ((0xff - this[offset] + 1) * -1)
24001}
24002
24003Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
24004 offset = offset >>> 0
24005 if (!noAssert) checkOffset(offset, 2, this.length)
24006 var val = this[offset] | (this[offset + 1] << 8)
24007 return (val & 0x8000) ? val | 0xFFFF0000 : val
24008}
24009
24010Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
24011 offset = offset >>> 0
24012 if (!noAssert) checkOffset(offset, 2, this.length)
24013 var val = this[offset + 1] | (this[offset] << 8)
24014 return (val & 0x8000) ? val | 0xFFFF0000 : val
24015}
24016
24017Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
24018 offset = offset >>> 0
24019 if (!noAssert) checkOffset(offset, 4, this.length)
24020
24021 return (this[offset]) |
24022 (this[offset + 1] << 8) |
24023 (this[offset + 2] << 16) |
24024 (this[offset + 3] << 24)
24025}
24026
24027Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
24028 offset = offset >>> 0
24029 if (!noAssert) checkOffset(offset, 4, this.length)
24030
24031 return (this[offset] << 24) |
24032 (this[offset + 1] << 16) |
24033 (this[offset + 2] << 8) |
24034 (this[offset + 3])
24035}
24036
24037Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
24038 offset = offset >>> 0
24039 if (!noAssert) checkOffset(offset, 4, this.length)
24040 return ieee754.read(this, offset, true, 23, 4)
24041}
24042
24043Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
24044 offset = offset >>> 0
24045 if (!noAssert) checkOffset(offset, 4, this.length)
24046 return ieee754.read(this, offset, false, 23, 4)
24047}
24048
24049Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
24050 offset = offset >>> 0
24051 if (!noAssert) checkOffset(offset, 8, this.length)
24052 return ieee754.read(this, offset, true, 52, 8)
24053}
24054
24055Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
24056 offset = offset >>> 0
24057 if (!noAssert) checkOffset(offset, 8, this.length)
24058 return ieee754.read(this, offset, false, 52, 8)
24059}
24060
24061function checkInt (buf, value, offset, ext, max, min) {
24062 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
24063 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
24064 if (offset + ext > buf.length) throw new RangeError('Index out of range')
24065}
24066
24067Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
24068 value = +value
24069 offset = offset >>> 0
24070 byteLength = byteLength >>> 0
24071 if (!noAssert) {
24072 var maxBytes = Math.pow(2, 8 * byteLength) - 1
24073 checkInt(this, value, offset, byteLength, maxBytes, 0)
24074 }
24075
24076 var mul = 1
24077 var i = 0
24078 this[offset] = value & 0xFF
24079 while (++i < byteLength && (mul *= 0x100)) {
24080 this[offset + i] = (value / mul) & 0xFF
24081 }
24082
24083 return offset + byteLength
24084}
24085
24086Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
24087 value = +value
24088 offset = offset >>> 0
24089 byteLength = byteLength >>> 0
24090 if (!noAssert) {
24091 var maxBytes = Math.pow(2, 8 * byteLength) - 1
24092 checkInt(this, value, offset, byteLength, maxBytes, 0)
24093 }
24094
24095 var i = byteLength - 1
24096 var mul = 1
24097 this[offset + i] = value & 0xFF
24098 while (--i >= 0 && (mul *= 0x100)) {
24099 this[offset + i] = (value / mul) & 0xFF
24100 }
24101
24102 return offset + byteLength
24103}
24104
24105Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
24106 value = +value
24107 offset = offset >>> 0
24108 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
24109 this[offset] = (value & 0xff)
24110 return offset + 1
24111}
24112
24113Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
24114 value = +value
24115 offset = offset >>> 0
24116 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
24117 this[offset] = (value & 0xff)
24118 this[offset + 1] = (value >>> 8)
24119 return offset + 2
24120}
24121
24122Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
24123 value = +value
24124 offset = offset >>> 0
24125 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
24126 this[offset] = (value >>> 8)
24127 this[offset + 1] = (value & 0xff)
24128 return offset + 2
24129}
24130
24131Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
24132 value = +value
24133 offset = offset >>> 0
24134 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
24135 this[offset + 3] = (value >>> 24)
24136 this[offset + 2] = (value >>> 16)
24137 this[offset + 1] = (value >>> 8)
24138 this[offset] = (value & 0xff)
24139 return offset + 4
24140}
24141
24142Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
24143 value = +value
24144 offset = offset >>> 0
24145 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
24146 this[offset] = (value >>> 24)
24147 this[offset + 1] = (value >>> 16)
24148 this[offset + 2] = (value >>> 8)
24149 this[offset + 3] = (value & 0xff)
24150 return offset + 4
24151}
24152
24153Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
24154 value = +value
24155 offset = offset >>> 0
24156 if (!noAssert) {
24157 var limit = Math.pow(2, (8 * byteLength) - 1)
24158
24159 checkInt(this, value, offset, byteLength, limit - 1, -limit)
24160 }
24161
24162 var i = 0
24163 var mul = 1
24164 var sub = 0
24165 this[offset] = value & 0xFF
24166 while (++i < byteLength && (mul *= 0x100)) {
24167 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
24168 sub = 1
24169 }
24170 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
24171 }
24172
24173 return offset + byteLength
24174}
24175
24176Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
24177 value = +value
24178 offset = offset >>> 0
24179 if (!noAssert) {
24180 var limit = Math.pow(2, (8 * byteLength) - 1)
24181
24182 checkInt(this, value, offset, byteLength, limit - 1, -limit)
24183 }
24184
24185 var i = byteLength - 1
24186 var mul = 1
24187 var sub = 0
24188 this[offset + i] = value & 0xFF
24189 while (--i >= 0 && (mul *= 0x100)) {
24190 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
24191 sub = 1
24192 }
24193 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
24194 }
24195
24196 return offset + byteLength
24197}
24198
24199Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
24200 value = +value
24201 offset = offset >>> 0
24202 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
24203 if (value < 0) value = 0xff + value + 1
24204 this[offset] = (value & 0xff)
24205 return offset + 1
24206}
24207
24208Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
24209 value = +value
24210 offset = offset >>> 0
24211 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
24212 this[offset] = (value & 0xff)
24213 this[offset + 1] = (value >>> 8)
24214 return offset + 2
24215}
24216
24217Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
24218 value = +value
24219 offset = offset >>> 0
24220 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
24221 this[offset] = (value >>> 8)
24222 this[offset + 1] = (value & 0xff)
24223 return offset + 2
24224}
24225
24226Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
24227 value = +value
24228 offset = offset >>> 0
24229 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
24230 this[offset] = (value & 0xff)
24231 this[offset + 1] = (value >>> 8)
24232 this[offset + 2] = (value >>> 16)
24233 this[offset + 3] = (value >>> 24)
24234 return offset + 4
24235}
24236
24237Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
24238 value = +value
24239 offset = offset >>> 0
24240 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
24241 if (value < 0) value = 0xffffffff + value + 1
24242 this[offset] = (value >>> 24)
24243 this[offset + 1] = (value >>> 16)
24244 this[offset + 2] = (value >>> 8)
24245 this[offset + 3] = (value & 0xff)
24246 return offset + 4
24247}
24248
24249function checkIEEE754 (buf, value, offset, ext, max, min) {
24250 if (offset + ext > buf.length) throw new RangeError('Index out of range')
24251 if (offset < 0) throw new RangeError('Index out of range')
24252}
24253
24254function writeFloat (buf, value, offset, littleEndian, noAssert) {
24255 value = +value
24256 offset = offset >>> 0
24257 if (!noAssert) {
24258 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
24259 }
24260 ieee754.write(buf, value, offset, littleEndian, 23, 4)
24261 return offset + 4
24262}
24263
24264Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
24265 return writeFloat(this, value, offset, true, noAssert)
24266}
24267
24268Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
24269 return writeFloat(this, value, offset, false, noAssert)
24270}
24271
24272function writeDouble (buf, value, offset, littleEndian, noAssert) {
24273 value = +value
24274 offset = offset >>> 0
24275 if (!noAssert) {
24276 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
24277 }
24278 ieee754.write(buf, value, offset, littleEndian, 52, 8)
24279 return offset + 8
24280}
24281
24282Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
24283 return writeDouble(this, value, offset, true, noAssert)
24284}
24285
24286Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
24287 return writeDouble(this, value, offset, false, noAssert)
24288}
24289
24290// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
24291Buffer.prototype.copy = function copy (target, targetStart, start, end) {
24292 if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
24293 if (!start) start = 0
24294 if (!end && end !== 0) end = this.length
24295 if (targetStart >= target.length) targetStart = target.length
24296 if (!targetStart) targetStart = 0
24297 if (end > 0 && end < start) end = start
24298
24299 // Copy 0 bytes; we're done
24300 if (end === start) return 0
24301 if (target.length === 0 || this.length === 0) return 0
24302
24303 // Fatal error conditions
24304 if (targetStart < 0) {
24305 throw new RangeError('targetStart out of bounds')
24306 }
24307 if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
24308 if (end < 0) throw new RangeError('sourceEnd out of bounds')
24309
24310 // Are we oob?
24311 if (end > this.length) end = this.length
24312 if (target.length - targetStart < end - start) {
24313 end = target.length - targetStart + start
24314 }
24315
24316 var len = end - start
24317
24318 if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
24319 // Use built-in when available, missing from IE11
24320 this.copyWithin(targetStart, start, end)
24321 } else if (this === target && start < targetStart && targetStart < end) {
24322 // descending copy from end
24323 for (var i = len - 1; i >= 0; --i) {
24324 target[i + targetStart] = this[i + start]
24325 }
24326 } else {
24327 Uint8Array.prototype.set.call(
24328 target,
24329 this.subarray(start, end),
24330 targetStart
24331 )
24332 }
24333
24334 return len
24335}
24336
24337// Usage:
24338// buffer.fill(number[, offset[, end]])
24339// buffer.fill(buffer[, offset[, end]])
24340// buffer.fill(string[, offset[, end]][, encoding])
24341Buffer.prototype.fill = function fill (val, start, end, encoding) {
24342 // Handle string cases:
24343 if (typeof val === 'string') {
24344 if (typeof start === 'string') {
24345 encoding = start
24346 start = 0
24347 end = this.length
24348 } else if (typeof end === 'string') {
24349 encoding = end
24350 end = this.length
24351 }
24352 if (encoding !== undefined && typeof encoding !== 'string') {
24353 throw new TypeError('encoding must be a string')
24354 }
24355 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
24356 throw new TypeError('Unknown encoding: ' + encoding)
24357 }
24358 if (val.length === 1) {
24359 var code = val.charCodeAt(0)
24360 if ((encoding === 'utf8' && code < 128) ||
24361 encoding === 'latin1') {
24362 // Fast path: If `val` fits into a single byte, use that numeric value.
24363 val = code
24364 }
24365 }
24366 } else if (typeof val === 'number') {
24367 val = val & 255
24368 } else if (typeof val === 'boolean') {
24369 val = Number(val)
24370 }
24371
24372 // Invalid ranges are not set to a default, so can range check early.
24373 if (start < 0 || this.length < start || this.length < end) {
24374 throw new RangeError('Out of range index')
24375 }
24376
24377 if (end <= start) {
24378 return this
24379 }
24380
24381 start = start >>> 0
24382 end = end === undefined ? this.length : end >>> 0
24383
24384 if (!val) val = 0
24385
24386 var i
24387 if (typeof val === 'number') {
24388 for (i = start; i < end; ++i) {
24389 this[i] = val
24390 }
24391 } else {
24392 var bytes = Buffer.isBuffer(val)
24393 ? val
24394 : Buffer.from(val, encoding)
24395 var len = bytes.length
24396 if (len === 0) {
24397 throw new TypeError('The value "' + val +
24398 '" is invalid for argument "value"')
24399 }
24400 for (i = 0; i < end - start; ++i) {
24401 this[i + start] = bytes[i % len]
24402 }
24403 }
24404
24405 return this
24406}
24407
24408// HELPER FUNCTIONS
24409// ================
24410
24411var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
24412
24413function base64clean (str) {
24414 // Node takes equal signs as end of the Base64 encoding
24415 str = str.split('=')[0]
24416 // Node strips out invalid characters like \n and \t from the string, base64-js does not
24417 str = str.trim().replace(INVALID_BASE64_RE, '')
24418 // Node converts strings with length < 2 to ''
24419 if (str.length < 2) return ''
24420 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
24421 while (str.length % 4 !== 0) {
24422 str = str + '='
24423 }
24424 return str
24425}
24426
24427function utf8ToBytes (string, units) {
24428 units = units || Infinity
24429 var codePoint
24430 var length = string.length
24431 var leadSurrogate = null
24432 var bytes = []
24433
24434 for (var i = 0; i < length; ++i) {
24435 codePoint = string.charCodeAt(i)
24436
24437 // is surrogate component
24438 if (codePoint > 0xD7FF && codePoint < 0xE000) {
24439 // last char was a lead
24440 if (!leadSurrogate) {
24441 // no lead yet
24442 if (codePoint > 0xDBFF) {
24443 // unexpected trail
24444 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
24445 continue
24446 } else if (i + 1 === length) {
24447 // unpaired lead
24448 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
24449 continue
24450 }
24451
24452 // valid lead
24453 leadSurrogate = codePoint
24454
24455 continue
24456 }
24457
24458 // 2 leads in a row
24459 if (codePoint < 0xDC00) {
24460 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
24461 leadSurrogate = codePoint
24462 continue
24463 }
24464
24465 // valid surrogate pair
24466 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
24467 } else if (leadSurrogate) {
24468 // valid bmp char, but last char was a lead
24469 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
24470 }
24471
24472 leadSurrogate = null
24473
24474 // encode utf8
24475 if (codePoint < 0x80) {
24476 if ((units -= 1) < 0) break
24477 bytes.push(codePoint)
24478 } else if (codePoint < 0x800) {
24479 if ((units -= 2) < 0) break
24480 bytes.push(
24481 codePoint >> 0x6 | 0xC0,
24482 codePoint & 0x3F | 0x80
24483 )
24484 } else if (codePoint < 0x10000) {
24485 if ((units -= 3) < 0) break
24486 bytes.push(
24487 codePoint >> 0xC | 0xE0,
24488 codePoint >> 0x6 & 0x3F | 0x80,
24489 codePoint & 0x3F | 0x80
24490 )
24491 } else if (codePoint < 0x110000) {
24492 if ((units -= 4) < 0) break
24493 bytes.push(
24494 codePoint >> 0x12 | 0xF0,
24495 codePoint >> 0xC & 0x3F | 0x80,
24496 codePoint >> 0x6 & 0x3F | 0x80,
24497 codePoint & 0x3F | 0x80
24498 )
24499 } else {
24500 throw new Error('Invalid code point')
24501 }
24502 }
24503
24504 return bytes
24505}
24506
24507function asciiToBytes (str) {
24508 var byteArray = []
24509 for (var i = 0; i < str.length; ++i) {
24510 // Node's code seems to be doing this and not & 0x7F..
24511 byteArray.push(str.charCodeAt(i) & 0xFF)
24512 }
24513 return byteArray
24514}
24515
24516function utf16leToBytes (str, units) {
24517 var c, hi, lo
24518 var byteArray = []
24519 for (var i = 0; i < str.length; ++i) {
24520 if ((units -= 2) < 0) break
24521
24522 c = str.charCodeAt(i)
24523 hi = c >> 8
24524 lo = c % 256
24525 byteArray.push(lo)
24526 byteArray.push(hi)
24527 }
24528
24529 return byteArray
24530}
24531
24532function base64ToBytes (str) {
24533 return base64.toByteArray(base64clean(str))
24534}
24535
24536function blitBuffer (src, dst, offset, length) {
24537 for (var i = 0; i < length; ++i) {
24538 if ((i + offset >= dst.length) || (i >= src.length)) break
24539 dst[i + offset] = src[i]
24540 }
24541 return i
24542}
24543
24544// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
24545// the `instanceof` check but they should be treated as of that type.
24546// See: https://github.com/feross/buffer/issues/166
24547function isInstance (obj, type) {
24548 return obj instanceof type ||
24549 (obj != null && obj.constructor != null && obj.constructor.name != null &&
24550 obj.constructor.name === type.name)
24551}
24552function numberIsNaN (obj) {
24553 // For IE11 support
24554 return obj !== obj // eslint-disable-line no-self-compare
24555}
24556
24557// Create lookup table for `toString('hex')`
24558// See: https://github.com/feross/buffer/issues/219
24559var hexSliceLookupTable = (function () {
24560 var alphabet = '0123456789abcdef'
24561 var table = new Array(256)
24562 for (var i = 0; i < 16; ++i) {
24563 var i16 = i * 16
24564 for (var j = 0; j < 16; ++j) {
24565 table[i16 + j] = alphabet[i] + alphabet[j]
24566 }
24567 }
24568 return table
24569})()
24570
24571}).call(this,require("buffer").Buffer)
24572},{"base64-js":56,"buffer":146,"ieee754":395}],147:[function(require,module,exports){
24573/**
24574 * @license
24575 * https://github.com/bitcoincashjs/cashaddr
24576 * Copyright (c) 2017-2018 Emilio Almansi
24577 * Distributed under the MIT software license, see the accompanying
24578 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
24579 */
24580
24581'use strict';
24582
24583var validate = require('./validation').validate;
24584
24585/**
24586 * Base32 encoding and decoding.
24587 *
24588 * @module base32
24589 */
24590
24591/**
24592 * Charset containing the 32 symbols used in the base32 encoding.
24593 * @private
24594 */
24595var CHARSET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';
24596
24597/**
24598 * Inverted index mapping each symbol into its index within the charset.
24599 * @private
24600 */
24601var CHARSET_INVERSE_INDEX = {
24602 'q': 0, 'p': 1, 'z': 2, 'r': 3, 'y': 4, '9': 5, 'x': 6, '8': 7,
24603 'g': 8, 'f': 9, '2': 10, 't': 11, 'v': 12, 'd': 13, 'w': 14, '0': 15,
24604 's': 16, '3': 17, 'j': 18, 'n': 19, '5': 20, '4': 21, 'k': 22, 'h': 23,
24605 'c': 24, 'e': 25, '6': 26, 'm': 27, 'u': 28, 'a': 29, '7': 30, 'l': 31,
24606};
24607
24608/**
24609 * Encodes the given array of 5-bit integers as a base32-encoded string.
24610 *
24611 * @static
24612 * @param {Uint8Array} data Array of integers between 0 and 31 inclusive.
24613 * @returns {string}
24614 * @throws {ValidationError}
24615 */
24616function encode(data) {
24617 validate(data instanceof Uint8Array, 'Invalid data: ' + data + '.');
24618 var base32 = '';
24619 for (var i = 0; i < data.length; ++i) {
24620 var value = data[i];
24621 validate(0 <= value && value < 32, 'Invalid value: ' + value + '.');
24622 base32 += CHARSET[value];
24623 }
24624 return base32;
24625}
24626
24627/**
24628 * Decodes the given base32-encoded string into an array of 5-bit integers.
24629 *
24630 * @static
24631 * @param {string} string
24632 * @returns {Uint8Array}
24633 * @throws {ValidationError}
24634 */
24635function decode(string) {
24636 validate(typeof string === 'string', 'Invalid base32-encoded string: ' + string + '.');
24637 var data = new Uint8Array(string.length);
24638 for (var i = 0; i < string.length; ++i) {
24639 var value = string[i];
24640 validate(value in CHARSET_INVERSE_INDEX, 'Invalid value: ' + value + '.');
24641 data[i] = CHARSET_INVERSE_INDEX[value];
24642 }
24643 return data;
24644}
24645
24646module.exports = {
24647 encode: encode,
24648 decode: decode,
24649};
24650
24651},{"./validation":150}],148:[function(require,module,exports){
24652/**
24653 * @license
24654 * https://github.com/bitcoincashjs/cashaddr
24655 * Copyright (c) 2017-2018 Emilio Almansi
24656 * Distributed under the MIT software license, see the accompanying
24657 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
24658 */
24659
24660'use strict';
24661
24662var base32 = require('./base32');
24663var bigInt = require('big-integer');
24664var convertBits = require('./convertBits');
24665var validation = require('./validation');
24666var validate = validation.validate;
24667
24668/**
24669 * Encoding and decoding of the new Cash Address format for Bitcoin Cash. <br />
24670 * Compliant with the original cashaddr specification:
24671 * {@link https://github.com/Bitcoin-UAHF/spec/blob/master/cashaddr.md}
24672 * @module cashaddr
24673 */
24674
24675/**
24676 * Encodes a hash from a given type into a Bitcoin Cash address with the given prefix.
24677 *
24678 * @static
24679 * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
24680 * @param {string} type Type of address to generate. Either 'P2PKH' or 'P2SH'.
24681 * @param {Uint8Array} hash Hash to encode represented as an array of 8-bit integers.
24682 * @returns {string}
24683 * @throws {ValidationError}
24684 */
24685function encode(prefix, type, hash) {
24686 validate(typeof prefix === 'string' && isValidPrefix(prefix), 'Invalid prefix: ' + prefix + '.');
24687 validate(typeof type === 'string', 'Invalid type: ' + type + '.');
24688 validate(hash instanceof Uint8Array, 'Invalid hash: ' + hash + '.');
24689 var prefixData = concat(prefixToUint5Array(prefix), new Uint8Array(1));
24690 var versionByte = getTypeBits(type) + getHashSizeBits(hash);
24691 var payloadData = toUint5Array(concat(Uint8Array.of(versionByte), hash));
24692 var checksumData = concat(concat(prefixData, payloadData), new Uint8Array(8));
24693 var payload = concat(payloadData, checksumToUint5Array(polymod(checksumData)));
24694 return prefix + ':' + base32.encode(payload);
24695}
24696
24697/**
24698 * Decodes the given address into its constituting prefix, type and hash. See [#encode()]{@link encode}.
24699 *
24700 * @static
24701 * @param {string} address Address to decode. E.g.: 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'.
24702 * @returns {object}
24703 * @throws {ValidationError}
24704 */
24705function decode(address) {
24706 validate(typeof address === 'string' && hasSingleCase(address), 'Invalid address: ' + address + '.');
24707 var pieces = address.toLowerCase().split(':');
24708 validate(pieces.length === 2, 'Missing prefix: ' + address + '.');
24709 var prefix = pieces[0];
24710 var payload = base32.decode(pieces[1]);
24711 validate(validChecksum(prefix, payload), 'Invalid checksum: ' + address + '.');
24712 var payloadData = fromUint5Array(payload.slice(0, -8));
24713 var versionByte = payloadData[0];
24714 var hash = payloadData.slice(1);
24715 validate(getHashSize(versionByte) === hash.length * 8, 'Invalid hash size: ' + address + '.');
24716 var type = getType(versionByte);
24717 return {
24718 prefix: prefix,
24719 type: type,
24720 hash: hash,
24721 };
24722}
24723
24724/**
24725 * Error thrown when encoding or decoding fail due to invalid input.
24726 *
24727 * @constructor ValidationError
24728 * @param {string} message Error description.
24729 */
24730var ValidationError = validation.ValidationError;
24731
24732/**
24733 * Valid address prefixes.
24734 *
24735 * @private
24736 */
24737var VALID_PREFIXES = ['bitcoincash', 'bchtest', 'bchreg', 'simpleledger', 'slptest', 'slpreg'];
24738
24739/**
24740 * Checks whether a string is a valid prefix; ie., it has a single letter case
24741 * and is one of 'bitcoincash', 'bchtest', or 'bchreg'.
24742 *
24743 * @private
24744 * @param {string} prefix
24745 * @returns {boolean}
24746 */
24747function isValidPrefix(prefix) {
24748 return hasSingleCase(prefix) && VALID_PREFIXES.indexOf(prefix.toLowerCase()) !== -1;
24749}
24750
24751/**
24752 * Derives an array from the given prefix to be used in the computation
24753 * of the address' checksum.
24754 *
24755 * @private
24756 * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
24757 * @returns {Uint8Array}
24758 */
24759function prefixToUint5Array(prefix) {
24760 var result = new Uint8Array(prefix.length);
24761 for (var i = 0; i < prefix.length; ++i) {
24762 result[i] = prefix[i].charCodeAt(0) & 31;
24763 }
24764 return result;
24765}
24766
24767/**
24768 * Returns an array representation of the given checksum to be encoded
24769 * within the address' payload.
24770 *
24771 * @private
24772 * @param {BigInteger} checksum Computed checksum.
24773 * @returns {Uint8Array}
24774 */
24775function checksumToUint5Array(checksum) {
24776 var result = new Uint8Array(8);
24777 for (var i = 0; i < 8; ++i) {
24778 result[7 - i] = checksum.and(31).toJSNumber();
24779 checksum = checksum.shiftRight(5);
24780 }
24781 return result;
24782}
24783
24784/**
24785 * Returns the bit representation of the given type within the version
24786 * byte.
24787 *
24788 * @private
24789 * @param {string} type Address type. Either 'P2PKH' or 'P2SH'.
24790 * @returns {number}
24791 * @throws {ValidationError}
24792 */
24793function getTypeBits(type) {
24794 switch (type) {
24795 case 'P2PKH':
24796 return 0;
24797 case 'P2SH':
24798 return 8;
24799 default:
24800 throw new ValidationError('Invalid type: ' + type + '.');
24801 }
24802}
24803
24804/**
24805 * Retrieves the address type from its bit representation within the
24806 * version byte.
24807 *
24808 * @private
24809 * @param {number} versionByte
24810 * @returns {string}
24811 * @throws {ValidationError}
24812 */
24813function getType(versionByte) {
24814 switch (versionByte & 120) {
24815 case 0:
24816 return 'P2PKH';
24817 case 8:
24818 return 'P2SH';
24819 default:
24820 throw new ValidationError('Invalid address type in version byte: ' + versionByte + '.');
24821 }
24822}
24823
24824/**
24825 * Returns the bit representation of the length in bits of the given
24826 * hash within the version byte.
24827 *
24828 * @private
24829 * @param {Uint8Array} hash Hash to encode represented as an array of 8-bit integers.
24830 * @returns {number}
24831 * @throws {ValidationError}
24832 */
24833function getHashSizeBits(hash) {
24834 switch (hash.length * 8) {
24835 case 160:
24836 return 0;
24837 case 192:
24838 return 1;
24839 case 224:
24840 return 2;
24841 case 256:
24842 return 3;
24843 case 320:
24844 return 4;
24845 case 384:
24846 return 5;
24847 case 448:
24848 return 6;
24849 case 512:
24850 return 7;
24851 default:
24852 throw new ValidationError('Invalid hash size: ' + hash.length + '.');
24853 }
24854}
24855
24856/**
24857 * Retrieves the the length in bits of the encoded hash from its bit
24858 * representation within the version byte.
24859 *
24860 * @private
24861 * @param {number} versionByte
24862 * @returns {number}
24863 */
24864function getHashSize(versionByte) {
24865 switch (versionByte & 7) {
24866 case 0:
24867 return 160;
24868 case 1:
24869 return 192;
24870 case 2:
24871 return 224;
24872 case 3:
24873 return 256;
24874 case 4:
24875 return 320;
24876 case 5:
24877 return 384;
24878 case 6:
24879 return 448;
24880 case 7:
24881 return 512;
24882 }
24883}
24884
24885/**
24886 * Converts an array of 8-bit integers into an array of 5-bit integers,
24887 * right-padding with zeroes if necessary.
24888 *
24889 * @private
24890 * @param {Uint8Array} data
24891 * @returns {Uint8Array}
24892 */
24893function toUint5Array(data) {
24894 return convertBits(data, 8, 5);
24895}
24896
24897/**
24898 * Converts an array of 5-bit integers back into an array of 8-bit integers,
24899 * removing extra zeroes left from padding if necessary.
24900 * Throws a {@link ValidationError} if input is not a zero-padded array of 8-bit integers.
24901 *
24902 * @private
24903 * @param {Uint8Array} data
24904 * @returns {Uint8Array}
24905 * @throws {ValidationError}
24906 */
24907function fromUint5Array(data) {
24908 return convertBits(data, 5, 8, true);
24909}
24910
24911/**
24912 * Returns the concatenation a and b.
24913 *
24914 * @private
24915 * @param {Uint8Array} a
24916 * @param {Uint8Array} b
24917 * @returns {Uint8Array}
24918 * @throws {ValidationError}
24919 */
24920function concat(a, b) {
24921 var ab = new Uint8Array(a.length + b.length);
24922 ab.set(a);
24923 ab.set(b, a.length);
24924 return ab;
24925}
24926
24927/**
24928 * Computes a checksum from the given input data as specified for the CashAddr
24929 * format: https://github.com/Bitcoin-UAHF/spec/blob/master/cashaddr.md.
24930 *
24931 * @private
24932 * @param {Uint8Array} data Array of 5-bit integers over which the checksum is to be computed.
24933 * @returns {BigInteger}
24934 */
24935function polymod(data) {
24936 var GENERATOR = [0x98f2bc8e61, 0x79b76d99e2, 0xf33e5fb3c4, 0xae2eabe2a8, 0x1e4f43e470];
24937 var checksum = bigInt(1);
24938 for (var i = 0; i < data.length; ++i) {
24939 var value = data[i];
24940 var topBits = checksum.shiftRight(35);
24941 checksum = checksum.and(0x07ffffffff).shiftLeft(5).xor(value);
24942 for (var j = 0; j < GENERATOR.length; ++j) {
24943 if (topBits.shiftRight(j).and(1).equals(1)) {
24944 checksum = checksum.xor(GENERATOR[j]);
24945 }
24946 }
24947 }
24948 return checksum.xor(1);
24949}
24950
24951/**
24952 * Verify that the payload has not been corrupted by checking that the
24953 * checksum is valid.
24954 *
24955 * @private
24956 * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
24957 * @param {Uint8Array} payload Array of 5-bit integers containing the address' payload.
24958 * @returns {boolean}
24959 */
24960function validChecksum(prefix, payload) {
24961 var prefixData = concat(prefixToUint5Array(prefix), new Uint8Array(1));
24962 var checksumData = concat(prefixData, payload);
24963 return polymod(checksumData).equals(0);
24964}
24965
24966/**
24967 * Returns true if, and only if, the given string contains either uppercase
24968 * or lowercase letters, but not both.
24969 *
24970 * @private
24971 * @param {string} string Input string.
24972 * @returns {boolean}
24973 */
24974function hasSingleCase(string) {
24975 return string === string.toLowerCase() || string === string.toUpperCase();
24976}
24977
24978module.exports = {
24979 encode: encode,
24980 decode: decode,
24981 ValidationError: ValidationError,
24982};
24983
24984},{"./base32":147,"./convertBits":149,"./validation":150,"big-integer":60}],149:[function(require,module,exports){
24985// Copyright (c) 2017-2018 Emilio Almansi
24986// Copyright (c) 2017 Pieter Wuille
24987//
24988// Permission is hereby granted, free of charge, to any person obtaining a copy
24989// of this software and associated documentation files (the "Software"), to deal
24990// in the Software without restriction, including without limitation the rights
24991// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24992// copies of the Software, and to permit persons to whom the Software is
24993// furnished to do so, subject to the following conditions:
24994//
24995// The above copyright notice and this permission notice shall be included in
24996// all copies or substantial portions of the Software.
24997//
24998// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24999// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25000// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25001// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25002// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25003// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25004// THE SOFTWARE.
25005
25006'use strict';
25007
25008var validate = require('./validation').validate;
25009
25010/**
25011 * Converts an array of integers made up of 'from' bits into an
25012 * array of integers made up of 'to' bits. The output array is
25013 * zero-padded if necessary, unless strict mode is true.
25014 * Throws a {@link ValidationError} if input is invalid.
25015 * Original by Pieter Wuille: https://github.com/sipa/bech32.
25016 *
25017 * @param {Uint8Array} data Array of integers made up of 'from' bits.
25018 * @param {number} from Length in bits of elements in the input array.
25019 * @param {number} to Length in bits of elements in the output array.
25020 * @param {bool} strictMode Require the conversion to be completed without padding.
25021 * @returns {Uint8Array}
25022 */
25023module.exports = function(data, from, to, strictMode) {
25024 var length = strictMode
25025 ? Math.floor(data.length * from / to)
25026 : Math.ceil(data.length * from / to);
25027 var mask = (1 << to) - 1;
25028 var result = new Uint8Array(length);
25029 var index = 0;
25030 var accumulator = 0;
25031 var bits = 0;
25032 for (var i = 0; i < data.length; ++i) {
25033 var value = data[i];
25034 validate(0 <= value && (value >> from) === 0, 'Invalid value: ' + value + '.');
25035 accumulator = (accumulator << from) | value;
25036 bits += from;
25037 while (bits >= to) {
25038 bits -= to;
25039 result[index] = (accumulator >> bits) & mask;
25040 ++index;
25041 }
25042 }
25043 if (!strictMode) {
25044 if (bits > 0) {
25045 result[index] = (accumulator << (to - bits)) & mask;
25046 ++index;
25047 }
25048 } else {
25049 validate(
25050 bits < from && ((accumulator << (to - bits)) & mask) === 0,
25051 'Input cannot be converted to ' + to + ' bits without padding, but strict mode was used.'
25052 );
25053 }
25054 return result;
25055};
25056
25057},{"./validation":150}],150:[function(require,module,exports){
25058/**
25059 * @license
25060 * https://github.com/bitcoincashjs/cashaddr
25061 * Copyright (c) 2017-2018 Emilio Almansi
25062 * Distributed under the MIT software license, see the accompanying
25063 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
25064 */
25065
25066'use strict';
25067
25068/**
25069 * Validation utility.
25070 *
25071 * @module validation
25072 */
25073
25074/**
25075 * Error thrown when encoding or decoding fail due to invalid input.
25076 *
25077 * @constructor ValidationError
25078 * @param {string} message Error description.
25079 */
25080function ValidationError(message) {
25081 var error = new Error();
25082 this.name = error.name = 'ValidationError';
25083 this.message = error.message = message;
25084 this.stack = error.stack;
25085}
25086
25087ValidationError.prototype = Object.create(Error.prototype);
25088
25089/**
25090 * Validates a given condition, throwing a {@link ValidationError} if
25091 * the given condition does not hold.
25092 *
25093 * @static
25094 * @param {boolean} condition Condition to validate.
25095 * @param {string} message Error message in case the condition does not hold.
25096 */
25097function validate(condition, message) {
25098 if (!condition) {
25099 throw new ValidationError(message);
25100 }
25101}
25102
25103module.exports = {
25104 ValidationError: ValidationError,
25105 validate: validate,
25106};
25107
25108},{}],151:[function(require,module,exports){
25109arguments[4][147][0].apply(exports,arguments)
25110},{"./validation":154,"dup":147}],152:[function(require,module,exports){
25111/**
25112 * @license
25113 * https://github.com/bitcoincashjs/cashaddr
25114 * Copyright (c) 2017-2018 Emilio Almansi
25115 * Distributed under the MIT software license, see the accompanying
25116 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
25117 */
25118
25119'use strict';
25120
25121var base32 = require('./base32');
25122var bigInt = require('big-integer');
25123var convertBits = require('./convertBits');
25124var validation = require('./validation');
25125var validate = validation.validate;
25126
25127/**
25128 * Encoding and decoding of the new Cash Address format for Bitcoin Cash. <br />
25129 * Compliant with the original cashaddr specification:
25130 * {@link https://github.com/Bitcoin-UAHF/spec/blob/master/cashaddr.md}
25131 * @module cashaddr
25132 */
25133
25134/**
25135 * Encodes a hash from a given type into a Bitcoin Cash address with the given prefix.
25136 *
25137 * @static
25138 * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
25139 * @param {string} type Type of address to generate. Either 'P2PKH' or 'P2SH'.
25140 * @param {Uint8Array} hash Hash to encode represented as an array of 8-bit integers.
25141 * @returns {string}
25142 * @throws {ValidationError}
25143 */
25144function encode(prefix, type, hash) {
25145 validate(typeof prefix === 'string' && isValidPrefix(prefix), 'Invalid prefix: ' + prefix + '.');
25146 validate(typeof type === 'string', 'Invalid type: ' + type + '.');
25147 validate(hash instanceof Uint8Array, 'Invalid hash: ' + hash + '.');
25148 var prefixData = concat(prefixToUint5Array(prefix), new Uint8Array(1));
25149 var versionByte = getTypeBits(type) + getHashSizeBits(hash);
25150 var payloadData = toUint5Array(concat(new Uint8Array([versionByte]), hash));
25151 var checksumData = concat(concat(prefixData, payloadData), new Uint8Array(8));
25152 var payload = concat(payloadData, checksumToUint5Array(polymod(checksumData)));
25153 return prefix + ':' + base32.encode(payload);
25154}
25155
25156/**
25157 * Decodes the given address into its constituting prefix, type and hash. See [#encode()]{@link encode}.
25158 *
25159 * @static
25160 * @param {string} address Address to decode. E.g.: 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'.
25161 * @returns {object}
25162 * @throws {ValidationError}
25163 */
25164function decode(address) {
25165 validate(typeof address === 'string' && hasSingleCase(address), 'Invalid address: ' + address + '.');
25166 var pieces = address.toLowerCase().split(':');
25167 validate(pieces.length === 2, 'Missing prefix: ' + address + '.');
25168 var prefix = pieces[0];
25169 var payload = base32.decode(pieces[1]);
25170 validate(validChecksum(prefix, payload), 'Invalid checksum: ' + address + '.');
25171 var payloadData = fromUint5Array(payload.subarray(0, -8));
25172 var versionByte = payloadData[0];
25173 var hash = payloadData.subarray(1);
25174 validate(getHashSize(versionByte) === hash.length * 8, 'Invalid hash size: ' + address + '.');
25175 var type = getType(versionByte);
25176 return {
25177 prefix: prefix,
25178 type: type,
25179 hash: hash,
25180 };
25181}
25182
25183/**
25184 * Error thrown when encoding or decoding fail due to invalid input.
25185 *
25186 * @constructor ValidationError
25187 * @param {string} message Error description.
25188 */
25189var ValidationError = validation.ValidationError;
25190
25191/**
25192 * Valid address prefixes.
25193 *
25194 * @private
25195 */
25196var VALID_PREFIXES = ['bitcoincash', 'bchtest', 'bchreg'];
25197
25198/**
25199 * Checks whether a string is a valid prefix; ie., it has a single letter case
25200 * and is one of 'bitcoincash', 'bchtest', or 'bchreg'.
25201 *
25202 * @private
25203 * @param {string} prefix
25204 * @returns {boolean}
25205 */
25206function isValidPrefix(prefix) {
25207 return hasSingleCase(prefix) && VALID_PREFIXES.indexOf(prefix.toLowerCase()) !== -1;
25208}
25209
25210/**
25211 * Derives an array from the given prefix to be used in the computation
25212 * of the address' checksum.
25213 *
25214 * @private
25215 * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
25216 * @returns {Uint8Array}
25217 */
25218function prefixToUint5Array(prefix) {
25219 var result = new Uint8Array(prefix.length);
25220 for (var i = 0; i < prefix.length; ++i) {
25221 result[i] = prefix[i].charCodeAt(0) & 31;
25222 }
25223 return result;
25224}
25225
25226/**
25227 * Returns an array representation of the given checksum to be encoded
25228 * within the address' payload.
25229 *
25230 * @private
25231 * @param {BigInteger} checksum Computed checksum.
25232 * @returns {Uint8Array}
25233 */
25234function checksumToUint5Array(checksum) {
25235 var result = new Uint8Array(8);
25236 for (var i = 0; i < 8; ++i) {
25237 result[7 - i] = checksum.and(31).toJSNumber();
25238 checksum = checksum.shiftRight(5);
25239 }
25240 return result;
25241}
25242
25243/**
25244 * Returns the bit representation of the given type within the version
25245 * byte.
25246 *
25247 * @private
25248 * @param {string} type Address type. Either 'P2PKH' or 'P2SH'.
25249 * @returns {number}
25250 * @throws {ValidationError}
25251 */
25252function getTypeBits(type) {
25253 switch (type) {
25254 case 'P2PKH':
25255 return 0;
25256 case 'P2SH':
25257 return 8;
25258 default:
25259 throw new ValidationError('Invalid type: ' + type + '.');
25260 }
25261}
25262
25263/**
25264 * Retrieves the address type from its bit representation within the
25265 * version byte.
25266 *
25267 * @private
25268 * @param {number} versionByte
25269 * @returns {string}
25270 * @throws {ValidationError}
25271 */
25272function getType(versionByte) {
25273 switch (versionByte & 120) {
25274 case 0:
25275 return 'P2PKH';
25276 case 8:
25277 return 'P2SH';
25278 default:
25279 throw new ValidationError('Invalid address type in version byte: ' + versionByte + '.');
25280 }
25281}
25282
25283/**
25284 * Returns the bit representation of the length in bits of the given
25285 * hash within the version byte.
25286 *
25287 * @private
25288 * @param {Uint8Array} hash Hash to encode represented as an array of 8-bit integers.
25289 * @returns {number}
25290 * @throws {ValidationError}
25291 */
25292function getHashSizeBits(hash) {
25293 switch (hash.length * 8) {
25294 case 160:
25295 return 0;
25296 case 192:
25297 return 1;
25298 case 224:
25299 return 2;
25300 case 256:
25301 return 3;
25302 case 320:
25303 return 4;
25304 case 384:
25305 return 5;
25306 case 448:
25307 return 6;
25308 case 512:
25309 return 7;
25310 default:
25311 throw new ValidationError('Invalid hash size: ' + hash.length + '.');
25312 }
25313}
25314
25315/**
25316 * Retrieves the the length in bits of the encoded hash from its bit
25317 * representation within the version byte.
25318 *
25319 * @private
25320 * @param {number} versionByte
25321 * @returns {number}
25322 */
25323function getHashSize(versionByte) {
25324 switch (versionByte & 7) {
25325 case 0:
25326 return 160;
25327 case 1:
25328 return 192;
25329 case 2:
25330 return 224;
25331 case 3:
25332 return 256;
25333 case 4:
25334 return 320;
25335 case 5:
25336 return 384;
25337 case 6:
25338 return 448;
25339 case 7:
25340 return 512;
25341 }
25342}
25343
25344/**
25345 * Converts an array of 8-bit integers into an array of 5-bit integers,
25346 * right-padding with zeroes if necessary.
25347 *
25348 * @private
25349 * @param {Uint8Array} data
25350 * @returns {Uint8Array}
25351 */
25352function toUint5Array(data) {
25353 return convertBits(data, 8, 5);
25354}
25355
25356/**
25357 * Converts an array of 5-bit integers back into an array of 8-bit integers,
25358 * removing extra zeroes left from padding if necessary.
25359 * Throws a {@link ValidationError} if input is not a zero-padded array of 8-bit integers.
25360 *
25361 * @private
25362 * @param {Uint8Array} data
25363 * @returns {Uint8Array}
25364 * @throws {ValidationError}
25365 */
25366function fromUint5Array(data) {
25367 return convertBits(data, 5, 8, true);
25368}
25369
25370/**
25371 * Returns the concatenation a and b.
25372 *
25373 * @private
25374 * @param {Uint8Array} a
25375 * @param {Uint8Array} b
25376 * @returns {Uint8Array}
25377 * @throws {ValidationError}
25378 */
25379function concat(a, b) {
25380 var ab = new Uint8Array(a.length + b.length);
25381 ab.set(a);
25382 ab.set(b, a.length);
25383 return ab;
25384}
25385
25386/**
25387 * Computes a checksum from the given input data as specified for the CashAddr
25388 * format: https://github.com/Bitcoin-UAHF/spec/blob/master/cashaddr.md.
25389 *
25390 * @private
25391 * @param {Uint8Array} data Array of 5-bit integers over which the checksum is to be computed.
25392 * @returns {BigInteger}
25393 */
25394function polymod(data) {
25395 var GENERATOR = [0x98f2bc8e61, 0x79b76d99e2, 0xf33e5fb3c4, 0xae2eabe2a8, 0x1e4f43e470];
25396 var checksum = bigInt(1);
25397 for (var i = 0; i < data.length; ++i) {
25398 var value = data[i];
25399 var topBits = checksum.shiftRight(35);
25400 checksum = checksum.and(0x07ffffffff).shiftLeft(5).xor(value);
25401 for (var j = 0; j < GENERATOR.length; ++j) {
25402 if (topBits.shiftRight(j).and(1).equals(1)) {
25403 checksum = checksum.xor(GENERATOR[j]);
25404 }
25405 }
25406 }
25407 return checksum.xor(1);
25408}
25409
25410/**
25411 * Verify that the payload has not been corrupted by checking that the
25412 * checksum is valid.
25413 *
25414 * @private
25415 * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
25416 * @param {Uint8Array} payload Array of 5-bit integers containing the address' payload.
25417 * @returns {boolean}
25418 */
25419function validChecksum(prefix, payload) {
25420 var prefixData = concat(prefixToUint5Array(prefix), new Uint8Array(1));
25421 var checksumData = concat(prefixData, payload);
25422 return polymod(checksumData).equals(0);
25423}
25424
25425/**
25426 * Returns true if, and only if, the given string contains either uppercase
25427 * or lowercase letters, but not both.
25428 *
25429 * @private
25430 * @param {string} string Input string.
25431 * @returns {boolean}
25432 */
25433function hasSingleCase(string) {
25434 return string === string.toLowerCase() || string === string.toUpperCase();
25435}
25436
25437module.exports = {
25438 encode: encode,
25439 decode: decode,
25440 ValidationError: ValidationError,
25441};
25442
25443},{"./base32":151,"./convertBits":153,"./validation":154,"big-integer":60}],153:[function(require,module,exports){
25444arguments[4][149][0].apply(exports,arguments)
25445},{"./validation":154,"dup":149}],154:[function(require,module,exports){
25446arguments[4][150][0].apply(exports,arguments)
25447},{"dup":150}],155:[function(require,module,exports){
25448var Buffer = require('safe-buffer').Buffer
25449var Transform = require('stream').Transform
25450var StringDecoder = require('string_decoder').StringDecoder
25451var inherits = require('inherits')
25452
25453function CipherBase (hashMode) {
25454 Transform.call(this)
25455 this.hashMode = typeof hashMode === 'string'
25456 if (this.hashMode) {
25457 this[hashMode] = this._finalOrDigest
25458 } else {
25459 this.final = this._finalOrDigest
25460 }
25461 if (this._final) {
25462 this.__final = this._final
25463 this._final = null
25464 }
25465 this._decoder = null
25466 this._encoding = null
25467}
25468inherits(CipherBase, Transform)
25469
25470CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
25471 if (typeof data === 'string') {
25472 data = Buffer.from(data, inputEnc)
25473 }
25474
25475 var outData = this._update(data)
25476 if (this.hashMode) return this
25477
25478 if (outputEnc) {
25479 outData = this._toString(outData, outputEnc)
25480 }
25481
25482 return outData
25483}
25484
25485CipherBase.prototype.setAutoPadding = function () {}
25486CipherBase.prototype.getAuthTag = function () {
25487 throw new Error('trying to get auth tag in unsupported state')
25488}
25489
25490CipherBase.prototype.setAuthTag = function () {
25491 throw new Error('trying to set auth tag in unsupported state')
25492}
25493
25494CipherBase.prototype.setAAD = function () {
25495 throw new Error('trying to set aad in unsupported state')
25496}
25497
25498CipherBase.prototype._transform = function (data, _, next) {
25499 var err
25500 try {
25501 if (this.hashMode) {
25502 this._update(data)
25503 } else {
25504 this.push(this._update(data))
25505 }
25506 } catch (e) {
25507 err = e
25508 } finally {
25509 next(err)
25510 }
25511}
25512CipherBase.prototype._flush = function (done) {
25513 var err
25514 try {
25515 this.push(this.__final())
25516 } catch (e) {
25517 err = e
25518 }
25519
25520 done(err)
25521}
25522CipherBase.prototype._finalOrDigest = function (outputEnc) {
25523 var outData = this.__final() || Buffer.alloc(0)
25524 if (outputEnc) {
25525 outData = this._toString(outData, outputEnc, true)
25526 }
25527 return outData
25528}
25529
25530CipherBase.prototype._toString = function (value, enc, fin) {
25531 if (!this._decoder) {
25532 this._decoder = new StringDecoder(enc)
25533 this._encoding = enc
25534 }
25535
25536 if (this._encoding !== enc) throw new Error('can\'t switch encodings')
25537
25538 var out = this._decoder.write(value)
25539 if (fin) {
25540 out += this._decoder.end()
25541 }
25542
25543 return out
25544}
25545
25546module.exports = CipherBase
25547
25548},{"inherits":396,"safe-buffer":742,"stream":808,"string_decoder":809}],156:[function(require,module,exports){
25549require('../modules/es6.object.to-string');
25550require('../modules/es6.string.iterator');
25551require('../modules/web.dom.iterable');
25552require('../modules/es6.map');
25553module.exports = require('../modules/_core').Map;
25554
25555},{"../modules/_core":169,"../modules/es6.map":219,"../modules/es6.object.to-string":220,"../modules/es6.string.iterator":221,"../modules/web.dom.iterable":222}],157:[function(require,module,exports){
25556module.exports = function (it) {
25557 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
25558 return it;
25559};
25560
25561},{}],158:[function(require,module,exports){
25562module.exports = function () { /* empty */ };
25563
25564},{}],159:[function(require,module,exports){
25565module.exports = function (it, Constructor, name, forbiddenField) {
25566 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
25567 throw TypeError(name + ': incorrect invocation!');
25568 } return it;
25569};
25570
25571},{}],160:[function(require,module,exports){
25572var isObject = require('./_is-object');
25573module.exports = function (it) {
25574 if (!isObject(it)) throw TypeError(it + ' is not an object!');
25575 return it;
25576};
25577
25578},{"./_is-object":186}],161:[function(require,module,exports){
25579// false -> Array#indexOf
25580// true -> Array#includes
25581var toIObject = require('./_to-iobject');
25582var toLength = require('./_to-length');
25583var toAbsoluteIndex = require('./_to-absolute-index');
25584module.exports = function (IS_INCLUDES) {
25585 return function ($this, el, fromIndex) {
25586 var O = toIObject($this);
25587 var length = toLength(O.length);
25588 var index = toAbsoluteIndex(fromIndex, length);
25589 var value;
25590 // Array#includes uses SameValueZero equality algorithm
25591 // eslint-disable-next-line no-self-compare
25592 if (IS_INCLUDES && el != el) while (length > index) {
25593 value = O[index++];
25594 // eslint-disable-next-line no-self-compare
25595 if (value != value) return true;
25596 // Array#indexOf ignores holes, Array#includes - not
25597 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
25598 if (O[index] === el) return IS_INCLUDES || index || 0;
25599 } return !IS_INCLUDES && -1;
25600 };
25601};
25602
25603},{"./_to-absolute-index":208,"./_to-iobject":210,"./_to-length":211}],162:[function(require,module,exports){
25604// 0 -> Array#forEach
25605// 1 -> Array#map
25606// 2 -> Array#filter
25607// 3 -> Array#some
25608// 4 -> Array#every
25609// 5 -> Array#find
25610// 6 -> Array#findIndex
25611var ctx = require('./_ctx');
25612var IObject = require('./_iobject');
25613var toObject = require('./_to-object');
25614var toLength = require('./_to-length');
25615var asc = require('./_array-species-create');
25616module.exports = function (TYPE, $create) {
25617 var IS_MAP = TYPE == 1;
25618 var IS_FILTER = TYPE == 2;
25619 var IS_SOME = TYPE == 3;
25620 var IS_EVERY = TYPE == 4;
25621 var IS_FIND_INDEX = TYPE == 6;
25622 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
25623 var create = $create || asc;
25624 return function ($this, callbackfn, that) {
25625 var O = toObject($this);
25626 var self = IObject(O);
25627 var f = ctx(callbackfn, that, 3);
25628 var length = toLength(self.length);
25629 var index = 0;
25630 var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
25631 var val, res;
25632 for (;length > index; index++) if (NO_HOLES || index in self) {
25633 val = self[index];
25634 res = f(val, index, O);
25635 if (TYPE) {
25636 if (IS_MAP) result[index] = res; // map
25637 else if (res) switch (TYPE) {
25638 case 3: return true; // some
25639 case 5: return val; // find
25640 case 6: return index; // findIndex
25641 case 2: result.push(val); // filter
25642 } else if (IS_EVERY) return false; // every
25643 }
25644 }
25645 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
25646 };
25647};
25648
25649},{"./_array-species-create":164,"./_ctx":170,"./_iobject":183,"./_to-length":211,"./_to-object":212}],163:[function(require,module,exports){
25650var isObject = require('./_is-object');
25651var isArray = require('./_is-array');
25652var SPECIES = require('./_wks')('species');
25653
25654module.exports = function (original) {
25655 var C;
25656 if (isArray(original)) {
25657 C = original.constructor;
25658 // cross-realm fallback
25659 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
25660 if (isObject(C)) {
25661 C = C[SPECIES];
25662 if (C === null) C = undefined;
25663 }
25664 } return C === undefined ? Array : C;
25665};
25666
25667},{"./_is-array":185,"./_is-object":186,"./_wks":216}],164:[function(require,module,exports){
25668// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
25669var speciesConstructor = require('./_array-species-constructor');
25670
25671module.exports = function (original, length) {
25672 return new (speciesConstructor(original))(length);
25673};
25674
25675},{"./_array-species-constructor":163}],165:[function(require,module,exports){
25676// getting tag from 19.1.3.6 Object.prototype.toString()
25677var cof = require('./_cof');
25678var TAG = require('./_wks')('toStringTag');
25679// ES3 wrong here
25680var ARG = cof(function () { return arguments; }()) == 'Arguments';
25681
25682// fallback for IE11 Script Access Denied error
25683var tryGet = function (it, key) {
25684 try {
25685 return it[key];
25686 } catch (e) { /* empty */ }
25687};
25688
25689module.exports = function (it) {
25690 var O, T, B;
25691 return it === undefined ? 'Undefined' : it === null ? 'Null'
25692 // @@toStringTag case
25693 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
25694 // builtinTag case
25695 : ARG ? cof(O)
25696 // ES3 arguments fallback
25697 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
25698};
25699
25700},{"./_cof":166,"./_wks":216}],166:[function(require,module,exports){
25701var toString = {}.toString;
25702
25703module.exports = function (it) {
25704 return toString.call(it).slice(8, -1);
25705};
25706
25707},{}],167:[function(require,module,exports){
25708'use strict';
25709var dP = require('./_object-dp').f;
25710var create = require('./_object-create');
25711var redefineAll = require('./_redefine-all');
25712var ctx = require('./_ctx');
25713var anInstance = require('./_an-instance');
25714var forOf = require('./_for-of');
25715var $iterDefine = require('./_iter-define');
25716var step = require('./_iter-step');
25717var setSpecies = require('./_set-species');
25718var DESCRIPTORS = require('./_descriptors');
25719var fastKey = require('./_meta').fastKey;
25720var validate = require('./_validate-collection');
25721var SIZE = DESCRIPTORS ? '_s' : 'size';
25722
25723var getEntry = function (that, key) {
25724 // fast case
25725 var index = fastKey(key);
25726 var entry;
25727 if (index !== 'F') return that._i[index];
25728 // frozen object case
25729 for (entry = that._f; entry; entry = entry.n) {
25730 if (entry.k == key) return entry;
25731 }
25732};
25733
25734module.exports = {
25735 getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
25736 var C = wrapper(function (that, iterable) {
25737 anInstance(that, C, NAME, '_i');
25738 that._t = NAME; // collection type
25739 that._i = create(null); // index
25740 that._f = undefined; // first entry
25741 that._l = undefined; // last entry
25742 that[SIZE] = 0; // size
25743 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
25744 });
25745 redefineAll(C.prototype, {
25746 // 23.1.3.1 Map.prototype.clear()
25747 // 23.2.3.2 Set.prototype.clear()
25748 clear: function clear() {
25749 for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
25750 entry.r = true;
25751 if (entry.p) entry.p = entry.p.n = undefined;
25752 delete data[entry.i];
25753 }
25754 that._f = that._l = undefined;
25755 that[SIZE] = 0;
25756 },
25757 // 23.1.3.3 Map.prototype.delete(key)
25758 // 23.2.3.4 Set.prototype.delete(value)
25759 'delete': function (key) {
25760 var that = validate(this, NAME);
25761 var entry = getEntry(that, key);
25762 if (entry) {
25763 var next = entry.n;
25764 var prev = entry.p;
25765 delete that._i[entry.i];
25766 entry.r = true;
25767 if (prev) prev.n = next;
25768 if (next) next.p = prev;
25769 if (that._f == entry) that._f = next;
25770 if (that._l == entry) that._l = prev;
25771 that[SIZE]--;
25772 } return !!entry;
25773 },
25774 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
25775 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
25776 forEach: function forEach(callbackfn /* , that = undefined */) {
25777 validate(this, NAME);
25778 var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
25779 var entry;
25780 while (entry = entry ? entry.n : this._f) {
25781 f(entry.v, entry.k, this);
25782 // revert to the last existing entry
25783 while (entry && entry.r) entry = entry.p;
25784 }
25785 },
25786 // 23.1.3.7 Map.prototype.has(key)
25787 // 23.2.3.7 Set.prototype.has(value)
25788 has: function has(key) {
25789 return !!getEntry(validate(this, NAME), key);
25790 }
25791 });
25792 if (DESCRIPTORS) dP(C.prototype, 'size', {
25793 get: function () {
25794 return validate(this, NAME)[SIZE];
25795 }
25796 });
25797 return C;
25798 },
25799 def: function (that, key, value) {
25800 var entry = getEntry(that, key);
25801 var prev, index;
25802 // change existing entry
25803 if (entry) {
25804 entry.v = value;
25805 // create new entry
25806 } else {
25807 that._l = entry = {
25808 i: index = fastKey(key, true), // <- index
25809 k: key, // <- key
25810 v: value, // <- value
25811 p: prev = that._l, // <- previous entry
25812 n: undefined, // <- next entry
25813 r: false // <- removed
25814 };
25815 if (!that._f) that._f = entry;
25816 if (prev) prev.n = entry;
25817 that[SIZE]++;
25818 // add to index
25819 if (index !== 'F') that._i[index] = entry;
25820 } return that;
25821 },
25822 getEntry: getEntry,
25823 setStrong: function (C, NAME, IS_MAP) {
25824 // add .keys, .values, .entries, [@@iterator]
25825 // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
25826 $iterDefine(C, NAME, function (iterated, kind) {
25827 this._t = validate(iterated, NAME); // target
25828 this._k = kind; // kind
25829 this._l = undefined; // previous
25830 }, function () {
25831 var that = this;
25832 var kind = that._k;
25833 var entry = that._l;
25834 // revert to the last existing entry
25835 while (entry && entry.r) entry = entry.p;
25836 // get next entry
25837 if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
25838 // or finish the iteration
25839 that._t = undefined;
25840 return step(1);
25841 }
25842 // return step by kind
25843 if (kind == 'keys') return step(0, entry.k);
25844 if (kind == 'values') return step(0, entry.v);
25845 return step(0, [entry.k, entry.v]);
25846 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
25847
25848 // add [@@species], 23.1.2.2, 23.2.2.2
25849 setSpecies(NAME);
25850 }
25851};
25852
25853},{"./_an-instance":159,"./_ctx":170,"./_descriptors":172,"./_for-of":177,"./_iter-define":189,"./_iter-step":190,"./_meta":193,"./_object-create":194,"./_object-dp":195,"./_redefine-all":201,"./_set-species":203,"./_validate-collection":215}],168:[function(require,module,exports){
25854'use strict';
25855var global = require('./_global');
25856var $export = require('./_export');
25857var meta = require('./_meta');
25858var fails = require('./_fails');
25859var hide = require('./_hide');
25860var redefineAll = require('./_redefine-all');
25861var forOf = require('./_for-of');
25862var anInstance = require('./_an-instance');
25863var isObject = require('./_is-object');
25864var setToStringTag = require('./_set-to-string-tag');
25865var dP = require('./_object-dp').f;
25866var each = require('./_array-methods')(0);
25867var DESCRIPTORS = require('./_descriptors');
25868
25869module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
25870 var Base = global[NAME];
25871 var C = Base;
25872 var ADDER = IS_MAP ? 'set' : 'add';
25873 var proto = C && C.prototype;
25874 var O = {};
25875 if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
25876 new C().entries().next();
25877 }))) {
25878 // create collection constructor
25879 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
25880 redefineAll(C.prototype, methods);
25881 meta.NEED = true;
25882 } else {
25883 C = wrapper(function (target, iterable) {
25884 anInstance(target, C, NAME, '_c');
25885 target._c = new Base();
25886 if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
25887 });
25888 each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
25889 var IS_ADDER = KEY == 'add' || KEY == 'set';
25890 if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
25891 anInstance(this, C, KEY);
25892 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
25893 var result = this._c[KEY](a === 0 ? 0 : a, b);
25894 return IS_ADDER ? this : result;
25895 });
25896 });
25897 IS_WEAK || dP(C.prototype, 'size', {
25898 get: function () {
25899 return this._c.size;
25900 }
25901 });
25902 }
25903
25904 setToStringTag(C, NAME);
25905
25906 O[NAME] = C;
25907 $export($export.G + $export.W + $export.F, O);
25908
25909 if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
25910
25911 return C;
25912};
25913
25914},{"./_an-instance":159,"./_array-methods":162,"./_descriptors":172,"./_export":175,"./_fails":176,"./_for-of":177,"./_global":178,"./_hide":180,"./_is-object":186,"./_meta":193,"./_object-dp":195,"./_redefine-all":201,"./_set-to-string-tag":204}],169:[function(require,module,exports){
25915var core = module.exports = { version: '2.6.11' };
25916if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
25917
25918},{}],170:[function(require,module,exports){
25919// optional / simple context binding
25920var aFunction = require('./_a-function');
25921module.exports = function (fn, that, length) {
25922 aFunction(fn);
25923 if (that === undefined) return fn;
25924 switch (length) {
25925 case 1: return function (a) {
25926 return fn.call(that, a);
25927 };
25928 case 2: return function (a, b) {
25929 return fn.call(that, a, b);
25930 };
25931 case 3: return function (a, b, c) {
25932 return fn.call(that, a, b, c);
25933 };
25934 }
25935 return function (/* ...args */) {
25936 return fn.apply(that, arguments);
25937 };
25938};
25939
25940},{"./_a-function":157}],171:[function(require,module,exports){
25941// 7.2.1 RequireObjectCoercible(argument)
25942module.exports = function (it) {
25943 if (it == undefined) throw TypeError("Can't call method on " + it);
25944 return it;
25945};
25946
25947},{}],172:[function(require,module,exports){
25948// Thank's IE8 for his funny defineProperty
25949module.exports = !require('./_fails')(function () {
25950 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
25951});
25952
25953},{"./_fails":176}],173:[function(require,module,exports){
25954var isObject = require('./_is-object');
25955var document = require('./_global').document;
25956// typeof document.createElement is 'object' in old IE
25957var is = isObject(document) && isObject(document.createElement);
25958module.exports = function (it) {
25959 return is ? document.createElement(it) : {};
25960};
25961
25962},{"./_global":178,"./_is-object":186}],174:[function(require,module,exports){
25963// IE 8- don't enum bug keys
25964module.exports = (
25965 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
25966).split(',');
25967
25968},{}],175:[function(require,module,exports){
25969var global = require('./_global');
25970var core = require('./_core');
25971var ctx = require('./_ctx');
25972var hide = require('./_hide');
25973var has = require('./_has');
25974var PROTOTYPE = 'prototype';
25975
25976var $export = function (type, name, source) {
25977 var IS_FORCED = type & $export.F;
25978 var IS_GLOBAL = type & $export.G;
25979 var IS_STATIC = type & $export.S;
25980 var IS_PROTO = type & $export.P;
25981 var IS_BIND = type & $export.B;
25982 var IS_WRAP = type & $export.W;
25983 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
25984 var expProto = exports[PROTOTYPE];
25985 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
25986 var key, own, out;
25987 if (IS_GLOBAL) source = name;
25988 for (key in source) {
25989 // contains in native
25990 own = !IS_FORCED && target && target[key] !== undefined;
25991 if (own && has(exports, key)) continue;
25992 // export native or passed
25993 out = own ? target[key] : source[key];
25994 // prevent global pollution for namespaces
25995 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
25996 // bind timers to global for call from export context
25997 : IS_BIND && own ? ctx(out, global)
25998 // wrap global constructors for prevent change them in library
25999 : IS_WRAP && target[key] == out ? (function (C) {
26000 var F = function (a, b, c) {
26001 if (this instanceof C) {
26002 switch (arguments.length) {
26003 case 0: return new C();
26004 case 1: return new C(a);
26005 case 2: return new C(a, b);
26006 } return new C(a, b, c);
26007 } return C.apply(this, arguments);
26008 };
26009 F[PROTOTYPE] = C[PROTOTYPE];
26010 return F;
26011 // make static versions for prototype methods
26012 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
26013 // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
26014 if (IS_PROTO) {
26015 (exports.virtual || (exports.virtual = {}))[key] = out;
26016 // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
26017 if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
26018 }
26019 }
26020};
26021// type bitmap
26022$export.F = 1; // forced
26023$export.G = 2; // global
26024$export.S = 4; // static
26025$export.P = 8; // proto
26026$export.B = 16; // bind
26027$export.W = 32; // wrap
26028$export.U = 64; // safe
26029$export.R = 128; // real proto method for `library`
26030module.exports = $export;
26031
26032},{"./_core":169,"./_ctx":170,"./_global":178,"./_has":179,"./_hide":180}],176:[function(require,module,exports){
26033module.exports = function (exec) {
26034 try {
26035 return !!exec();
26036 } catch (e) {
26037 return true;
26038 }
26039};
26040
26041},{}],177:[function(require,module,exports){
26042var ctx = require('./_ctx');
26043var call = require('./_iter-call');
26044var isArrayIter = require('./_is-array-iter');
26045var anObject = require('./_an-object');
26046var toLength = require('./_to-length');
26047var getIterFn = require('./core.get-iterator-method');
26048var BREAK = {};
26049var RETURN = {};
26050var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
26051 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
26052 var f = ctx(fn, that, entries ? 2 : 1);
26053 var index = 0;
26054 var length, step, iterator, result;
26055 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
26056 // fast case for arrays with default iterator
26057 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
26058 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
26059 if (result === BREAK || result === RETURN) return result;
26060 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
26061 result = call(iterator, f, step.value, entries);
26062 if (result === BREAK || result === RETURN) return result;
26063 }
26064};
26065exports.BREAK = BREAK;
26066exports.RETURN = RETURN;
26067
26068},{"./_an-object":160,"./_ctx":170,"./_is-array-iter":184,"./_iter-call":187,"./_to-length":211,"./core.get-iterator-method":217}],178:[function(require,module,exports){
26069// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
26070var global = module.exports = typeof window != 'undefined' && window.Math == Math
26071 ? window : typeof self != 'undefined' && self.Math == Math ? self
26072 // eslint-disable-next-line no-new-func
26073 : Function('return this')();
26074if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
26075
26076},{}],179:[function(require,module,exports){
26077var hasOwnProperty = {}.hasOwnProperty;
26078module.exports = function (it, key) {
26079 return hasOwnProperty.call(it, key);
26080};
26081
26082},{}],180:[function(require,module,exports){
26083var dP = require('./_object-dp');
26084var createDesc = require('./_property-desc');
26085module.exports = require('./_descriptors') ? function (object, key, value) {
26086 return dP.f(object, key, createDesc(1, value));
26087} : function (object, key, value) {
26088 object[key] = value;
26089 return object;
26090};
26091
26092},{"./_descriptors":172,"./_object-dp":195,"./_property-desc":200}],181:[function(require,module,exports){
26093var document = require('./_global').document;
26094module.exports = document && document.documentElement;
26095
26096},{"./_global":178}],182:[function(require,module,exports){
26097module.exports = !require('./_descriptors') && !require('./_fails')(function () {
26098 return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
26099});
26100
26101},{"./_descriptors":172,"./_dom-create":173,"./_fails":176}],183:[function(require,module,exports){
26102// fallback for non-array-like ES3 and non-enumerable old V8 strings
26103var cof = require('./_cof');
26104// eslint-disable-next-line no-prototype-builtins
26105module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
26106 return cof(it) == 'String' ? it.split('') : Object(it);
26107};
26108
26109},{"./_cof":166}],184:[function(require,module,exports){
26110// check on default Array iterator
26111var Iterators = require('./_iterators');
26112var ITERATOR = require('./_wks')('iterator');
26113var ArrayProto = Array.prototype;
26114
26115module.exports = function (it) {
26116 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
26117};
26118
26119},{"./_iterators":191,"./_wks":216}],185:[function(require,module,exports){
26120// 7.2.2 IsArray(argument)
26121var cof = require('./_cof');
26122module.exports = Array.isArray || function isArray(arg) {
26123 return cof(arg) == 'Array';
26124};
26125
26126},{"./_cof":166}],186:[function(require,module,exports){
26127module.exports = function (it) {
26128 return typeof it === 'object' ? it !== null : typeof it === 'function';
26129};
26130
26131},{}],187:[function(require,module,exports){
26132// call something on iterator step with safe closing on error
26133var anObject = require('./_an-object');
26134module.exports = function (iterator, fn, value, entries) {
26135 try {
26136 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
26137 // 7.4.6 IteratorClose(iterator, completion)
26138 } catch (e) {
26139 var ret = iterator['return'];
26140 if (ret !== undefined) anObject(ret.call(iterator));
26141 throw e;
26142 }
26143};
26144
26145},{"./_an-object":160}],188:[function(require,module,exports){
26146'use strict';
26147var create = require('./_object-create');
26148var descriptor = require('./_property-desc');
26149var setToStringTag = require('./_set-to-string-tag');
26150var IteratorPrototype = {};
26151
26152// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
26153require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
26154
26155module.exports = function (Constructor, NAME, next) {
26156 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
26157 setToStringTag(Constructor, NAME + ' Iterator');
26158};
26159
26160},{"./_hide":180,"./_object-create":194,"./_property-desc":200,"./_set-to-string-tag":204,"./_wks":216}],189:[function(require,module,exports){
26161'use strict';
26162var LIBRARY = require('./_library');
26163var $export = require('./_export');
26164var redefine = require('./_redefine');
26165var hide = require('./_hide');
26166var Iterators = require('./_iterators');
26167var $iterCreate = require('./_iter-create');
26168var setToStringTag = require('./_set-to-string-tag');
26169var getPrototypeOf = require('./_object-gpo');
26170var ITERATOR = require('./_wks')('iterator');
26171var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
26172var FF_ITERATOR = '@@iterator';
26173var KEYS = 'keys';
26174var VALUES = 'values';
26175
26176var returnThis = function () { return this; };
26177
26178module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
26179 $iterCreate(Constructor, NAME, next);
26180 var getMethod = function (kind) {
26181 if (!BUGGY && kind in proto) return proto[kind];
26182 switch (kind) {
26183 case KEYS: return function keys() { return new Constructor(this, kind); };
26184 case VALUES: return function values() { return new Constructor(this, kind); };
26185 } return function entries() { return new Constructor(this, kind); };
26186 };
26187 var TAG = NAME + ' Iterator';
26188 var DEF_VALUES = DEFAULT == VALUES;
26189 var VALUES_BUG = false;
26190 var proto = Base.prototype;
26191 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
26192 var $default = $native || getMethod(DEFAULT);
26193 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
26194 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
26195 var methods, key, IteratorPrototype;
26196 // Fix native
26197 if ($anyNative) {
26198 IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
26199 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
26200 // Set @@toStringTag to native iterators
26201 setToStringTag(IteratorPrototype, TAG, true);
26202 // fix for some old engines
26203 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
26204 }
26205 }
26206 // fix Array#{values, @@iterator}.name in V8 / FF
26207 if (DEF_VALUES && $native && $native.name !== VALUES) {
26208 VALUES_BUG = true;
26209 $default = function values() { return $native.call(this); };
26210 }
26211 // Define iterator
26212 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
26213 hide(proto, ITERATOR, $default);
26214 }
26215 // Plug for library
26216 Iterators[NAME] = $default;
26217 Iterators[TAG] = returnThis;
26218 if (DEFAULT) {
26219 methods = {
26220 values: DEF_VALUES ? $default : getMethod(VALUES),
26221 keys: IS_SET ? $default : getMethod(KEYS),
26222 entries: $entries
26223 };
26224 if (FORCED) for (key in methods) {
26225 if (!(key in proto)) redefine(proto, key, methods[key]);
26226 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
26227 }
26228 return methods;
26229};
26230
26231},{"./_export":175,"./_hide":180,"./_iter-create":188,"./_iterators":191,"./_library":192,"./_object-gpo":197,"./_redefine":202,"./_set-to-string-tag":204,"./_wks":216}],190:[function(require,module,exports){
26232module.exports = function (done, value) {
26233 return { value: value, done: !!done };
26234};
26235
26236},{}],191:[function(require,module,exports){
26237module.exports = {};
26238
26239},{}],192:[function(require,module,exports){
26240module.exports = true;
26241
26242},{}],193:[function(require,module,exports){
26243var META = require('./_uid')('meta');
26244var isObject = require('./_is-object');
26245var has = require('./_has');
26246var setDesc = require('./_object-dp').f;
26247var id = 0;
26248var isExtensible = Object.isExtensible || function () {
26249 return true;
26250};
26251var FREEZE = !require('./_fails')(function () {
26252 return isExtensible(Object.preventExtensions({}));
26253});
26254var setMeta = function (it) {
26255 setDesc(it, META, { value: {
26256 i: 'O' + ++id, // object ID
26257 w: {} // weak collections IDs
26258 } });
26259};
26260var fastKey = function (it, create) {
26261 // return primitive with prefix
26262 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
26263 if (!has(it, META)) {
26264 // can't set metadata to uncaught frozen object
26265 if (!isExtensible(it)) return 'F';
26266 // not necessary to add metadata
26267 if (!create) return 'E';
26268 // add missing metadata
26269 setMeta(it);
26270 // return object ID
26271 } return it[META].i;
26272};
26273var getWeak = function (it, create) {
26274 if (!has(it, META)) {
26275 // can't set metadata to uncaught frozen object
26276 if (!isExtensible(it)) return true;
26277 // not necessary to add metadata
26278 if (!create) return false;
26279 // add missing metadata
26280 setMeta(it);
26281 // return hash weak collections IDs
26282 } return it[META].w;
26283};
26284// add metadata on freeze-family methods calling
26285var onFreeze = function (it) {
26286 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
26287 return it;
26288};
26289var meta = module.exports = {
26290 KEY: META,
26291 NEED: false,
26292 fastKey: fastKey,
26293 getWeak: getWeak,
26294 onFreeze: onFreeze
26295};
26296
26297},{"./_fails":176,"./_has":179,"./_is-object":186,"./_object-dp":195,"./_uid":214}],194:[function(require,module,exports){
26298// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
26299var anObject = require('./_an-object');
26300var dPs = require('./_object-dps');
26301var enumBugKeys = require('./_enum-bug-keys');
26302var IE_PROTO = require('./_shared-key')('IE_PROTO');
26303var Empty = function () { /* empty */ };
26304var PROTOTYPE = 'prototype';
26305
26306// Create object with fake `null` prototype: use iframe Object with cleared prototype
26307var createDict = function () {
26308 // Thrash, waste and sodomy: IE GC bug
26309 var iframe = require('./_dom-create')('iframe');
26310 var i = enumBugKeys.length;
26311 var lt = '<';
26312 var gt = '>';
26313 var iframeDocument;
26314 iframe.style.display = 'none';
26315 require('./_html').appendChild(iframe);
26316 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
26317 // createDict = iframe.contentWindow.Object;
26318 // html.removeChild(iframe);
26319 iframeDocument = iframe.contentWindow.document;
26320 iframeDocument.open();
26321 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
26322 iframeDocument.close();
26323 createDict = iframeDocument.F;
26324 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
26325 return createDict();
26326};
26327
26328module.exports = Object.create || function create(O, Properties) {
26329 var result;
26330 if (O !== null) {
26331 Empty[PROTOTYPE] = anObject(O);
26332 result = new Empty();
26333 Empty[PROTOTYPE] = null;
26334 // add "__proto__" for Object.getPrototypeOf polyfill
26335 result[IE_PROTO] = O;
26336 } else result = createDict();
26337 return Properties === undefined ? result : dPs(result, Properties);
26338};
26339
26340},{"./_an-object":160,"./_dom-create":173,"./_enum-bug-keys":174,"./_html":181,"./_object-dps":196,"./_shared-key":205}],195:[function(require,module,exports){
26341var anObject = require('./_an-object');
26342var IE8_DOM_DEFINE = require('./_ie8-dom-define');
26343var toPrimitive = require('./_to-primitive');
26344var dP = Object.defineProperty;
26345
26346exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
26347 anObject(O);
26348 P = toPrimitive(P, true);
26349 anObject(Attributes);
26350 if (IE8_DOM_DEFINE) try {
26351 return dP(O, P, Attributes);
26352 } catch (e) { /* empty */ }
26353 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
26354 if ('value' in Attributes) O[P] = Attributes.value;
26355 return O;
26356};
26357
26358},{"./_an-object":160,"./_descriptors":172,"./_ie8-dom-define":182,"./_to-primitive":213}],196:[function(require,module,exports){
26359var dP = require('./_object-dp');
26360var anObject = require('./_an-object');
26361var getKeys = require('./_object-keys');
26362
26363module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
26364 anObject(O);
26365 var keys = getKeys(Properties);
26366 var length = keys.length;
26367 var i = 0;
26368 var P;
26369 while (length > i) dP.f(O, P = keys[i++], Properties[P]);
26370 return O;
26371};
26372
26373},{"./_an-object":160,"./_descriptors":172,"./_object-dp":195,"./_object-keys":199}],197:[function(require,module,exports){
26374// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
26375var has = require('./_has');
26376var toObject = require('./_to-object');
26377var IE_PROTO = require('./_shared-key')('IE_PROTO');
26378var ObjectProto = Object.prototype;
26379
26380module.exports = Object.getPrototypeOf || function (O) {
26381 O = toObject(O);
26382 if (has(O, IE_PROTO)) return O[IE_PROTO];
26383 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
26384 return O.constructor.prototype;
26385 } return O instanceof Object ? ObjectProto : null;
26386};
26387
26388},{"./_has":179,"./_shared-key":205,"./_to-object":212}],198:[function(require,module,exports){
26389var has = require('./_has');
26390var toIObject = require('./_to-iobject');
26391var arrayIndexOf = require('./_array-includes')(false);
26392var IE_PROTO = require('./_shared-key')('IE_PROTO');
26393
26394module.exports = function (object, names) {
26395 var O = toIObject(object);
26396 var i = 0;
26397 var result = [];
26398 var key;
26399 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
26400 // Don't enum bug & hidden keys
26401 while (names.length > i) if (has(O, key = names[i++])) {
26402 ~arrayIndexOf(result, key) || result.push(key);
26403 }
26404 return result;
26405};
26406
26407},{"./_array-includes":161,"./_has":179,"./_shared-key":205,"./_to-iobject":210}],199:[function(require,module,exports){
26408// 19.1.2.14 / 15.2.3.14 Object.keys(O)
26409var $keys = require('./_object-keys-internal');
26410var enumBugKeys = require('./_enum-bug-keys');
26411
26412module.exports = Object.keys || function keys(O) {
26413 return $keys(O, enumBugKeys);
26414};
26415
26416},{"./_enum-bug-keys":174,"./_object-keys-internal":198}],200:[function(require,module,exports){
26417module.exports = function (bitmap, value) {
26418 return {
26419 enumerable: !(bitmap & 1),
26420 configurable: !(bitmap & 2),
26421 writable: !(bitmap & 4),
26422 value: value
26423 };
26424};
26425
26426},{}],201:[function(require,module,exports){
26427var hide = require('./_hide');
26428module.exports = function (target, src, safe) {
26429 for (var key in src) {
26430 if (safe && target[key]) target[key] = src[key];
26431 else hide(target, key, src[key]);
26432 } return target;
26433};
26434
26435},{"./_hide":180}],202:[function(require,module,exports){
26436module.exports = require('./_hide');
26437
26438},{"./_hide":180}],203:[function(require,module,exports){
26439'use strict';
26440var global = require('./_global');
26441var core = require('./_core');
26442var dP = require('./_object-dp');
26443var DESCRIPTORS = require('./_descriptors');
26444var SPECIES = require('./_wks')('species');
26445
26446module.exports = function (KEY) {
26447 var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
26448 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
26449 configurable: true,
26450 get: function () { return this; }
26451 });
26452};
26453
26454},{"./_core":169,"./_descriptors":172,"./_global":178,"./_object-dp":195,"./_wks":216}],204:[function(require,module,exports){
26455var def = require('./_object-dp').f;
26456var has = require('./_has');
26457var TAG = require('./_wks')('toStringTag');
26458
26459module.exports = function (it, tag, stat) {
26460 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
26461};
26462
26463},{"./_has":179,"./_object-dp":195,"./_wks":216}],205:[function(require,module,exports){
26464var shared = require('./_shared')('keys');
26465var uid = require('./_uid');
26466module.exports = function (key) {
26467 return shared[key] || (shared[key] = uid(key));
26468};
26469
26470},{"./_shared":206,"./_uid":214}],206:[function(require,module,exports){
26471var core = require('./_core');
26472var global = require('./_global');
26473var SHARED = '__core-js_shared__';
26474var store = global[SHARED] || (global[SHARED] = {});
26475
26476(module.exports = function (key, value) {
26477 return store[key] || (store[key] = value !== undefined ? value : {});
26478})('versions', []).push({
26479 version: core.version,
26480 mode: require('./_library') ? 'pure' : 'global',
26481 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
26482});
26483
26484},{"./_core":169,"./_global":178,"./_library":192}],207:[function(require,module,exports){
26485var toInteger = require('./_to-integer');
26486var defined = require('./_defined');
26487// true -> String#at
26488// false -> String#codePointAt
26489module.exports = function (TO_STRING) {
26490 return function (that, pos) {
26491 var s = String(defined(that));
26492 var i = toInteger(pos);
26493 var l = s.length;
26494 var a, b;
26495 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
26496 a = s.charCodeAt(i);
26497 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
26498 ? TO_STRING ? s.charAt(i) : a
26499 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
26500 };
26501};
26502
26503},{"./_defined":171,"./_to-integer":209}],208:[function(require,module,exports){
26504var toInteger = require('./_to-integer');
26505var max = Math.max;
26506var min = Math.min;
26507module.exports = function (index, length) {
26508 index = toInteger(index);
26509 return index < 0 ? max(index + length, 0) : min(index, length);
26510};
26511
26512},{"./_to-integer":209}],209:[function(require,module,exports){
26513// 7.1.4 ToInteger
26514var ceil = Math.ceil;
26515var floor = Math.floor;
26516module.exports = function (it) {
26517 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
26518};
26519
26520},{}],210:[function(require,module,exports){
26521// to indexed object, toObject with fallback for non-array-like ES3 strings
26522var IObject = require('./_iobject');
26523var defined = require('./_defined');
26524module.exports = function (it) {
26525 return IObject(defined(it));
26526};
26527
26528},{"./_defined":171,"./_iobject":183}],211:[function(require,module,exports){
26529// 7.1.15 ToLength
26530var toInteger = require('./_to-integer');
26531var min = Math.min;
26532module.exports = function (it) {
26533 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
26534};
26535
26536},{"./_to-integer":209}],212:[function(require,module,exports){
26537// 7.1.13 ToObject(argument)
26538var defined = require('./_defined');
26539module.exports = function (it) {
26540 return Object(defined(it));
26541};
26542
26543},{"./_defined":171}],213:[function(require,module,exports){
26544// 7.1.1 ToPrimitive(input [, PreferredType])
26545var isObject = require('./_is-object');
26546// instead of the ES6 spec version, we didn't implement @@toPrimitive case
26547// and the second argument - flag - preferred type is a string
26548module.exports = function (it, S) {
26549 if (!isObject(it)) return it;
26550 var fn, val;
26551 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
26552 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
26553 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
26554 throw TypeError("Can't convert object to primitive value");
26555};
26556
26557},{"./_is-object":186}],214:[function(require,module,exports){
26558var id = 0;
26559var px = Math.random();
26560module.exports = function (key) {
26561 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
26562};
26563
26564},{}],215:[function(require,module,exports){
26565var isObject = require('./_is-object');
26566module.exports = function (it, TYPE) {
26567 if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
26568 return it;
26569};
26570
26571},{"./_is-object":186}],216:[function(require,module,exports){
26572var store = require('./_shared')('wks');
26573var uid = require('./_uid');
26574var Symbol = require('./_global').Symbol;
26575var USE_SYMBOL = typeof Symbol == 'function';
26576
26577var $exports = module.exports = function (name) {
26578 return store[name] || (store[name] =
26579 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
26580};
26581
26582$exports.store = store;
26583
26584},{"./_global":178,"./_shared":206,"./_uid":214}],217:[function(require,module,exports){
26585var classof = require('./_classof');
26586var ITERATOR = require('./_wks')('iterator');
26587var Iterators = require('./_iterators');
26588module.exports = require('./_core').getIteratorMethod = function (it) {
26589 if (it != undefined) return it[ITERATOR]
26590 || it['@@iterator']
26591 || Iterators[classof(it)];
26592};
26593
26594},{"./_classof":165,"./_core":169,"./_iterators":191,"./_wks":216}],218:[function(require,module,exports){
26595'use strict';
26596var addToUnscopables = require('./_add-to-unscopables');
26597var step = require('./_iter-step');
26598var Iterators = require('./_iterators');
26599var toIObject = require('./_to-iobject');
26600
26601// 22.1.3.4 Array.prototype.entries()
26602// 22.1.3.13 Array.prototype.keys()
26603// 22.1.3.29 Array.prototype.values()
26604// 22.1.3.30 Array.prototype[@@iterator]()
26605module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
26606 this._t = toIObject(iterated); // target
26607 this._i = 0; // next index
26608 this._k = kind; // kind
26609// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
26610}, function () {
26611 var O = this._t;
26612 var kind = this._k;
26613 var index = this._i++;
26614 if (!O || index >= O.length) {
26615 this._t = undefined;
26616 return step(1);
26617 }
26618 if (kind == 'keys') return step(0, index);
26619 if (kind == 'values') return step(0, O[index]);
26620 return step(0, [index, O[index]]);
26621}, 'values');
26622
26623// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
26624Iterators.Arguments = Iterators.Array;
26625
26626addToUnscopables('keys');
26627addToUnscopables('values');
26628addToUnscopables('entries');
26629
26630},{"./_add-to-unscopables":158,"./_iter-define":189,"./_iter-step":190,"./_iterators":191,"./_to-iobject":210}],219:[function(require,module,exports){
26631'use strict';
26632var strong = require('./_collection-strong');
26633var validate = require('./_validate-collection');
26634var MAP = 'Map';
26635
26636// 23.1 Map Objects
26637module.exports = require('./_collection')(MAP, function (get) {
26638 return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
26639}, {
26640 // 23.1.3.6 Map.prototype.get(key)
26641 get: function get(key) {
26642 var entry = strong.getEntry(validate(this, MAP), key);
26643 return entry && entry.v;
26644 },
26645 // 23.1.3.9 Map.prototype.set(key, value)
26646 set: function set(key, value) {
26647 return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
26648 }
26649}, strong, true);
26650
26651},{"./_collection":168,"./_collection-strong":167,"./_validate-collection":215}],220:[function(require,module,exports){
26652arguments[4][110][0].apply(exports,arguments)
26653},{"dup":110}],221:[function(require,module,exports){
26654'use strict';
26655var $at = require('./_string-at')(true);
26656
26657// 21.1.3.27 String.prototype[@@iterator]()
26658require('./_iter-define')(String, 'String', function (iterated) {
26659 this._t = String(iterated); // target
26660 this._i = 0; // next index
26661// 21.1.5.2.1 %StringIteratorPrototype%.next()
26662}, function () {
26663 var O = this._t;
26664 var index = this._i;
26665 var point;
26666 if (index >= O.length) return { value: undefined, done: true };
26667 point = $at(O, index);
26668 this._i += point.length;
26669 return { value: point, done: false };
26670});
26671
26672},{"./_iter-define":189,"./_string-at":207}],222:[function(require,module,exports){
26673require('./es6.array.iterator');
26674var global = require('./_global');
26675var hide = require('./_hide');
26676var Iterators = require('./_iterators');
26677var TO_STRING_TAG = require('./_wks')('toStringTag');
26678
26679var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
26680 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
26681 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
26682 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
26683 'TextTrackList,TouchList').split(',');
26684
26685for (var i = 0; i < DOMIterables.length; i++) {
26686 var NAME = DOMIterables[i];
26687 var Collection = global[NAME];
26688 var proto = Collection && Collection.prototype;
26689 if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
26690 Iterators[NAME] = Iterators.Array;
26691}
26692
26693},{"./_global":178,"./_hide":180,"./_iterators":191,"./_wks":216,"./es6.array.iterator":218}],223:[function(require,module,exports){
26694(function (Buffer){
26695// Copyright Joyent, Inc. and other Node contributors.
26696//
26697// Permission is hereby granted, free of charge, to any person obtaining a
26698// copy of this software and associated documentation files (the
26699// "Software"), to deal in the Software without restriction, including
26700// without limitation the rights to use, copy, modify, merge, publish,
26701// distribute, sublicense, and/or sell copies of the Software, and to permit
26702// persons to whom the Software is furnished to do so, subject to the
26703// following conditions:
26704//
26705// The above copyright notice and this permission notice shall be included
26706// in all copies or substantial portions of the Software.
26707//
26708// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26709// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26710// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26711// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26712// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26713// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26714// USE OR OTHER DEALINGS IN THE SOFTWARE.
26715
26716// NOTE: These type checking functions intentionally don't use `instanceof`
26717// because it is fragile and can be easily faked with `Object.create()`.
26718
26719function isArray(arg) {
26720 if (Array.isArray) {
26721 return Array.isArray(arg);
26722 }
26723 return objectToString(arg) === '[object Array]';
26724}
26725exports.isArray = isArray;
26726
26727function isBoolean(arg) {
26728 return typeof arg === 'boolean';
26729}
26730exports.isBoolean = isBoolean;
26731
26732function isNull(arg) {
26733 return arg === null;
26734}
26735exports.isNull = isNull;
26736
26737function isNullOrUndefined(arg) {
26738 return arg == null;
26739}
26740exports.isNullOrUndefined = isNullOrUndefined;
26741
26742function isNumber(arg) {
26743 return typeof arg === 'number';
26744}
26745exports.isNumber = isNumber;
26746
26747function isString(arg) {
26748 return typeof arg === 'string';
26749}
26750exports.isString = isString;
26751
26752function isSymbol(arg) {
26753 return typeof arg === 'symbol';
26754}
26755exports.isSymbol = isSymbol;
26756
26757function isUndefined(arg) {
26758 return arg === void 0;
26759}
26760exports.isUndefined = isUndefined;
26761
26762function isRegExp(re) {
26763 return objectToString(re) === '[object RegExp]';
26764}
26765exports.isRegExp = isRegExp;
26766
26767function isObject(arg) {
26768 return typeof arg === 'object' && arg !== null;
26769}
26770exports.isObject = isObject;
26771
26772function isDate(d) {
26773 return objectToString(d) === '[object Date]';
26774}
26775exports.isDate = isDate;
26776
26777function isError(e) {
26778 return (objectToString(e) === '[object Error]' || e instanceof Error);
26779}
26780exports.isError = isError;
26781
26782function isFunction(arg) {
26783 return typeof arg === 'function';
26784}
26785exports.isFunction = isFunction;
26786
26787function isPrimitive(arg) {
26788 return arg === null ||
26789 typeof arg === 'boolean' ||
26790 typeof arg === 'number' ||
26791 typeof arg === 'string' ||
26792 typeof arg === 'symbol' || // ES6 symbol
26793 typeof arg === 'undefined';
26794}
26795exports.isPrimitive = isPrimitive;
26796
26797exports.isBuffer = Buffer.isBuffer;
26798
26799function objectToString(o) {
26800 return Object.prototype.toString.call(o);
26801}
26802
26803}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")})
26804},{"../../insert-module-globals/node_modules/is-buffer/index.js":397}],224:[function(require,module,exports){
26805'use strict';
26806
26807var _buffer = require('buffer');
26808
26809var _create_buffer = require('./create_buffer');
26810
26811var _create_buffer2 = _interopRequireDefault(_create_buffer);
26812
26813var _define_crc = require('./define_crc');
26814
26815var _define_crc2 = _interopRequireDefault(_define_crc);
26816
26817function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26818
26819module.exports = (0, _define_crc2.default)('crc1', function (buf, previous) {
26820 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
26821
26822 var crc = ~~previous;
26823 var accum = 0;
26824
26825 for (var index = 0; index < buf.length; index++) {
26826 var byte = buf[index];
26827 accum += byte;
26828 }
26829
26830 crc += accum % 256;
26831 return crc % 256;
26832});
26833},{"./create_buffer":235,"./define_crc":236,"buffer":146}],225:[function(require,module,exports){
26834'use strict';
26835
26836var _buffer = require('buffer');
26837
26838var _create_buffer = require('./create_buffer');
26839
26840var _create_buffer2 = _interopRequireDefault(_create_buffer);
26841
26842var _define_crc = require('./define_crc');
26843
26844var _define_crc2 = _interopRequireDefault(_define_crc);
26845
26846function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26847
26848// Generated by `./pycrc.py --algorithm=table-driven --model=crc-16 --generate=c`
26849var TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040];
26850
26851if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
26852
26853module.exports = (0, _define_crc2.default)('crc-16', function (buf, previous) {
26854 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
26855
26856 var crc = ~~previous;
26857
26858 for (var index = 0; index < buf.length; index++) {
26859 var byte = buf[index];
26860 crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
26861 }
26862
26863 return crc;
26864});
26865},{"./create_buffer":235,"./define_crc":236,"buffer":146}],226:[function(require,module,exports){
26866'use strict';
26867
26868var _buffer = require('buffer');
26869
26870var _create_buffer = require('./create_buffer');
26871
26872var _create_buffer2 = _interopRequireDefault(_create_buffer);
26873
26874var _define_crc = require('./define_crc');
26875
26876var _define_crc2 = _interopRequireDefault(_define_crc);
26877
26878function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26879
26880// Generated by `./pycrc.py --algorithm=table-driven --model=ccitt --generate=c`
26881var TABLE = [0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0];
26882
26883if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
26884
26885module.exports = (0, _define_crc2.default)('ccitt', function (buf, previous) {
26886 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
26887
26888 var crc = typeof previous !== 'undefined' ? ~~previous : 0xffff;
26889
26890 for (var index = 0; index < buf.length; index++) {
26891 var byte = buf[index];
26892 crc = (TABLE[(crc >> 8 ^ byte) & 0xff] ^ crc << 8) & 0xffff;
26893 }
26894
26895 return crc;
26896});
26897},{"./create_buffer":235,"./define_crc":236,"buffer":146}],227:[function(require,module,exports){
26898'use strict';
26899
26900var _buffer = require('buffer');
26901
26902var _create_buffer = require('./create_buffer');
26903
26904var _create_buffer2 = _interopRequireDefault(_create_buffer);
26905
26906var _define_crc = require('./define_crc');
26907
26908var _define_crc2 = _interopRequireDefault(_define_crc);
26909
26910function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26911
26912// Generated by `./pycrc.py --algorithm=table-driven --model=kermit --generate=c`
26913var TABLE = [0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78];
26914
26915if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
26916
26917module.exports = (0, _define_crc2.default)('kermit', function (buf, previous) {
26918 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
26919
26920 var crc = typeof previous !== 'undefined' ? ~~previous : 0x0000;
26921
26922 for (var index = 0; index < buf.length; index++) {
26923 var byte = buf[index];
26924 crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
26925 }
26926
26927 return crc;
26928});
26929},{"./create_buffer":235,"./define_crc":236,"buffer":146}],228:[function(require,module,exports){
26930'use strict';
26931
26932var _buffer = require('buffer');
26933
26934var _create_buffer = require('./create_buffer');
26935
26936var _create_buffer2 = _interopRequireDefault(_create_buffer);
26937
26938var _define_crc = require('./define_crc');
26939
26940var _define_crc2 = _interopRequireDefault(_define_crc);
26941
26942function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26943
26944// Generated by `./pycrc.py --algorithm=table-driven --model=crc-16-modbus --generate=c`
26945var TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040];
26946
26947if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
26948
26949module.exports = (0, _define_crc2.default)('crc-16-modbus', function (buf, previous) {
26950 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
26951
26952 var crc = typeof previous !== 'undefined' ? ~~previous : 0xffff;
26953
26954 for (var index = 0; index < buf.length; index++) {
26955 var byte = buf[index];
26956 crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
26957 }
26958
26959 return crc;
26960});
26961},{"./create_buffer":235,"./define_crc":236,"buffer":146}],229:[function(require,module,exports){
26962'use strict';
26963
26964var _buffer = require('buffer');
26965
26966var _create_buffer = require('./create_buffer');
26967
26968var _create_buffer2 = _interopRequireDefault(_create_buffer);
26969
26970var _define_crc = require('./define_crc');
26971
26972var _define_crc2 = _interopRequireDefault(_define_crc);
26973
26974function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26975
26976module.exports = (0, _define_crc2.default)('xmodem', function (buf, previous) {
26977 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
26978
26979 var crc = typeof previous !== 'undefined' ? ~~previous : 0x0;
26980
26981 for (var index = 0; index < buf.length; index++) {
26982 var byte = buf[index];
26983 var code = crc >>> 8 & 0xFF;
26984
26985 code ^= byte & 0xFF;
26986 code ^= code >>> 4;
26987 crc = crc << 8 & 0xFFFF;
26988 crc ^= code;
26989 code = code << 5 & 0xFFFF;
26990 crc ^= code;
26991 code = code << 7 & 0xFFFF;
26992 crc ^= code;
26993 }
26994
26995 return crc;
26996});
26997},{"./create_buffer":235,"./define_crc":236,"buffer":146}],230:[function(require,module,exports){
26998'use strict';
26999
27000var _buffer = require('buffer');
27001
27002var _create_buffer = require('./create_buffer');
27003
27004var _create_buffer2 = _interopRequireDefault(_create_buffer);
27005
27006var _define_crc = require('./define_crc');
27007
27008var _define_crc2 = _interopRequireDefault(_define_crc);
27009
27010function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27011
27012// Generated by `./pycrc.py --algorithm=table-drive --model=crc-24 --generate=c`
27013var TABLE = [0x000000, 0x864cfb, 0x8ad50d, 0x0c99f6, 0x93e6e1, 0x15aa1a, 0x1933ec, 0x9f7f17, 0xa18139, 0x27cdc2, 0x2b5434, 0xad18cf, 0x3267d8, 0xb42b23, 0xb8b2d5, 0x3efe2e, 0xc54e89, 0x430272, 0x4f9b84, 0xc9d77f, 0x56a868, 0xd0e493, 0xdc7d65, 0x5a319e, 0x64cfb0, 0xe2834b, 0xee1abd, 0x685646, 0xf72951, 0x7165aa, 0x7dfc5c, 0xfbb0a7, 0x0cd1e9, 0x8a9d12, 0x8604e4, 0x00481f, 0x9f3708, 0x197bf3, 0x15e205, 0x93aefe, 0xad50d0, 0x2b1c2b, 0x2785dd, 0xa1c926, 0x3eb631, 0xb8faca, 0xb4633c, 0x322fc7, 0xc99f60, 0x4fd39b, 0x434a6d, 0xc50696, 0x5a7981, 0xdc357a, 0xd0ac8c, 0x56e077, 0x681e59, 0xee52a2, 0xe2cb54, 0x6487af, 0xfbf8b8, 0x7db443, 0x712db5, 0xf7614e, 0x19a3d2, 0x9fef29, 0x9376df, 0x153a24, 0x8a4533, 0x0c09c8, 0x00903e, 0x86dcc5, 0xb822eb, 0x3e6e10, 0x32f7e6, 0xb4bb1d, 0x2bc40a, 0xad88f1, 0xa11107, 0x275dfc, 0xdced5b, 0x5aa1a0, 0x563856, 0xd074ad, 0x4f0bba, 0xc94741, 0xc5deb7, 0x43924c, 0x7d6c62, 0xfb2099, 0xf7b96f, 0x71f594, 0xee8a83, 0x68c678, 0x645f8e, 0xe21375, 0x15723b, 0x933ec0, 0x9fa736, 0x19ebcd, 0x8694da, 0x00d821, 0x0c41d7, 0x8a0d2c, 0xb4f302, 0x32bff9, 0x3e260f, 0xb86af4, 0x2715e3, 0xa15918, 0xadc0ee, 0x2b8c15, 0xd03cb2, 0x567049, 0x5ae9bf, 0xdca544, 0x43da53, 0xc596a8, 0xc90f5e, 0x4f43a5, 0x71bd8b, 0xf7f170, 0xfb6886, 0x7d247d, 0xe25b6a, 0x641791, 0x688e67, 0xeec29c, 0x3347a4, 0xb50b5f, 0xb992a9, 0x3fde52, 0xa0a145, 0x26edbe, 0x2a7448, 0xac38b3, 0x92c69d, 0x148a66, 0x181390, 0x9e5f6b, 0x01207c, 0x876c87, 0x8bf571, 0x0db98a, 0xf6092d, 0x7045d6, 0x7cdc20, 0xfa90db, 0x65efcc, 0xe3a337, 0xef3ac1, 0x69763a, 0x578814, 0xd1c4ef, 0xdd5d19, 0x5b11e2, 0xc46ef5, 0x42220e, 0x4ebbf8, 0xc8f703, 0x3f964d, 0xb9dab6, 0xb54340, 0x330fbb, 0xac70ac, 0x2a3c57, 0x26a5a1, 0xa0e95a, 0x9e1774, 0x185b8f, 0x14c279, 0x928e82, 0x0df195, 0x8bbd6e, 0x872498, 0x016863, 0xfad8c4, 0x7c943f, 0x700dc9, 0xf64132, 0x693e25, 0xef72de, 0xe3eb28, 0x65a7d3, 0x5b59fd, 0xdd1506, 0xd18cf0, 0x57c00b, 0xc8bf1c, 0x4ef3e7, 0x426a11, 0xc426ea, 0x2ae476, 0xaca88d, 0xa0317b, 0x267d80, 0xb90297, 0x3f4e6c, 0x33d79a, 0xb59b61, 0x8b654f, 0x0d29b4, 0x01b042, 0x87fcb9, 0x1883ae, 0x9ecf55, 0x9256a3, 0x141a58, 0xefaaff, 0x69e604, 0x657ff2, 0xe33309, 0x7c4c1e, 0xfa00e5, 0xf69913, 0x70d5e8, 0x4e2bc6, 0xc8673d, 0xc4fecb, 0x42b230, 0xddcd27, 0x5b81dc, 0x57182a, 0xd154d1, 0x26359f, 0xa07964, 0xace092, 0x2aac69, 0xb5d37e, 0x339f85, 0x3f0673, 0xb94a88, 0x87b4a6, 0x01f85d, 0x0d61ab, 0x8b2d50, 0x145247, 0x921ebc, 0x9e874a, 0x18cbb1, 0xe37b16, 0x6537ed, 0x69ae1b, 0xefe2e0, 0x709df7, 0xf6d10c, 0xfa48fa, 0x7c0401, 0x42fa2f, 0xc4b6d4, 0xc82f22, 0x4e63d9, 0xd11cce, 0x575035, 0x5bc9c3, 0xdd8538];
27014
27015if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
27016
27017module.exports = (0, _define_crc2.default)('crc-24', function (buf, previous) {
27018 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
27019
27020 var crc = typeof previous !== 'undefined' ? ~~previous : 0xb704ce;
27021
27022 for (var index = 0; index < buf.length; index++) {
27023 var byte = buf[index];
27024 crc = (TABLE[(crc >> 16 ^ byte) & 0xff] ^ crc << 8) & 0xffffff;
27025 }
27026
27027 return crc;
27028});
27029},{"./create_buffer":235,"./define_crc":236,"buffer":146}],231:[function(require,module,exports){
27030'use strict';
27031
27032var _buffer = require('buffer');
27033
27034var _create_buffer = require('./create_buffer');
27035
27036var _create_buffer2 = _interopRequireDefault(_create_buffer);
27037
27038var _define_crc = require('./define_crc');
27039
27040var _define_crc2 = _interopRequireDefault(_define_crc);
27041
27042function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27043
27044// Generated by `./pycrc.py --algorithm=table-driven --model=crc-32 --generate=c`
27045var TABLE = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d];
27046
27047if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
27048
27049module.exports = (0, _define_crc2.default)('crc-32', function (buf, previous) {
27050 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
27051
27052 var crc = previous === 0 ? 0 : ~~previous ^ -1;
27053
27054 for (var index = 0; index < buf.length; index++) {
27055 var byte = buf[index];
27056 crc = TABLE[(crc ^ byte) & 0xff] ^ crc >>> 8;
27057 }
27058
27059 return crc ^ -1;
27060});
27061},{"./create_buffer":235,"./define_crc":236,"buffer":146}],232:[function(require,module,exports){
27062'use strict';
27063
27064var _buffer = require('buffer');
27065
27066var _create_buffer = require('./create_buffer');
27067
27068var _create_buffer2 = _interopRequireDefault(_create_buffer);
27069
27070var _define_crc = require('./define_crc');
27071
27072var _define_crc2 = _interopRequireDefault(_define_crc);
27073
27074function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27075
27076// Generated by `./pycrc.py --algorithm=table-driven --model=crc-8 --generate=c`
27077var TABLE = [0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3];
27078
27079if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
27080
27081module.exports = (0, _define_crc2.default)('crc-8', function (buf, previous) {
27082 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
27083
27084 var crc = ~~previous;
27085
27086 for (var index = 0; index < buf.length; index++) {
27087 var byte = buf[index];
27088 crc = TABLE[(crc ^ byte) & 0xff] & 0xff;
27089 }
27090
27091 return crc;
27092});
27093},{"./create_buffer":235,"./define_crc":236,"buffer":146}],233:[function(require,module,exports){
27094'use strict';
27095
27096var _buffer = require('buffer');
27097
27098var _create_buffer = require('./create_buffer');
27099
27100var _create_buffer2 = _interopRequireDefault(_create_buffer);
27101
27102var _define_crc = require('./define_crc');
27103
27104var _define_crc2 = _interopRequireDefault(_define_crc);
27105
27106function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27107
27108// Generated by `./pycrc.py --algorithm=table-driven --model=dallas-1-wire --generate=c`
27109var TABLE = [0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35];
27110
27111if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
27112
27113module.exports = (0, _define_crc2.default)('dallas-1-wire', function (buf, previous) {
27114 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
27115
27116 var crc = ~~previous;
27117
27118 for (var index = 0; index < buf.length; index++) {
27119 var byte = buf[index];
27120 crc = TABLE[(crc ^ byte) & 0xff] & 0xff;
27121 }
27122
27123 return crc;
27124});
27125},{"./create_buffer":235,"./define_crc":236,"buffer":146}],234:[function(require,module,exports){
27126'use strict';
27127
27128var _buffer = require('buffer');
27129
27130var _create_buffer = require('./create_buffer');
27131
27132var _create_buffer2 = _interopRequireDefault(_create_buffer);
27133
27134var _define_crc = require('./define_crc');
27135
27136var _define_crc2 = _interopRequireDefault(_define_crc);
27137
27138function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27139
27140// Generated by `./pycrc.py --algorithm=table-driven --model=jam --generate=c`
27141var TABLE = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d];
27142
27143if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
27144
27145module.exports = (0, _define_crc2.default)('jam', function (buf) {
27146 var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
27147
27148 if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf);
27149
27150 var crc = previous === 0 ? 0 : ~~previous;
27151
27152 for (var index = 0; index < buf.length; index++) {
27153 var byte = buf[index];
27154 crc = TABLE[(crc ^ byte) & 0xff] ^ crc >>> 8;
27155 }
27156
27157 return crc;
27158});
27159},{"./create_buffer":235,"./define_crc":236,"buffer":146}],235:[function(require,module,exports){
27160'use strict';
27161
27162Object.defineProperty(exports, "__esModule", {
27163 value: true
27164});
27165
27166var _buffer = require('buffer');
27167
27168var createBuffer = _buffer.Buffer.from && _buffer.Buffer.alloc && _buffer.Buffer.allocUnsafe && _buffer.Buffer.allocUnsafeSlow ? _buffer.Buffer.from
27169
27170// support for Node < 5.10
27171: function (val) {
27172 return new _buffer.Buffer(val);
27173};
27174
27175exports.default = createBuffer;
27176},{"buffer":146}],236:[function(require,module,exports){
27177"use strict";
27178
27179Object.defineProperty(exports, "__esModule", {
27180 value: true
27181});
27182
27183exports.default = function (model, calc) {
27184 var fn = function fn(buf, previous) {
27185 return calc(buf, previous) >>> 0;
27186 };
27187 fn.signed = calc;
27188 fn.unsigned = fn;
27189 fn.model = model;
27190
27191 return fn;
27192};
27193},{}],237:[function(require,module,exports){
27194'use strict';
27195
27196module.exports = {
27197 crc1: require('./crc1'),
27198 crc8: require('./crc8'),
27199 crc81wire: require('./crc8_1wire'),
27200 crc16: require('./crc16'),
27201 crc16ccitt: require('./crc16_ccitt'),
27202 crc16modbus: require('./crc16_modbus'),
27203 crc16xmodem: require('./crc16_xmodem'),
27204 crc16kermit: require('./crc16_kermit'),
27205 crc24: require('./crc24'),
27206 crc32: require('./crc32'),
27207 crcjam: require('./crcjam')
27208};
27209},{"./crc1":224,"./crc16":225,"./crc16_ccitt":226,"./crc16_kermit":227,"./crc16_modbus":228,"./crc16_xmodem":229,"./crc24":230,"./crc32":231,"./crc8":232,"./crc8_1wire":233,"./crcjam":234}],238:[function(require,module,exports){
27210(function (Buffer){
27211var elliptic = require('elliptic')
27212var BN = require('bn.js')
27213
27214module.exports = function createECDH (curve) {
27215 return new ECDH(curve)
27216}
27217
27218var aliases = {
27219 secp256k1: {
27220 name: 'secp256k1',
27221 byteLength: 32
27222 },
27223 secp224r1: {
27224 name: 'p224',
27225 byteLength: 28
27226 },
27227 prime256v1: {
27228 name: 'p256',
27229 byteLength: 32
27230 },
27231 prime192v1: {
27232 name: 'p192',
27233 byteLength: 24
27234 },
27235 ed25519: {
27236 name: 'ed25519',
27237 byteLength: 32
27238 },
27239 secp384r1: {
27240 name: 'p384',
27241 byteLength: 48
27242 },
27243 secp521r1: {
27244 name: 'p521',
27245 byteLength: 66
27246 }
27247}
27248
27249aliases.p224 = aliases.secp224r1
27250aliases.p256 = aliases.secp256r1 = aliases.prime256v1
27251aliases.p192 = aliases.secp192r1 = aliases.prime192v1
27252aliases.p384 = aliases.secp384r1
27253aliases.p521 = aliases.secp521r1
27254
27255function ECDH (curve) {
27256 this.curveType = aliases[curve]
27257 if (!this.curveType) {
27258 this.curveType = {
27259 name: curve
27260 }
27261 }
27262 this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
27263 this.keys = void 0
27264}
27265
27266ECDH.prototype.generateKeys = function (enc, format) {
27267 this.keys = this.curve.genKeyPair()
27268 return this.getPublicKey(enc, format)
27269}
27270
27271ECDH.prototype.computeSecret = function (other, inenc, enc) {
27272 inenc = inenc || 'utf8'
27273 if (!Buffer.isBuffer(other)) {
27274 other = new Buffer(other, inenc)
27275 }
27276 var otherPub = this.curve.keyFromPublic(other).getPublic()
27277 var out = otherPub.mul(this.keys.getPrivate()).getX()
27278 return formatReturnValue(out, enc, this.curveType.byteLength)
27279}
27280
27281ECDH.prototype.getPublicKey = function (enc, format) {
27282 var key = this.keys.getPublic(format === 'compressed', true)
27283 if (format === 'hybrid') {
27284 if (key[key.length - 1] % 2) {
27285 key[0] = 7
27286 } else {
27287 key[0] = 6
27288 }
27289 }
27290 return formatReturnValue(key, enc)
27291}
27292
27293ECDH.prototype.getPrivateKey = function (enc) {
27294 return formatReturnValue(this.keys.getPrivate(), enc)
27295}
27296
27297ECDH.prototype.setPublicKey = function (pub, enc) {
27298 enc = enc || 'utf8'
27299 if (!Buffer.isBuffer(pub)) {
27300 pub = new Buffer(pub, enc)
27301 }
27302 this.keys._importPublic(pub)
27303 return this
27304}
27305
27306ECDH.prototype.setPrivateKey = function (priv, enc) {
27307 enc = enc || 'utf8'
27308 if (!Buffer.isBuffer(priv)) {
27309 priv = new Buffer(priv, enc)
27310 }
27311
27312 var _priv = new BN(priv)
27313 _priv = _priv.toString(16)
27314 this.keys = this.curve.genKeyPair()
27315 this.keys._importPrivate(_priv)
27316 return this
27317}
27318
27319function formatReturnValue (bn, enc, len) {
27320 if (!Array.isArray(bn)) {
27321 bn = bn.toArray()
27322 }
27323 var buf = new Buffer(bn)
27324 if (len && buf.length < len) {
27325 var zeros = new Buffer(len - buf.length)
27326 zeros.fill(0)
27327 buf = Buffer.concat([zeros, buf])
27328 }
27329 if (!enc) {
27330 return buf
27331 } else {
27332 return buf.toString(enc)
27333 }
27334}
27335
27336}).call(this,require("buffer").Buffer)
27337},{"bn.js":108,"buffer":146,"elliptic":317}],239:[function(require,module,exports){
27338'use strict'
27339var inherits = require('inherits')
27340var MD5 = require('md5.js')
27341var RIPEMD160 = require('ripemd160')
27342var sha = require('sha.js')
27343var Base = require('cipher-base')
27344
27345function Hash (hash) {
27346 Base.call(this, 'digest')
27347
27348 this._hash = hash
27349}
27350
27351inherits(Hash, Base)
27352
27353Hash.prototype._update = function (data) {
27354 this._hash.update(data)
27355}
27356
27357Hash.prototype._final = function () {
27358 return this._hash.digest()
27359}
27360
27361module.exports = function createHash (alg) {
27362 alg = alg.toLowerCase()
27363 if (alg === 'md5') return new MD5()
27364 if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
27365
27366 return new Hash(sha(alg))
27367}
27368
27369},{"cipher-base":155,"inherits":396,"md5.js":637,"ripemd160":740,"sha.js":770}],240:[function(require,module,exports){
27370var MD5 = require('md5.js')
27371
27372module.exports = function (buffer) {
27373 return new MD5().update(buffer).digest()
27374}
27375
27376},{"md5.js":637}],241:[function(require,module,exports){
27377'use strict'
27378var inherits = require('inherits')
27379var Legacy = require('./legacy')
27380var Base = require('cipher-base')
27381var Buffer = require('safe-buffer').Buffer
27382var md5 = require('create-hash/md5')
27383var RIPEMD160 = require('ripemd160')
27384
27385var sha = require('sha.js')
27386
27387var ZEROS = Buffer.alloc(128)
27388
27389function Hmac (alg, key) {
27390 Base.call(this, 'digest')
27391 if (typeof key === 'string') {
27392 key = Buffer.from(key)
27393 }
27394
27395 var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
27396
27397 this._alg = alg
27398 this._key = key
27399 if (key.length > blocksize) {
27400 var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
27401 key = hash.update(key).digest()
27402 } else if (key.length < blocksize) {
27403 key = Buffer.concat([key, ZEROS], blocksize)
27404 }
27405
27406 var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
27407 var opad = this._opad = Buffer.allocUnsafe(blocksize)
27408
27409 for (var i = 0; i < blocksize; i++) {
27410 ipad[i] = key[i] ^ 0x36
27411 opad[i] = key[i] ^ 0x5C
27412 }
27413 this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
27414 this._hash.update(ipad)
27415}
27416
27417inherits(Hmac, Base)
27418
27419Hmac.prototype._update = function (data) {
27420 this._hash.update(data)
27421}
27422
27423Hmac.prototype._final = function () {
27424 var h = this._hash.digest()
27425 var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
27426 return hash.update(this._opad).update(h).digest()
27427}
27428
27429module.exports = function createHmac (alg, key) {
27430 alg = alg.toLowerCase()
27431 if (alg === 'rmd160' || alg === 'ripemd160') {
27432 return new Hmac('rmd160', key)
27433 }
27434 if (alg === 'md5') {
27435 return new Legacy(md5, key)
27436 }
27437 return new Hmac(alg, key)
27438}
27439
27440},{"./legacy":242,"cipher-base":155,"create-hash/md5":240,"inherits":396,"ripemd160":740,"safe-buffer":742,"sha.js":770}],242:[function(require,module,exports){
27441'use strict'
27442var inherits = require('inherits')
27443var Buffer = require('safe-buffer').Buffer
27444
27445var Base = require('cipher-base')
27446
27447var ZEROS = Buffer.alloc(128)
27448var blocksize = 64
27449
27450function Hmac (alg, key) {
27451 Base.call(this, 'digest')
27452 if (typeof key === 'string') {
27453 key = Buffer.from(key)
27454 }
27455
27456 this._alg = alg
27457 this._key = key
27458
27459 if (key.length > blocksize) {
27460 key = alg(key)
27461 } else if (key.length < blocksize) {
27462 key = Buffer.concat([key, ZEROS], blocksize)
27463 }
27464
27465 var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
27466 var opad = this._opad = Buffer.allocUnsafe(blocksize)
27467
27468 for (var i = 0; i < blocksize; i++) {
27469 ipad[i] = key[i] ^ 0x36
27470 opad[i] = key[i] ^ 0x5C
27471 }
27472
27473 this._hash = [ipad]
27474}
27475
27476inherits(Hmac, Base)
27477
27478Hmac.prototype._update = function (data) {
27479 this._hash.push(data)
27480}
27481
27482Hmac.prototype._final = function () {
27483 var h = this._alg(Buffer.concat(this._hash))
27484 return this._alg(Buffer.concat([this._opad, h]))
27485}
27486module.exports = Hmac
27487
27488},{"cipher-base":155,"inherits":396,"safe-buffer":742}],243:[function(require,module,exports){
27489'use strict'
27490
27491exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')
27492exports.createHash = exports.Hash = require('create-hash')
27493exports.createHmac = exports.Hmac = require('create-hmac')
27494
27495var algos = require('browserify-sign/algos')
27496var algoKeys = Object.keys(algos)
27497var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
27498exports.getHashes = function () {
27499 return hashes
27500}
27501
27502var p = require('pbkdf2')
27503exports.pbkdf2 = p.pbkdf2
27504exports.pbkdf2Sync = p.pbkdf2Sync
27505
27506var aes = require('browserify-cipher')
27507
27508exports.Cipher = aes.Cipher
27509exports.createCipher = aes.createCipher
27510exports.Cipheriv = aes.Cipheriv
27511exports.createCipheriv = aes.createCipheriv
27512exports.Decipher = aes.Decipher
27513exports.createDecipher = aes.createDecipher
27514exports.Decipheriv = aes.Decipheriv
27515exports.createDecipheriv = aes.createDecipheriv
27516exports.getCiphers = aes.getCiphers
27517exports.listCiphers = aes.listCiphers
27518
27519var dh = require('diffie-hellman')
27520
27521exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
27522exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
27523exports.getDiffieHellman = dh.getDiffieHellman
27524exports.createDiffieHellman = dh.createDiffieHellman
27525exports.DiffieHellman = dh.DiffieHellman
27526
27527var sign = require('browserify-sign')
27528
27529exports.createSign = sign.createSign
27530exports.Sign = sign.Sign
27531exports.createVerify = sign.createVerify
27532exports.Verify = sign.Verify
27533
27534exports.createECDH = require('create-ecdh')
27535
27536var publicEncrypt = require('public-encrypt')
27537
27538exports.publicEncrypt = publicEncrypt.publicEncrypt
27539exports.privateEncrypt = publicEncrypt.privateEncrypt
27540exports.publicDecrypt = publicEncrypt.publicDecrypt
27541exports.privateDecrypt = publicEncrypt.privateDecrypt
27542
27543// the least I can do is make error messages for the rest of the node.js/crypto api.
27544// ;[
27545// 'createCredentials'
27546// ].forEach(function (name) {
27547// exports[name] = function () {
27548// throw new Error([
27549// 'sorry, ' + name + ' is not implemented yet',
27550// 'we accept pull requests',
27551// 'https://github.com/crypto-browserify/crypto-browserify'
27552// ].join('\n'))
27553// }
27554// })
27555
27556var rf = require('randomfill')
27557
27558exports.randomFill = rf.randomFill
27559exports.randomFillSync = rf.randomFillSync
27560
27561exports.createCredentials = function () {
27562 throw new Error([
27563 'sorry, createCredentials is not implemented yet',
27564 'we accept pull requests',
27565 'https://github.com/crypto-browserify/crypto-browserify'
27566 ].join('\n'))
27567}
27568
27569exports.constants = {
27570 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
27571 'DH_CHECK_P_NOT_PRIME': 1,
27572 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
27573 'DH_NOT_SUITABLE_GENERATOR': 8,
27574 'NPN_ENABLED': 1,
27575 'ALPN_ENABLED': 1,
27576 'RSA_PKCS1_PADDING': 1,
27577 'RSA_SSLV23_PADDING': 2,
27578 'RSA_NO_PADDING': 3,
27579 'RSA_PKCS1_OAEP_PADDING': 4,
27580 'RSA_X931_PADDING': 5,
27581 'RSA_PKCS1_PSS_PADDING': 6,
27582 'POINT_CONVERSION_COMPRESSED': 2,
27583 'POINT_CONVERSION_UNCOMPRESSED': 4,
27584 'POINT_CONVERSION_HYBRID': 6
27585}
27586
27587},{"browserify-cipher":128,"browserify-sign":135,"browserify-sign/algos":132,"create-ecdh":238,"create-hash":239,"create-hmac":241,"diffie-hellman":251,"pbkdf2":672,"public-encrypt":713,"randombytes":724,"randomfill":725}],244:[function(require,module,exports){
27588(function (Buffer){
27589var Cursor = function(buffer)
27590{
27591 if (!(this instanceof Cursor))
27592 {
27593 return new Cursor(buffer);
27594 }
27595
27596 if (!(buffer instanceof Buffer))
27597 {
27598 buffer = new Buffer(buffer);
27599 }
27600
27601 this._setBuffer(buffer);
27602 this.rewind();
27603};
27604
27605Cursor.prototype._setBuffer = function(buffer)
27606{
27607 this._buffer = buffer;
27608 this.length = buffer.length;
27609};
27610
27611Cursor.prototype.buffer = function()
27612{
27613 return this._buffer;
27614};
27615
27616Cursor.prototype.tap = function(cb)
27617{
27618 cb(this);
27619 return this;
27620};
27621
27622Cursor.prototype.clone = function(newIndex)
27623{
27624 var c = new this.constructor(this.buffer());
27625 c.seek(arguments.length === 0 ? this.tell() : newIndex);
27626
27627 return c;
27628};
27629
27630Cursor.prototype.tell = function()
27631{
27632 return this._index;
27633};
27634
27635Cursor.prototype.seek = function(op, index)
27636{
27637 if (arguments.length == 1)
27638 {
27639 index = op;
27640 op = '=';
27641 }
27642
27643 if (op == '+')
27644 {
27645 this._index += index;
27646 }
27647 else if (op == '-')
27648 {
27649 this._index -= index;
27650 }
27651 else
27652 {
27653 this._index = index;
27654 }
27655
27656 return this;
27657};
27658
27659Cursor.prototype.rewind = function()
27660{
27661 return this.seek(0);
27662};
27663
27664Cursor.prototype.eof = function()
27665{
27666 return this.tell() == this.buffer().length;
27667};
27668
27669Cursor.prototype.write = function(string, length, encoding)
27670{
27671 return this.seek('+', this.buffer().write(string, this.tell(), length, encoding));
27672};
27673
27674Cursor.prototype.fill = function(value, length)
27675{
27676 if (arguments.length == 1)
27677 {
27678 length = this.buffer().length - this.tell();
27679 }
27680
27681 this.buffer().fill(value, this.tell(), this.tell() + length);
27682 this.seek('+', length);
27683
27684 return this;
27685};
27686
27687Cursor.prototype.slice = function(length)
27688{
27689 if (arguments.length === 0)
27690 {
27691 length = this.length - this.tell();
27692 }
27693
27694 var c = new this.constructor(this.buffer().slice(this.tell(), this.tell() + length));
27695 this.seek('+', length);
27696
27697 return c;
27698};
27699
27700Cursor.prototype.copyFrom = function(source)
27701{
27702 var buf = source instanceof Buffer ? source: source.buffer();
27703 buf.copy(this.buffer(), this.tell(), 0, buf.length);
27704 this.seek('+', buf.length);
27705
27706 return this;
27707};
27708
27709Cursor.prototype.concat = function(list)
27710{
27711 for (var i in list)
27712 {
27713 if (list[i] instanceof Cursor)
27714 {
27715 list[i] = list[i].buffer();
27716 }
27717 }
27718
27719 list.unshift(this.buffer());
27720
27721 var b = Buffer.concat(list);
27722 this._setBuffer(b);
27723
27724 return this;
27725};
27726
27727Cursor.prototype.toString = function(encoding, length)
27728{
27729 if (arguments.length === 0)
27730 {
27731 encoding = 'utf8';
27732 length = this.buffer().length - this.tell();
27733 }
27734 else if (arguments.length === 1)
27735 {
27736 length = this.buffer().length - this.tell();
27737 }
27738
27739 var val = this.buffer().toString(encoding, this.tell(), this.tell() + length);
27740 this.seek('+', length);
27741
27742 return val;
27743};
27744
27745[
27746 [1, ['readInt8', 'readUInt8']],
27747 [2, ['readInt16BE', 'readInt16LE', 'readUInt16BE', 'readUInt16LE']],
27748 [4, ['readInt32BE', 'readInt32LE', 'readUInt32BE', 'readUInt32LE', 'readFloatBE', 'readFloatLE']],
27749 [8, ['readDoubleBE', 'readDoubleLE']]
27750].forEach(function(arr)
27751{
27752 arr[1].forEach(function(method)
27753 {
27754 Cursor.prototype[method] = function()
27755 {
27756 var val = this.buffer()[method](this.tell());
27757 this.seek('+', arr[0]);
27758
27759 return val;
27760 };
27761 });
27762});
27763
27764[
27765 [1, ['writeInt8', 'writeUInt8']],
27766 [2, ['writeInt16BE', 'writeInt16LE', 'writeUInt16BE', 'writeUInt16LE']],
27767 [4, ['writeInt32BE', 'writeInt32LE', 'writeUInt32BE', 'writeUInt32LE', 'writeFloatBE', 'writeFloatLE']],
27768 [8, ['writeDoubleBE', 'writeDoubleLE']]
27769].forEach(function(arr)
27770{
27771 arr[1].forEach(function(method)
27772 {
27773 Cursor.prototype[method] = function(val)
27774 {
27775 val = this.buffer()[method](val, this.tell());
27776 this.seek('+', arr[0]);
27777
27778 return this;
27779 };
27780 });
27781});
27782
27783//basic extend functionality to facilitate
27784//writing your own cursor while still providing
27785//access to low level r/w functionality
27786Cursor.extend = function(C, proto)
27787{
27788 var parent = this;
27789
27790 if (arguments.length === 1)
27791 {
27792 proto = C;
27793 C = null;
27794 }
27795
27796 proto = proto || {};
27797
27798 C = C || function ctor(buffer)
27799 {
27800 if (!(this instanceof C))
27801 {
27802 return new C(buffer);
27803 }
27804
27805 parent.call(this, buffer);
27806 };
27807
27808 require('util').inherits(C, parent);
27809
27810 C.extend = parent.extend;
27811 C.define = parent.define;
27812
27813 for (var i in proto)
27814 {
27815 C.define(i, proto[i]);
27816 }
27817
27818 return C;
27819};
27820
27821Cursor.define = function(name, fn)
27822{
27823 var proto = this.prototype[name];
27824
27825 this.prototype[name] = proto && function()
27826 {
27827 this.__super = proto;
27828 return fn.apply(this, arguments);
27829 } || fn;
27830};
27831
27832module.exports = Cursor;
27833
27834}).call(this,require("buffer").Buffer)
27835},{"buffer":146,"util":824}],245:[function(require,module,exports){
27836'use strict';
27837
27838exports.utils = require('./des/utils');
27839exports.Cipher = require('./des/cipher');
27840exports.DES = require('./des/des');
27841exports.CBC = require('./des/cbc');
27842exports.EDE = require('./des/ede');
27843
27844},{"./des/cbc":246,"./des/cipher":247,"./des/des":248,"./des/ede":249,"./des/utils":250}],246:[function(require,module,exports){
27845'use strict';
27846
27847var assert = require('minimalistic-assert');
27848var inherits = require('inherits');
27849
27850var proto = {};
27851
27852function CBCState(iv) {
27853 assert.equal(iv.length, 8, 'Invalid IV length');
27854
27855 this.iv = new Array(8);
27856 for (var i = 0; i < this.iv.length; i++)
27857 this.iv[i] = iv[i];
27858}
27859
27860function instantiate(Base) {
27861 function CBC(options) {
27862 Base.call(this, options);
27863 this._cbcInit();
27864 }
27865 inherits(CBC, Base);
27866
27867 var keys = Object.keys(proto);
27868 for (var i = 0; i < keys.length; i++) {
27869 var key = keys[i];
27870 CBC.prototype[key] = proto[key];
27871 }
27872
27873 CBC.create = function create(options) {
27874 return new CBC(options);
27875 };
27876
27877 return CBC;
27878}
27879
27880exports.instantiate = instantiate;
27881
27882proto._cbcInit = function _cbcInit() {
27883 var state = new CBCState(this.options.iv);
27884 this._cbcState = state;
27885};
27886
27887proto._update = function _update(inp, inOff, out, outOff) {
27888 var state = this._cbcState;
27889 var superProto = this.constructor.super_.prototype;
27890
27891 var iv = state.iv;
27892 if (this.type === 'encrypt') {
27893 for (var i = 0; i < this.blockSize; i++)
27894 iv[i] ^= inp[inOff + i];
27895
27896 superProto._update.call(this, iv, 0, out, outOff);
27897
27898 for (var i = 0; i < this.blockSize; i++)
27899 iv[i] = out[outOff + i];
27900 } else {
27901 superProto._update.call(this, inp, inOff, out, outOff);
27902
27903 for (var i = 0; i < this.blockSize; i++)
27904 out[outOff + i] ^= iv[i];
27905
27906 for (var i = 0; i < this.blockSize; i++)
27907 iv[i] = inp[inOff + i];
27908 }
27909};
27910
27911},{"inherits":396,"minimalistic-assert":640}],247:[function(require,module,exports){
27912'use strict';
27913
27914var assert = require('minimalistic-assert');
27915
27916function Cipher(options) {
27917 this.options = options;
27918
27919 this.type = this.options.type;
27920 this.blockSize = 8;
27921 this._init();
27922
27923 this.buffer = new Array(this.blockSize);
27924 this.bufferOff = 0;
27925}
27926module.exports = Cipher;
27927
27928Cipher.prototype._init = function _init() {
27929 // Might be overrided
27930};
27931
27932Cipher.prototype.update = function update(data) {
27933 if (data.length === 0)
27934 return [];
27935
27936 if (this.type === 'decrypt')
27937 return this._updateDecrypt(data);
27938 else
27939 return this._updateEncrypt(data);
27940};
27941
27942Cipher.prototype._buffer = function _buffer(data, off) {
27943 // Append data to buffer
27944 var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
27945 for (var i = 0; i < min; i++)
27946 this.buffer[this.bufferOff + i] = data[off + i];
27947 this.bufferOff += min;
27948
27949 // Shift next
27950 return min;
27951};
27952
27953Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
27954 this._update(this.buffer, 0, out, off);
27955 this.bufferOff = 0;
27956 return this.blockSize;
27957};
27958
27959Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
27960 var inputOff = 0;
27961 var outputOff = 0;
27962
27963 var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
27964 var out = new Array(count * this.blockSize);
27965
27966 if (this.bufferOff !== 0) {
27967 inputOff += this._buffer(data, inputOff);
27968
27969 if (this.bufferOff === this.buffer.length)
27970 outputOff += this._flushBuffer(out, outputOff);
27971 }
27972
27973 // Write blocks
27974 var max = data.length - ((data.length - inputOff) % this.blockSize);
27975 for (; inputOff < max; inputOff += this.blockSize) {
27976 this._update(data, inputOff, out, outputOff);
27977 outputOff += this.blockSize;
27978 }
27979
27980 // Queue rest
27981 for (; inputOff < data.length; inputOff++, this.bufferOff++)
27982 this.buffer[this.bufferOff] = data[inputOff];
27983
27984 return out;
27985};
27986
27987Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
27988 var inputOff = 0;
27989 var outputOff = 0;
27990
27991 var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
27992 var out = new Array(count * this.blockSize);
27993
27994 // TODO(indutny): optimize it, this is far from optimal
27995 for (; count > 0; count--) {
27996 inputOff += this._buffer(data, inputOff);
27997 outputOff += this._flushBuffer(out, outputOff);
27998 }
27999
28000 // Buffer rest of the input
28001 inputOff += this._buffer(data, inputOff);
28002
28003 return out;
28004};
28005
28006Cipher.prototype.final = function final(buffer) {
28007 var first;
28008 if (buffer)
28009 first = this.update(buffer);
28010
28011 var last;
28012 if (this.type === 'encrypt')
28013 last = this._finalEncrypt();
28014 else
28015 last = this._finalDecrypt();
28016
28017 if (first)
28018 return first.concat(last);
28019 else
28020 return last;
28021};
28022
28023Cipher.prototype._pad = function _pad(buffer, off) {
28024 if (off === 0)
28025 return false;
28026
28027 while (off < buffer.length)
28028 buffer[off++] = 0;
28029
28030 return true;
28031};
28032
28033Cipher.prototype._finalEncrypt = function _finalEncrypt() {
28034 if (!this._pad(this.buffer, this.bufferOff))
28035 return [];
28036
28037 var out = new Array(this.blockSize);
28038 this._update(this.buffer, 0, out, 0);
28039 return out;
28040};
28041
28042Cipher.prototype._unpad = function _unpad(buffer) {
28043 return buffer;
28044};
28045
28046Cipher.prototype._finalDecrypt = function _finalDecrypt() {
28047 assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
28048 var out = new Array(this.blockSize);
28049 this._flushBuffer(out, 0);
28050
28051 return this._unpad(out);
28052};
28053
28054},{"minimalistic-assert":640}],248:[function(require,module,exports){
28055'use strict';
28056
28057var assert = require('minimalistic-assert');
28058var inherits = require('inherits');
28059
28060var utils = require('./utils');
28061var Cipher = require('./cipher');
28062
28063function DESState() {
28064 this.tmp = new Array(2);
28065 this.keys = null;
28066}
28067
28068function DES(options) {
28069 Cipher.call(this, options);
28070
28071 var state = new DESState();
28072 this._desState = state;
28073
28074 this.deriveKeys(state, options.key);
28075}
28076inherits(DES, Cipher);
28077module.exports = DES;
28078
28079DES.create = function create(options) {
28080 return new DES(options);
28081};
28082
28083var shiftTable = [
28084 1, 1, 2, 2, 2, 2, 2, 2,
28085 1, 2, 2, 2, 2, 2, 2, 1
28086];
28087
28088DES.prototype.deriveKeys = function deriveKeys(state, key) {
28089 state.keys = new Array(16 * 2);
28090
28091 assert.equal(key.length, this.blockSize, 'Invalid key length');
28092
28093 var kL = utils.readUInt32BE(key, 0);
28094 var kR = utils.readUInt32BE(key, 4);
28095
28096 utils.pc1(kL, kR, state.tmp, 0);
28097 kL = state.tmp[0];
28098 kR = state.tmp[1];
28099 for (var i = 0; i < state.keys.length; i += 2) {
28100 var shift = shiftTable[i >>> 1];
28101 kL = utils.r28shl(kL, shift);
28102 kR = utils.r28shl(kR, shift);
28103 utils.pc2(kL, kR, state.keys, i);
28104 }
28105};
28106
28107DES.prototype._update = function _update(inp, inOff, out, outOff) {
28108 var state = this._desState;
28109
28110 var l = utils.readUInt32BE(inp, inOff);
28111 var r = utils.readUInt32BE(inp, inOff + 4);
28112
28113 // Initial Permutation
28114 utils.ip(l, r, state.tmp, 0);
28115 l = state.tmp[0];
28116 r = state.tmp[1];
28117
28118 if (this.type === 'encrypt')
28119 this._encrypt(state, l, r, state.tmp, 0);
28120 else
28121 this._decrypt(state, l, r, state.tmp, 0);
28122
28123 l = state.tmp[0];
28124 r = state.tmp[1];
28125
28126 utils.writeUInt32BE(out, l, outOff);
28127 utils.writeUInt32BE(out, r, outOff + 4);
28128};
28129
28130DES.prototype._pad = function _pad(buffer, off) {
28131 var value = buffer.length - off;
28132 for (var i = off; i < buffer.length; i++)
28133 buffer[i] = value;
28134
28135 return true;
28136};
28137
28138DES.prototype._unpad = function _unpad(buffer) {
28139 var pad = buffer[buffer.length - 1];
28140 for (var i = buffer.length - pad; i < buffer.length; i++)
28141 assert.equal(buffer[i], pad);
28142
28143 return buffer.slice(0, buffer.length - pad);
28144};
28145
28146DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
28147 var l = lStart;
28148 var r = rStart;
28149
28150 // Apply f() x16 times
28151 for (var i = 0; i < state.keys.length; i += 2) {
28152 var keyL = state.keys[i];
28153 var keyR = state.keys[i + 1];
28154
28155 // f(r, k)
28156 utils.expand(r, state.tmp, 0);
28157
28158 keyL ^= state.tmp[0];
28159 keyR ^= state.tmp[1];
28160 var s = utils.substitute(keyL, keyR);
28161 var f = utils.permute(s);
28162
28163 var t = r;
28164 r = (l ^ f) >>> 0;
28165 l = t;
28166 }
28167
28168 // Reverse Initial Permutation
28169 utils.rip(r, l, out, off);
28170};
28171
28172DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
28173 var l = rStart;
28174 var r = lStart;
28175
28176 // Apply f() x16 times
28177 for (var i = state.keys.length - 2; i >= 0; i -= 2) {
28178 var keyL = state.keys[i];
28179 var keyR = state.keys[i + 1];
28180
28181 // f(r, k)
28182 utils.expand(l, state.tmp, 0);
28183
28184 keyL ^= state.tmp[0];
28185 keyR ^= state.tmp[1];
28186 var s = utils.substitute(keyL, keyR);
28187 var f = utils.permute(s);
28188
28189 var t = l;
28190 l = (r ^ f) >>> 0;
28191 r = t;
28192 }
28193
28194 // Reverse Initial Permutation
28195 utils.rip(l, r, out, off);
28196};
28197
28198},{"./cipher":247,"./utils":250,"inherits":396,"minimalistic-assert":640}],249:[function(require,module,exports){
28199'use strict';
28200
28201var assert = require('minimalistic-assert');
28202var inherits = require('inherits');
28203
28204var Cipher = require('./cipher');
28205var DES = require('./des');
28206
28207function EDEState(type, key) {
28208 assert.equal(key.length, 24, 'Invalid key length');
28209
28210 var k1 = key.slice(0, 8);
28211 var k2 = key.slice(8, 16);
28212 var k3 = key.slice(16, 24);
28213
28214 if (type === 'encrypt') {
28215 this.ciphers = [
28216 DES.create({ type: 'encrypt', key: k1 }),
28217 DES.create({ type: 'decrypt', key: k2 }),
28218 DES.create({ type: 'encrypt', key: k3 })
28219 ];
28220 } else {
28221 this.ciphers = [
28222 DES.create({ type: 'decrypt', key: k3 }),
28223 DES.create({ type: 'encrypt', key: k2 }),
28224 DES.create({ type: 'decrypt', key: k1 })
28225 ];
28226 }
28227}
28228
28229function EDE(options) {
28230 Cipher.call(this, options);
28231
28232 var state = new EDEState(this.type, this.options.key);
28233 this._edeState = state;
28234}
28235inherits(EDE, Cipher);
28236
28237module.exports = EDE;
28238
28239EDE.create = function create(options) {
28240 return new EDE(options);
28241};
28242
28243EDE.prototype._update = function _update(inp, inOff, out, outOff) {
28244 var state = this._edeState;
28245
28246 state.ciphers[0]._update(inp, inOff, out, outOff);
28247 state.ciphers[1]._update(out, outOff, out, outOff);
28248 state.ciphers[2]._update(out, outOff, out, outOff);
28249};
28250
28251EDE.prototype._pad = DES.prototype._pad;
28252EDE.prototype._unpad = DES.prototype._unpad;
28253
28254},{"./cipher":247,"./des":248,"inherits":396,"minimalistic-assert":640}],250:[function(require,module,exports){
28255'use strict';
28256
28257exports.readUInt32BE = function readUInt32BE(bytes, off) {
28258 var res = (bytes[0 + off] << 24) |
28259 (bytes[1 + off] << 16) |
28260 (bytes[2 + off] << 8) |
28261 bytes[3 + off];
28262 return res >>> 0;
28263};
28264
28265exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
28266 bytes[0 + off] = value >>> 24;
28267 bytes[1 + off] = (value >>> 16) & 0xff;
28268 bytes[2 + off] = (value >>> 8) & 0xff;
28269 bytes[3 + off] = value & 0xff;
28270};
28271
28272exports.ip = function ip(inL, inR, out, off) {
28273 var outL = 0;
28274 var outR = 0;
28275
28276 for (var i = 6; i >= 0; i -= 2) {
28277 for (var j = 0; j <= 24; j += 8) {
28278 outL <<= 1;
28279 outL |= (inR >>> (j + i)) & 1;
28280 }
28281 for (var j = 0; j <= 24; j += 8) {
28282 outL <<= 1;
28283 outL |= (inL >>> (j + i)) & 1;
28284 }
28285 }
28286
28287 for (var i = 6; i >= 0; i -= 2) {
28288 for (var j = 1; j <= 25; j += 8) {
28289 outR <<= 1;
28290 outR |= (inR >>> (j + i)) & 1;
28291 }
28292 for (var j = 1; j <= 25; j += 8) {
28293 outR <<= 1;
28294 outR |= (inL >>> (j + i)) & 1;
28295 }
28296 }
28297
28298 out[off + 0] = outL >>> 0;
28299 out[off + 1] = outR >>> 0;
28300};
28301
28302exports.rip = function rip(inL, inR, out, off) {
28303 var outL = 0;
28304 var outR = 0;
28305
28306 for (var i = 0; i < 4; i++) {
28307 for (var j = 24; j >= 0; j -= 8) {
28308 outL <<= 1;
28309 outL |= (inR >>> (j + i)) & 1;
28310 outL <<= 1;
28311 outL |= (inL >>> (j + i)) & 1;
28312 }
28313 }
28314 for (var i = 4; i < 8; i++) {
28315 for (var j = 24; j >= 0; j -= 8) {
28316 outR <<= 1;
28317 outR |= (inR >>> (j + i)) & 1;
28318 outR <<= 1;
28319 outR |= (inL >>> (j + i)) & 1;
28320 }
28321 }
28322
28323 out[off + 0] = outL >>> 0;
28324 out[off + 1] = outR >>> 0;
28325};
28326
28327exports.pc1 = function pc1(inL, inR, out, off) {
28328 var outL = 0;
28329 var outR = 0;
28330
28331 // 7, 15, 23, 31, 39, 47, 55, 63
28332 // 6, 14, 22, 30, 39, 47, 55, 63
28333 // 5, 13, 21, 29, 39, 47, 55, 63
28334 // 4, 12, 20, 28
28335 for (var i = 7; i >= 5; i--) {
28336 for (var j = 0; j <= 24; j += 8) {
28337 outL <<= 1;
28338 outL |= (inR >> (j + i)) & 1;
28339 }
28340 for (var j = 0; j <= 24; j += 8) {
28341 outL <<= 1;
28342 outL |= (inL >> (j + i)) & 1;
28343 }
28344 }
28345 for (var j = 0; j <= 24; j += 8) {
28346 outL <<= 1;
28347 outL |= (inR >> (j + i)) & 1;
28348 }
28349
28350 // 1, 9, 17, 25, 33, 41, 49, 57
28351 // 2, 10, 18, 26, 34, 42, 50, 58
28352 // 3, 11, 19, 27, 35, 43, 51, 59
28353 // 36, 44, 52, 60
28354 for (var i = 1; i <= 3; i++) {
28355 for (var j = 0; j <= 24; j += 8) {
28356 outR <<= 1;
28357 outR |= (inR >> (j + i)) & 1;
28358 }
28359 for (var j = 0; j <= 24; j += 8) {
28360 outR <<= 1;
28361 outR |= (inL >> (j + i)) & 1;
28362 }
28363 }
28364 for (var j = 0; j <= 24; j += 8) {
28365 outR <<= 1;
28366 outR |= (inL >> (j + i)) & 1;
28367 }
28368
28369 out[off + 0] = outL >>> 0;
28370 out[off + 1] = outR >>> 0;
28371};
28372
28373exports.r28shl = function r28shl(num, shift) {
28374 return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
28375};
28376
28377var pc2table = [
28378 // inL => outL
28379 14, 11, 17, 4, 27, 23, 25, 0,
28380 13, 22, 7, 18, 5, 9, 16, 24,
28381 2, 20, 12, 21, 1, 8, 15, 26,
28382
28383 // inR => outR
28384 15, 4, 25, 19, 9, 1, 26, 16,
28385 5, 11, 23, 8, 12, 7, 17, 0,
28386 22, 3, 10, 14, 6, 20, 27, 24
28387];
28388
28389exports.pc2 = function pc2(inL, inR, out, off) {
28390 var outL = 0;
28391 var outR = 0;
28392
28393 var len = pc2table.length >>> 1;
28394 for (var i = 0; i < len; i++) {
28395 outL <<= 1;
28396 outL |= (inL >>> pc2table[i]) & 0x1;
28397 }
28398 for (var i = len; i < pc2table.length; i++) {
28399 outR <<= 1;
28400 outR |= (inR >>> pc2table[i]) & 0x1;
28401 }
28402
28403 out[off + 0] = outL >>> 0;
28404 out[off + 1] = outR >>> 0;
28405};
28406
28407exports.expand = function expand(r, out, off) {
28408 var outL = 0;
28409 var outR = 0;
28410
28411 outL = ((r & 1) << 5) | (r >>> 27);
28412 for (var i = 23; i >= 15; i -= 4) {
28413 outL <<= 6;
28414 outL |= (r >>> i) & 0x3f;
28415 }
28416 for (var i = 11; i >= 3; i -= 4) {
28417 outR |= (r >>> i) & 0x3f;
28418 outR <<= 6;
28419 }
28420 outR |= ((r & 0x1f) << 1) | (r >>> 31);
28421
28422 out[off + 0] = outL >>> 0;
28423 out[off + 1] = outR >>> 0;
28424};
28425
28426var sTable = [
28427 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
28428 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
28429 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
28430 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
28431
28432 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
28433 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
28434 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
28435 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
28436
28437 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
28438 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
28439 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
28440 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
28441
28442 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
28443 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
28444 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
28445 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
28446
28447 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
28448 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
28449 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
28450 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
28451
28452 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
28453 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
28454 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
28455 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
28456
28457 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
28458 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
28459 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
28460 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
28461
28462 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
28463 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
28464 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
28465 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
28466];
28467
28468exports.substitute = function substitute(inL, inR) {
28469 var out = 0;
28470 for (var i = 0; i < 4; i++) {
28471 var b = (inL >>> (18 - i * 6)) & 0x3f;
28472 var sb = sTable[i * 0x40 + b];
28473
28474 out <<= 4;
28475 out |= sb;
28476 }
28477 for (var i = 0; i < 4; i++) {
28478 var b = (inR >>> (18 - i * 6)) & 0x3f;
28479 var sb = sTable[4 * 0x40 + i * 0x40 + b];
28480
28481 out <<= 4;
28482 out |= sb;
28483 }
28484 return out >>> 0;
28485};
28486
28487var permuteTable = [
28488 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
28489 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
28490];
28491
28492exports.permute = function permute(num) {
28493 var out = 0;
28494 for (var i = 0; i < permuteTable.length; i++) {
28495 out <<= 1;
28496 out |= (num >>> permuteTable[i]) & 0x1;
28497 }
28498 return out >>> 0;
28499};
28500
28501exports.padSplit = function padSplit(num, size, group) {
28502 var str = num.toString(2);
28503 while (str.length < size)
28504 str = '0' + str;
28505
28506 var out = [];
28507 for (var i = 0; i < size; i += group)
28508 out.push(str.slice(i, i + group));
28509 return out.join(' ');
28510};
28511
28512},{}],251:[function(require,module,exports){
28513(function (Buffer){
28514var generatePrime = require('./lib/generatePrime')
28515var primes = require('./lib/primes.json')
28516
28517var DH = require('./lib/dh')
28518
28519function getDiffieHellman (mod) {
28520 var prime = new Buffer(primes[mod].prime, 'hex')
28521 var gen = new Buffer(primes[mod].gen, 'hex')
28522
28523 return new DH(prime, gen)
28524}
28525
28526var ENCODINGS = {
28527 'binary': true, 'hex': true, 'base64': true
28528}
28529
28530function createDiffieHellman (prime, enc, generator, genc) {
28531 if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
28532 return createDiffieHellman(prime, 'binary', enc, generator)
28533 }
28534
28535 enc = enc || 'binary'
28536 genc = genc || 'binary'
28537 generator = generator || new Buffer([2])
28538
28539 if (!Buffer.isBuffer(generator)) {
28540 generator = new Buffer(generator, genc)
28541 }
28542
28543 if (typeof prime === 'number') {
28544 return new DH(generatePrime(prime, generator), generator, true)
28545 }
28546
28547 if (!Buffer.isBuffer(prime)) {
28548 prime = new Buffer(prime, enc)
28549 }
28550
28551 return new DH(prime, generator, true)
28552}
28553
28554exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
28555exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
28556
28557}).call(this,require("buffer").Buffer)
28558},{"./lib/dh":252,"./lib/generatePrime":253,"./lib/primes.json":254,"buffer":146}],252:[function(require,module,exports){
28559(function (Buffer){
28560var BN = require('bn.js');
28561var MillerRabin = require('miller-rabin');
28562var millerRabin = new MillerRabin();
28563var TWENTYFOUR = new BN(24);
28564var ELEVEN = new BN(11);
28565var TEN = new BN(10);
28566var THREE = new BN(3);
28567var SEVEN = new BN(7);
28568var primes = require('./generatePrime');
28569var randomBytes = require('randombytes');
28570module.exports = DH;
28571
28572function setPublicKey(pub, enc) {
28573 enc = enc || 'utf8';
28574 if (!Buffer.isBuffer(pub)) {
28575 pub = new Buffer(pub, enc);
28576 }
28577 this._pub = new BN(pub);
28578 return this;
28579}
28580
28581function setPrivateKey(priv, enc) {
28582 enc = enc || 'utf8';
28583 if (!Buffer.isBuffer(priv)) {
28584 priv = new Buffer(priv, enc);
28585 }
28586 this._priv = new BN(priv);
28587 return this;
28588}
28589
28590var primeCache = {};
28591function checkPrime(prime, generator) {
28592 var gen = generator.toString('hex');
28593 var hex = [gen, prime.toString(16)].join('_');
28594 if (hex in primeCache) {
28595 return primeCache[hex];
28596 }
28597 var error = 0;
28598
28599 if (prime.isEven() ||
28600 !primes.simpleSieve ||
28601 !primes.fermatTest(prime) ||
28602 !millerRabin.test(prime)) {
28603 //not a prime so +1
28604 error += 1;
28605
28606 if (gen === '02' || gen === '05') {
28607 // we'd be able to check the generator
28608 // it would fail so +8
28609 error += 8;
28610 } else {
28611 //we wouldn't be able to test the generator
28612 // so +4
28613 error += 4;
28614 }
28615 primeCache[hex] = error;
28616 return error;
28617 }
28618 if (!millerRabin.test(prime.shrn(1))) {
28619 //not a safe prime
28620 error += 2;
28621 }
28622 var rem;
28623 switch (gen) {
28624 case '02':
28625 if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
28626 // unsuidable generator
28627 error += 8;
28628 }
28629 break;
28630 case '05':
28631 rem = prime.mod(TEN);
28632 if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
28633 // prime mod 10 needs to equal 3 or 7
28634 error += 8;
28635 }
28636 break;
28637 default:
28638 error += 4;
28639 }
28640 primeCache[hex] = error;
28641 return error;
28642}
28643
28644function DH(prime, generator, malleable) {
28645 this.setGenerator(generator);
28646 this.__prime = new BN(prime);
28647 this._prime = BN.mont(this.__prime);
28648 this._primeLen = prime.length;
28649 this._pub = undefined;
28650 this._priv = undefined;
28651 this._primeCode = undefined;
28652 if (malleable) {
28653 this.setPublicKey = setPublicKey;
28654 this.setPrivateKey = setPrivateKey;
28655 } else {
28656 this._primeCode = 8;
28657 }
28658}
28659Object.defineProperty(DH.prototype, 'verifyError', {
28660 enumerable: true,
28661 get: function () {
28662 if (typeof this._primeCode !== 'number') {
28663 this._primeCode = checkPrime(this.__prime, this.__gen);
28664 }
28665 return this._primeCode;
28666 }
28667});
28668DH.prototype.generateKeys = function () {
28669 if (!this._priv) {
28670 this._priv = new BN(randomBytes(this._primeLen));
28671 }
28672 this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
28673 return this.getPublicKey();
28674};
28675
28676DH.prototype.computeSecret = function (other) {
28677 other = new BN(other);
28678 other = other.toRed(this._prime);
28679 var secret = other.redPow(this._priv).fromRed();
28680 var out = new Buffer(secret.toArray());
28681 var prime = this.getPrime();
28682 if (out.length < prime.length) {
28683 var front = new Buffer(prime.length - out.length);
28684 front.fill(0);
28685 out = Buffer.concat([front, out]);
28686 }
28687 return out;
28688};
28689
28690DH.prototype.getPublicKey = function getPublicKey(enc) {
28691 return formatReturnValue(this._pub, enc);
28692};
28693
28694DH.prototype.getPrivateKey = function getPrivateKey(enc) {
28695 return formatReturnValue(this._priv, enc);
28696};
28697
28698DH.prototype.getPrime = function (enc) {
28699 return formatReturnValue(this.__prime, enc);
28700};
28701
28702DH.prototype.getGenerator = function (enc) {
28703 return formatReturnValue(this._gen, enc);
28704};
28705
28706DH.prototype.setGenerator = function (gen, enc) {
28707 enc = enc || 'utf8';
28708 if (!Buffer.isBuffer(gen)) {
28709 gen = new Buffer(gen, enc);
28710 }
28711 this.__gen = gen;
28712 this._gen = new BN(gen);
28713 return this;
28714};
28715
28716function formatReturnValue(bn, enc) {
28717 var buf = new Buffer(bn.toArray());
28718 if (!enc) {
28719 return buf;
28720 } else {
28721 return buf.toString(enc);
28722 }
28723}
28724
28725}).call(this,require("buffer").Buffer)
28726},{"./generatePrime":253,"bn.js":108,"buffer":146,"miller-rabin":639,"randombytes":724}],253:[function(require,module,exports){
28727var randomBytes = require('randombytes');
28728module.exports = findPrime;
28729findPrime.simpleSieve = simpleSieve;
28730findPrime.fermatTest = fermatTest;
28731var BN = require('bn.js');
28732var TWENTYFOUR = new BN(24);
28733var MillerRabin = require('miller-rabin');
28734var millerRabin = new MillerRabin();
28735var ONE = new BN(1);
28736var TWO = new BN(2);
28737var FIVE = new BN(5);
28738var SIXTEEN = new BN(16);
28739var EIGHT = new BN(8);
28740var TEN = new BN(10);
28741var THREE = new BN(3);
28742var SEVEN = new BN(7);
28743var ELEVEN = new BN(11);
28744var FOUR = new BN(4);
28745var TWELVE = new BN(12);
28746var primes = null;
28747
28748function _getPrimes() {
28749 if (primes !== null)
28750 return primes;
28751
28752 var limit = 0x100000;
28753 var res = [];
28754 res[0] = 2;
28755 for (var i = 1, k = 3; k < limit; k += 2) {
28756 var sqrt = Math.ceil(Math.sqrt(k));
28757 for (var j = 0; j < i && res[j] <= sqrt; j++)
28758 if (k % res[j] === 0)
28759 break;
28760
28761 if (i !== j && res[j] <= sqrt)
28762 continue;
28763
28764 res[i++] = k;
28765 }
28766 primes = res;
28767 return res;
28768}
28769
28770function simpleSieve(p) {
28771 var primes = _getPrimes();
28772
28773 for (var i = 0; i < primes.length; i++)
28774 if (p.modn(primes[i]) === 0) {
28775 if (p.cmpn(primes[i]) === 0) {
28776 return true;
28777 } else {
28778 return false;
28779 }
28780 }
28781
28782 return true;
28783}
28784
28785function fermatTest(p) {
28786 var red = BN.mont(p);
28787 return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
28788}
28789
28790function findPrime(bits, gen) {
28791 if (bits < 16) {
28792 // this is what openssl does
28793 if (gen === 2 || gen === 5) {
28794 return new BN([0x8c, 0x7b]);
28795 } else {
28796 return new BN([0x8c, 0x27]);
28797 }
28798 }
28799 gen = new BN(gen);
28800
28801 var num, n2;
28802
28803 while (true) {
28804 num = new BN(randomBytes(Math.ceil(bits / 8)));
28805 while (num.bitLength() > bits) {
28806 num.ishrn(1);
28807 }
28808 if (num.isEven()) {
28809 num.iadd(ONE);
28810 }
28811 if (!num.testn(1)) {
28812 num.iadd(TWO);
28813 }
28814 if (!gen.cmp(TWO)) {
28815 while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
28816 num.iadd(FOUR);
28817 }
28818 } else if (!gen.cmp(FIVE)) {
28819 while (num.mod(TEN).cmp(THREE)) {
28820 num.iadd(FOUR);
28821 }
28822 }
28823 n2 = num.shrn(1);
28824 if (simpleSieve(n2) && simpleSieve(num) &&
28825 fermatTest(n2) && fermatTest(num) &&
28826 millerRabin.test(n2) && millerRabin.test(num)) {
28827 return num;
28828 }
28829 }
28830
28831}
28832
28833},{"bn.js":108,"miller-rabin":639,"randombytes":724}],254:[function(require,module,exports){
28834module.exports={
28835 "modp1": {
28836 "gen": "02",
28837 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"
28838 },
28839 "modp2": {
28840 "gen": "02",
28841 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"
28842 },
28843 "modp5": {
28844 "gen": "02",
28845 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"
28846 },
28847 "modp14": {
28848 "gen": "02",
28849 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"
28850 },
28851 "modp15": {
28852 "gen": "02",
28853 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"
28854 },
28855 "modp16": {
28856 "gen": "02",
28857 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"
28858 },
28859 "modp17": {
28860 "gen": "02",
28861 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"
28862 },
28863 "modp18": {
28864 "gen": "02",
28865 "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"
28866 }
28867}
28868},{}],255:[function(require,module,exports){
28869var assert = require('assert')
28870var BigInteger = require('bigi')
28871
28872var Point = require('./point')
28873
28874function Curve (p, a, b, Gx, Gy, n, h) {
28875 this.p = p
28876 this.a = a
28877 this.b = b
28878 this.G = Point.fromAffine(this, Gx, Gy)
28879 this.n = n
28880 this.h = h
28881
28882 this.infinity = new Point(this, null, null, BigInteger.ZERO)
28883
28884 // result caching
28885 this.pOverFour = p.add(BigInteger.ONE).shiftRight(2)
28886
28887 // determine size of p in bytes
28888 this.pLength = Math.floor((this.p.bitLength() + 7) / 8)
28889}
28890
28891Curve.prototype.pointFromX = function (isOdd, x) {
28892 var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p)
28893 var beta = alpha.modPow(this.pOverFour, this.p) // XXX: not compatible with all curves
28894
28895 var y = beta
28896 if (beta.isEven() ^ !isOdd) {
28897 y = this.p.subtract(y) // -y % p
28898 }
28899
28900 return Point.fromAffine(this, x, y)
28901}
28902
28903Curve.prototype.isInfinity = function (Q) {
28904 if (Q === this.infinity) return true
28905
28906 return Q.z.signum() === 0 && Q.y.signum() !== 0
28907}
28908
28909Curve.prototype.isOnCurve = function (Q) {
28910 if (this.isInfinity(Q)) return true
28911
28912 var x = Q.affineX
28913 var y = Q.affineY
28914 var a = this.a
28915 var b = this.b
28916 var p = this.p
28917
28918 // Check that xQ and yQ are integers in the interval [0, p - 1]
28919 if (x.signum() < 0 || x.compareTo(p) >= 0) return false
28920 if (y.signum() < 0 || y.compareTo(p) >= 0) return false
28921
28922 // and check that y^2 = x^3 + ax + b (mod p)
28923 var lhs = y.square().mod(p)
28924 var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p)
28925 return lhs.equals(rhs)
28926}
28927
28928/**
28929 * Validate an elliptic curve point.
28930 *
28931 * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive
28932 */
28933Curve.prototype.validate = function (Q) {
28934 // Check Q != O
28935 assert(!this.isInfinity(Q), 'Point is at infinity')
28936 assert(this.isOnCurve(Q), 'Point is not on the curve')
28937
28938 // Check nQ = O (where Q is a scalar multiple of G)
28939 var nQ = Q.multiply(this.n)
28940 assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G')
28941
28942 return true
28943}
28944
28945module.exports = Curve
28946
28947},{"./point":259,"assert":26,"bigi":63}],256:[function(require,module,exports){
28948module.exports={
28949 "secp128r1": {
28950 "p": "fffffffdffffffffffffffffffffffff",
28951 "a": "fffffffdfffffffffffffffffffffffc",
28952 "b": "e87579c11079f43dd824993c2cee5ed3",
28953 "n": "fffffffe0000000075a30d1b9038a115",
28954 "h": "01",
28955 "Gx": "161ff7528b899b2d0c28607ca52c5b86",
28956 "Gy": "cf5ac8395bafeb13c02da292dded7a83"
28957 },
28958 "secp160k1": {
28959 "p": "fffffffffffffffffffffffffffffffeffffac73",
28960 "a": "00",
28961 "b": "07",
28962 "n": "0100000000000000000001b8fa16dfab9aca16b6b3",
28963 "h": "01",
28964 "Gx": "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",
28965 "Gy": "938cf935318fdced6bc28286531733c3f03c4fee"
28966 },
28967 "secp160r1": {
28968 "p": "ffffffffffffffffffffffffffffffff7fffffff",
28969 "a": "ffffffffffffffffffffffffffffffff7ffffffc",
28970 "b": "1c97befc54bd7a8b65acf89f81d4d4adc565fa45",
28971 "n": "0100000000000000000001f4c8f927aed3ca752257",
28972 "h": "01",
28973 "Gx": "4a96b5688ef573284664698968c38bb913cbfc82",
28974 "Gy": "23a628553168947d59dcc912042351377ac5fb32"
28975 },
28976 "secp192k1": {
28977 "p": "fffffffffffffffffffffffffffffffffffffffeffffee37",
28978 "a": "00",
28979 "b": "03",
28980 "n": "fffffffffffffffffffffffe26f2fc170f69466a74defd8d",
28981 "h": "01",
28982 "Gx": "db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",
28983 "Gy": "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"
28984 },
28985 "secp192r1": {
28986 "p": "fffffffffffffffffffffffffffffffeffffffffffffffff",
28987 "a": "fffffffffffffffffffffffffffffffefffffffffffffffc",
28988 "b": "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",
28989 "n": "ffffffffffffffffffffffff99def836146bc9b1b4d22831",
28990 "h": "01",
28991 "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
28992 "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
28993 },
28994 "secp256k1": {
28995 "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
28996 "a": "00",
28997 "b": "07",
28998 "n": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",
28999 "h": "01",
29000 "Gx": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
29001 "Gy": "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
29002 },
29003 "secp256r1": {
29004 "p": "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",
29005 "a": "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",
29006 "b": "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",
29007 "n": "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",
29008 "h": "01",
29009 "Gx": "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
29010 "Gy": "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"
29011 }
29012}
29013
29014},{}],257:[function(require,module,exports){
29015var Point = require('./point')
29016var Curve = require('./curve')
29017
29018var getCurveByName = require('./names')
29019
29020module.exports = {
29021 Curve: Curve,
29022 Point: Point,
29023 getCurveByName: getCurveByName
29024}
29025
29026},{"./curve":255,"./names":258,"./point":259}],258:[function(require,module,exports){
29027var BigInteger = require('bigi')
29028
29029var curves = require('./curves.json')
29030var Curve = require('./curve')
29031
29032function getCurveByName (name) {
29033 var curve = curves[name]
29034 if (!curve) return null
29035
29036 var p = new BigInteger(curve.p, 16)
29037 var a = new BigInteger(curve.a, 16)
29038 var b = new BigInteger(curve.b, 16)
29039 var n = new BigInteger(curve.n, 16)
29040 var h = new BigInteger(curve.h, 16)
29041 var Gx = new BigInteger(curve.Gx, 16)
29042 var Gy = new BigInteger(curve.Gy, 16)
29043
29044 return new Curve(p, a, b, Gx, Gy, n, h)
29045}
29046
29047module.exports = getCurveByName
29048
29049},{"./curve":255,"./curves.json":256,"bigi":63}],259:[function(require,module,exports){
29050var assert = require('assert')
29051var Buffer = require('safe-buffer').Buffer
29052var BigInteger = require('bigi')
29053
29054var THREE = BigInteger.valueOf(3)
29055
29056function Point (curve, x, y, z) {
29057 assert.notStrictEqual(z, undefined, 'Missing Z coordinate')
29058
29059 this.curve = curve
29060 this.x = x
29061 this.y = y
29062 this.z = z
29063 this._zInv = null
29064
29065 this.compressed = true
29066}
29067
29068Object.defineProperty(Point.prototype, 'zInv', {
29069 get: function () {
29070 if (this._zInv === null) {
29071 this._zInv = this.z.modInverse(this.curve.p)
29072 }
29073
29074 return this._zInv
29075 }
29076})
29077
29078Object.defineProperty(Point.prototype, 'affineX', {
29079 get: function () {
29080 return this.x.multiply(this.zInv).mod(this.curve.p)
29081 }
29082})
29083
29084Object.defineProperty(Point.prototype, 'affineY', {
29085 get: function () {
29086 return this.y.multiply(this.zInv).mod(this.curve.p)
29087 }
29088})
29089
29090Point.fromAffine = function (curve, x, y) {
29091 return new Point(curve, x, y, BigInteger.ONE)
29092}
29093
29094Point.prototype.equals = function (other) {
29095 if (other === this) return true
29096 if (this.curve.isInfinity(this)) return this.curve.isInfinity(other)
29097 if (this.curve.isInfinity(other)) return this.curve.isInfinity(this)
29098
29099 // u = Y2 * Z1 - Y1 * Z2
29100 var u = other.y.multiply(this.z).subtract(this.y.multiply(other.z)).mod(this.curve.p)
29101
29102 if (u.signum() !== 0) return false
29103
29104 // v = X2 * Z1 - X1 * Z2
29105 var v = other.x.multiply(this.z).subtract(this.x.multiply(other.z)).mod(this.curve.p)
29106
29107 return v.signum() === 0
29108}
29109
29110Point.prototype.negate = function () {
29111 var y = this.curve.p.subtract(this.y)
29112
29113 return new Point(this.curve, this.x, y, this.z)
29114}
29115
29116Point.prototype.add = function (b) {
29117 if (this.curve.isInfinity(this)) return b
29118 if (this.curve.isInfinity(b)) return this
29119
29120 var x1 = this.x
29121 var y1 = this.y
29122 var x2 = b.x
29123 var y2 = b.y
29124
29125 // u = Y2 * Z1 - Y1 * Z2
29126 var u = y2.multiply(this.z).subtract(y1.multiply(b.z)).mod(this.curve.p)
29127 // v = X2 * Z1 - X1 * Z2
29128 var v = x2.multiply(this.z).subtract(x1.multiply(b.z)).mod(this.curve.p)
29129
29130 if (v.signum() === 0) {
29131 if (u.signum() === 0) {
29132 return this.twice() // this == b, so double
29133 }
29134
29135 return this.curve.infinity // this = -b, so infinity
29136 }
29137
29138 var v2 = v.square()
29139 var v3 = v2.multiply(v)
29140 var x1v2 = x1.multiply(v2)
29141 var zu2 = u.square().multiply(this.z)
29142
29143 // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
29144 var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.p)
29145 // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
29146 var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.p)
29147 // z3 = v^3 * z1 * z2
29148 var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.p)
29149
29150 return new Point(this.curve, x3, y3, z3)
29151}
29152
29153Point.prototype.twice = function () {
29154 if (this.curve.isInfinity(this)) return this
29155 if (this.y.signum() === 0) return this.curve.infinity
29156
29157 var x1 = this.x
29158 var y1 = this.y
29159
29160 var y1z1 = y1.multiply(this.z).mod(this.curve.p)
29161 var y1sqz1 = y1z1.multiply(y1).mod(this.curve.p)
29162 var a = this.curve.a
29163
29164 // w = 3 * x1^2 + a * z1^2
29165 var w = x1.square().multiply(THREE)
29166
29167 if (a.signum() !== 0) {
29168 w = w.add(this.z.square().multiply(a))
29169 }
29170
29171 w = w.mod(this.curve.p)
29172 // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
29173 var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.p)
29174 // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
29175 var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.pow(3)).mod(this.curve.p)
29176 // z3 = 8 * (y1 * z1)^3
29177 var z3 = y1z1.pow(3).shiftLeft(3).mod(this.curve.p)
29178
29179 return new Point(this.curve, x3, y3, z3)
29180}
29181
29182// Simple NAF (Non-Adjacent Form) multiplication algorithm
29183// TODO: modularize the multiplication algorithm
29184Point.prototype.multiply = function (k) {
29185 if (this.curve.isInfinity(this)) return this
29186 if (k.signum() === 0) return this.curve.infinity
29187
29188 var e = k
29189 var h = e.multiply(THREE)
29190
29191 var neg = this.negate()
29192 var R = this
29193
29194 for (var i = h.bitLength() - 2; i > 0; --i) {
29195 var hBit = h.testBit(i)
29196 var eBit = e.testBit(i)
29197
29198 R = R.twice()
29199
29200 if (hBit !== eBit) {
29201 R = R.add(hBit ? this : neg)
29202 }
29203 }
29204
29205 return R
29206}
29207
29208// Compute this*j + x*k (simultaneous multiplication)
29209Point.prototype.multiplyTwo = function (j, x, k) {
29210 var i = Math.max(j.bitLength(), k.bitLength()) - 1
29211 var R = this.curve.infinity
29212 var both = this.add(x)
29213
29214 while (i >= 0) {
29215 var jBit = j.testBit(i)
29216 var kBit = k.testBit(i)
29217
29218 R = R.twice()
29219
29220 if (jBit) {
29221 if (kBit) {
29222 R = R.add(both)
29223 } else {
29224 R = R.add(this)
29225 }
29226 } else if (kBit) {
29227 R = R.add(x)
29228 }
29229 --i
29230 }
29231
29232 return R
29233}
29234
29235Point.prototype.getEncoded = function (compressed) {
29236 if (compressed == null) compressed = this.compressed
29237 if (this.curve.isInfinity(this)) return Buffer.alloc(1, 0) // Infinity point encoded is simply '00'
29238
29239 var x = this.affineX
29240 var y = this.affineY
29241 var byteLength = this.curve.pLength
29242 var buffer
29243
29244 // 0x02/0x03 | X
29245 if (compressed) {
29246 buffer = Buffer.allocUnsafe(1 + byteLength)
29247 buffer.writeUInt8(y.isEven() ? 0x02 : 0x03, 0)
29248
29249 // 0x04 | X | Y
29250 } else {
29251 buffer = Buffer.allocUnsafe(1 + byteLength + byteLength)
29252 buffer.writeUInt8(0x04, 0)
29253
29254 y.toBuffer(byteLength).copy(buffer, 1 + byteLength)
29255 }
29256
29257 x.toBuffer(byteLength).copy(buffer, 1)
29258
29259 return buffer
29260}
29261
29262Point.decodeFrom = function (curve, buffer) {
29263 var type = buffer.readUInt8(0)
29264 var compressed = (type !== 4)
29265
29266 var byteLength = Math.floor((curve.p.bitLength() + 7) / 8)
29267 var x = BigInteger.fromBuffer(buffer.slice(1, 1 + byteLength))
29268
29269 var Q
29270 if (compressed) {
29271 assert.equal(buffer.length, byteLength + 1, 'Invalid sequence length')
29272 assert(type === 0x02 || type === 0x03, 'Invalid sequence tag')
29273
29274 var isOdd = (type === 0x03)
29275 Q = curve.pointFromX(isOdd, x)
29276 } else {
29277 assert.equal(buffer.length, 1 + byteLength + byteLength, 'Invalid sequence length')
29278
29279 var y = BigInteger.fromBuffer(buffer.slice(1 + byteLength))
29280 Q = Point.fromAffine(curve, x, y)
29281 }
29282
29283 Q.compressed = compressed
29284 return Q
29285}
29286
29287Point.prototype.toString = function () {
29288 if (this.curve.isInfinity(this)) return '(INFINITY)'
29289
29290 return '(' + this.affineX.toString() + ',' + this.affineY.toString() + ')'
29291}
29292
29293module.exports = Point
29294
29295},{"assert":26,"bigi":63,"safe-buffer":742}],260:[function(require,module,exports){
29296(function (Buffer){
29297"use strict";
29298Object.defineProperty(exports, "__esModule", { value: true });
29299const createHmac = require("create-hmac");
29300const nacl = require("tweetnacl");
29301const utils_1 = require("./utils");
29302const ED25519_CURVE = 'ed25519 seed';
29303const HARDENED_OFFSET = 0x80000000;
29304exports.getMasterKeyFromSeed = (seed) => {
29305 const hmac = createHmac('sha512', ED25519_CURVE);
29306 const I = hmac.update(Buffer.from(seed, 'hex')).digest();
29307 const IL = I.slice(0, 32);
29308 const IR = I.slice(32);
29309 return {
29310 key: IL,
29311 chainCode: IR,
29312 };
29313};
29314const CKDPriv = ({ key, chainCode }, index) => {
29315 const indexBuffer = Buffer.allocUnsafe(4);
29316 indexBuffer.writeUInt32BE(index, 0);
29317 const data = Buffer.concat([Buffer.alloc(1, 0), key, indexBuffer]);
29318 const I = createHmac('sha512', chainCode)
29319 .update(data)
29320 .digest();
29321 const IL = I.slice(0, 32);
29322 const IR = I.slice(32);
29323 return {
29324 key: IL,
29325 chainCode: IR,
29326 };
29327};
29328exports.getPublicKey = (privateKey, withZeroByte = true) => {
29329 const keyPair = nacl.sign.keyPair.fromSeed(privateKey);
29330 const signPk = keyPair.secretKey.subarray(32);
29331 const zero = Buffer.alloc(1, 0);
29332 return withZeroByte ?
29333 Buffer.concat([zero, Buffer.from(signPk)]) :
29334 Buffer.from(signPk);
29335};
29336exports.isValidPath = (path) => {
29337 if (!utils_1.pathRegex.test(path)) {
29338 return false;
29339 }
29340 return !path
29341 .split('/')
29342 .slice(1)
29343 .map(utils_1.replaceDerive)
29344 .some(isNaN);
29345};
29346exports.derivePath = (path, seed) => {
29347 if (!exports.isValidPath(path)) {
29348 throw new Error('Invalid derivation path');
29349 }
29350 const { key, chainCode } = exports.getMasterKeyFromSeed(seed);
29351 const segments = path
29352 .split('/')
29353 .slice(1)
29354 .map(utils_1.replaceDerive)
29355 .map(el => parseInt(el, 10));
29356 return segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + HARDENED_OFFSET), { key, chainCode });
29357};
29358
29359}).call(this,require("buffer").Buffer)
29360},{"./utils":261,"buffer":146,"create-hmac":262,"tweetnacl":813}],261:[function(require,module,exports){
29361"use strict";
29362Object.defineProperty(exports, "__esModule", { value: true });
29363exports.pathRegex = new RegExp("^m(\\/[0-9]+')+$");
29364exports.replaceDerive = (val) => val.replace("'", '');
29365
29366},{}],262:[function(require,module,exports){
29367arguments[4][241][0].apply(exports,arguments)
29368},{"./legacy":263,"cipher-base":155,"create-hash/md5":240,"dup":241,"inherits":396,"ripemd160":740,"safe-buffer":742,"sha.js":770}],263:[function(require,module,exports){
29369arguments[4][242][0].apply(exports,arguments)
29370},{"cipher-base":155,"dup":242,"inherits":396,"safe-buffer":742}],264:[function(require,module,exports){
29371//const { generateMnemonic, getSeedFromMnemonic } = require('./src/Mnemonic')
29372const { getMultiSignAddress, getAddress, getDid } = require('./src/Address')
29373//const Transaction = require('./src/Transaction')
29374const {
29375 getMasterPrivateKey,
29376 getMasterPublicKey,
29377 getBip32ExtendedPrivateKey,
29378 getBip32ExtendedPublicKey,
29379 getAccountExtendedPrivateKey,
29380 getAccountExtendedPublicKey,
29381 getDerivedPrivateKey,
29382 getDerivedPublicKey,
29383 getSinglePrivateKey,
29384 getSinglePublicKey,
29385 getPublicKeyFromPrivateKey,
29386 generateSubPrivateKey,
29387 generateSubPublicKey,
29388 getIdChainMasterPublicKey,
29389 generateIdChainSubPrivateKey,
29390 generateIdChainSubPublicKey,
29391 sign,
29392 verify,
29393} = require('./src/Api')
29394
29395module.exports = {
29396 //generateMnemonic,
29397 //getSeedFromMnemonic,
29398 getMultiSignAddress,
29399 getAddress,
29400 getDid,
29401 getMasterPrivateKey,
29402 getMasterPublicKey,
29403 getBip32ExtendedPrivateKey,
29404 getBip32ExtendedPublicKey,
29405 getAccountExtendedPrivateKey,
29406 getAccountExtendedPublicKey,
29407 getDerivedPrivateKey,
29408 getDerivedPublicKey,
29409 getSinglePrivateKey,
29410 getSinglePublicKey,
29411 getPublicKeyFromPrivateKey,
29412 generateSubPrivateKey,
29413 generateSubPublicKey,
29414 getIdChainMasterPublicKey,
29415 generateIdChainSubPrivateKey,
29416 generateIdChainSubPublicKey,
29417 sign,
29418 verify,
29419 //Transaction,
29420}
29421
29422},{"./src/Address":314,"./src/Api":315}],265:[function(require,module,exports){
29423(function (global,Buffer){
29424'use strict';
29425
29426var bitcore = module.exports;
29427
29428// module information
29429bitcore.version = 'v' + require('./package.json').version;
29430bitcore.versionGuard = function(version) {
29431 if (version !== undefined) {
29432 var message = 'More than one instance of bitcore-lib found. ' +
29433 'Please make sure to require bitcore-lib and check that submodules do' +
29434 ' not also include their own bitcore-lib dependency.';
29435 throw new Error(message);
29436 }
29437};
29438bitcore.versionGuard(global._bitcore);
29439global._bitcore = bitcore.version;
29440
29441// crypto
29442bitcore.crypto = {};
29443bitcore.crypto.BN = require('./lib/crypto/bn');
29444bitcore.crypto.ECDSA = require('./lib/crypto/ecdsa');
29445bitcore.crypto.Hash = require('./lib/crypto/hash');
29446bitcore.crypto.Random = require('./lib/crypto/random');
29447bitcore.crypto.Point = require('./lib/crypto/point');
29448bitcore.crypto.Signature = require('./lib/crypto/signature');
29449
29450// encoding
29451bitcore.encoding = {};
29452bitcore.encoding.Base58 = require('./lib/encoding/base58');
29453bitcore.encoding.Base58Check = require('./lib/encoding/base58check');
29454bitcore.encoding.BufferReader = require('./lib/encoding/bufferreader');
29455bitcore.encoding.BufferWriter = require('./lib/encoding/bufferwriter');
29456bitcore.encoding.Varint = require('./lib/encoding/varint');
29457
29458// utilities
29459bitcore.util = {};
29460bitcore.util.buffer = require('./lib/util/buffer');
29461bitcore.util.js = require('./lib/util/js');
29462bitcore.util.preconditions = require('./lib/util/preconditions');
29463
29464// errors thrown by the library
29465bitcore.errors = require('./lib/errors');
29466
29467// main bitcoin library
29468bitcore.Address = require('./lib/address');
29469bitcore.Block = require('./lib/block');
29470bitcore.MerkleBlock = require('./lib/block/merkleblock');
29471bitcore.BlockHeader = require('./lib/block/blockheader');
29472bitcore.HDPrivateKey = require('./lib/hdprivatekey.js');
29473bitcore.HDPublicKey = require('./lib/hdpublickey.js');
29474bitcore.Networks = require('./lib/networks');
29475bitcore.Opcode = require('./lib/opcode');
29476bitcore.PrivateKey = require('./lib/privatekey');
29477bitcore.PublicKey = require('./lib/publickey');
29478bitcore.Script = require('./lib/script');
29479bitcore.Transaction = require('./lib/transaction');
29480bitcore.URI = require('./lib/uri');
29481bitcore.Unit = require('./lib/unit');
29482
29483// dependencies, subject to change
29484bitcore.deps = {};
29485bitcore.deps.bnjs = require('bn.js');
29486bitcore.deps.bs58 = require('bs58');
29487bitcore.deps.Buffer = Buffer;
29488bitcore.deps.elliptic = require('elliptic');
29489bitcore.deps._ = require('lodash');
29490
29491// Internal usage, exposed for testing/advanced tweaking
29492bitcore.Transaction.sighash = require('./lib/transaction/sighash');
29493
29494}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
29495},{"./lib/address":266,"./lib/block":269,"./lib/block/blockheader":268,"./lib/block/merkleblock":270,"./lib/crypto/bn":271,"./lib/crypto/ecdsa":272,"./lib/crypto/hash":273,"./lib/crypto/point":274,"./lib/crypto/random":275,"./lib/crypto/signature":276,"./lib/encoding/base58":277,"./lib/encoding/base58check":278,"./lib/encoding/bufferreader":279,"./lib/encoding/bufferwriter":280,"./lib/encoding/varint":281,"./lib/errors":282,"./lib/hdprivatekey.js":284,"./lib/hdpublickey.js":285,"./lib/networks":286,"./lib/opcode":287,"./lib/privatekey":288,"./lib/publickey":289,"./lib/script":290,"./lib/transaction":293,"./lib/transaction/sighash":301,"./lib/unit":306,"./lib/uri":307,"./lib/util/buffer":308,"./lib/util/js":309,"./lib/util/preconditions":310,"./package.json":312,"bn.js":108,"bs58":138,"buffer":146,"elliptic":317,"lodash":311}],266:[function(require,module,exports){
29496(function (Buffer){
29497'use strict';
29498
29499var _ = require('lodash');
29500var $ = require('./util/preconditions');
29501var errors = require('./errors');
29502var Base58Check = require('./encoding/base58check');
29503var Networks = require('./networks');
29504var Hash = require('./crypto/hash');
29505var JSUtil = require('./util/js');
29506var PublicKey = require('./publickey');
29507
29508/**
29509 * Instantiate an address from an address String or Buffer, a public key or script hash Buffer,
29510 * or an instance of {@link PublicKey} or {@link Script}.
29511 *
29512 * This is an immutable class, and if the first parameter provided to this constructor is an
29513 * `Address` instance, the same argument will be returned.
29514 *
29515 * An address has two key properties: `network` and `type`. The type is either
29516 * `Address.PayToPublicKeyHash` (value is the `'pubkeyhash'` string)
29517 * or `Address.PayToScriptHash` (the string `'scripthash'`). The network is an instance of {@link Network}.
29518 * You can quickly check whether an address is of a given kind by using the methods
29519 * `isPayToPublicKeyHash` and `isPayToScriptHash`
29520 *
29521 * @example
29522 * ```javascript
29523 * // validate that an input field is valid
29524 * var error = Address.getValidationError(input, 'testnet');
29525 * if (!error) {
29526 * var address = Address(input, 'testnet');
29527 * } else {
29528 * // invalid network or checksum (typo?)
29529 * var message = error.messsage;
29530 * }
29531 *
29532 * // get an address from a public key
29533 * var address = Address(publicKey, 'testnet').toString();
29534 * ```
29535 *
29536 * @param {*} data - The encoded data in various formats
29537 * @param {Network|String|number=} network - The network: 'livenet' or 'testnet'
29538 * @param {string=} type - The type of address: 'script' or 'pubkey'
29539 * @returns {Address} A new valid and frozen instance of an Address
29540 * @constructor
29541 */
29542function Address(data, network, type) {
29543 /* jshint maxcomplexity: 12 */
29544 /* jshint maxstatements: 20 */
29545
29546 if (!(this instanceof Address)) {
29547 return new Address(data, network, type);
29548 }
29549
29550 if (_.isArray(data) && _.isNumber(network)) {
29551 return Address.createMultisig(data, network, type);
29552 }
29553
29554 if (data instanceof Address) {
29555 // Immutable instance
29556 return data;
29557 }
29558
29559 $.checkArgument(data, 'First argument is required, please include address data.', 'guide/address.html');
29560
29561 if (network && !Networks.get(network)) {
29562 throw new TypeError('Second argument must be "livenet" or "testnet".');
29563 }
29564
29565 if (type && (type !== Address.PayToPublicKeyHash && type !== Address.PayToScriptHash)) {
29566 throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');
29567 }
29568
29569 var info = this._classifyArguments(data, network, type);
29570
29571 // set defaults if not set
29572 info.network = info.network || Networks.get(network) || Networks.defaultNetwork;
29573 info.type = info.type || type || Address.PayToPublicKeyHash;
29574
29575 JSUtil.defineImmutable(this, {
29576 hashBuffer: info.hashBuffer,
29577 network: info.network,
29578 type: info.type
29579 });
29580
29581 return this;
29582}
29583
29584/**
29585 * Internal function used to split different kinds of arguments of the constructor
29586 * @param {*} data - The encoded data in various formats
29587 * @param {Network|String|number=} network - The network: 'livenet' or 'testnet'
29588 * @param {string=} type - The type of address: 'script' or 'pubkey'
29589 * @returns {Object} An "info" object with "type", "network", and "hashBuffer"
29590 */
29591Address.prototype._classifyArguments = function(data, network, type) {
29592 /* jshint maxcomplexity: 10 */
29593 // transform and validate input data
29594 if ((data instanceof Buffer || data instanceof Uint8Array) && data.length === 20) {
29595 return Address._transformHash(data);
29596 } else if ((data instanceof Buffer || data instanceof Uint8Array) && data.length === 21) {
29597 return Address._transformBuffer(data, network, type);
29598 } else if (data instanceof PublicKey) {
29599 return Address._transformPublicKey(data);
29600 } else if (data instanceof Script) {
29601 return Address._transformScript(data, network);
29602 } else if (typeof(data) === 'string') {
29603 return Address._transformString(data, network, type);
29604 } else if (_.isObject(data)) {
29605 return Address._transformObject(data);
29606 } else {
29607 throw new TypeError('First argument is an unrecognized data format.');
29608 }
29609};
29610
29611/** @static */
29612Address.PayToPublicKeyHash = 'pubkeyhash';
29613/** @static */
29614Address.PayToScriptHash = 'scripthash';
29615
29616/**
29617 * @param {Buffer} hash - An instance of a hash Buffer
29618 * @returns {Object} An object with keys: hashBuffer
29619 * @private
29620 */
29621Address._transformHash = function(hash) {
29622 var info = {};
29623 if (!(hash instanceof Buffer) && !(hash instanceof Uint8Array)) {
29624 throw new TypeError('Address supplied is not a buffer.');
29625 }
29626 if (hash.length !== 20) {
29627 throw new TypeError('Address hashbuffers must be exactly 20 bytes.');
29628 }
29629 info.hashBuffer = hash;
29630 return info;
29631};
29632
29633/**
29634 * Deserializes an address serialized through `Address#toObject()`
29635 * @param {Object} data
29636 * @param {string} data.hash - the hash that this address encodes
29637 * @param {string} data.type - either 'pubkeyhash' or 'scripthash'
29638 * @param {Network=} data.network - the name of the network associated
29639 * @return {Address}
29640 */
29641Address._transformObject = function(data) {
29642 $.checkArgument(data.hash || data.hashBuffer, 'Must provide a `hash` or `hashBuffer` property');
29643 $.checkArgument(data.type, 'Must provide a `type` property');
29644 return {
29645 hashBuffer: data.hash ? Buffer.from(data.hash, 'hex') : data.hashBuffer,
29646 network: Networks.get(data.network) || Networks.defaultNetwork,
29647 type: data.type
29648 };
29649};
29650
29651/**
29652 * Internal function to discover the network and type based on the first data byte
29653 *
29654 * @param {Buffer} buffer - An instance of a hex encoded address Buffer
29655 * @returns {Object} An object with keys: network and type
29656 * @private
29657 */
29658Address._classifyFromVersion = function(buffer) {
29659 var version = {};
29660
29661 var pubkeyhashNetwork = Networks.get(buffer[0], 'pubkeyhash');
29662 var scripthashNetwork = Networks.get(buffer[0], 'scripthash');
29663
29664 if (pubkeyhashNetwork) {
29665 version.network = pubkeyhashNetwork;
29666 version.type = Address.PayToPublicKeyHash;
29667 } else if (scripthashNetwork) {
29668 version.network = scripthashNetwork;
29669 version.type = Address.PayToScriptHash;
29670 }
29671
29672 return version;
29673};
29674
29675/**
29676 * Internal function to transform a bitcoin address buffer
29677 *
29678 * @param {Buffer} buffer - An instance of a hex encoded address Buffer
29679 * @param {string=} network - The network: 'livenet' or 'testnet'
29680 * @param {string=} type - The type: 'pubkeyhash' or 'scripthash'
29681 * @returns {Object} An object with keys: hashBuffer, network and type
29682 * @private
29683 */
29684Address._transformBuffer = function(buffer, network, type) {
29685 /* jshint maxcomplexity: 9 */
29686 var info = {};
29687 if (!(buffer instanceof Buffer) && !(buffer instanceof Uint8Array)) {
29688 throw new TypeError('Address supplied is not a buffer.');
29689 }
29690 if (buffer.length !== 1 + 20) {
29691 throw new TypeError('Address buffers must be exactly 21 bytes.');
29692 }
29693
29694 var networkObj = Networks.get(network);
29695 var bufferVersion = Address._classifyFromVersion(buffer);
29696
29697 if (network && !networkObj) {
29698 throw new TypeError('Unknown network');
29699 }
29700
29701 if (!bufferVersion.network || (networkObj && networkObj !== bufferVersion.network)) {
29702 throw new TypeError('Address has mismatched network type.');
29703 }
29704
29705 if (!bufferVersion.type || (type && type !== bufferVersion.type)) {
29706 throw new TypeError('Address has mismatched type.');
29707 }
29708
29709 info.hashBuffer = buffer.slice(1);
29710 info.network = bufferVersion.network;
29711 info.type = bufferVersion.type;
29712 return info;
29713};
29714
29715/**
29716 * Internal function to transform a {@link PublicKey}
29717 *
29718 * @param {PublicKey} pubkey - An instance of PublicKey
29719 * @returns {Object} An object with keys: hashBuffer, type
29720 * @private
29721 */
29722Address._transformPublicKey = function(pubkey) {
29723 var info = {};
29724 if (!(pubkey instanceof PublicKey)) {
29725 throw new TypeError('Address must be an instance of PublicKey.');
29726 }
29727 info.hashBuffer = Hash.sha256ripemd160(pubkey.toBuffer());
29728 info.type = Address.PayToPublicKeyHash;
29729 return info;
29730};
29731
29732/**
29733 * Internal function to transform a {@link Script} into a `info` object.
29734 *
29735 * @param {Script} script - An instance of Script
29736 * @returns {Object} An object with keys: hashBuffer, type
29737 * @private
29738 */
29739Address._transformScript = function(script, network) {
29740 $.checkArgument(script instanceof Script, 'script must be a Script instance');
29741 var info = script.getAddressInfo(network);
29742 if (!info) {
29743 throw new errors.Script.CantDeriveAddress(script);
29744 }
29745 return info;
29746};
29747
29748/**
29749 * Creates a P2SH address from a set of public keys and a threshold.
29750 *
29751 * The addresses will be sorted lexicographically, as that is the trend in bitcoin.
29752 * To create an address from unsorted public keys, use the {@link Script#buildMultisigOut}
29753 * interface.
29754 *
29755 * @param {Array} publicKeys - a set of public keys to create an address
29756 * @param {number} threshold - the number of signatures needed to release the funds
29757 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29758 * @param {boolean=} nestedWitness - if the address uses a nested p2sh witness
29759 * @return {Address}
29760 */
29761Address.createMultisig = function(publicKeys, threshold, network, nestedWitness) {
29762 network = network || publicKeys[0].network || Networks.defaultNetwork;
29763 var redeemScript = Script.buildMultisigOut(publicKeys, threshold);
29764 if (nestedWitness) {
29765 return Address.payingTo(Script.buildWitnessMultisigOutFromScript(redeemScript), network);
29766 }
29767 return Address.payingTo(redeemScript, network);
29768};
29769
29770/**
29771 * Internal function to transform a bitcoin address string
29772 *
29773 * @param {string} data
29774 * @param {String|Network=} network - either a Network instance, 'livenet', or 'testnet'
29775 * @param {string=} type - The type: 'pubkeyhash' or 'scripthash'
29776 * @returns {Object} An object with keys: hashBuffer, network and type
29777 * @private
29778 */
29779Address._transformString = function(data, network, type) {
29780 if (typeof(data) !== 'string') {
29781 throw new TypeError('data parameter supplied is not a string.');
29782 }
29783 data = data.trim();
29784 var addressBuffer = Base58Check.decode(data);
29785 var info = Address._transformBuffer(addressBuffer, network, type);
29786 return info;
29787};
29788
29789/**
29790 * Instantiate an address from a PublicKey instance
29791 *
29792 * @param {PublicKey} data
29793 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29794 * @returns {Address} A new valid and frozen instance of an Address
29795 */
29796Address.fromPublicKey = function(data, network) {
29797 var info = Address._transformPublicKey(data);
29798 network = network || Networks.defaultNetwork;
29799 return new Address(info.hashBuffer, network, info.type);
29800};
29801
29802/**
29803 * Instantiate an address from a ripemd160 public key hash
29804 *
29805 * @param {Buffer} hash - An instance of buffer of the hash
29806 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29807 * @returns {Address} A new valid and frozen instance of an Address
29808 */
29809Address.fromPublicKeyHash = function(hash, network) {
29810 var info = Address._transformHash(hash);
29811 return new Address(info.hashBuffer, network, Address.PayToPublicKeyHash);
29812};
29813
29814/**
29815 * Instantiate an address from a ripemd160 script hash
29816 *
29817 * @param {Buffer} hash - An instance of buffer of the hash
29818 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29819 * @returns {Address} A new valid and frozen instance of an Address
29820 */
29821Address.fromScriptHash = function(hash, network) {
29822 $.checkArgument(hash, 'hash parameter is required');
29823 var info = Address._transformHash(hash);
29824 return new Address(info.hashBuffer, network, Address.PayToScriptHash);
29825};
29826
29827/**
29828 * Builds a p2sh address paying to script. This will hash the script and
29829 * use that to create the address.
29830 * If you want to extract an address associated with a script instead,
29831 * see {{Address#fromScript}}
29832 *
29833 * @param {Script} script - An instance of Script
29834 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29835 * @returns {Address} A new valid and frozen instance of an Address
29836 */
29837Address.payingTo = function(script, network) {
29838 $.checkArgument(script, 'script is required');
29839 $.checkArgument(script instanceof Script, 'script must be instance of Script');
29840 return Address.fromScriptHash(Hash.sha256ripemd160(script.toBuffer()), network);
29841};
29842
29843/**
29844 * Extract address from a Script. The script must be of one
29845 * of the following types: p2pkh input, p2pkh output, p2sh input
29846 * or p2sh output.
29847 * This will analyze the script and extract address information from it.
29848 * If you want to transform any script to a p2sh Address paying
29849 * to that script's hash instead, use {{Address#payingTo}}
29850 *
29851 * @param {Script} script - An instance of Script
29852 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29853 * @returns {Address} A new valid and frozen instance of an Address
29854 */
29855Address.fromScript = function(script, network) {
29856 $.checkArgument(script instanceof Script, 'script must be a Script instance');
29857 var info = Address._transformScript(script, network);
29858 return new Address(info.hashBuffer, network, info.type);
29859};
29860
29861/**
29862 * Instantiate an address from a buffer of the address
29863 *
29864 * @param {Buffer} buffer - An instance of buffer of the address
29865 * @param {String|Network=} network - either a Network instance, 'livenet', or 'testnet'
29866 * @param {string=} type - The type of address: 'script' or 'pubkey'
29867 * @returns {Address} A new valid and frozen instance of an Address
29868 */
29869Address.fromBuffer = function(buffer, network, type) {
29870 var info = Address._transformBuffer(buffer, network, type);
29871 return new Address(info.hashBuffer, info.network, info.type);
29872};
29873
29874/**
29875 * Instantiate an address from an address string
29876 *
29877 * @param {string} str - An string of the bitcoin address
29878 * @param {String|Network=} network - either a Network instance, 'livenet', or 'testnet'
29879 * @param {string=} type - The type of address: 'script' or 'pubkey'
29880 * @returns {Address} A new valid and frozen instance of an Address
29881 */
29882Address.fromString = function(str, network, type) {
29883 var info = Address._transformString(str, network, type);
29884 return new Address(info.hashBuffer, info.network, info.type);
29885};
29886
29887/**
29888 * Instantiate an address from an Object
29889 *
29890 * @param {string} json - An JSON string or Object with keys: hash, network and type
29891 * @returns {Address} A new valid instance of an Address
29892 */
29893Address.fromObject = function fromObject(obj) {
29894 $.checkState(
29895 JSUtil.isHexa(obj.hash),
29896 'Unexpected hash property, "' + obj.hash + '", expected to be hex.'
29897 );
29898 var hashBuffer = Buffer.from(obj.hash, 'hex');
29899 return new Address(hashBuffer, obj.network, obj.type);
29900};
29901
29902/**
29903 * Will return a validation error if exists
29904 *
29905 * @example
29906 * ```javascript
29907 * // a network mismatch error
29908 * var error = Address.getValidationError('15vkcKf7gB23wLAnZLmbVuMiiVDc1Nm4a2', 'testnet');
29909 * ```
29910 *
29911 * @param {string} data - The encoded data
29912 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29913 * @param {string} type - The type of address: 'script' or 'pubkey'
29914 * @returns {null|Error} The corresponding error message
29915 */
29916Address.getValidationError = function(data, network, type) {
29917 var error;
29918 try {
29919 /* jshint nonew: false */
29920 new Address(data, network, type);
29921 } catch (e) {
29922 error = e;
29923 }
29924 return error;
29925};
29926
29927/**
29928 * Will return a boolean if an address is valid
29929 *
29930 * @example
29931 * ```javascript
29932 * assert(Address.isValid('15vkcKf7gB23wLAnZLmbVuMiiVDc1Nm4a2', 'livenet'));
29933 * ```
29934 *
29935 * @param {string} data - The encoded data
29936 * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
29937 * @param {string} type - The type of address: 'script' or 'pubkey'
29938 * @returns {boolean} The corresponding error message
29939 */
29940Address.isValid = function(data, network, type) {
29941 return !Address.getValidationError(data, network, type);
29942};
29943
29944/**
29945 * Returns true if an address is of pay to public key hash type
29946 * @return boolean
29947 */
29948Address.prototype.isPayToPublicKeyHash = function() {
29949 return this.type === Address.PayToPublicKeyHash;
29950};
29951
29952/**
29953 * Returns true if an address is of pay to script hash type
29954 * @return boolean
29955 */
29956Address.prototype.isPayToScriptHash = function() {
29957 return this.type === Address.PayToScriptHash;
29958};
29959
29960/**
29961 * Will return a buffer representation of the address
29962 *
29963 * @returns {Buffer} Bitcoin address buffer
29964 */
29965Address.prototype.toBuffer = function() {
29966 var version = Buffer.from([this.network[this.type]]);
29967 return Buffer.concat([version, this.hashBuffer]);
29968};
29969
29970/**
29971 * @returns {Object} A plain object with the address information
29972 */
29973Address.prototype.toObject = Address.prototype.toJSON = function toObject() {
29974 return {
29975 hash: this.hashBuffer.toString('hex'),
29976 type: this.type,
29977 network: this.network.toString()
29978 };
29979};
29980
29981/**
29982 * Will return a the string representation of the address
29983 *
29984 * @returns {string} Bitcoin address
29985 */
29986Address.prototype.toString = function() {
29987 return Base58Check.encode(this.toBuffer());
29988};
29989
29990/**
29991 * Will return a string formatted for the console
29992 *
29993 * @returns {string} Bitcoin address
29994 */
29995Address.prototype.inspect = function() {
29996 return '<Address: ' + this.toString() + ', type: ' + this.type + ', network: ' + this.network + '>';
29997};
29998
29999module.exports = Address;
30000
30001var Script = require('./script');
30002
30003}).call(this,require("buffer").Buffer)
30004},{"./crypto/hash":273,"./encoding/base58check":278,"./errors":282,"./networks":286,"./publickey":289,"./script":290,"./util/js":309,"./util/preconditions":310,"buffer":146,"lodash":311}],267:[function(require,module,exports){
30005(function (Buffer){
30006'use strict';
30007
30008var _ = require('lodash');
30009var BlockHeader = require('./blockheader');
30010var BN = require('../crypto/bn');
30011var BufferUtil = require('../util/buffer');
30012var BufferReader = require('../encoding/bufferreader');
30013var BufferWriter = require('../encoding/bufferwriter');
30014var Hash = require('../crypto/hash');
30015var Transaction = require('../transaction');
30016var $ = require('../util/preconditions');
30017
30018/**
30019 * Instantiate a Block from a Buffer, JSON object, or Object with
30020 * the properties of the Block
30021 *
30022 * @param {*} - A Buffer, JSON string, or Object
30023 * @returns {Block}
30024 * @constructor
30025 */
30026function Block(arg) {
30027 if (!(this instanceof Block)) {
30028 return new Block(arg);
30029 }
30030 _.extend(this, Block._from(arg));
30031 return this;
30032}
30033
30034// https://github.com/bitcoin/bitcoin/blob/b5fa132329f0377d787a4a21c1686609c2bfaece/src/primitives/block.h#L14
30035Block.MAX_BLOCK_SIZE = 1000000;
30036
30037/**
30038 * @param {*} - A Buffer, JSON string or Object
30039 * @returns {Object} - An object representing block data
30040 * @throws {TypeError} - If the argument was not recognized
30041 * @private
30042 */
30043Block._from = function _from(arg) {
30044 var info = {};
30045 if (BufferUtil.isBuffer(arg)) {
30046 info = Block._fromBufferReader(BufferReader(arg));
30047 } else if (_.isObject(arg)) {
30048 info = Block._fromObject(arg);
30049 } else {
30050 throw new TypeError('Unrecognized argument for Block');
30051 }
30052 return info;
30053};
30054
30055/**
30056 * @param {Object} - A plain JavaScript object
30057 * @returns {Object} - An object representing block data
30058 * @private
30059 */
30060Block._fromObject = function _fromObject(data) {
30061 var transactions = [];
30062 data.transactions.forEach(function(tx) {
30063 if (tx instanceof Transaction) {
30064 transactions.push(tx);
30065 } else {
30066 transactions.push(Transaction().fromObject(tx));
30067 }
30068 });
30069 var info = {
30070 header: BlockHeader.fromObject(data.header),
30071 transactions: transactions
30072 };
30073 return info;
30074};
30075
30076/**
30077 * @param {Object} - A plain JavaScript object
30078 * @returns {Block} - An instance of block
30079 */
30080Block.fromObject = function fromObject(obj) {
30081 var info = Block._fromObject(obj);
30082 return new Block(info);
30083};
30084
30085/**
30086 * @param {BufferReader} - Block data
30087 * @returns {Object} - An object representing the block data
30088 * @private
30089 */
30090Block._fromBufferReader = function _fromBufferReader(br) {
30091 var info = {};
30092 $.checkState(!br.finished(), 'No block data received');
30093 info.header = BlockHeader.fromBufferReader(br);
30094 var transactions = br.readVarintNum();
30095 info.transactions = [];
30096 for (var i = 0; i < transactions; i++) {
30097 info.transactions.push(Transaction().fromBufferReader(br));
30098 }
30099 return info;
30100};
30101
30102/**
30103 * @param {BufferReader} - A buffer reader of the block
30104 * @returns {Block} - An instance of block
30105 */
30106Block.fromBufferReader = function fromBufferReader(br) {
30107 $.checkArgument(br, 'br is required');
30108 var info = Block._fromBufferReader(br);
30109 return new Block(info);
30110};
30111
30112/**
30113 * @param {Buffer} - A buffer of the block
30114 * @returns {Block} - An instance of block
30115 */
30116Block.fromBuffer = function fromBuffer(buf) {
30117 return Block.fromBufferReader(new BufferReader(buf));
30118};
30119
30120/**
30121 * @param {string} - str - A hex encoded string of the block
30122 * @returns {Block} - A hex encoded string of the block
30123 */
30124Block.fromString = function fromString(str) {
30125 var buf = Buffer.from(str, 'hex');
30126 return Block.fromBuffer(buf);
30127};
30128
30129/**
30130 * @param {Binary} - Raw block binary data or buffer
30131 * @returns {Block} - An instance of block
30132 */
30133Block.fromRawBlock = function fromRawBlock(data) {
30134 if (!BufferUtil.isBuffer(data)) {
30135 data = Buffer.from(data, 'binary');
30136 }
30137 var br = BufferReader(data);
30138 br.pos = Block.Values.START_OF_BLOCK;
30139 var info = Block._fromBufferReader(br);
30140 return new Block(info);
30141};
30142
30143/**
30144 * @returns {Object} - A plain object with the block properties
30145 */
30146Block.prototype.toObject = Block.prototype.toJSON = function toObject() {
30147 var transactions = [];
30148 this.transactions.forEach(function(tx) {
30149 transactions.push(tx.toObject());
30150 });
30151 return {
30152 header: this.header.toObject(),
30153 transactions: transactions
30154 };
30155};
30156
30157/**
30158 * @returns {Buffer} - A buffer of the block
30159 */
30160Block.prototype.toBuffer = function toBuffer() {
30161 return this.toBufferWriter().concat();
30162};
30163
30164/**
30165 * @returns {string} - A hex encoded string of the block
30166 */
30167Block.prototype.toString = function toString() {
30168 return this.toBuffer().toString('hex');
30169};
30170
30171/**
30172 * @param {BufferWriter} - An existing instance of BufferWriter
30173 * @returns {BufferWriter} - An instance of BufferWriter representation of the Block
30174 */
30175Block.prototype.toBufferWriter = function toBufferWriter(bw) {
30176 if (!bw) {
30177 bw = new BufferWriter();
30178 }
30179 bw.write(this.header.toBuffer());
30180 bw.writeVarintNum(this.transactions.length);
30181 for (var i = 0; i < this.transactions.length; i++) {
30182 this.transactions[i].toBufferWriter(bw);
30183 }
30184 return bw;
30185};
30186
30187/**
30188 * Will iterate through each transaction and return an array of hashes
30189 * @returns {Array} - An array with transaction hashes
30190 */
30191Block.prototype.getTransactionHashes = function getTransactionHashes() {
30192 var hashes = [];
30193 if (this.transactions.length === 0) {
30194 return [Block.Values.NULL_HASH];
30195 }
30196 for (var t = 0; t < this.transactions.length; t++) {
30197 hashes.push(this.transactions[t]._getHash());
30198 }
30199 return hashes;
30200};
30201
30202/**
30203 * Will build a merkle tree of all the transactions, ultimately arriving at
30204 * a single point, the merkle root.
30205 * @link https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees
30206 * @returns {Array} - An array with each level of the tree after the other.
30207 */
30208Block.prototype.getMerkleTree = function getMerkleTree() {
30209
30210 var tree = this.getTransactionHashes();
30211
30212 var j = 0;
30213 for (var size = this.transactions.length; size > 1; size = Math.floor((size + 1) / 2)) {
30214 for (var i = 0; i < size; i += 2) {
30215 var i2 = Math.min(i + 1, size - 1);
30216 var buf = Buffer.concat([tree[j + i], tree[j + i2]]);
30217 tree.push(Hash.sha256sha256(buf));
30218 }
30219 j += size;
30220 }
30221
30222 return tree;
30223};
30224
30225/**
30226 * Calculates the merkleRoot from the transactions.
30227 * @returns {Buffer} - A buffer of the merkle root hash
30228 */
30229Block.prototype.getMerkleRoot = function getMerkleRoot() {
30230 var tree = this.getMerkleTree();
30231 return tree[tree.length - 1];
30232};
30233
30234/**
30235 * Verifies that the transactions in the block match the header merkle root
30236 * @returns {Boolean} - If the merkle roots match
30237 */
30238Block.prototype.validMerkleRoot = function validMerkleRoot() {
30239
30240 var h = new BN(this.header.merkleRoot.toString('hex'), 'hex');
30241 var c = new BN(this.getMerkleRoot().toString('hex'), 'hex');
30242
30243 if (h.cmp(c) !== 0) {
30244 return false;
30245 }
30246
30247 return true;
30248};
30249
30250/**
30251 * @returns {Buffer} - The little endian hash buffer of the header
30252 */
30253Block.prototype._getHash = function() {
30254 return this.header._getHash();
30255};
30256
30257var idProperty = {
30258 configurable: false,
30259 enumerable: true,
30260 /**
30261 * @returns {string} - The big endian hash buffer of the header
30262 */
30263 get: function() {
30264 if (!this._id) {
30265 this._id = this.header.id;
30266 }
30267 return this._id;
30268 },
30269 set: _.noop
30270};
30271Object.defineProperty(Block.prototype, 'id', idProperty);
30272Object.defineProperty(Block.prototype, 'hash', idProperty);
30273
30274/**
30275 * @returns {string} - A string formatted for the console
30276 */
30277Block.prototype.inspect = function inspect() {
30278 return '<Block ' + this.id + '>';
30279};
30280
30281Block.Values = {
30282 START_OF_BLOCK: 8, // Start of block in raw block data
30283 NULL_HASH: Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
30284};
30285
30286module.exports = Block;
30287
30288}).call(this,require("buffer").Buffer)
30289},{"../crypto/bn":271,"../crypto/hash":273,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../transaction":293,"../util/buffer":308,"../util/preconditions":310,"./blockheader":268,"buffer":146,"lodash":311}],268:[function(require,module,exports){
30290(function (Buffer){
30291'use strict';
30292
30293var _ = require('lodash');
30294var BN = require('../crypto/bn');
30295var BufferUtil = require('../util/buffer');
30296var BufferReader = require('../encoding/bufferreader');
30297var BufferWriter = require('../encoding/bufferwriter');
30298var Hash = require('../crypto/hash');
30299var JSUtil = require('../util/js');
30300var $ = require('../util/preconditions');
30301
30302var GENESIS_BITS = 0x1d00ffff;
30303
30304/**
30305 * Instantiate a BlockHeader from a Buffer, JSON object, or Object with
30306 * the properties of the BlockHeader
30307 *
30308 * @param {*} - A Buffer, JSON string, or Object
30309 * @returns {BlockHeader} - An instance of block header
30310 * @constructor
30311 */
30312var BlockHeader = function BlockHeader(arg) {
30313 if (!(this instanceof BlockHeader)) {
30314 return new BlockHeader(arg);
30315 }
30316 var info = BlockHeader._from(arg);
30317 this.version = info.version;
30318 this.prevHash = info.prevHash;
30319 this.merkleRoot = info.merkleRoot;
30320 this.time = info.time;
30321 this.timestamp = info.time;
30322 this.bits = info.bits;
30323 this.nonce = info.nonce;
30324
30325 if (info.hash) {
30326 $.checkState(
30327 this.hash === info.hash,
30328 'Argument object hash property does not match block hash.'
30329 );
30330 }
30331
30332 return this;
30333};
30334
30335/**
30336 * @param {*} - A Buffer, JSON string or Object
30337 * @returns {Object} - An object representing block header data
30338 * @throws {TypeError} - If the argument was not recognized
30339 * @private
30340 */
30341BlockHeader._from = function _from(arg) {
30342 var info = {};
30343 if (BufferUtil.isBuffer(arg)) {
30344 info = BlockHeader._fromBufferReader(BufferReader(arg));
30345 } else if (_.isObject(arg)) {
30346 info = BlockHeader._fromObject(arg);
30347 } else {
30348 throw new TypeError('Unrecognized argument for BlockHeader');
30349 }
30350 return info;
30351};
30352
30353/**
30354 * @param {Object} - A JSON string
30355 * @returns {Object} - An object representing block header data
30356 * @private
30357 */
30358BlockHeader._fromObject = function _fromObject(data) {
30359 $.checkArgument(data, 'data is required');
30360 var prevHash = data.prevHash;
30361 var merkleRoot = data.merkleRoot;
30362 if (_.isString(data.prevHash)) {
30363 prevHash = BufferUtil.reverse(Buffer.from(data.prevHash, 'hex'));
30364 }
30365 if (_.isString(data.merkleRoot)) {
30366 merkleRoot = BufferUtil.reverse(Buffer.from(data.merkleRoot, 'hex'));
30367 }
30368 var info = {
30369 hash: data.hash,
30370 version: data.version,
30371 prevHash: prevHash,
30372 merkleRoot: merkleRoot,
30373 time: data.time,
30374 timestamp: data.time,
30375 bits: data.bits,
30376 nonce: data.nonce
30377 };
30378 return info;
30379};
30380
30381/**
30382 * @param {Object} - A plain JavaScript object
30383 * @returns {BlockHeader} - An instance of block header
30384 */
30385BlockHeader.fromObject = function fromObject(obj) {
30386 var info = BlockHeader._fromObject(obj);
30387 return new BlockHeader(info);
30388};
30389
30390/**
30391 * @param {Binary} - Raw block binary data or buffer
30392 * @returns {BlockHeader} - An instance of block header
30393 */
30394BlockHeader.fromRawBlock = function fromRawBlock(data) {
30395 if (!BufferUtil.isBuffer(data)) {
30396 data = Buffer.from(data, 'binary');
30397 }
30398 var br = BufferReader(data);
30399 br.pos = BlockHeader.Constants.START_OF_HEADER;
30400 var info = BlockHeader._fromBufferReader(br);
30401 return new BlockHeader(info);
30402};
30403
30404/**
30405 * @param {Buffer} - A buffer of the block header
30406 * @returns {BlockHeader} - An instance of block header
30407 */
30408BlockHeader.fromBuffer = function fromBuffer(buf) {
30409 var info = BlockHeader._fromBufferReader(BufferReader(buf));
30410 return new BlockHeader(info);
30411};
30412
30413/**
30414 * @param {string} - A hex encoded buffer of the block header
30415 * @returns {BlockHeader} - An instance of block header
30416 */
30417BlockHeader.fromString = function fromString(str) {
30418 var buf = Buffer.from(str, 'hex');
30419 return BlockHeader.fromBuffer(buf);
30420};
30421
30422/**
30423 * @param {BufferReader} - A BufferReader of the block header
30424 * @returns {Object} - An object representing block header data
30425 * @private
30426 */
30427BlockHeader._fromBufferReader = function _fromBufferReader(br) {
30428 var info = {};
30429 info.version = br.readInt32LE();
30430 info.prevHash = br.read(32);
30431 info.merkleRoot = br.read(32);
30432 info.time = br.readUInt32LE();
30433 info.bits = br.readUInt32LE();
30434 info.nonce = br.readUInt32LE();
30435 return info;
30436};
30437
30438/**
30439 * @param {BufferReader} - A BufferReader of the block header
30440 * @returns {BlockHeader} - An instance of block header
30441 */
30442BlockHeader.fromBufferReader = function fromBufferReader(br) {
30443 var info = BlockHeader._fromBufferReader(br);
30444 return new BlockHeader(info);
30445};
30446
30447/**
30448 * @returns {Object} - A plain object of the BlockHeader
30449 */
30450BlockHeader.prototype.toObject = BlockHeader.prototype.toJSON = function toObject() {
30451 return {
30452 hash: this.hash,
30453 version: this.version,
30454 prevHash: BufferUtil.reverse(this.prevHash).toString('hex'),
30455 merkleRoot: BufferUtil.reverse(this.merkleRoot).toString('hex'),
30456 time: this.time,
30457 bits: this.bits,
30458 nonce: this.nonce
30459 };
30460};
30461
30462/**
30463 * @returns {Buffer} - A Buffer of the BlockHeader
30464 */
30465BlockHeader.prototype.toBuffer = function toBuffer() {
30466 return this.toBufferWriter().concat();
30467};
30468
30469/**
30470 * @returns {string} - A hex encoded string of the BlockHeader
30471 */
30472BlockHeader.prototype.toString = function toString() {
30473 return this.toBuffer().toString('hex');
30474};
30475
30476/**
30477 * @param {BufferWriter} - An existing instance BufferWriter
30478 * @returns {BufferWriter} - An instance of BufferWriter representation of the BlockHeader
30479 */
30480BlockHeader.prototype.toBufferWriter = function toBufferWriter(bw) {
30481 if (!bw) {
30482 bw = new BufferWriter();
30483 }
30484 bw.writeInt32LE(this.version);
30485 bw.write(this.prevHash);
30486 bw.write(this.merkleRoot);
30487 bw.writeUInt32LE(this.time);
30488 bw.writeUInt32LE(this.bits);
30489 bw.writeUInt32LE(this.nonce);
30490 return bw;
30491};
30492
30493/**
30494 * Returns the target difficulty for this block
30495 * @param {Number} bits
30496 * @returns {BN} An instance of BN with the decoded difficulty bits
30497 */
30498BlockHeader.prototype.getTargetDifficulty = function getTargetDifficulty(bits) {
30499 bits = bits || this.bits;
30500
30501 var target = new BN(bits & 0xffffff);
30502 var mov = 8 * ((bits >>> 24) - 3);
30503 while (mov-- > 0) {
30504 target = target.mul(new BN(2));
30505 }
30506 return target;
30507};
30508
30509/**
30510 * @link https://en.bitcoin.it/wiki/Difficulty
30511 * @return {Number}
30512 */
30513BlockHeader.prototype.getDifficulty = function getDifficulty() {
30514 var difficulty1TargetBN = this.getTargetDifficulty(GENESIS_BITS).mul(new BN(Math.pow(10, 8)));
30515 var currentTargetBN = this.getTargetDifficulty();
30516
30517 var difficultyString = difficulty1TargetBN.div(currentTargetBN).toString(10);
30518 var decimalPos = difficultyString.length - 8;
30519 difficultyString = difficultyString.slice(0, decimalPos) + '.' + difficultyString.slice(decimalPos);
30520
30521 return parseFloat(difficultyString);
30522};
30523
30524/**
30525 * @returns {Buffer} - The little endian hash buffer of the header
30526 */
30527BlockHeader.prototype._getHash = function hash() {
30528 var buf = this.toBuffer();
30529 return Hash.sha256sha256(buf);
30530};
30531
30532var idProperty = {
30533 configurable: false,
30534 enumerable: true,
30535 /**
30536 * @returns {string} - The big endian hash buffer of the header
30537 */
30538 get: function() {
30539 if (!this._id) {
30540 this._id = BufferReader(this._getHash()).readReverse().toString('hex');
30541 }
30542 return this._id;
30543 },
30544 set: _.noop
30545};
30546Object.defineProperty(BlockHeader.prototype, 'id', idProperty);
30547Object.defineProperty(BlockHeader.prototype, 'hash', idProperty);
30548
30549/**
30550 * @returns {Boolean} - If timestamp is not too far in the future
30551 */
30552BlockHeader.prototype.validTimestamp = function validTimestamp() {
30553 var currentTime = Math.round(new Date().getTime() / 1000);
30554 if (this.time > currentTime + BlockHeader.Constants.MAX_TIME_OFFSET) {
30555 return false;
30556 }
30557 return true;
30558};
30559
30560/**
30561 * @returns {Boolean} - If the proof-of-work hash satisfies the target difficulty
30562 */
30563BlockHeader.prototype.validProofOfWork = function validProofOfWork() {
30564 var pow = new BN(this.id, 'hex');
30565 var target = this.getTargetDifficulty();
30566
30567 if (pow.cmp(target) > 0) {
30568 return false;
30569 }
30570 return true;
30571};
30572
30573/**
30574 * @returns {string} - A string formatted for the console
30575 */
30576BlockHeader.prototype.inspect = function inspect() {
30577 return '<BlockHeader ' + this.id + '>';
30578};
30579
30580BlockHeader.Constants = {
30581 START_OF_HEADER: 8, // Start buffer position in raw block data
30582 MAX_TIME_OFFSET: 2 * 60 * 60, // The max a timestamp can be in the future
30583 LARGEST_HASH: new BN('10000000000000000000000000000000000000000000000000000000000000000', 'hex')
30584};
30585
30586module.exports = BlockHeader;
30587
30588}).call(this,require("buffer").Buffer)
30589},{"../crypto/bn":271,"../crypto/hash":273,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"buffer":146,"lodash":311}],269:[function(require,module,exports){
30590module.exports = require('./block');
30591
30592module.exports.BlockHeader = require('./blockheader');
30593module.exports.MerkleBlock = require('./merkleblock');
30594
30595},{"./block":267,"./blockheader":268,"./merkleblock":270}],270:[function(require,module,exports){
30596(function (Buffer){
30597'use strict';
30598
30599var _ = require('lodash');
30600var BlockHeader = require('./blockheader');
30601var BufferUtil = require('../util/buffer');
30602var BufferReader = require('../encoding/bufferreader');
30603var BufferWriter = require('../encoding/bufferwriter');
30604var Hash = require('../crypto/hash');
30605var JSUtil = require('../util/js');
30606var Transaction = require('../transaction');
30607var errors = require('../errors');
30608var $ = require('../util/preconditions');
30609
30610/**
30611 * Instantiate a MerkleBlock from a Buffer, JSON object, or Object with
30612 * the properties of the Block
30613 *
30614 * @param {*} - A Buffer, JSON string, or Object representing a MerkleBlock
30615 * @returns {MerkleBlock}
30616 * @constructor
30617 */
30618function MerkleBlock(arg) {
30619 /* jshint maxstatements: 18 */
30620
30621 if (!(this instanceof MerkleBlock)) {
30622 return new MerkleBlock(arg);
30623 }
30624
30625 var info = {};
30626 if (BufferUtil.isBuffer(arg)) {
30627 info = MerkleBlock._fromBufferReader(BufferReader(arg));
30628 } else if (_.isObject(arg)) {
30629 var header;
30630 if(arg.header instanceof BlockHeader) {
30631 header = arg.header;
30632 } else {
30633 header = BlockHeader.fromObject(arg.header);
30634 }
30635 info = {
30636 /**
30637 * @name MerkleBlock#header
30638 * @type {BlockHeader}
30639 */
30640 header: header,
30641 /**
30642 * @name MerkleBlock#numTransactions
30643 * @type {Number}
30644 */
30645 numTransactions: arg.numTransactions,
30646 /**
30647 * @name MerkleBlock#hashes
30648 * @type {String[]}
30649 */
30650 hashes: arg.hashes,
30651 /**
30652 * @name MerkleBlock#flags
30653 * @type {Number[]}
30654 */
30655 flags: arg.flags
30656 };
30657 } else {
30658 throw new TypeError('Unrecognized argument for MerkleBlock');
30659 }
30660 _.extend(this,info);
30661 this._flagBitsUsed = 0;
30662 this._hashesUsed = 0;
30663
30664 return this;
30665}
30666
30667/**
30668 * @param {Buffer} - MerkleBlock data in a Buffer object
30669 * @returns {MerkleBlock} - A MerkleBlock object
30670 */
30671MerkleBlock.fromBuffer = function fromBuffer(buf) {
30672 return MerkleBlock.fromBufferReader(BufferReader(buf));
30673};
30674
30675/**
30676 * @param {BufferReader} - MerkleBlock data in a BufferReader object
30677 * @returns {MerkleBlock} - A MerkleBlock object
30678 */
30679MerkleBlock.fromBufferReader = function fromBufferReader(br) {
30680 return new MerkleBlock(MerkleBlock._fromBufferReader(br));
30681};
30682
30683/**
30684 * @returns {Buffer} - A buffer of the block
30685 */
30686MerkleBlock.prototype.toBuffer = function toBuffer() {
30687 return this.toBufferWriter().concat();
30688};
30689
30690/**
30691 * @param {BufferWriter} - An existing instance of BufferWriter
30692 * @returns {BufferWriter} - An instance of BufferWriter representation of the MerkleBlock
30693 */
30694MerkleBlock.prototype.toBufferWriter = function toBufferWriter(bw) {
30695 if (!bw) {
30696 bw = new BufferWriter();
30697 }
30698 bw.write(this.header.toBuffer());
30699 bw.writeUInt32LE(this.numTransactions);
30700 bw.writeVarintNum(this.hashes.length);
30701 for (var i = 0; i < this.hashes.length; i++) {
30702 bw.write(Buffer.from(this.hashes[i], 'hex'));
30703 }
30704 bw.writeVarintNum(this.flags.length);
30705 for (i = 0; i < this.flags.length; i++) {
30706 bw.writeUInt8(this.flags[i]);
30707 }
30708 return bw;
30709};
30710
30711/**
30712 * @returns {Object} - A plain object with the MerkleBlock properties
30713 */
30714MerkleBlock.prototype.toObject = MerkleBlock.prototype.toJSON = function toObject() {
30715 return {
30716 header: this.header.toObject(),
30717 numTransactions: this.numTransactions,
30718 hashes: this.hashes,
30719 flags: this.flags
30720 };
30721};
30722
30723/**
30724 * Verify that the MerkleBlock is valid
30725 * @returns {Boolean} - True/False whether this MerkleBlock is Valid
30726 */
30727MerkleBlock.prototype.validMerkleTree = function validMerkleTree() {
30728 $.checkState(_.isArray(this.flags), 'MerkleBlock flags is not an array');
30729 $.checkState(_.isArray(this.hashes), 'MerkleBlock hashes is not an array');
30730
30731 // Can't have more hashes than numTransactions
30732 if(this.hashes.length > this.numTransactions) {
30733 return false;
30734 }
30735
30736 // Can't have more flag bits than num hashes
30737 if(this.flags.length * 8 < this.hashes.length) {
30738 return false;
30739 }
30740
30741 var height = this._calcTreeHeight();
30742 var opts = { hashesUsed: 0, flagBitsUsed: 0 };
30743 var root = this._traverseMerkleTree(height, 0, opts);
30744 if(opts.hashesUsed !== this.hashes.length) {
30745 return false;
30746 }
30747 return BufferUtil.equals(root, this.header.merkleRoot);
30748};
30749
30750/**
30751 * Return a list of all the txs hash that match the filter
30752 * @returns {Array} - txs hash that match the filter
30753 */
30754MerkleBlock.prototype.filterdTxsHash = function filterdTxsHash() {
30755 $.checkState(_.isArray(this.flags), 'MerkleBlock flags is not an array');
30756 $.checkState(_.isArray(this.hashes), 'MerkleBlock hashes is not an array');
30757
30758 // Can't have more hashes than numTransactions
30759 if(this.hashes.length > this.numTransactions) {
30760 throw new errors.MerkleBlock.InvalidMerkleTree();
30761 }
30762
30763 // Can't have more flag bits than num hashes
30764 if(this.flags.length * 8 < this.hashes.length) {
30765 throw new errors.MerkleBlock.InvalidMerkleTree();
30766 }
30767
30768 // If there is only one hash the filter do not match any txs in the block
30769 if(this.hashes.length === 1) {
30770 return [];
30771 };
30772
30773 var height = this._calcTreeHeight();
30774 var opts = { hashesUsed: 0, flagBitsUsed: 0 };
30775 var txs = this._traverseMerkleTree(height, 0, opts, true);
30776 if(opts.hashesUsed !== this.hashes.length) {
30777 throw new errors.MerkleBlock.InvalidMerkleTree();
30778 }
30779 return txs;
30780};
30781
30782/**
30783 * Traverse a the tree in this MerkleBlock, validating it along the way
30784 * Modeled after Bitcoin Core merkleblock.cpp TraverseAndExtract()
30785 * @param {Number} - depth - Current height
30786 * @param {Number} - pos - Current position in the tree
30787 * @param {Object} - opts - Object with values that need to be mutated throughout the traversal
30788 * @param {Boolean} - checkForTxs - if true return opts.txs else return the Merkle Hash
30789 * @param {Number} - opts.flagBitsUsed - Number of flag bits used, should start at 0
30790 * @param {Number} - opts.hashesUsed - Number of hashes used, should start at 0
30791 * @param {Array} - opts.txs - Will finish populated by transactions found during traversal that match the filter
30792 * @returns {Buffer|null} - Buffer containing the Merkle Hash for that height
30793 * @returns {Array} - transactions found during traversal that match the filter
30794 * @private
30795 */
30796MerkleBlock.prototype._traverseMerkleTree = function traverseMerkleTree(depth, pos, opts, checkForTxs) {
30797 /* jshint maxcomplexity: 12*/
30798 /* jshint maxstatements: 20 */
30799
30800 opts = opts || {};
30801 opts.txs = opts.txs || [];
30802 opts.flagBitsUsed = opts.flagBitsUsed || 0;
30803 opts.hashesUsed = opts.hashesUsed || 0;
30804 var checkForTxs = checkForTxs || false;
30805
30806 if(opts.flagBitsUsed > this.flags.length * 8) {
30807 return null;
30808 }
30809 var isParentOfMatch = (this.flags[opts.flagBitsUsed >> 3] >>> (opts.flagBitsUsed++ & 7)) & 1;
30810 if(depth === 0 || !isParentOfMatch) {
30811 if(opts.hashesUsed >= this.hashes.length) {
30812 return null;
30813 }
30814 var hash = this.hashes[opts.hashesUsed++];
30815 if(depth === 0 && isParentOfMatch) {
30816 opts.txs.push(hash);
30817 }
30818 return Buffer.from(hash, 'hex');
30819 } else {
30820 var left = this._traverseMerkleTree(depth-1, pos*2, opts);
30821 var right = left;
30822 if(pos*2+1 < this._calcTreeWidth(depth-1)) {
30823 right = this._traverseMerkleTree(depth-1, pos*2+1, opts);
30824 }
30825 if (checkForTxs){
30826 return opts.txs;
30827 } else {
30828 return Hash.sha256sha256(new Buffer.concat([left, right]));
30829 };
30830 }
30831};
30832
30833/** Calculates the width of a merkle tree at a given height.
30834 * Modeled after Bitcoin Core merkleblock.h CalcTreeWidth()
30835 * @param {Number} - Height at which we want the tree width
30836 * @returns {Number} - Width of the tree at a given height
30837 * @private
30838 */
30839MerkleBlock.prototype._calcTreeWidth = function calcTreeWidth(height) {
30840 return (this.numTransactions + (1 << height) - 1) >> height;
30841};
30842
30843/** Calculates the height of the merkle tree in this MerkleBlock
30844 * @param {Number} - Height at which we want the tree width
30845 * @returns {Number} - Height of the merkle tree in this MerkleBlock
30846 * @private
30847 */
30848MerkleBlock.prototype._calcTreeHeight = function calcTreeHeight() {
30849 var height = 0;
30850 while (this._calcTreeWidth(height) > 1) {
30851 height++;
30852 }
30853 return height;
30854};
30855
30856/**
30857 * @param {Transaction|String} - Transaction or Transaction ID Hash
30858 * @returns {Boolean} - return true/false if this MerkleBlock has the TX or not
30859 * @private
30860 */
30861MerkleBlock.prototype.hasTransaction = function hasTransaction(tx) {
30862 $.checkArgument(!_.isUndefined(tx), 'tx cannot be undefined');
30863 $.checkArgument(tx instanceof Transaction || typeof tx === 'string',
30864 'Invalid tx given, tx must be a "string" or "Transaction"');
30865
30866 var hash = tx;
30867 if(tx instanceof Transaction) {
30868 // We need to reverse the id hash for the lookup
30869 hash = BufferUtil.reverse(Buffer.from(tx.id, 'hex')).toString('hex');
30870 }
30871
30872 var txs = [];
30873 var height = this._calcTreeHeight();
30874 this._traverseMerkleTree(height, 0, { txs: txs });
30875 return txs.indexOf(hash) !== -1;
30876};
30877
30878/**
30879 * @param {Buffer} - MerkleBlock data
30880 * @returns {Object} - An Object representing merkleblock data
30881 * @private
30882 */
30883MerkleBlock._fromBufferReader = function _fromBufferReader(br) {
30884 $.checkState(!br.finished(), 'No merkleblock data received');
30885 var info = {};
30886 info.header = BlockHeader.fromBufferReader(br);
30887 info.numTransactions = br.readUInt32LE();
30888 var numHashes = br.readVarintNum();
30889 info.hashes = [];
30890 for (var i = 0; i < numHashes; i++) {
30891 info.hashes.push(br.read(32).toString('hex'));
30892 }
30893 var numFlags = br.readVarintNum();
30894 info.flags = [];
30895 for (i = 0; i < numFlags; i++) {
30896 info.flags.push(br.readUInt8());
30897 }
30898 return info;
30899};
30900
30901/**
30902 * @param {Object} - A plain JavaScript object
30903 * @returns {Block} - An instance of block
30904 */
30905MerkleBlock.fromObject = function fromObject(obj) {
30906 return new MerkleBlock(obj);
30907};
30908
30909module.exports = MerkleBlock;
30910
30911}).call(this,require("buffer").Buffer)
30912},{"../crypto/hash":273,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../errors":282,"../transaction":293,"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"./blockheader":268,"buffer":146,"lodash":311}],271:[function(require,module,exports){
30913(function (Buffer){
30914'use strict';
30915
30916var BN = require('bn.js');
30917var $ = require('../util/preconditions');
30918var _ = require('lodash');
30919
30920var reversebuf = function(buf) {
30921 var buf2 = Buffer.alloc(buf.length);
30922 for (var i = 0; i < buf.length; i++) {
30923 buf2[i] = buf[buf.length - 1 - i];
30924 }
30925 return buf2;
30926};
30927
30928BN.Zero = new BN(0);
30929BN.One = new BN(1);
30930BN.Minus1 = new BN(-1);
30931
30932BN.fromNumber = function(n) {
30933 $.checkArgument(_.isNumber(n));
30934 return new BN(n);
30935};
30936
30937BN.fromString = function(str, base) {
30938 $.checkArgument(_.isString(str));
30939 return new BN(str, base);
30940};
30941
30942BN.fromBuffer = function(buf, opts) {
30943 if (typeof opts !== 'undefined' && opts.endian === 'little') {
30944 buf = reversebuf(buf);
30945 }
30946 var hex = buf.toString('hex');
30947 var bn = new BN(hex, 16);
30948 return bn;
30949};
30950
30951/**
30952 * Instantiate a BigNumber from a "signed magnitude buffer"
30953 * (a buffer where the most significant bit represents the sign (0 = positive, -1 = negative))
30954 */
30955BN.fromSM = function(buf, opts) {
30956 var ret;
30957 if (buf.length === 0) {
30958 return BN.fromBuffer(Buffer.from([0]));
30959 }
30960
30961 var endian = 'big';
30962 if (opts) {
30963 endian = opts.endian;
30964 }
30965 if (endian === 'little') {
30966 buf = reversebuf(buf);
30967 }
30968
30969 if (buf[0] & 0x80) {
30970 buf[0] = buf[0] & 0x7f;
30971 ret = BN.fromBuffer(buf);
30972 ret.neg().copy(ret);
30973 } else {
30974 ret = BN.fromBuffer(buf);
30975 }
30976 return ret;
30977};
30978
30979
30980BN.prototype.toNumber = function() {
30981 return parseInt(this.toString(10), 10);
30982};
30983
30984BN.prototype.toBuffer = function(opts) {
30985 var buf, hex;
30986 if (opts && opts.size) {
30987 hex = this.toString(16, 2);
30988 var natlen = hex.length / 2;
30989 buf = Buffer.from(hex, 'hex');
30990
30991 if (natlen === opts.size) {
30992 buf = buf;
30993 } else if (natlen > opts.size) {
30994 buf = BN.trim(buf, natlen);
30995 } else if (natlen < opts.size) {
30996 buf = BN.pad(buf, natlen, opts.size);
30997 }
30998 } else {
30999 hex = this.toString(16, 2);
31000 buf = Buffer.from(hex, 'hex');
31001 }
31002
31003 if (typeof opts !== 'undefined' && opts.endian === 'little') {
31004 buf = reversebuf(buf);
31005 }
31006
31007 return buf;
31008};
31009
31010BN.prototype.toSMBigEndian = function() {
31011 var buf;
31012 if (this.cmp(BN.Zero) === -1) {
31013 buf = this.neg().toBuffer();
31014 if (buf[0] & 0x80) {
31015 buf = Buffer.concat([Buffer.from([0x80]), buf]);
31016 } else {
31017 buf[0] = buf[0] | 0x80;
31018 }
31019 } else {
31020 buf = this.toBuffer();
31021 if (buf[0] & 0x80) {
31022 buf = Buffer.concat([Buffer.from([0x00]), buf]);
31023 }
31024 }
31025
31026 if (buf.length === 1 & buf[0] === 0) {
31027 buf = Buffer.from([]);
31028 }
31029 return buf;
31030};
31031
31032BN.prototype.toSM = function(opts) {
31033 var endian = opts ? opts.endian : 'big';
31034 var buf = this.toSMBigEndian();
31035
31036 if (endian === 'little') {
31037 buf = reversebuf(buf);
31038 }
31039 return buf;
31040};
31041
31042/**
31043 * Create a BN from a "ScriptNum":
31044 * This is analogous to the constructor for CScriptNum in bitcoind. Many ops in
31045 * bitcoind's script interpreter use CScriptNum, which is not really a proper
31046 * bignum. Instead, an error is thrown if trying to input a number bigger than
31047 * 4 bytes. We copy that behavior here. A third argument, `size`, is provided to
31048 * extend the hard limit of 4 bytes, as some usages require more than 4 bytes.
31049 */
31050BN.fromScriptNumBuffer = function(buf, fRequireMinimal, size) {
31051 var nMaxNumSize = size || 4;
31052 $.checkArgument(buf.length <= nMaxNumSize, new Error('script number overflow'));
31053 if (fRequireMinimal && buf.length > 0) {
31054 // Check that the number is encoded with the minimum possible
31055 // number of bytes.
31056 //
31057 // If the most-significant-byte - excluding the sign bit - is zero
31058 // then we're not minimal. Note how this test also rejects the
31059 // negative-zero encoding, 0x80.
31060 if ((buf[buf.length - 1] & 0x7f) === 0) {
31061 // One exception: if there's more than one byte and the most
31062 // significant bit of the second-most-significant-byte is set
31063 // it would conflict with the sign bit. An example of this case
31064 // is +-255, which encode to 0xff00 and 0xff80 respectively.
31065 // (big-endian).
31066 if (buf.length <= 1 || (buf[buf.length - 2] & 0x80) === 0) {
31067 throw new Error('non-minimally encoded script number');
31068 }
31069 }
31070 }
31071 return BN.fromSM(buf, {
31072 endian: 'little'
31073 });
31074};
31075
31076/**
31077 * The corollary to the above, with the notable exception that we do not throw
31078 * an error if the output is larger than four bytes. (Which can happen if
31079 * performing a numerical operation that results in an overflow to more than 4
31080 * bytes).
31081 */
31082BN.prototype.toScriptNumBuffer = function() {
31083 return this.toSM({
31084 endian: 'little'
31085 });
31086};
31087
31088BN.trim = function(buf, natlen) {
31089 return buf.slice(natlen - buf.length, buf.length);
31090};
31091
31092BN.pad = function(buf, natlen, size) {
31093 var rbuf = Buffer.alloc(size);
31094 for (var i = 0; i < buf.length; i++) {
31095 rbuf[rbuf.length - 1 - i] = buf[buf.length - 1 - i];
31096 }
31097 for (i = 0; i < size - natlen; i++) {
31098 rbuf[i] = 0;
31099 }
31100 return rbuf;
31101};
31102
31103module.exports = BN;
31104
31105}).call(this,require("buffer").Buffer)
31106},{"../util/preconditions":310,"bn.js":108,"buffer":146,"lodash":311}],272:[function(require,module,exports){
31107(function (Buffer){
31108'use strict';
31109
31110var BN = require('./bn');
31111var Point = require('./point');
31112var Signature = require('./signature');
31113var PublicKey = require('../publickey');
31114var Random = require('./random');
31115var Hash = require('./hash');
31116var BufferUtil = require('../util/buffer');
31117var _ = require('lodash');
31118var $ = require('../util/preconditions');
31119
31120var ECDSA = function ECDSA(obj) {
31121 if (!(this instanceof ECDSA)) {
31122 return new ECDSA(obj);
31123 }
31124 if (obj) {
31125 this.set(obj);
31126 }
31127};
31128
31129/* jshint maxcomplexity: 9 */
31130ECDSA.prototype.set = function(obj) {
31131 this.hashbuf = obj.hashbuf || this.hashbuf;
31132 this.endian = obj.endian || this.endian; //the endianness of hashbuf
31133 this.privkey = obj.privkey || this.privkey;
31134 this.pubkey = obj.pubkey || (this.privkey ? this.privkey.publicKey : this.pubkey);
31135 this.sig = obj.sig || this.sig;
31136 this.k = obj.k || this.k;
31137 this.verified = obj.verified || this.verified;
31138 return this;
31139};
31140
31141ECDSA.prototype.privkey2pubkey = function() {
31142 this.pubkey = this.privkey.toPublicKey();
31143};
31144
31145ECDSA.prototype.calci = function() {
31146 for (var i = 0; i < 4; i++) {
31147 this.sig.i = i;
31148 var Qprime;
31149 try {
31150 Qprime = this.toPublicKey();
31151 } catch (e) {
31152 console.error(e);
31153 continue;
31154 }
31155
31156 if (Qprime.point.eq(this.pubkey.point)) {
31157 this.sig.compressed = this.pubkey.compressed;
31158 return this;
31159 }
31160 }
31161
31162 this.sig.i = undefined;
31163 throw new Error('Unable to find valid recovery factor');
31164};
31165
31166ECDSA.fromString = function(str) {
31167 var obj = JSON.parse(str);
31168 return new ECDSA(obj);
31169};
31170
31171ECDSA.prototype.randomK = function() {
31172 var N = Point.getN();
31173 var k;
31174 do {
31175 k = BN.fromBuffer(Random.getRandomBuffer(32));
31176 } while (!(k.lt(N) && k.gt(BN.Zero)));
31177 this.k = k;
31178 return this;
31179};
31180
31181
31182// https://tools.ietf.org/html/rfc6979#section-3.2
31183ECDSA.prototype.deterministicK = function(badrs) {
31184 /* jshint maxstatements: 25 */
31185 // if r or s were invalid when this function was used in signing,
31186 // we do not want to actually compute r, s here for efficiency, so,
31187 // we can increment badrs. explained at end of RFC 6979 section 3.2
31188 if (_.isUndefined(badrs)) {
31189 badrs = 0;
31190 }
31191 var v = Buffer.alloc(32);
31192 v.fill(0x01);
31193 var k = Buffer.alloc(32);
31194 k.fill(0x00);
31195 var x = this.privkey.bn.toBuffer({
31196 size: 32
31197 });
31198 var hashbuf = this.endian === 'little' ? BufferUtil.reverse(this.hashbuf) : this.hashbuf
31199 k = Hash.sha256hmac(Buffer.concat([v, Buffer.from([0x00]), x, hashbuf]), k);
31200 v = Hash.sha256hmac(v, k);
31201 k = Hash.sha256hmac(Buffer.concat([v, Buffer.from([0x01]), x, hashbuf]), k);
31202 v = Hash.sha256hmac(v, k);
31203 v = Hash.sha256hmac(v, k);
31204 var T = BN.fromBuffer(v);
31205 var N = Point.getN();
31206
31207 // also explained in 3.2, we must ensure T is in the proper range (0, N)
31208 for (var i = 0; i < badrs || !(T.lt(N) && T.gt(BN.Zero)); i++) {
31209 k = Hash.sha256hmac(Buffer.concat([v, Buffer.from([0x00])]), k);
31210 v = Hash.sha256hmac(v, k);
31211 v = Hash.sha256hmac(v, k);
31212 T = BN.fromBuffer(v);
31213 }
31214
31215 this.k = T;
31216 return this;
31217};
31218
31219// Information about public key recovery:
31220// https://bitcointalk.org/index.php?topic=6430.0
31221// http://stackoverflow.com/questions/19665491/how-do-i-get-an-ecdsa-public-key-from-just-a-bitcoin-signature-sec1-4-1-6-k
31222ECDSA.prototype.toPublicKey = function() {
31223 /* jshint maxstatements: 25 */
31224 var i = this.sig.i;
31225 $.checkArgument(i === 0 || i === 1 || i === 2 || i === 3, new Error('i must be equal to 0, 1, 2, or 3'));
31226
31227 var e = BN.fromBuffer(this.hashbuf);
31228 var r = this.sig.r;
31229 var s = this.sig.s;
31230
31231 // A set LSB signifies that the y-coordinate is odd
31232 var isYOdd = i & 1;
31233
31234 // The more significant bit specifies whether we should use the
31235 // first or second candidate key.
31236 var isSecondKey = i >> 1;
31237
31238 var n = Point.getN();
31239 var G = Point.getG();
31240
31241 // 1.1 Let x = r + jn
31242 var x = isSecondKey ? r.add(n) : r;
31243 var R = Point.fromX(isYOdd, x);
31244
31245 // 1.4 Check that nR is at infinity
31246 var nR = R.mul(n);
31247
31248 if (!nR.isInfinity()) {
31249 throw new Error('nR is not a valid curve point');
31250 }
31251
31252 // Compute -e from e
31253 var eNeg = e.neg().umod(n);
31254
31255 // 1.6.1 Compute Q = r^-1 (sR - eG)
31256 // Q = r^-1 (sR + -eG)
31257 var rInv = r.invm(n);
31258
31259 //var Q = R.multiplyTwo(s, G, eNeg).mul(rInv);
31260 var Q = R.mul(s).add(G.mul(eNeg)).mul(rInv);
31261
31262 var pubkey = PublicKey.fromPoint(Q, this.sig.compressed);
31263
31264 return pubkey;
31265};
31266
31267ECDSA.prototype.sigError = function() {
31268 /* jshint maxstatements: 25 */
31269 if (!BufferUtil.isBuffer(this.hashbuf) || this.hashbuf.length !== 32) {
31270 return 'hashbuf must be a 32 byte buffer';
31271 }
31272
31273 var r = this.sig.r;
31274 var s = this.sig.s;
31275 if (!(r.gt(BN.Zero) && r.lt(Point.getN())) || !(s.gt(BN.Zero) && s.lt(Point.getN()))) {
31276 return 'r and s not in range';
31277 }
31278
31279 var e = BN.fromBuffer(this.hashbuf, this.endian ? {
31280 endian: this.endian
31281 } : undefined);
31282 var n = Point.getN();
31283 var sinv = s.invm(n);
31284 var u1 = sinv.mul(e).umod(n);
31285 var u2 = sinv.mul(r).umod(n);
31286
31287 var p = Point.getG().mulAdd(u1, this.pubkey.point, u2);
31288 if (p.isInfinity()) {
31289 return 'p is infinity';
31290 }
31291
31292 if (p.getX().umod(n).cmp(r) !== 0) {
31293 return 'Invalid signature';
31294 } else {
31295 return false;
31296 }
31297};
31298
31299ECDSA.toLowS = function(s) {
31300 //enforce low s
31301 //see BIP 62, "low S values in signatures"
31302 if (s.gt(BN.fromBuffer(Buffer.from('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0', 'hex')))) {
31303 s = Point.getN().sub(s);
31304 }
31305 return s;
31306};
31307
31308ECDSA.prototype._findSignature = function(d, e) {
31309 var N = Point.getN();
31310 var G = Point.getG();
31311 // try different values of k until r, s are valid
31312 var badrs = 0;
31313 var k, Q, r, s;
31314 do {
31315 if (!this.k || badrs > 0) {
31316 this.deterministicK(badrs);
31317 }
31318 badrs++;
31319 k = this.k;
31320 Q = G.mul(k);
31321 r = Q.x.umod(N);
31322 s = k.invm(N).mul(e.add(d.mul(r))).umod(N);
31323 } while (r.cmp(BN.Zero) <= 0 || s.cmp(BN.Zero) <= 0);
31324
31325 s = ECDSA.toLowS(s);
31326 return {
31327 s: s,
31328 r: r
31329 };
31330
31331};
31332
31333ECDSA.prototype.sign = function() {
31334 var hashbuf = this.hashbuf;
31335 var privkey = this.privkey;
31336 var d = privkey.bn;
31337
31338 $.checkState(hashbuf && privkey && d, new Error('invalid parameters'));
31339 $.checkState(BufferUtil.isBuffer(hashbuf) && hashbuf.length === 32, new Error('hashbuf must be a 32 byte buffer'));
31340
31341 var e = BN.fromBuffer(hashbuf, this.endian ? {
31342 endian: this.endian
31343 } : undefined);
31344
31345 var obj = this._findSignature(d, e);
31346 obj.compressed = this.pubkey.compressed;
31347
31348 this.sig = new Signature(obj);
31349 return this;
31350};
31351
31352ECDSA.prototype.signRandomK = function() {
31353 this.randomK();
31354 return this.sign();
31355};
31356
31357ECDSA.prototype.toString = function() {
31358 var obj = {};
31359 if (this.hashbuf) {
31360 obj.hashbuf = this.hashbuf.toString('hex');
31361 }
31362 if (this.privkey) {
31363 obj.privkey = this.privkey.toString();
31364 }
31365 if (this.pubkey) {
31366 obj.pubkey = this.pubkey.toString();
31367 }
31368 if (this.sig) {
31369 obj.sig = this.sig.toString();
31370 }
31371 if (this.k) {
31372 obj.k = this.k.toString();
31373 }
31374 return JSON.stringify(obj);
31375};
31376
31377ECDSA.prototype.verify = function() {
31378 if (!this.sigError()) {
31379 this.verified = true;
31380 } else {
31381 this.verified = false;
31382 }
31383 return this;
31384};
31385
31386ECDSA.sign = function(hashbuf, privkey, endian) {
31387 return ECDSA().set({
31388 hashbuf: hashbuf,
31389 endian: endian,
31390 privkey: privkey
31391 }).sign().sig;
31392};
31393
31394ECDSA.verify = function(hashbuf, sig, pubkey, endian) {
31395 return ECDSA().set({
31396 hashbuf: hashbuf,
31397 endian: endian,
31398 sig: sig,
31399 pubkey: pubkey
31400 }).verify().verified;
31401};
31402
31403module.exports = ECDSA;
31404
31405}).call(this,require("buffer").Buffer)
31406},{"../publickey":289,"../util/buffer":308,"../util/preconditions":310,"./bn":271,"./hash":273,"./point":274,"./random":275,"./signature":276,"buffer":146,"lodash":311}],273:[function(require,module,exports){
31407(function (Buffer){
31408'use strict';
31409
31410var crypto = require('crypto');
31411var BufferUtil = require('../util/buffer');
31412var $ = require('../util/preconditions');
31413
31414var Hash = module.exports;
31415
31416Hash.sha1 = function(buf) {
31417 $.checkArgument(BufferUtil.isBuffer(buf));
31418 return crypto.createHash('sha1').update(buf).digest();
31419};
31420
31421Hash.sha1.blocksize = 512;
31422
31423Hash.sha256 = function(buf) {
31424 $.checkArgument(BufferUtil.isBuffer(buf));
31425 return crypto.createHash('sha256').update(buf).digest();
31426};
31427
31428Hash.sha256.blocksize = 512;
31429
31430Hash.sha256sha256 = function(buf) {
31431 $.checkArgument(BufferUtil.isBuffer(buf));
31432 return Hash.sha256(Hash.sha256(buf));
31433};
31434
31435Hash.ripemd160 = function(buf) {
31436 $.checkArgument(BufferUtil.isBuffer(buf));
31437 return crypto.createHash('ripemd160').update(buf).digest();
31438};
31439
31440Hash.sha256ripemd160 = function(buf) {
31441 $.checkArgument(BufferUtil.isBuffer(buf));
31442 return Hash.ripemd160(Hash.sha256(buf));
31443};
31444
31445Hash.sha512 = function(buf) {
31446 $.checkArgument(BufferUtil.isBuffer(buf));
31447 return crypto.createHash('sha512').update(buf).digest();
31448};
31449
31450Hash.sha512.blocksize = 1024;
31451
31452Hash.hmac = function(hashf, data, key) {
31453 //http://en.wikipedia.org/wiki/Hash-based_message_authentication_code
31454 //http://tools.ietf.org/html/rfc4868#section-2
31455 $.checkArgument(BufferUtil.isBuffer(data));
31456 $.checkArgument(BufferUtil.isBuffer(key));
31457 $.checkArgument(hashf.blocksize);
31458
31459 var blocksize = hashf.blocksize / 8;
31460
31461 if (key.length > blocksize) {
31462 key = hashf(key);
31463 } else if (key < blocksize) {
31464 var fill = Buffer.alloc(blocksize);
31465 fill.fill(0);
31466 key.copy(fill);
31467 key = fill;
31468 }
31469
31470 var o_key = Buffer.alloc(blocksize);
31471 o_key.fill(0x5c);
31472
31473 var i_key = Buffer.alloc(blocksize);
31474 i_key.fill(0x36);
31475
31476 var o_key_pad = Buffer.alloc(blocksize);
31477 var i_key_pad = Buffer.alloc(blocksize);
31478 for (var i = 0; i < blocksize; i++) {
31479 o_key_pad[i] = o_key[i] ^ key[i];
31480 i_key_pad[i] = i_key[i] ^ key[i];
31481 }
31482
31483 return hashf(Buffer.concat([o_key_pad, hashf(Buffer.concat([i_key_pad, data]))]));
31484};
31485
31486Hash.sha256hmac = function(data, key) {
31487 return Hash.hmac(Hash.sha256, data, key);
31488};
31489
31490Hash.sha512hmac = function(data, key) {
31491 return Hash.hmac(Hash.sha512, data, key);
31492};
31493
31494}).call(this,require("buffer").Buffer)
31495},{"../util/buffer":308,"../util/preconditions":310,"buffer":146,"crypto":243}],274:[function(require,module,exports){
31496(function (Buffer){
31497'use strict'
31498
31499var BN = require('./bn')
31500var BufferUtil = require('../util/buffer')
31501
31502var EC = require('elliptic').ec
31503var ec = new EC('p256')
31504var ecPoint = ec.curve.point.bind(ec.curve)
31505var ecPointFromX = ec.curve.pointFromX.bind(ec.curve)
31506
31507/**
31508 *
31509 * Instantiate a valid secp256k1 Point from the X and Y coordinates.
31510 *
31511 * @param {BN|String} x - The X coordinate
31512 * @param {BN|String} y - The Y coordinate
31513 * @link https://github.com/indutny/elliptic
31514 * @augments elliptic.curve.point
31515 * @throws {Error} A validation error if exists
31516 * @returns {Point} An instance of Point
31517 * @constructor
31518 */
31519var Point = function Point(x, y, isRed) {
31520 try {
31521 var point = ecPoint(x, y, isRed)
31522 } catch (e) {
31523 throw new Error('Invalid Point')
31524 }
31525 point.validate()
31526 return point
31527}
31528
31529Point.prototype = Object.getPrototypeOf(ec.curve.point())
31530
31531/**
31532 *
31533 * Instantiate a valid secp256k1 Point from only the X coordinate
31534 *
31535 * @param {boolean} odd - If the Y coordinate is odd
31536 * @param {BN|String} x - The X coordinate
31537 * @throws {Error} A validation error if exists
31538 * @returns {Point} An instance of Point
31539 */
31540Point.fromX = function fromX(odd, x) {
31541 try {
31542 var point = ecPointFromX(x, odd)
31543 } catch (e) {
31544 throw new Error('Invalid X')
31545 }
31546 point.validate()
31547 return point
31548}
31549
31550/**
31551 *
31552 * Will return a secp256k1 ECDSA base point.
31553 *
31554 * @link https://en.bitcoin.it/wiki/Secp256k1
31555 * @returns {Point} An instance of the base point.
31556 */
31557Point.getG = function getG() {
31558 return ec.curve.g
31559}
31560
31561/**
31562 *
31563 * Will return the max of range of valid private keys as governed by the secp256k1 ECDSA standard.
31564 *
31565 * @link https://en.bitcoin.it/wiki/Private_key#Range_of_valid_ECDSA_private_keys
31566 * @returns {BN} A BN instance of the number of points on the curve
31567 */
31568Point.getN = function getN() {
31569 return new BN(ec.curve.n.toArray())
31570}
31571
31572Point.prototype._getX = Point.prototype.getX
31573
31574/**
31575 *
31576 * Will return the X coordinate of the Point
31577 *
31578 * @returns {BN} A BN instance of the X coordinate
31579 */
31580Point.prototype.getX = function getX() {
31581 return new BN(this._getX().toArray())
31582}
31583
31584Point.prototype._getY = Point.prototype.getY
31585
31586/**
31587 *
31588 * Will return the Y coordinate of the Point
31589 *
31590 * @returns {BN} A BN instance of the Y coordinate
31591 */
31592Point.prototype.getY = function getY() {
31593 return new BN(this._getY().toArray())
31594}
31595
31596/**
31597 *
31598 * Will determine if the point is valid
31599 *
31600 * @link https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf
31601 * @param {Point} An instance of Point
31602 * @throws {Error} A validation error if exists
31603 * @returns {Point} An instance of the same Point
31604 */
31605Point.prototype.validate = function validate() {
31606 if (this.isInfinity()) {
31607 throw new Error('Point cannot be equal to Infinity')
31608 }
31609
31610 var p2
31611 try {
31612 p2 = ecPointFromX(this.getX(), this.getY().isOdd())
31613 } catch (e) {
31614 throw new Error('Point does not lie on the curve')
31615 }
31616
31617 if (p2.y.cmp(this.y) !== 0) {
31618 throw new Error('Invalid y value for curve.')
31619 }
31620
31621 //todo: needs test case
31622 if (!this.mul(Point.getN()).isInfinity()) {
31623 throw new Error('Point times N must be infinity')
31624 }
31625
31626 return this
31627}
31628
31629Point.pointToCompressed = function pointToCompressed(point) {
31630 var xbuf = point.getX().toBuffer({ size: 32 })
31631 var ybuf = point.getY().toBuffer({ size: 32 })
31632
31633 var prefix
31634 var odd = ybuf[ybuf.length - 1] % 2
31635 if (odd) {
31636 prefix = Buffer.from([0x03])
31637 } else {
31638 prefix = Buffer.from([0x02])
31639 }
31640 return BufferUtil.concat([prefix, xbuf])
31641}
31642
31643module.exports = Point
31644
31645}).call(this,require("buffer").Buffer)
31646},{"../util/buffer":308,"./bn":271,"buffer":146,"elliptic":317}],275:[function(require,module,exports){
31647(function (process,Buffer){
31648'use strict';
31649
31650function Random() {
31651}
31652
31653/* secure random bytes that sometimes throws an error due to lack of entropy */
31654Random.getRandomBuffer = function(size) {
31655 if (process.browser)
31656 return Random.getRandomBufferBrowser(size);
31657 else
31658 return Random.getRandomBufferNode(size);
31659};
31660
31661Random.getRandomBufferNode = function(size) {
31662 var crypto = require('crypto');
31663 return crypto.randomBytes(size);
31664};
31665
31666Random.getRandomBufferBrowser = function(size) {
31667 if (!window.crypto && !window.msCrypto)
31668 throw new Error('window.crypto not available');
31669
31670 if (window.crypto && window.crypto.getRandomValues)
31671 var crypto = window.crypto;
31672 else if (window.msCrypto && window.msCrypto.getRandomValues) //internet explorer
31673 var crypto = window.msCrypto;
31674 else
31675 throw new Error('window.crypto.getRandomValues not available');
31676
31677 var bbuf = new Uint8Array(size);
31678 crypto.getRandomValues(bbuf);
31679 var buf = Buffer.from(bbuf);
31680
31681 return buf;
31682};
31683
31684/* insecure random bytes, but it never fails */
31685Random.getPseudoRandomBuffer = function(size) {
31686 var b32 = 0x100000000;
31687 var b = Buffer.alloc(size);
31688 var r;
31689
31690 for (var i = 0; i <= size; i++) {
31691 var j = Math.floor(i / 4);
31692 var k = i - j * 4;
31693 if (k === 0) {
31694 r = Math.random() * b32;
31695 b[i] = r & 0xff;
31696 } else {
31697 b[i] = (r = r >>> 8) & 0xff;
31698 }
31699 }
31700
31701 return b;
31702};
31703
31704module.exports = Random;
31705
31706}).call(this,require('_process'),require("buffer").Buffer)
31707},{"_process":678,"buffer":146,"crypto":243}],276:[function(require,module,exports){
31708(function (Buffer){
31709'use strict';
31710
31711var BN = require('./bn');
31712var _ = require('lodash');
31713var $ = require('../util/preconditions');
31714var BufferUtil = require('../util/buffer');
31715var JSUtil = require('../util/js');
31716
31717var Signature = function Signature(r, s) {
31718 if (!(this instanceof Signature)) {
31719 return new Signature(r, s);
31720 }
31721 if (r instanceof BN) {
31722 this.set({
31723 r: r,
31724 s: s
31725 });
31726 } else if (r) {
31727 var obj = r;
31728 this.set(obj);
31729 }
31730};
31731
31732/* jshint maxcomplexity: 7 */
31733Signature.prototype.set = function(obj) {
31734 this.r = obj.r || this.r || undefined;
31735 this.s = obj.s || this.s || undefined;
31736
31737 this.i = typeof obj.i !== 'undefined' ? obj.i : this.i; //public key recovery parameter in range [0, 3]
31738 this.compressed = typeof obj.compressed !== 'undefined' ?
31739 obj.compressed : this.compressed; //whether the recovered pubkey is compressed
31740 this.nhashtype = obj.nhashtype || this.nhashtype || undefined;
31741 return this;
31742};
31743
31744Signature.fromCompact = function(buf) {
31745 $.checkArgument(BufferUtil.isBuffer(buf), 'Argument is expected to be a Buffer');
31746
31747 var sig = new Signature();
31748
31749 var compressed = true;
31750 var i = buf.slice(0, 1)[0] - 27 - 4;
31751 if (i < 0) {
31752 compressed = false;
31753 i = i + 4;
31754 }
31755
31756 var b2 = buf.slice(1, 33);
31757 var b3 = buf.slice(33, 65);
31758
31759 $.checkArgument(i === 0 || i === 1 || i === 2 || i === 3, new Error('i must be 0, 1, 2, or 3'));
31760 $.checkArgument(b2.length === 32, new Error('r must be 32 bytes'));
31761 $.checkArgument(b3.length === 32, new Error('s must be 32 bytes'));
31762
31763 sig.compressed = compressed;
31764 sig.i = i;
31765 sig.r = BN.fromBuffer(b2);
31766 sig.s = BN.fromBuffer(b3);
31767
31768 return sig;
31769};
31770
31771Signature.fromDER = Signature.fromBuffer = function(buf, strict) {
31772 var obj = Signature.parseDER(buf, strict);
31773 var sig = new Signature();
31774
31775 sig.r = obj.r;
31776 sig.s = obj.s;
31777
31778 return sig;
31779};
31780
31781// The format used in a tx
31782Signature.fromTxFormat = function(buf) {
31783 var nhashtype = buf.readUInt8(buf.length - 1);
31784 var derbuf = buf.slice(0, buf.length - 1);
31785 var sig = new Signature.fromDER(derbuf, false);
31786 sig.nhashtype = nhashtype;
31787 return sig;
31788};
31789
31790Signature.fromString = function(str) {
31791 var buf = Buffer.from(str, 'hex');
31792 return Signature.fromDER(buf);
31793};
31794
31795
31796/**
31797 * In order to mimic the non-strict DER encoding of OpenSSL, set strict = false.
31798 */
31799Signature.parseDER = function(buf, strict) {
31800 $.checkArgument(BufferUtil.isBuffer(buf), new Error('DER formatted signature should be a buffer'));
31801 if (_.isUndefined(strict)) {
31802 strict = true;
31803 }
31804
31805 var header = buf[0];
31806 $.checkArgument(header === 0x30, new Error('Header byte should be 0x30'));
31807
31808 var length = buf[1];
31809 var buflength = buf.slice(2).length;
31810 $.checkArgument(!strict || length === buflength, new Error('Length byte should length of what follows'));
31811
31812 length = length < buflength ? length : buflength;
31813
31814 var rheader = buf[2 + 0];
31815 $.checkArgument(rheader === 0x02, new Error('Integer byte for r should be 0x02'));
31816
31817 var rlength = buf[2 + 1];
31818 var rbuf = buf.slice(2 + 2, 2 + 2 + rlength);
31819 var r = BN.fromBuffer(rbuf);
31820 var rneg = buf[2 + 1 + 1] === 0x00 ? true : false;
31821 $.checkArgument(rlength === rbuf.length, new Error('Length of r incorrect'));
31822
31823 var sheader = buf[2 + 2 + rlength + 0];
31824 $.checkArgument(sheader === 0x02, new Error('Integer byte for s should be 0x02'));
31825
31826 var slength = buf[2 + 2 + rlength + 1];
31827 var sbuf = buf.slice(2 + 2 + rlength + 2, 2 + 2 + rlength + 2 + slength);
31828 var s = BN.fromBuffer(sbuf);
31829 var sneg = buf[2 + 2 + rlength + 2 + 2] === 0x00 ? true : false;
31830 $.checkArgument(slength === sbuf.length, new Error('Length of s incorrect'));
31831
31832 var sumlength = 2 + 2 + rlength + 2 + slength;
31833 $.checkArgument(length === sumlength - 2, new Error('Length of signature incorrect'));
31834
31835 var obj = {
31836 header: header,
31837 length: length,
31838 rheader: rheader,
31839 rlength: rlength,
31840 rneg: rneg,
31841 rbuf: rbuf,
31842 r: r,
31843 sheader: sheader,
31844 slength: slength,
31845 sneg: sneg,
31846 sbuf: sbuf,
31847 s: s
31848 };
31849
31850 return obj;
31851};
31852
31853
31854Signature.prototype.toCompact = function(i, compressed) {
31855 i = typeof i === 'number' ? i : this.i;
31856 compressed = typeof compressed === 'boolean' ? compressed : this.compressed;
31857
31858 if (!(i === 0 || i === 1 || i === 2 || i === 3)) {
31859 throw new Error('i must be equal to 0, 1, 2, or 3');
31860 }
31861
31862 var val = i + 27 + 4;
31863 if (compressed === false) {
31864 val = val - 4;
31865 }
31866 var b1 = Buffer.from([val]);
31867 var b2 = this.r.toBuffer({
31868 size: 32
31869 });
31870 var b3 = this.s.toBuffer({
31871 size: 32
31872 });
31873 return Buffer.concat([b1, b2, b3]);
31874};
31875
31876Signature.prototype.toBuffer = Signature.prototype.toDER = function() {
31877 var rnbuf = this.r.toBuffer();
31878 var snbuf = this.s.toBuffer();
31879
31880 var rneg = rnbuf[0] & 0x80 ? true : false;
31881 var sneg = snbuf[0] & 0x80 ? true : false;
31882
31883 var rbuf = rneg ? Buffer.concat([Buffer.from([0x00]), rnbuf]) : rnbuf;
31884 var sbuf = sneg ? Buffer.concat([Buffer.from([0x00]), snbuf]) : snbuf;
31885
31886 var rlength = rbuf.length;
31887 var slength = sbuf.length;
31888 var length = 2 + rlength + 2 + slength;
31889 var rheader = 0x02;
31890 var sheader = 0x02;
31891 var header = 0x30;
31892
31893 var der = Buffer.concat([Buffer.from([header, length, rheader, rlength]), rbuf, Buffer.from([sheader, slength]), sbuf]);
31894 return der;
31895};
31896
31897Signature.prototype.toString = function() {
31898 var buf = this.toDER();
31899 return buf.toString('hex');
31900};
31901
31902/**
31903 * This function is translated from bitcoind's IsDERSignature and is used in
31904 * the script interpreter. This "DER" format actually includes an extra byte,
31905 * the nhashtype, at the end. It is really the tx format, not DER format.
31906 *
31907 * A canonical signature exists of: [30] [total len] [02] [len R] [R] [02] [len S] [S] [hashtype]
31908 * Where R and S are not negative (their first byte has its highest bit not set), and not
31909 * excessively padded (do not start with a 0 byte, unless an otherwise negative number follows,
31910 * in which case a single 0 byte is necessary and even required).
31911 *
31912 * See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
31913 */
31914Signature.isTxDER = function(buf) {
31915 if (buf.length < 9) {
31916 // Non-canonical signature: too short
31917 return false;
31918 }
31919 if (buf.length > 73) {
31920 // Non-canonical signature: too long
31921 return false;
31922 }
31923 if (buf[0] !== 0x30) {
31924 // Non-canonical signature: wrong type
31925 return false;
31926 }
31927 if (buf[1] !== buf.length - 3) {
31928 // Non-canonical signature: wrong length marker
31929 return false;
31930 }
31931 var nLenR = buf[3];
31932 if (5 + nLenR >= buf.length) {
31933 // Non-canonical signature: S length misplaced
31934 return false;
31935 }
31936 var nLenS = buf[5 + nLenR];
31937 if ((nLenR + nLenS + 7) !== buf.length) {
31938 // Non-canonical signature: R+S length mismatch
31939 return false;
31940 }
31941
31942 var R = buf.slice(4);
31943 if (buf[4 - 2] !== 0x02) {
31944 // Non-canonical signature: R value type mismatch
31945 return false;
31946 }
31947 if (nLenR === 0) {
31948 // Non-canonical signature: R length is zero
31949 return false;
31950 }
31951 if (R[0] & 0x80) {
31952 // Non-canonical signature: R value negative
31953 return false;
31954 }
31955 if (nLenR > 1 && (R[0] === 0x00) && !(R[1] & 0x80)) {
31956 // Non-canonical signature: R value excessively padded
31957 return false;
31958 }
31959
31960 var S = buf.slice(6 + nLenR);
31961 if (buf[6 + nLenR - 2] !== 0x02) {
31962 // Non-canonical signature: S value type mismatch
31963 return false;
31964 }
31965 if (nLenS === 0) {
31966 // Non-canonical signature: S length is zero
31967 return false;
31968 }
31969 if (S[0] & 0x80) {
31970 // Non-canonical signature: S value negative
31971 return false;
31972 }
31973 if (nLenS > 1 && (S[0] === 0x00) && !(S[1] & 0x80)) {
31974 // Non-canonical signature: S value excessively padded
31975 return false;
31976 }
31977 return true;
31978};
31979
31980/**
31981 * Compares to bitcoind's IsLowDERSignature
31982 * See also ECDSA signature algorithm which enforces this.
31983 * See also BIP 62, "low S values in signatures"
31984 */
31985Signature.prototype.hasLowS = function() {
31986 if (this.s.lt(new BN(1)) ||
31987 this.s.gt(new BN('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0', 'hex'))) {
31988 return false;
31989 }
31990 return true;
31991};
31992
31993/**
31994 * @returns true if the nhashtype is exactly equal to one of the standard options or combinations thereof.
31995 * Translated from bitcoind's IsDefinedHashtypeSignature
31996 */
31997Signature.prototype.hasDefinedHashtype = function() {
31998 if (!JSUtil.isNaturalNumber(this.nhashtype)) {
31999 return false;
32000 }
32001 // accept with or without Signature.SIGHASH_ANYONECANPAY by ignoring the bit
32002 var temp = this.nhashtype & ~Signature.SIGHASH_ANYONECANPAY;
32003 if (temp < Signature.SIGHASH_ALL || temp > Signature.SIGHASH_SINGLE) {
32004 return false;
32005 }
32006 return true;
32007};
32008
32009Signature.prototype.toTxFormat = function() {
32010 var derbuf = this.toDER();
32011 var buf = Buffer.alloc(1);
32012 buf.writeUInt8(this.nhashtype, 0);
32013 return Buffer.concat([derbuf, buf]);
32014};
32015
32016Signature.SIGHASH_ALL = 0x01;
32017Signature.SIGHASH_NONE = 0x02;
32018Signature.SIGHASH_SINGLE = 0x03;
32019Signature.SIGHASH_ANYONECANPAY = 0x80;
32020
32021module.exports = Signature;
32022
32023}).call(this,require("buffer").Buffer)
32024},{"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"./bn":271,"buffer":146,"lodash":311}],277:[function(require,module,exports){
32025(function (Buffer){
32026'use strict';
32027
32028var _ = require('lodash');
32029var bs58 = require('bs58');
32030var buffer = require('buffer');
32031
32032var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'.split('');
32033
32034var Base58 = function Base58(obj) {
32035 /* jshint maxcomplexity: 8 */
32036 if (!(this instanceof Base58)) {
32037 return new Base58(obj);
32038 }
32039 if (Buffer.isBuffer(obj)) {
32040 var buf = obj;
32041 this.fromBuffer(buf);
32042 } else if (typeof obj === 'string') {
32043 var str = obj;
32044 this.fromString(str);
32045 } else if (obj) {
32046 this.set(obj);
32047 }
32048};
32049
32050Base58.validCharacters = function validCharacters(chars) {
32051 if (buffer.Buffer.isBuffer(chars)) {
32052 chars = chars.toString();
32053 }
32054 return _.every(_.map(chars, function(char) { return _.includes(ALPHABET, char); }));
32055};
32056
32057Base58.prototype.set = function(obj) {
32058 this.buf = obj.buf || this.buf || undefined;
32059 return this;
32060};
32061
32062Base58.encode = function(buf) {
32063 if (!buffer.Buffer.isBuffer(buf)) {
32064 throw new Error('Input should be a buffer');
32065 }
32066 return bs58.encode(buf);
32067};
32068
32069Base58.decode = function(str) {
32070 if (typeof str !== 'string') {
32071 throw new Error('Input should be a string');
32072 }
32073 return Buffer.from(bs58.decode(str));
32074};
32075
32076Base58.prototype.fromBuffer = function(buf) {
32077 this.buf = buf;
32078 return this;
32079};
32080
32081Base58.prototype.fromString = function(str) {
32082 var buf = Base58.decode(str);
32083 this.buf = buf;
32084 return this;
32085};
32086
32087Base58.prototype.toBuffer = function() {
32088 return this.buf;
32089};
32090
32091Base58.prototype.toString = function() {
32092 return Base58.encode(this.buf);
32093};
32094
32095module.exports = Base58;
32096
32097}).call(this,require("buffer").Buffer)
32098},{"bs58":138,"buffer":146,"lodash":311}],278:[function(require,module,exports){
32099(function (Buffer){
32100'use strict';
32101
32102var _ = require('lodash');
32103var Base58 = require('./base58');
32104var buffer = require('buffer');
32105var sha256sha256 = require('../crypto/hash').sha256sha256;
32106
32107var Base58Check = function Base58Check(obj) {
32108 if (!(this instanceof Base58Check))
32109 return new Base58Check(obj);
32110 if (Buffer.isBuffer(obj)) {
32111 var buf = obj;
32112 this.fromBuffer(buf);
32113 } else if (typeof obj === 'string') {
32114 var str = obj;
32115 this.fromString(str);
32116 } else if (obj) {
32117 this.set(obj);
32118 }
32119};
32120
32121Base58Check.prototype.set = function(obj) {
32122 this.buf = obj.buf || this.buf || undefined;
32123 return this;
32124};
32125
32126Base58Check.validChecksum = function validChecksum(data, checksum) {
32127 if (_.isString(data)) {
32128 data = new buffer.Buffer(Base58.decode(data));
32129 }
32130 if (_.isString(checksum)) {
32131 checksum = new buffer.Buffer(Base58.decode(checksum));
32132 }
32133 if (!checksum) {
32134 checksum = data.slice(-4);
32135 data = data.slice(0, -4);
32136 }
32137 return Base58Check.checksum(data).toString('hex') === checksum.toString('hex');
32138};
32139
32140Base58Check.decode = function(s) {
32141 if (typeof s !== 'string')
32142 throw new Error('Input must be a string');
32143
32144 var buf = Buffer.from(Base58.decode(s));
32145
32146 if (buf.length < 4)
32147 throw new Error("Input string too short");
32148
32149 var data = buf.slice(0, -4);
32150 var csum = buf.slice(-4);
32151
32152 var hash = sha256sha256(data);
32153 var hash4 = hash.slice(0, 4);
32154
32155 if (csum.toString('hex') !== hash4.toString('hex'))
32156 throw new Error("Checksum mismatch");
32157
32158 return data;
32159};
32160
32161Base58Check.checksum = function(buffer) {
32162 return sha256sha256(buffer).slice(0, 4);
32163};
32164
32165Base58Check.encode = function(buf) {
32166 if (!Buffer.isBuffer(buf))
32167 throw new Error('Input must be a buffer');
32168 var checkedBuf = Buffer.alloc(buf.length + 4);
32169 var hash = Base58Check.checksum(buf);
32170 buf.copy(checkedBuf);
32171 hash.copy(checkedBuf, buf.length);
32172 return Base58.encode(checkedBuf);
32173};
32174
32175Base58Check.prototype.fromBuffer = function(buf) {
32176 this.buf = buf;
32177 return this;
32178};
32179
32180Base58Check.prototype.fromString = function(str) {
32181 var buf = Base58Check.decode(str);
32182 this.buf = buf;
32183 return this;
32184};
32185
32186Base58Check.prototype.toBuffer = function() {
32187 return this.buf;
32188};
32189
32190Base58Check.prototype.toString = function() {
32191 return Base58Check.encode(this.buf);
32192};
32193
32194module.exports = Base58Check;
32195
32196}).call(this,require("buffer").Buffer)
32197},{"../crypto/hash":273,"./base58":277,"buffer":146,"lodash":311}],279:[function(require,module,exports){
32198(function (Buffer){
32199'use strict';
32200
32201var _ = require('lodash');
32202var $ = require('../util/preconditions');
32203var BufferUtil = require('../util/buffer');
32204var BN = require('../crypto/bn');
32205
32206var BufferReader = function BufferReader(buf) {
32207 if (!(this instanceof BufferReader)) {
32208 return new BufferReader(buf);
32209 }
32210 if (_.isUndefined(buf)) {
32211 return;
32212 }
32213 if (Buffer.isBuffer(buf)) {
32214 this.set({
32215 buf: buf
32216 });
32217 } else if (_.isString(buf)) {
32218 this.set({
32219 buf: Buffer.from(buf, 'hex'),
32220 });
32221 } else if (_.isObject(buf)) {
32222 var obj = buf;
32223 this.set(obj);
32224 } else {
32225 throw new TypeError('Unrecognized argument for BufferReader');
32226 }
32227};
32228
32229BufferReader.prototype.set = function(obj) {
32230 this.buf = obj.buf || this.buf || undefined;
32231 this.pos = obj.pos || this.pos || 0;
32232 return this;
32233};
32234
32235BufferReader.prototype.eof = function() {
32236 return this.pos >= this.buf.length;
32237};
32238
32239BufferReader.prototype.finished = BufferReader.prototype.eof;
32240
32241BufferReader.prototype.read = function(len) {
32242 $.checkArgument(!_.isUndefined(len), 'Must specify a length');
32243 var buf = this.buf.slice(this.pos, this.pos + len);
32244 this.pos = this.pos + len;
32245 return buf;
32246};
32247
32248BufferReader.prototype.readAll = function() {
32249 var buf = this.buf.slice(this.pos, this.buf.length);
32250 this.pos = this.buf.length;
32251 return buf;
32252};
32253
32254BufferReader.prototype.readUInt8 = function() {
32255 var val = this.buf.readUInt8(this.pos);
32256 this.pos = this.pos + 1;
32257 return val;
32258};
32259
32260BufferReader.prototype.readUInt16BE = function() {
32261 var val = this.buf.readUInt16BE(this.pos);
32262 this.pos = this.pos + 2;
32263 return val;
32264};
32265
32266BufferReader.prototype.readUInt16LE = function() {
32267 var val = this.buf.readUInt16LE(this.pos);
32268 this.pos = this.pos + 2;
32269 return val;
32270};
32271
32272BufferReader.prototype.readUInt32BE = function() {
32273 var val = this.buf.readUInt32BE(this.pos);
32274 this.pos = this.pos + 4;
32275 return val;
32276};
32277
32278BufferReader.prototype.readUInt32LE = function() {
32279 var val = this.buf.readUInt32LE(this.pos);
32280 this.pos = this.pos + 4;
32281 return val;
32282};
32283
32284BufferReader.prototype.readInt32LE = function() {
32285 var val = this.buf.readInt32LE(this.pos);
32286 this.pos = this.pos + 4;
32287 return val;
32288};
32289
32290BufferReader.prototype.readUInt64BEBN = function() {
32291 var buf = this.buf.slice(this.pos, this.pos + 8);
32292 var bn = BN.fromBuffer(buf);
32293 this.pos = this.pos + 8;
32294 return bn;
32295};
32296
32297BufferReader.prototype.readUInt64LEBN = function() {
32298 var second = this.buf.readUInt32LE(this.pos);
32299 var first = this.buf.readUInt32LE(this.pos + 4);
32300 var combined = (first * 0x100000000) + second;
32301 // Instantiating an instance of BN with a number is faster than with an
32302 // array or string. However, the maximum safe number for a double precision
32303 // floating point is 2 ^ 52 - 1 (0x1fffffffffffff), thus we can safely use
32304 // non-floating point numbers less than this amount (52 bits). And in the case
32305 // that the number is larger, we can instatiate an instance of BN by passing
32306 // an array from the buffer (slower) and specifying the endianness.
32307 var bn;
32308 if (combined <= 0x1fffffffffffff) {
32309 bn = new BN(combined);
32310 } else {
32311 var data = Array.prototype.slice.call(this.buf, this.pos, this.pos + 8);
32312 bn = new BN(data, 10, 'le');
32313 }
32314 this.pos = this.pos + 8;
32315 return bn;
32316};
32317
32318BufferReader.prototype.readVarintNum = function() {
32319 var first = this.readUInt8();
32320 switch (first) {
32321 case 0xFD:
32322 return this.readUInt16LE();
32323 case 0xFE:
32324 return this.readUInt32LE();
32325 case 0xFF:
32326 var bn = this.readUInt64LEBN();
32327 var n = bn.toNumber();
32328 if (n <= Math.pow(2, 53)) {
32329 return n;
32330 } else {
32331 throw new Error('number too large to retain precision - use readVarintBN');
32332 }
32333 break;
32334 default:
32335 return first;
32336 }
32337};
32338
32339/**
32340 * reads a length prepended buffer
32341 */
32342BufferReader.prototype.readVarLengthBuffer = function() {
32343 var len = this.readVarintNum();
32344 var buf = this.read(len);
32345 $.checkState(buf.length === len, 'Invalid length while reading varlength buffer. ' +
32346 'Expected to read: ' + len + ' and read ' + buf.length);
32347 return buf;
32348};
32349
32350BufferReader.prototype.readVarintBuf = function() {
32351 var first = this.buf.readUInt8(this.pos);
32352 switch (first) {
32353 case 0xFD:
32354 return this.read(1 + 2);
32355 case 0xFE:
32356 return this.read(1 + 4);
32357 case 0xFF:
32358 return this.read(1 + 8);
32359 default:
32360 return this.read(1);
32361 }
32362};
32363
32364BufferReader.prototype.readVarintBN = function() {
32365 var first = this.readUInt8();
32366 switch (first) {
32367 case 0xFD:
32368 return new BN(this.readUInt16LE());
32369 case 0xFE:
32370 return new BN(this.readUInt32LE());
32371 case 0xFF:
32372 return this.readUInt64LEBN();
32373 default:
32374 return new BN(first);
32375 }
32376};
32377
32378BufferReader.prototype.reverse = function() {
32379 var buf = Buffer.alloc(this.buf.length);
32380 for (var i = 0; i < buf.length; i++) {
32381 buf[i] = this.buf[this.buf.length - 1 - i];
32382 }
32383 this.buf = buf;
32384 return this;
32385};
32386
32387BufferReader.prototype.readReverse = function(len) {
32388 if (_.isUndefined(len)) {
32389 len = this.buf.length;
32390 }
32391 var buf = this.buf.slice(this.pos, this.pos + len);
32392 this.pos = this.pos + len;
32393 return BufferUtil.reverse(buf);
32394};
32395
32396module.exports = BufferReader;
32397
32398}).call(this,require("buffer").Buffer)
32399},{"../crypto/bn":271,"../util/buffer":308,"../util/preconditions":310,"buffer":146,"lodash":311}],280:[function(require,module,exports){
32400(function (Buffer){
32401'use strict';
32402
32403var bufferUtil = require('../util/buffer');
32404var assert = require('assert');
32405
32406var BufferWriter = function BufferWriter(obj) {
32407 if (!(this instanceof BufferWriter))
32408 return new BufferWriter(obj);
32409 this.bufLen = 0;
32410 if (obj)
32411 this.set(obj);
32412 else
32413 this.bufs = [];
32414};
32415
32416BufferWriter.prototype.set = function(obj) {
32417 this.bufs = obj.bufs || this.bufs || [];
32418 this.bufLen = this.bufs.reduce(function(prev, buf){ return prev + buf.length; }, 0);
32419 return this;
32420};
32421
32422BufferWriter.prototype.toBuffer = function() {
32423 return this.concat();
32424};
32425
32426BufferWriter.prototype.concat = function() {
32427 return Buffer.concat(this.bufs, this.bufLen);
32428};
32429
32430BufferWriter.prototype.write = function(buf) {
32431 assert(bufferUtil.isBuffer(buf));
32432 this.bufs.push(buf);
32433 this.bufLen += buf.length;
32434 return this;
32435};
32436
32437BufferWriter.prototype.writeReverse = function(buf) {
32438 assert(bufferUtil.isBuffer(buf));
32439 this.bufs.push(bufferUtil.reverse(buf));
32440 this.bufLen += buf.length;
32441 return this;
32442};
32443
32444BufferWriter.prototype.writeUInt8 = function(n) {
32445 var buf = Buffer.alloc(1);
32446 buf.writeUInt8(n, 0);
32447 this.write(buf);
32448 return this;
32449};
32450
32451BufferWriter.prototype.writeUInt16BE = function(n) {
32452 var buf = Buffer.alloc(2);
32453 buf.writeUInt16BE(n, 0);
32454 this.write(buf);
32455 return this;
32456};
32457
32458BufferWriter.prototype.writeUInt16LE = function(n) {
32459 var buf = Buffer.alloc(2);
32460 buf.writeUInt16LE(n, 0);
32461 this.write(buf);
32462 return this;
32463};
32464
32465BufferWriter.prototype.writeUInt32BE = function(n) {
32466 var buf = Buffer.alloc(4);
32467 buf.writeUInt32BE(n, 0);
32468 this.write(buf);
32469 return this;
32470};
32471
32472BufferWriter.prototype.writeInt32LE = function(n) {
32473 var buf = Buffer.alloc(4);
32474 buf.writeInt32LE(n, 0);
32475 this.write(buf);
32476 return this;
32477};
32478
32479BufferWriter.prototype.writeUInt32LE = function(n) {
32480 var buf = Buffer.alloc(4);
32481 buf.writeUInt32LE(n, 0);
32482 this.write(buf);
32483 return this;
32484};
32485
32486BufferWriter.prototype.writeUInt64BEBN = function(bn) {
32487 var buf = bn.toBuffer({size: 8});
32488 this.write(buf);
32489 return this;
32490};
32491
32492BufferWriter.prototype.writeUInt64LEBN = function(bn) {
32493 var buf = bn.toBuffer({size: 8});
32494 this.writeReverse(buf);
32495 return this;
32496};
32497
32498BufferWriter.prototype.writeVarintNum = function(n) {
32499 var buf = BufferWriter.varintBufNum(n);
32500 this.write(buf);
32501 return this;
32502};
32503
32504BufferWriter.prototype.writeVarintBN = function(bn) {
32505 var buf = BufferWriter.varintBufBN(bn);
32506 this.write(buf);
32507 return this;
32508};
32509
32510BufferWriter.varintBufNum = function(n) {
32511 var buf = undefined;
32512 if (n < 253) {
32513 buf = Buffer.alloc(1);
32514 buf.writeUInt8(n, 0);
32515 } else if (n < 0x10000) {
32516 buf = Buffer.alloc(1 + 2);
32517 buf.writeUInt8(253, 0);
32518 buf.writeUInt16LE(n, 1);
32519 } else if (n < 0x100000000) {
32520 buf = Buffer.alloc(1 + 4);
32521 buf.writeUInt8(254, 0);
32522 buf.writeUInt32LE(n, 1);
32523 } else {
32524 buf = Buffer.alloc(1 + 8);
32525 buf.writeUInt8(255, 0);
32526 buf.writeInt32LE(n & -1, 1);
32527 buf.writeUInt32LE(Math.floor(n / 0x100000000), 5);
32528 }
32529 return buf;
32530};
32531
32532BufferWriter.varintBufBN = function(bn) {
32533 var buf = undefined;
32534 var n = bn.toNumber();
32535 if (n < 253) {
32536 buf = Buffer.alloc(1);
32537 buf.writeUInt8(n, 0);
32538 } else if (n < 0x10000) {
32539 buf = Buffer.alloc(1 + 2);
32540 buf.writeUInt8(253, 0);
32541 buf.writeUInt16LE(n, 1);
32542 } else if (n < 0x100000000) {
32543 buf = Buffer.alloc(1 + 4);
32544 buf.writeUInt8(254, 0);
32545 buf.writeUInt32LE(n, 1);
32546 } else {
32547 var bw = new BufferWriter();
32548 bw.writeUInt8(255);
32549 bw.writeUInt64LEBN(bn);
32550 var buf = bw.concat();
32551 }
32552 return buf;
32553};
32554
32555module.exports = BufferWriter;
32556
32557}).call(this,require("buffer").Buffer)
32558},{"../util/buffer":308,"assert":26,"buffer":146}],281:[function(require,module,exports){
32559(function (Buffer){
32560'use strict';
32561
32562var BufferWriter = require('./bufferwriter');
32563var BufferReader = require('./bufferreader');
32564var BN = require('../crypto/bn');
32565
32566var Varint = function Varint(buf) {
32567 if (!(this instanceof Varint))
32568 return new Varint(buf);
32569 if (Buffer.isBuffer(buf)) {
32570 this.buf = buf;
32571 } else if (typeof buf === 'number') {
32572 var num = buf;
32573 this.fromNumber(num);
32574 } else if (buf instanceof BN) {
32575 var bn = buf;
32576 this.fromBN(bn);
32577 } else if (buf) {
32578 var obj = buf;
32579 this.set(obj);
32580 }
32581};
32582
32583Varint.prototype.set = function(obj) {
32584 this.buf = obj.buf || this.buf;
32585 return this;
32586};
32587
32588Varint.prototype.fromString = function(str) {
32589 this.set({
32590 buf: Buffer.from(str, 'hex')
32591 });
32592 return this;
32593};
32594
32595Varint.prototype.toString = function() {
32596 return this.buf.toString('hex');
32597};
32598
32599Varint.prototype.fromBuffer = function(buf) {
32600 this.buf = buf;
32601 return this;
32602};
32603
32604Varint.prototype.fromBufferReader = function(br) {
32605 this.buf = br.readVarintBuf();
32606 return this;
32607};
32608
32609Varint.prototype.fromBN = function(bn) {
32610 this.buf = BufferWriter().writeVarintBN(bn).concat();
32611 return this;
32612};
32613
32614Varint.prototype.fromNumber = function(num) {
32615 this.buf = BufferWriter().writeVarintNum(num).concat();
32616 return this;
32617};
32618
32619Varint.prototype.toBuffer = function() {
32620 return this.buf;
32621};
32622
32623Varint.prototype.toBN = function() {
32624 return BufferReader(this.buf).readVarintBN();
32625};
32626
32627Varint.prototype.toNumber = function() {
32628 return BufferReader(this.buf).readVarintNum();
32629};
32630
32631module.exports = Varint;
32632
32633}).call(this,require("buffer").Buffer)
32634},{"../crypto/bn":271,"./bufferreader":279,"./bufferwriter":280,"buffer":146}],282:[function(require,module,exports){
32635'use strict';
32636
32637var _ = require('lodash');
32638
32639function format(message, args) {
32640 return message
32641 .replace('{0}', args[0])
32642 .replace('{1}', args[1])
32643 .replace('{2}', args[2]);
32644}
32645var traverseNode = function(parent, errorDefinition) {
32646 var NodeError = function() {
32647 if (_.isString(errorDefinition.message)) {
32648 this.message = format(errorDefinition.message, arguments);
32649 } else if (_.isFunction(errorDefinition.message)) {
32650 this.message = errorDefinition.message.apply(null, arguments);
32651 } else {
32652 throw new Error('Invalid error definition for ' + errorDefinition.name);
32653 }
32654 this.stack = this.message + '\n' + (new Error()).stack;
32655 };
32656 NodeError.prototype = Object.create(parent.prototype);
32657 NodeError.prototype.name = parent.prototype.name + errorDefinition.name;
32658 parent[errorDefinition.name] = NodeError;
32659 if (errorDefinition.errors) {
32660 childDefinitions(NodeError, errorDefinition.errors);
32661 }
32662 return NodeError;
32663};
32664
32665/* jshint latedef: false */
32666var childDefinitions = function(parent, childDefinitions) {
32667 _.each(childDefinitions, function(childDefinition) {
32668 traverseNode(parent, childDefinition);
32669 });
32670};
32671/* jshint latedef: true */
32672
32673var traverseRoot = function(parent, errorsDefinition) {
32674 childDefinitions(parent, errorsDefinition);
32675 return parent;
32676};
32677
32678
32679var bitcore = {};
32680bitcore.Error = function() {
32681 this.message = 'Internal error';
32682 this.stack = this.message + '\n' + (new Error()).stack;
32683};
32684bitcore.Error.prototype = Object.create(Error.prototype);
32685bitcore.Error.prototype.name = 'bitcore.Error';
32686
32687
32688var data = require('./spec');
32689traverseRoot(bitcore.Error, data);
32690
32691module.exports = bitcore.Error;
32692
32693module.exports.extend = function(spec) {
32694 return traverseNode(bitcore.Error, spec);
32695};
32696
32697},{"./spec":283,"lodash":311}],283:[function(require,module,exports){
32698'use strict';
32699
32700var docsURL = 'http://bitcore.io/';
32701
32702module.exports = [{
32703 name: 'InvalidB58Char',
32704 message: 'Invalid Base58 character: {0} in {1}'
32705}, {
32706 name: 'InvalidB58Checksum',
32707 message: 'Invalid Base58 checksum for {0}'
32708}, {
32709 name: 'InvalidNetwork',
32710 message: 'Invalid version for network: got {0}'
32711}, {
32712 name: 'InvalidState',
32713 message: 'Invalid state: {0}'
32714}, {
32715 name: 'NotImplemented',
32716 message: 'Function {0} was not implemented yet'
32717}, {
32718 name: 'InvalidNetworkArgument',
32719 message: 'Invalid network: must be "livenet" or "testnet", got {0}'
32720}, {
32721 name: 'InvalidArgument',
32722 message: function() {
32723 return 'Invalid Argument' + (arguments[0] ? (': ' + arguments[0]) : '') +
32724 (arguments[1] ? (' Documentation: ' + docsURL + arguments[1]) : '');
32725 }
32726}, {
32727 name: 'AbstractMethodInvoked',
32728 message: 'Abstract Method Invocation: {0}'
32729}, {
32730 name: 'InvalidArgumentType',
32731 message: function() {
32732 return 'Invalid Argument for ' + arguments[2] + ', expected ' + arguments[1] + ' but got ' + typeof arguments[0];
32733 }
32734}, {
32735 name: 'Unit',
32736 message: 'Internal Error on Unit {0}',
32737 errors: [{
32738 'name': 'UnknownCode',
32739 'message': 'Unrecognized unit code: {0}'
32740 }, {
32741 'name': 'InvalidRate',
32742 'message': 'Invalid exchange rate: {0}'
32743 }]
32744}, {
32745 name: 'MerkleBlock',
32746 message: 'Internal Error on MerkleBlock {0}',
32747 errors: [{
32748 'name': 'InvalidMerkleTree',
32749 'message': 'This MerkleBlock contain an invalid Merkle Tree'
32750 }]
32751}, {
32752 name: 'Transaction',
32753 message: 'Internal Error on Transaction {0}',
32754 errors: [{
32755 name: 'Input',
32756 message: 'Internal Error on Input {0}',
32757 errors: [{
32758 name: 'MissingScript',
32759 message: 'Need a script to create an input'
32760 }, {
32761 name: 'UnsupportedScript',
32762 message: 'Unsupported input script type: {0}'
32763 }, {
32764 name: 'MissingPreviousOutput',
32765 message: 'No previous output information.'
32766 }]
32767 }, {
32768 name: 'NeedMoreInfo',
32769 message: '{0}'
32770 }, {
32771 name: 'InvalidSorting',
32772 message: 'The sorting function provided did not return the change output as one of the array elements'
32773 }, {
32774 name: 'InvalidOutputAmountSum',
32775 message: '{0}'
32776 }, {
32777 name: 'MissingSignatures',
32778 message: 'Some inputs have not been fully signed'
32779 }, {
32780 name: 'InvalidIndex',
32781 message: 'Invalid index: {0} is not between 0, {1}'
32782 }, {
32783 name: 'UnableToVerifySignature',
32784 message: 'Unable to verify signature: {0}'
32785 }, {
32786 name: 'DustOutputs',
32787 message: 'Dust amount detected in one output'
32788 }, {
32789 name: 'InvalidSatoshis',
32790 message: 'Output satoshis are invalid',
32791 }, {
32792 name: 'FeeError',
32793 message: 'Internal Error on Fee {0}',
32794 errors: [{
32795 name: 'TooSmall',
32796 message: 'Fee is too small: {0}',
32797 }, {
32798 name: 'TooLarge',
32799 message: 'Fee is too large: {0}',
32800 }, {
32801 name: 'Different',
32802 message: 'Unspent value is different from specified fee: {0}',
32803 }]
32804 }, {
32805 name: 'ChangeAddressMissing',
32806 message: 'Change address is missing'
32807 }, {
32808 name: 'BlockHeightTooHigh',
32809 message: 'Block Height can be at most 2^32 -1'
32810 }, {
32811 name: 'NLockTimeOutOfRange',
32812 message: 'Block Height can only be between 0 and 499 999 999'
32813 }, {
32814 name: 'LockTimeTooEarly',
32815 message: 'Lock Time can\'t be earlier than UNIX date 500 000 000'
32816 }]
32817}, {
32818 name: 'Script',
32819 message: 'Internal Error on Script {0}',
32820 errors: [{
32821 name: 'UnrecognizedAddress',
32822 message: 'Expected argument {0} to be an address'
32823 }, {
32824 name: 'CantDeriveAddress',
32825 message: 'Can\'t derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out.'
32826 }, {
32827 name: 'InvalidBuffer',
32828 message: 'Invalid script buffer: can\'t parse valid script from given buffer {0}'
32829 }]
32830}, {
32831 name: 'HDPrivateKey',
32832 message: 'Internal Error on HDPrivateKey {0}',
32833 errors: [{
32834 name: 'InvalidDerivationArgument',
32835 message: 'Invalid derivation argument {0}, expected string, or number and boolean'
32836 }, {
32837 name: 'InvalidEntropyArgument',
32838 message: 'Invalid entropy: must be an hexa string or binary buffer, got {0}',
32839 errors: [{
32840 name: 'TooMuchEntropy',
32841 message: 'Invalid entropy: more than 512 bits is non standard, got "{0}"'
32842 }, {
32843 name: 'NotEnoughEntropy',
32844 message: 'Invalid entropy: at least 128 bits needed, got "{0}"'
32845 }]
32846 }, {
32847 name: 'InvalidLength',
32848 message: 'Invalid length for xprivkey string in {0}'
32849 }, {
32850 name: 'InvalidPath',
32851 message: 'Invalid derivation path: {0}'
32852 }, {
32853 name: 'UnrecognizedArgument',
32854 message: 'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'
32855 }]
32856}, {
32857 name: 'HDPublicKey',
32858 message: 'Internal Error on HDPublicKey {0}',
32859 errors: [{
32860 name: 'ArgumentIsPrivateExtended',
32861 message: 'Argument is an extended private key: {0}'
32862 }, {
32863 name: 'InvalidDerivationArgument',
32864 message: 'Invalid derivation argument: got {0}'
32865 }, {
32866 name: 'InvalidLength',
32867 message: 'Invalid length for xpubkey: got "{0}"'
32868 }, {
32869 name: 'InvalidPath',
32870 message: 'Invalid derivation path, it should look like: "m/1/100", got "{0}"'
32871 }, {
32872 name: 'InvalidIndexCantDeriveHardened',
32873 message: 'Invalid argument: creating a hardened path requires an HDPrivateKey'
32874 }, {
32875 name: 'MustSupplyArgument',
32876 message: 'Must supply an argument to create a HDPublicKey'
32877 }, {
32878 name: 'UnrecognizedArgument',
32879 message: 'Invalid argument for creation, must be string, json, buffer, or object'
32880 }]
32881}];
32882
32883},{}],284:[function(require,module,exports){
32884(function (Buffer){
32885'use strict';
32886
32887
32888var assert = require('assert');
32889var buffer = require('buffer');
32890var _ = require('lodash');
32891var $ = require('./util/preconditions');
32892
32893var BN = require('./crypto/bn');
32894var Base58 = require('./encoding/base58');
32895var Base58Check = require('./encoding/base58check');
32896var Hash = require('./crypto/hash');
32897var Network = require('./networks');
32898var Point = require('./crypto/point');
32899var PrivateKey = require('./privatekey');
32900var Random = require('./crypto/random');
32901
32902var errors = require('./errors');
32903var hdErrors = errors.HDPrivateKey;
32904var BufferUtil = require('./util/buffer');
32905var JSUtil = require('./util/js');
32906
32907var MINIMUM_ENTROPY_BITS = 128;
32908var BITS_TO_BYTES = 1 / 8;
32909var MAXIMUM_ENTROPY_BITS = 512;
32910
32911
32912/**
32913 * Represents an instance of an hierarchically derived private key.
32914 *
32915 * More info on https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
32916 *
32917 * @constructor
32918 * @param {string|Buffer|Object} arg
32919 */
32920function HDPrivateKey(arg) {
32921 /* jshint maxcomplexity: 10 */
32922 if (arg instanceof HDPrivateKey) {
32923 return arg;
32924 }
32925 if (!(this instanceof HDPrivateKey)) {
32926 return new HDPrivateKey(arg);
32927 }
32928 if (!arg) {
32929 return this._generateRandomly();
32930 }
32931
32932 if (Network.get(arg)) {
32933 return this._generateRandomly(arg);
32934 } else if (_.isString(arg) || BufferUtil.isBuffer(arg)) {
32935 if (HDPrivateKey.isValidSerialized(arg)) {
32936 this._buildFromSerialized(arg);
32937 } else if (JSUtil.isValidJSON(arg)) {
32938 this._buildFromJSON(arg);
32939 } else if (BufferUtil.isBuffer(arg) && HDPrivateKey.isValidSerialized(arg.toString())) {
32940 this._buildFromSerialized(arg.toString());
32941 } else {
32942 throw HDPrivateKey.getSerializedError(arg);
32943 }
32944 } else if (_.isObject(arg)) {
32945 this._buildFromObject(arg);
32946 } else {
32947 throw new hdErrors.UnrecognizedArgument(arg);
32948 }
32949}
32950
32951/**
32952 * Verifies that a given path is valid.
32953 *
32954 * @param {string|number} arg
32955 * @param {boolean?} hardened
32956 * @return {boolean}
32957 */
32958HDPrivateKey.isValidPath = function(arg, hardened) {
32959 if (_.isString(arg)) {
32960 var indexes = HDPrivateKey._getDerivationIndexes(arg);
32961 return indexes !== null && _.every(indexes, HDPrivateKey.isValidPath);
32962 }
32963
32964 if (_.isNumber(arg)) {
32965 if (arg < HDPrivateKey.Hardened && hardened === true) {
32966 arg += HDPrivateKey.Hardened;
32967 }
32968 return arg >= 0 && arg < HDPrivateKey.MaxIndex;
32969 }
32970
32971 return false;
32972};
32973
32974/**
32975 * Internal function that splits a string path into a derivation index array.
32976 * It will return null if the string path is malformed.
32977 * It does not validate if indexes are in bounds.
32978 *
32979 * @param {string} path
32980 * @return {Array}
32981 */
32982HDPrivateKey._getDerivationIndexes = function(path) {
32983 var steps = path.split('/');
32984
32985 // Special cases:
32986 if (_.includes(HDPrivateKey.RootElementAlias, path)) {
32987 return [];
32988 }
32989
32990 if (!_.includes(HDPrivateKey.RootElementAlias, steps[0])) {
32991 return null;
32992 }
32993
32994 var indexes = steps.slice(1).map(function(step) {
32995 var isHardened = step.slice(-1) === '\'';
32996 if (isHardened) {
32997 step = step.slice(0, -1);
32998 }
32999 if (!step || step[0] === '-') {
33000 return NaN;
33001 }
33002 var index = +step; // cast to number
33003 if (isHardened) {
33004 index += HDPrivateKey.Hardened;
33005 }
33006
33007 return index;
33008 });
33009
33010 return _.some(indexes, isNaN) ? null : indexes;
33011};
33012
33013/**
33014 * WARNING: This method is deprecated. Use deriveChild or deriveNonCompliantChild instead. This is not BIP32 compliant
33015 *
33016 *
33017 * Get a derived child based on a string or number.
33018 *
33019 * If the first argument is a string, it's parsed as the full path of
33020 * derivation. Valid values for this argument include "m" (which returns the
33021 * same private key), "m/0/1/40/2'/1000", where the ' quote means a hardened
33022 * derivation.
33023 *
33024 * If the first argument is a number, the child with that index will be
33025 * derived. If the second argument is truthy, the hardened version will be
33026 * derived. See the example usage for clarification.
33027 *
33028 * @example
33029 * ```javascript
33030 * var parent = new HDPrivateKey('xprv...');
33031 * var child_0_1_2h = parent.derive(0).derive(1).derive(2, true);
33032 * var copy_of_child_0_1_2h = parent.derive("m/0/1/2'");
33033 * assert(child_0_1_2h.xprivkey === copy_of_child_0_1_2h);
33034 * ```
33035 *
33036 * @param {string|number} arg
33037 * @param {boolean?} hardened
33038 */
33039HDPrivateKey.prototype.derive = function(arg, hardened) {
33040 return this.deriveNonCompliantChild(arg, hardened);
33041};
33042
33043/**
33044 * WARNING: This method will not be officially supported until v1.0.0.
33045 *
33046 *
33047 * Get a derived child based on a string or number.
33048 *
33049 * If the first argument is a string, it's parsed as the full path of
33050 * derivation. Valid values for this argument include "m" (which returns the
33051 * same private key), "m/0/1/40/2'/1000", where the ' quote means a hardened
33052 * derivation.
33053 *
33054 * If the first argument is a number, the child with that index will be
33055 * derived. If the second argument is truthy, the hardened version will be
33056 * derived. See the example usage for clarification.
33057 *
33058 * WARNING: The `nonCompliant` option should NOT be used, except for older implementation
33059 * that used a derivation strategy that used a non-zero padded private key.
33060 *
33061 * @example
33062 * ```javascript
33063 * var parent = new HDPrivateKey('xprv...');
33064 * var child_0_1_2h = parent.deriveChild(0).deriveChild(1).deriveChild(2, true);
33065 * var copy_of_child_0_1_2h = parent.deriveChild("m/0/1/2'");
33066 * assert(child_0_1_2h.xprivkey === copy_of_child_0_1_2h);
33067 * ```
33068 *
33069 * @param {string|number} arg
33070 * @param {boolean?} hardened
33071 */
33072HDPrivateKey.prototype.deriveChild = function(arg, hardened) {
33073 if (_.isNumber(arg)) {
33074 return this._deriveWithNumber(arg, hardened);
33075 } else if (_.isString(arg)) {
33076 return this._deriveFromString(arg);
33077 } else {
33078 throw new hdErrors.InvalidDerivationArgument(arg);
33079 }
33080};
33081
33082/**
33083 * WARNING: This method will not be officially supported until v1.0.0
33084 *
33085 *
33086 * WARNING: If this is a new implementation you should NOT use this method, you should be using
33087 * `derive` instead.
33088 *
33089 * This method is explicitly for use and compatibility with an implementation that
33090 * was not compliant with BIP32 regarding the derivation algorithm. The private key
33091 * must be 32 bytes hashing, and this implementation will use the non-zero padded
33092 * serialization of a private key, such that it's still possible to derive the privateKey
33093 * to recover those funds.
33094 *
33095 * @param {string|number} arg
33096 * @param {boolean?} hardened
33097 */
33098HDPrivateKey.prototype.deriveNonCompliantChild = function(arg, hardened) {
33099 if (_.isNumber(arg)) {
33100 return this._deriveWithNumber(arg, hardened, true);
33101 } else if (_.isString(arg)) {
33102 return this._deriveFromString(arg, true);
33103 } else {
33104 throw new hdErrors.InvalidDerivationArgument(arg);
33105 }
33106};
33107
33108HDPrivateKey.prototype._deriveWithNumber = function(index, hardened, nonCompliant) {
33109 /* jshint maxstatements: 20 */
33110 /* jshint maxcomplexity: 10 */
33111 if (!HDPrivateKey.isValidPath(index, hardened)) {
33112 throw new hdErrors.InvalidPath(index);
33113 }
33114
33115 hardened = index >= HDPrivateKey.Hardened ? true : hardened;
33116 if (index < HDPrivateKey.Hardened && hardened === true) {
33117 index += HDPrivateKey.Hardened;
33118 }
33119
33120 var indexBuffer = BufferUtil.integerAsBuffer(index);
33121 var data;
33122 if (hardened && nonCompliant) {
33123 // The private key serialization in this case will not be exactly 32 bytes and can be
33124 // any value less, and the value is not zero-padded.
33125 var nonZeroPadded = this.privateKey.bn.toBuffer();
33126 data = BufferUtil.concat([new buffer.Buffer([0]), nonZeroPadded, indexBuffer]);
33127 } else if (hardened) {
33128 // This will use a 32 byte zero padded serialization of the private key
33129 var privateKeyBuffer = this.privateKey.bn.toBuffer({size: 32});
33130 assert(privateKeyBuffer.length === 32, 'length of private key buffer is expected to be 32 bytes');
33131 data = BufferUtil.concat([new buffer.Buffer([0]), privateKeyBuffer, indexBuffer]);
33132 } else {
33133 data = BufferUtil.concat([this.publicKey.toBuffer(), indexBuffer]);
33134 }
33135 var hash = Hash.sha512hmac(data, this._buffers.chainCode);
33136 var leftPart = BN.fromBuffer(hash.slice(0, 32), {
33137 size: 32
33138 });
33139 var chainCode = hash.slice(32, 64);
33140
33141 var privateKey = leftPart.add(this.privateKey.toBigNumber()).umod(Point.getN()).toBuffer({
33142 size: 32
33143 });
33144
33145 if (!PrivateKey.isValid(privateKey)) {
33146 // Index at this point is already hardened, we can pass null as the hardened arg
33147 return this._deriveWithNumber(index + 1, null, nonCompliant);
33148 }
33149
33150 var derived = new HDPrivateKey({
33151 network: this.network,
33152 depth: this.depth + 1,
33153 parentFingerPrint: this.fingerPrint,
33154 childIndex: index,
33155 chainCode: chainCode,
33156 privateKey: privateKey
33157 });
33158
33159 return derived;
33160};
33161
33162HDPrivateKey.prototype._deriveFromString = function(path, nonCompliant) {
33163 if (!HDPrivateKey.isValidPath(path)) {
33164 throw new hdErrors.InvalidPath(path);
33165 }
33166
33167 var indexes = HDPrivateKey._getDerivationIndexes(path);
33168 var derived = indexes.reduce(function(prev, index) {
33169 return prev._deriveWithNumber(index, null, nonCompliant);
33170 }, this);
33171
33172 return derived;
33173};
33174
33175/**
33176 * Verifies that a given serialized private key in base58 with checksum format
33177 * is valid.
33178 *
33179 * @param {string|Buffer} data - the serialized private key
33180 * @param {string|Network=} network - optional, if present, checks that the
33181 * network provided matches the network serialized.
33182 * @return {boolean}
33183 */
33184HDPrivateKey.isValidSerialized = function(data, network) {
33185 return !HDPrivateKey.getSerializedError(data, network);
33186};
33187
33188/**
33189 * Checks what's the error that causes the validation of a serialized private key
33190 * in base58 with checksum to fail.
33191 *
33192 * @param {string|Buffer} data - the serialized private key
33193 * @param {string|Network=} network - optional, if present, checks that the
33194 * network provided matches the network serialized.
33195 * @return {errors.InvalidArgument|null}
33196 */
33197HDPrivateKey.getSerializedError = function(data, network) {
33198 /* jshint maxcomplexity: 10 */
33199 if (!(_.isString(data) || BufferUtil.isBuffer(data))) {
33200 return new hdErrors.UnrecognizedArgument('Expected string or buffer');
33201 }
33202 if (!Base58.validCharacters(data)) {
33203 return new errors.InvalidB58Char('(unknown)', data);
33204 }
33205 try {
33206 data = Base58Check.decode(data);
33207 } catch (e) {
33208 return new errors.InvalidB58Checksum(data);
33209 }
33210 if (data.length !== HDPrivateKey.DataLength) {
33211 return new hdErrors.InvalidLength(data);
33212 }
33213 if (!_.isUndefined(network)) {
33214 var error = HDPrivateKey._validateNetwork(data, network);
33215 if (error) {
33216 return error;
33217 }
33218 }
33219 return null;
33220};
33221
33222HDPrivateKey._validateNetwork = function(data, networkArg) {
33223 var network = Network.get(networkArg);
33224 if (!network) {
33225 return new errors.InvalidNetworkArgument(networkArg);
33226 }
33227 var version = data.slice(0, 4);
33228 if (BufferUtil.integerFromBuffer(version) !== network.xprivkey) {
33229 return new errors.InvalidNetwork(version);
33230 }
33231 return null;
33232};
33233
33234HDPrivateKey.fromString = function(arg) {
33235 $.checkArgument(_.isString(arg), 'No valid string was provided');
33236 return new HDPrivateKey(arg);
33237};
33238
33239HDPrivateKey.fromObject = function(arg) {
33240 $.checkArgument(_.isObject(arg), 'No valid argument was provided');
33241 return new HDPrivateKey(arg);
33242};
33243
33244HDPrivateKey.prototype._buildFromJSON = function(arg) {
33245 return this._buildFromObject(JSON.parse(arg));
33246};
33247
33248HDPrivateKey.prototype._buildFromObject = function(arg) {
33249 /* jshint maxcomplexity: 12 */
33250 // TODO: Type validation
33251 var buffers = {
33252 version: arg.network ? BufferUtil.integerAsBuffer(Network.get(arg.network).xprivkey) : arg.version,
33253 depth: _.isNumber(arg.depth) ? BufferUtil.integerAsSingleByteBuffer(arg.depth) : arg.depth,
33254 parentFingerPrint: _.isNumber(arg.parentFingerPrint) ? BufferUtil.integerAsBuffer(arg.parentFingerPrint) : arg.parentFingerPrint,
33255 childIndex: _.isNumber(arg.childIndex) ? BufferUtil.integerAsBuffer(arg.childIndex) : arg.childIndex,
33256 chainCode: _.isString(arg.chainCode) ? BufferUtil.hexToBuffer(arg.chainCode) : arg.chainCode,
33257 privateKey: (_.isString(arg.privateKey) && JSUtil.isHexa(arg.privateKey)) ? BufferUtil.hexToBuffer(arg.privateKey) : arg.privateKey,
33258 checksum: arg.checksum ? (arg.checksum.length ? arg.checksum : BufferUtil.integerAsBuffer(arg.checksum)) : undefined
33259 };
33260 return this._buildFromBuffers(buffers);
33261};
33262
33263HDPrivateKey.prototype._buildFromSerialized = function(arg) {
33264 var decoded = Base58Check.decode(arg);
33265 var buffers = {
33266 version: decoded.slice(HDPrivateKey.VersionStart, HDPrivateKey.VersionEnd),
33267 depth: decoded.slice(HDPrivateKey.DepthStart, HDPrivateKey.DepthEnd),
33268 parentFingerPrint: decoded.slice(HDPrivateKey.ParentFingerPrintStart,
33269 HDPrivateKey.ParentFingerPrintEnd),
33270 childIndex: decoded.slice(HDPrivateKey.ChildIndexStart, HDPrivateKey.ChildIndexEnd),
33271 chainCode: decoded.slice(HDPrivateKey.ChainCodeStart, HDPrivateKey.ChainCodeEnd),
33272 privateKey: decoded.slice(HDPrivateKey.PrivateKeyStart, HDPrivateKey.PrivateKeyEnd),
33273 checksum: decoded.slice(HDPrivateKey.ChecksumStart, HDPrivateKey.ChecksumEnd),
33274 xprivkey: arg
33275 };
33276 return this._buildFromBuffers(buffers);
33277};
33278
33279HDPrivateKey.prototype._generateRandomly = function(network) {
33280 return HDPrivateKey.fromSeed(Random.getRandomBuffer(64), network);
33281};
33282
33283/**
33284 * Generate a private key from a seed, as described in BIP32
33285 *
33286 * @param {string|Buffer} hexa
33287 * @param {*} network
33288 * @return HDPrivateKey
33289 */
33290HDPrivateKey.fromSeed = function(hexa, network) {
33291 /* jshint maxcomplexity: 8 */
33292 if (JSUtil.isHexaString(hexa)) {
33293 hexa = BufferUtil.hexToBuffer(hexa);
33294 }
33295 if (!Buffer.isBuffer(hexa)) {
33296 throw new hdErrors.InvalidEntropyArgument(hexa);
33297 }
33298 if (hexa.length < MINIMUM_ENTROPY_BITS * BITS_TO_BYTES) {
33299 throw new hdErrors.InvalidEntropyArgument.NotEnoughEntropy(hexa);
33300 }
33301 if (hexa.length > MAXIMUM_ENTROPY_BITS * BITS_TO_BYTES) {
33302 throw new hdErrors.InvalidEntropyArgument.TooMuchEntropy(hexa);
33303 }
33304 var hash = Hash.sha512hmac(hexa, new buffer.Buffer('Bitcoin seed'));
33305
33306 return new HDPrivateKey({
33307 network: Network.get(network) || Network.defaultNetwork,
33308 depth: 0,
33309 parentFingerPrint: 0,
33310 childIndex: 0,
33311 privateKey: hash.slice(0, 32),
33312 chainCode: hash.slice(32, 64)
33313 });
33314};
33315
33316
33317
33318HDPrivateKey.prototype._calcHDPublicKey = function() {
33319 if (!this._hdPublicKey) {
33320 var HDPublicKey = require('./hdpublickey');
33321 this._hdPublicKey = new HDPublicKey(this);
33322 }
33323};
33324
33325/**
33326 * Receives a object with buffers in all the properties and populates the
33327 * internal structure
33328 *
33329 * @param {Object} arg
33330 * @param {buffer.Buffer} arg.version
33331 * @param {buffer.Buffer} arg.depth
33332 * @param {buffer.Buffer} arg.parentFingerPrint
33333 * @param {buffer.Buffer} arg.childIndex
33334 * @param {buffer.Buffer} arg.chainCode
33335 * @param {buffer.Buffer} arg.privateKey
33336 * @param {buffer.Buffer} arg.checksum
33337 * @param {string=} arg.xprivkey - if set, don't recalculate the base58
33338 * representation
33339 * @return {HDPrivateKey} this
33340 */
33341HDPrivateKey.prototype._buildFromBuffers = function(arg) {
33342 /* jshint maxcomplexity: 8 */
33343 /* jshint maxstatements: 20 */
33344
33345 HDPrivateKey._validateBufferArguments(arg);
33346
33347 JSUtil.defineImmutable(this, {
33348 _buffers: arg
33349 });
33350
33351 var sequence = [
33352 arg.version, arg.depth, arg.parentFingerPrint, arg.childIndex, arg.chainCode,
33353 BufferUtil.emptyBuffer(1), arg.privateKey
33354 ];
33355 var concat = buffer.Buffer.concat(sequence);
33356 if (!arg.checksum || !arg.checksum.length) {
33357 arg.checksum = Base58Check.checksum(concat);
33358 } else {
33359 if (arg.checksum.toString() !== Base58Check.checksum(concat).toString()) {
33360 throw new errors.InvalidB58Checksum(concat);
33361 }
33362 }
33363
33364 var network = Network.get(BufferUtil.integerFromBuffer(arg.version));
33365 var xprivkey;
33366 xprivkey = Base58Check.encode(buffer.Buffer.concat(sequence));
33367 arg.xprivkey = Buffer.from(xprivkey);
33368
33369 var privateKey = new PrivateKey(BN.fromBuffer(arg.privateKey), network);
33370 var publicKey = privateKey.toPublicKey();
33371 var size = HDPrivateKey.ParentFingerPrintSize;
33372 var fingerPrint = Hash.sha256ripemd160(publicKey.toBuffer()).slice(0, size);
33373
33374 JSUtil.defineImmutable(this, {
33375 xprivkey: xprivkey,
33376 network: network,
33377 depth: BufferUtil.integerFromSingleByteBuffer(arg.depth),
33378 privateKey: privateKey,
33379 publicKey: publicKey,
33380 fingerPrint: fingerPrint
33381 });
33382
33383 this._hdPublicKey = null;
33384
33385 Object.defineProperty(this, 'hdPublicKey', {
33386 configurable: false,
33387 enumerable: true,
33388 get: function() {
33389 this._calcHDPublicKey();
33390 return this._hdPublicKey;
33391 }
33392 });
33393 Object.defineProperty(this, 'xpubkey', {
33394 configurable: false,
33395 enumerable: true,
33396 get: function() {
33397 this._calcHDPublicKey();
33398 return this._hdPublicKey.xpubkey;
33399 }
33400 });
33401 return this;
33402};
33403
33404HDPrivateKey._validateBufferArguments = function(arg) {
33405 var checkBuffer = function(name, size) {
33406 var buff = arg[name];
33407 assert(BufferUtil.isBuffer(buff), name + ' argument is not a buffer');
33408 assert(
33409 buff.length === size,
33410 name + ' has not the expected size: found ' + buff.length + ', expected ' + size
33411 );
33412 };
33413 checkBuffer('version', HDPrivateKey.VersionSize);
33414 checkBuffer('depth', HDPrivateKey.DepthSize);
33415 checkBuffer('parentFingerPrint', HDPrivateKey.ParentFingerPrintSize);
33416 checkBuffer('childIndex', HDPrivateKey.ChildIndexSize);
33417 checkBuffer('chainCode', HDPrivateKey.ChainCodeSize);
33418 checkBuffer('privateKey', HDPrivateKey.PrivateKeySize);
33419 if (arg.checksum && arg.checksum.length) {
33420 checkBuffer('checksum', HDPrivateKey.CheckSumSize);
33421 }
33422};
33423
33424/**
33425 * Returns the string representation of this private key (a string starting
33426 * with "xprv..."
33427 *
33428 * @return string
33429 */
33430HDPrivateKey.prototype.toString = function() {
33431 return this.xprivkey;
33432};
33433
33434/**
33435 * Returns the console representation of this extended private key.
33436 * @return string
33437 */
33438HDPrivateKey.prototype.inspect = function() {
33439 return '<HDPrivateKey: ' + this.xprivkey + '>';
33440};
33441
33442/**
33443 * Returns a plain object with a representation of this private key.
33444 *
33445 * Fields include:<ul>
33446 * <li> network: either 'livenet' or 'testnet'
33447 * <li> depth: a number ranging from 0 to 255
33448 * <li> fingerPrint: a number ranging from 0 to 2^32-1, taken from the hash of the
33449 * <li> associated public key
33450 * <li> parentFingerPrint: a number ranging from 0 to 2^32-1, taken from the hash
33451 * <li> of this parent's associated public key or zero.
33452 * <li> childIndex: the index from which this child was derived (or zero)
33453 * <li> chainCode: an hexa string representing a number used in the derivation
33454 * <li> privateKey: the private key associated, in hexa representation
33455 * <li> xprivkey: the representation of this extended private key in checksum
33456 * <li> base58 format
33457 * <li> checksum: the base58 checksum of xprivkey
33458 * </ul>
33459 * @return {Object}
33460 */
33461HDPrivateKey.prototype.toObject = HDPrivateKey.prototype.toJSON = function toObject() {
33462 return {
33463 network: Network.get(BufferUtil.integerFromBuffer(this._buffers.version), 'xprivkey').name,
33464 depth: BufferUtil.integerFromSingleByteBuffer(this._buffers.depth),
33465 fingerPrint: BufferUtil.integerFromBuffer(this.fingerPrint),
33466 parentFingerPrint: BufferUtil.integerFromBuffer(this._buffers.parentFingerPrint),
33467 childIndex: BufferUtil.integerFromBuffer(this._buffers.childIndex),
33468 chainCode: BufferUtil.bufferToHex(this._buffers.chainCode),
33469 privateKey: this.privateKey.toBuffer().toString('hex'),
33470 checksum: BufferUtil.integerFromBuffer(this._buffers.checksum),
33471 xprivkey: this.xprivkey
33472 };
33473};
33474
33475/**
33476 * Build a HDPrivateKey from a buffer
33477 *
33478 * @param {Buffer} arg
33479 * @return {HDPrivateKey}
33480 */
33481HDPrivateKey.fromBuffer = function(arg) {
33482 return new HDPrivateKey(arg.toString());
33483};
33484
33485/**
33486 * Returns a buffer representation of the HDPrivateKey
33487 *
33488 * @return {string}
33489 */
33490HDPrivateKey.prototype.toBuffer = function() {
33491 return BufferUtil.copy(this._buffers.xprivkey);
33492};
33493
33494HDPrivateKey.DefaultDepth = 0;
33495HDPrivateKey.DefaultFingerprint = 0;
33496HDPrivateKey.DefaultChildIndex = 0;
33497HDPrivateKey.Hardened = 0x80000000;
33498HDPrivateKey.MaxIndex = 2 * HDPrivateKey.Hardened;
33499
33500HDPrivateKey.RootElementAlias = ['m', 'M', 'm\'', 'M\''];
33501
33502HDPrivateKey.VersionSize = 4;
33503HDPrivateKey.DepthSize = 1;
33504HDPrivateKey.ParentFingerPrintSize = 4;
33505HDPrivateKey.ChildIndexSize = 4;
33506HDPrivateKey.ChainCodeSize = 32;
33507HDPrivateKey.PrivateKeySize = 32;
33508HDPrivateKey.CheckSumSize = 4;
33509
33510HDPrivateKey.DataLength = 78;
33511HDPrivateKey.SerializedByteSize = 82;
33512
33513HDPrivateKey.VersionStart = 0;
33514HDPrivateKey.VersionEnd = HDPrivateKey.VersionStart + HDPrivateKey.VersionSize;
33515HDPrivateKey.DepthStart = HDPrivateKey.VersionEnd;
33516HDPrivateKey.DepthEnd = HDPrivateKey.DepthStart + HDPrivateKey.DepthSize;
33517HDPrivateKey.ParentFingerPrintStart = HDPrivateKey.DepthEnd;
33518HDPrivateKey.ParentFingerPrintEnd = HDPrivateKey.ParentFingerPrintStart + HDPrivateKey.ParentFingerPrintSize;
33519HDPrivateKey.ChildIndexStart = HDPrivateKey.ParentFingerPrintEnd;
33520HDPrivateKey.ChildIndexEnd = HDPrivateKey.ChildIndexStart + HDPrivateKey.ChildIndexSize;
33521HDPrivateKey.ChainCodeStart = HDPrivateKey.ChildIndexEnd;
33522HDPrivateKey.ChainCodeEnd = HDPrivateKey.ChainCodeStart + HDPrivateKey.ChainCodeSize;
33523HDPrivateKey.PrivateKeyStart = HDPrivateKey.ChainCodeEnd + 1;
33524HDPrivateKey.PrivateKeyEnd = HDPrivateKey.PrivateKeyStart + HDPrivateKey.PrivateKeySize;
33525HDPrivateKey.ChecksumStart = HDPrivateKey.PrivateKeyEnd;
33526HDPrivateKey.ChecksumEnd = HDPrivateKey.ChecksumStart + HDPrivateKey.CheckSumSize;
33527
33528assert(HDPrivateKey.ChecksumEnd === HDPrivateKey.SerializedByteSize);
33529
33530module.exports = HDPrivateKey;
33531
33532}).call(this,require("buffer").Buffer)
33533},{"./crypto/bn":271,"./crypto/hash":273,"./crypto/point":274,"./crypto/random":275,"./encoding/base58":277,"./encoding/base58check":278,"./errors":282,"./hdpublickey":285,"./networks":286,"./privatekey":288,"./util/buffer":308,"./util/js":309,"./util/preconditions":310,"assert":26,"buffer":146,"lodash":311}],285:[function(require,module,exports){
33534(function (Buffer){
33535'use strict';
33536
33537var _ = require('lodash');
33538var $ = require('./util/preconditions');
33539
33540var BN = require('./crypto/bn');
33541var Base58 = require('./encoding/base58');
33542var Base58Check = require('./encoding/base58check');
33543var Hash = require('./crypto/hash');
33544var HDPrivateKey = require('./hdprivatekey');
33545var Network = require('./networks');
33546var Point = require('./crypto/point');
33547var PublicKey = require('./publickey');
33548
33549var bitcoreErrors = require('./errors');
33550var errors = bitcoreErrors;
33551var hdErrors = bitcoreErrors.HDPublicKey;
33552var assert = require('assert');
33553
33554var JSUtil = require('./util/js');
33555var BufferUtil = require('./util/buffer');
33556
33557/**
33558 * The representation of an hierarchically derived public key.
33559 *
33560 * See https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
33561 *
33562 * @constructor
33563 * @param {Object|string|Buffer} arg
33564 */
33565function HDPublicKey(arg) {
33566 /* jshint maxcomplexity: 12 */
33567 /* jshint maxstatements: 20 */
33568 if (arg instanceof HDPublicKey) {
33569 return arg;
33570 }
33571 if (!(this instanceof HDPublicKey)) {
33572 return new HDPublicKey(arg);
33573 }
33574 if (arg) {
33575 if (_.isString(arg) || BufferUtil.isBuffer(arg)) {
33576 var error = HDPublicKey.getSerializedError(arg);
33577 if (!error) {
33578 return this._buildFromSerialized(arg);
33579 } else if (BufferUtil.isBuffer(arg) && !HDPublicKey.getSerializedError(arg.toString())) {
33580 return this._buildFromSerialized(arg.toString());
33581 } else {
33582 if (error instanceof hdErrors.ArgumentIsPrivateExtended) {
33583 return new HDPrivateKey(arg).hdPublicKey;
33584 }
33585 throw error;
33586 }
33587 } else {
33588 if (_.isObject(arg)) {
33589 if (arg instanceof HDPrivateKey) {
33590 return this._buildFromPrivate(arg);
33591 } else {
33592 return this._buildFromObject(arg);
33593 }
33594 } else {
33595 throw new hdErrors.UnrecognizedArgument(arg);
33596 }
33597 }
33598 } else {
33599 throw new hdErrors.MustSupplyArgument();
33600 }
33601}
33602
33603/**
33604 * Verifies that a given path is valid.
33605 *
33606 * @param {string|number} arg
33607 * @return {boolean}
33608 */
33609HDPublicKey.isValidPath = function(arg) {
33610 if (_.isString(arg)) {
33611 var indexes = HDPrivateKey._getDerivationIndexes(arg);
33612 return indexes !== null && _.every(indexes, HDPublicKey.isValidPath);
33613 }
33614
33615 if (_.isNumber(arg)) {
33616 return arg >= 0 && arg < HDPublicKey.Hardened;
33617 }
33618
33619 return false;
33620};
33621
33622/**
33623 * WARNING: This method is deprecated. Use deriveChild instead.
33624 *
33625 *
33626 * Get a derivated child based on a string or number.
33627 *
33628 * If the first argument is a string, it's parsed as the full path of
33629 * derivation. Valid values for this argument include "m" (which returns the
33630 * same public key), "m/0/1/40/2/1000".
33631 *
33632 * Note that hardened keys can't be derived from a public extended key.
33633 *
33634 * If the first argument is a number, the child with that index will be
33635 * derived. See the example usage for clarification.
33636 *
33637 * @example
33638 * ```javascript
33639 * var parent = new HDPublicKey('xpub...');
33640 * var child_0_1_2 = parent.derive(0).derive(1).derive(2);
33641 * var copy_of_child_0_1_2 = parent.derive("m/0/1/2");
33642 * assert(child_0_1_2.xprivkey === copy_of_child_0_1_2);
33643 * ```
33644 *
33645 * @param {string|number} arg
33646 */
33647HDPublicKey.prototype.derive = function(arg, hardened) {
33648 return this.deriveChild(arg, hardened);
33649};
33650
33651/**
33652 * WARNING: This method will not be officially supported until v1.0.0.
33653 *
33654 *
33655 * Get a derivated child based on a string or number.
33656 *
33657 * If the first argument is a string, it's parsed as the full path of
33658 * derivation. Valid values for this argument include "m" (which returns the
33659 * same public key), "m/0/1/40/2/1000".
33660 *
33661 * Note that hardened keys can't be derived from a public extended key.
33662 *
33663 * If the first argument is a number, the child with that index will be
33664 * derived. See the example usage for clarification.
33665 *
33666 * @example
33667 * ```javascript
33668 * var parent = new HDPublicKey('xpub...');
33669 * var child_0_1_2 = parent.deriveChild(0).deriveChild(1).deriveChild(2);
33670 * var copy_of_child_0_1_2 = parent.deriveChild("m/0/1/2");
33671 * assert(child_0_1_2.xprivkey === copy_of_child_0_1_2);
33672 * ```
33673 *
33674 * @param {string|number} arg
33675 */
33676HDPublicKey.prototype.deriveChild = function(arg, hardened) {
33677 if (_.isNumber(arg)) {
33678 return this._deriveWithNumber(arg, hardened);
33679 } else if (_.isString(arg)) {
33680 return this._deriveFromString(arg);
33681 } else {
33682 throw new hdErrors.InvalidDerivationArgument(arg);
33683 }
33684};
33685
33686HDPublicKey.prototype._deriveWithNumber = function(index, hardened) {
33687 if (index >= HDPublicKey.Hardened || hardened) {
33688 throw new hdErrors.InvalidIndexCantDeriveHardened();
33689 }
33690 if (index < 0) {
33691 throw new hdErrors.InvalidPath(index);
33692 }
33693
33694 var indexBuffer = BufferUtil.integerAsBuffer(index);
33695 var data = BufferUtil.concat([this.publicKey.toBuffer(), indexBuffer]);
33696 var hash = Hash.sha512hmac(data, this._buffers.chainCode);
33697 var leftPart = BN.fromBuffer(hash.slice(0, 32), {size: 32});
33698 var chainCode = hash.slice(32, 64);
33699
33700 var publicKey;
33701 try {
33702 publicKey = PublicKey.fromPoint(Point.getG().mul(leftPart).add(this.publicKey.point));
33703 } catch (e) {
33704 return this._deriveWithNumber(index + 1);
33705 }
33706
33707 var derived = new HDPublicKey({
33708 network: this.network,
33709 depth: this.depth + 1,
33710 parentFingerPrint: this.fingerPrint,
33711 childIndex: index,
33712 chainCode: chainCode,
33713 publicKey: publicKey
33714 });
33715
33716 return derived;
33717};
33718
33719HDPublicKey.prototype._deriveFromString = function(path) {
33720 /* jshint maxcomplexity: 8 */
33721 if (_.includes(path, "'")) {
33722 throw new hdErrors.InvalidIndexCantDeriveHardened();
33723 } else if (!HDPublicKey.isValidPath(path)) {
33724 throw new hdErrors.InvalidPath(path);
33725 }
33726
33727 var indexes = HDPrivateKey._getDerivationIndexes(path);
33728 var derived = indexes.reduce(function(prev, index) {
33729 return prev._deriveWithNumber(index);
33730 }, this);
33731
33732 return derived;
33733};
33734
33735/**
33736 * Verifies that a given serialized public key in base58 with checksum format
33737 * is valid.
33738 *
33739 * @param {string|Buffer} data - the serialized public key
33740 * @param {string|Network=} network - optional, if present, checks that the
33741 * network provided matches the network serialized.
33742 * @return {boolean}
33743 */
33744HDPublicKey.isValidSerialized = function(data, network) {
33745 return _.isNull(HDPublicKey.getSerializedError(data, network));
33746};
33747
33748/**
33749 * Checks what's the error that causes the validation of a serialized public key
33750 * in base58 with checksum to fail.
33751 *
33752 * @param {string|Buffer} data - the serialized public key
33753 * @param {string|Network=} network - optional, if present, checks that the
33754 * network provided matches the network serialized.
33755 * @return {errors|null}
33756 */
33757HDPublicKey.getSerializedError = function(data, network) {
33758 /* jshint maxcomplexity: 10 */
33759 /* jshint maxstatements: 20 */
33760 if (!(_.isString(data) || BufferUtil.isBuffer(data))) {
33761 return new hdErrors.UnrecognizedArgument('expected buffer or string');
33762 }
33763 if (!Base58.validCharacters(data)) {
33764 return new errors.InvalidB58Char('(unknown)', data);
33765 }
33766 try {
33767 data = Base58Check.decode(data);
33768 } catch (e) {
33769 return new errors.InvalidB58Checksum(data);
33770 }
33771 if (data.length !== HDPublicKey.DataSize) {
33772 return new hdErrors.InvalidLength(data);
33773 }
33774 if (!_.isUndefined(network)) {
33775 var error = HDPublicKey._validateNetwork(data, network);
33776 if (error) {
33777 return error;
33778 }
33779 }
33780 var version = BufferUtil.integerFromBuffer(data.slice(0, 4));
33781 if (version === Network.livenet.xprivkey || version === Network.testnet.xprivkey ) {
33782 return new hdErrors.ArgumentIsPrivateExtended();
33783 }
33784 return null;
33785};
33786
33787HDPublicKey._validateNetwork = function(data, networkArg) {
33788 var network = Network.get(networkArg);
33789 if (!network) {
33790 return new errors.InvalidNetworkArgument(networkArg);
33791 }
33792 var version = data.slice(HDPublicKey.VersionStart, HDPublicKey.VersionEnd);
33793 if (BufferUtil.integerFromBuffer(version) !== network.xpubkey) {
33794 return new errors.InvalidNetwork(version);
33795 }
33796 return null;
33797};
33798
33799HDPublicKey.prototype._buildFromPrivate = function (arg) {
33800 var args = _.clone(arg._buffers);
33801 var point = Point.getG().mul(BN.fromBuffer(args.privateKey));
33802 args.publicKey = Point.pointToCompressed(point);
33803 args.version = BufferUtil.integerAsBuffer(Network.get(BufferUtil.integerFromBuffer(args.version)).xpubkey);
33804 args.privateKey = undefined;
33805 args.checksum = undefined;
33806 args.xprivkey = undefined;
33807 return this._buildFromBuffers(args);
33808};
33809
33810HDPublicKey.prototype._buildFromObject = function(arg) {
33811 /* jshint maxcomplexity: 10 */
33812 // TODO: Type validation
33813 var buffers = {
33814 version: arg.network ? BufferUtil.integerAsBuffer(Network.get(arg.network).xpubkey) : arg.version,
33815 depth: _.isNumber(arg.depth) ? BufferUtil.integerAsSingleByteBuffer(arg.depth) : arg.depth,
33816 parentFingerPrint: _.isNumber(arg.parentFingerPrint) ? BufferUtil.integerAsBuffer(arg.parentFingerPrint) : arg.parentFingerPrint,
33817 childIndex: _.isNumber(arg.childIndex) ? BufferUtil.integerAsBuffer(arg.childIndex) : arg.childIndex,
33818 chainCode: _.isString(arg.chainCode) ? BufferUtil.hexToBuffer(arg.chainCode) : arg.chainCode,
33819 publicKey: _.isString(arg.publicKey) ? BufferUtil.hexToBuffer(arg.publicKey) :
33820 BufferUtil.isBuffer(arg.publicKey) ? arg.publicKey : arg.publicKey.toBuffer(),
33821 checksum: _.isNumber(arg.checksum) ? BufferUtil.integerAsBuffer(arg.checksum) : arg.checksum
33822 };
33823 return this._buildFromBuffers(buffers);
33824};
33825
33826HDPublicKey.prototype._buildFromSerialized = function(arg) {
33827 var decoded = Base58Check.decode(arg);
33828 var buffers = {
33829 version: decoded.slice(HDPublicKey.VersionStart, HDPublicKey.VersionEnd),
33830 depth: decoded.slice(HDPublicKey.DepthStart, HDPublicKey.DepthEnd),
33831 parentFingerPrint: decoded.slice(HDPublicKey.ParentFingerPrintStart,
33832 HDPublicKey.ParentFingerPrintEnd),
33833 childIndex: decoded.slice(HDPublicKey.ChildIndexStart, HDPublicKey.ChildIndexEnd),
33834 chainCode: decoded.slice(HDPublicKey.ChainCodeStart, HDPublicKey.ChainCodeEnd),
33835 publicKey: decoded.slice(HDPublicKey.PublicKeyStart, HDPublicKey.PublicKeyEnd),
33836 checksum: decoded.slice(HDPublicKey.ChecksumStart, HDPublicKey.ChecksumEnd),
33837 xpubkey: arg
33838 };
33839 return this._buildFromBuffers(buffers);
33840};
33841
33842/**
33843 * Receives a object with buffers in all the properties and populates the
33844 * internal structure
33845 *
33846 * @param {Object} arg
33847 * @param {buffer.Buffer} arg.version
33848 * @param {buffer.Buffer} arg.depth
33849 * @param {buffer.Buffer} arg.parentFingerPrint
33850 * @param {buffer.Buffer} arg.childIndex
33851 * @param {buffer.Buffer} arg.chainCode
33852 * @param {buffer.Buffer} arg.publicKey
33853 * @param {buffer.Buffer} arg.checksum
33854 * @param {string=} arg.xpubkey - if set, don't recalculate the base58
33855 * representation
33856 * @return {HDPublicKey} this
33857 */
33858HDPublicKey.prototype._buildFromBuffers = function(arg) {
33859 /* jshint maxcomplexity: 8 */
33860 /* jshint maxstatements: 20 */
33861
33862 HDPublicKey._validateBufferArguments(arg);
33863
33864 JSUtil.defineImmutable(this, {
33865 _buffers: arg
33866 });
33867
33868 var sequence = [
33869 arg.version, arg.depth, arg.parentFingerPrint, arg.childIndex, arg.chainCode,
33870 arg.publicKey
33871 ];
33872 var concat = BufferUtil.concat(sequence);
33873 var checksum = Base58Check.checksum(concat);
33874 if (!arg.checksum || !arg.checksum.length) {
33875 arg.checksum = checksum;
33876 } else {
33877 if (arg.checksum.toString('hex') !== checksum.toString('hex')) {
33878 throw new errors.InvalidB58Checksum(concat, checksum);
33879 }
33880 }
33881 var network = Network.get(BufferUtil.integerFromBuffer(arg.version));
33882
33883 var xpubkey;
33884 xpubkey = Base58Check.encode(BufferUtil.concat(sequence));
33885 arg.xpubkey = Buffer.from(xpubkey);
33886
33887 var publicKey = new PublicKey(arg.publicKey, {network: network});
33888 var size = HDPublicKey.ParentFingerPrintSize;
33889 var fingerPrint = Hash.sha256ripemd160(publicKey.toBuffer()).slice(0, size);
33890
33891 JSUtil.defineImmutable(this, {
33892 xpubkey: xpubkey,
33893 network: network,
33894 depth: BufferUtil.integerFromSingleByteBuffer(arg.depth),
33895 publicKey: publicKey,
33896 fingerPrint: fingerPrint
33897 });
33898
33899 return this;
33900};
33901
33902HDPublicKey._validateBufferArguments = function(arg) {
33903 var checkBuffer = function(name, size) {
33904 var buff = arg[name];
33905 assert(BufferUtil.isBuffer(buff), name + ' argument is not a buffer, it\'s ' + typeof buff);
33906 assert(
33907 buff.length === size,
33908 name + ' has not the expected size: found ' + buff.length + ', expected ' + size
33909 );
33910 };
33911 checkBuffer('version', HDPublicKey.VersionSize);
33912 checkBuffer('depth', HDPublicKey.DepthSize);
33913 checkBuffer('parentFingerPrint', HDPublicKey.ParentFingerPrintSize);
33914 checkBuffer('childIndex', HDPublicKey.ChildIndexSize);
33915 checkBuffer('chainCode', HDPublicKey.ChainCodeSize);
33916 checkBuffer('publicKey', HDPublicKey.PublicKeySize);
33917 if (arg.checksum && arg.checksum.length) {
33918 checkBuffer('checksum', HDPublicKey.CheckSumSize);
33919 }
33920};
33921
33922HDPublicKey.fromString = function(arg) {
33923 $.checkArgument(_.isString(arg), 'No valid string was provided');
33924 return new HDPublicKey(arg);
33925};
33926
33927HDPublicKey.fromObject = function(arg) {
33928 $.checkArgument(_.isObject(arg), 'No valid argument was provided');
33929 return new HDPublicKey(arg);
33930};
33931
33932/**
33933 * Returns the base58 checked representation of the public key
33934 * @return {string} a string starting with "xpub..." in livenet
33935 */
33936HDPublicKey.prototype.toString = function() {
33937 return this.xpubkey;
33938};
33939
33940/**
33941 * Returns the console representation of this extended public key.
33942 * @return string
33943 */
33944HDPublicKey.prototype.inspect = function() {
33945 return '<HDPublicKey: ' + this.xpubkey + '>';
33946};
33947
33948/**
33949 * Returns a plain JavaScript object with information to reconstruct a key.
33950 *
33951 * Fields are: <ul>
33952 * <li> network: 'livenet' or 'testnet'
33953 * <li> depth: a number from 0 to 255, the depth to the master extended key
33954 * <li> fingerPrint: a number of 32 bits taken from the hash of the public key
33955 * <li> fingerPrint: a number of 32 bits taken from the hash of this key's
33956 * <li> parent's public key
33957 * <li> childIndex: index with which this key was derived
33958 * <li> chainCode: string in hexa encoding used for derivation
33959 * <li> publicKey: string, hexa encoded, in compressed key format
33960 * <li> checksum: BufferUtil.integerFromBuffer(this._buffers.checksum),
33961 * <li> xpubkey: the string with the base58 representation of this extended key
33962 * <li> checksum: the base58 checksum of xpubkey
33963 * </ul>
33964 */
33965HDPublicKey.prototype.toObject = HDPublicKey.prototype.toJSON = function toObject() {
33966 return {
33967 network: Network.get(BufferUtil.integerFromBuffer(this._buffers.version)).name,
33968 depth: BufferUtil.integerFromSingleByteBuffer(this._buffers.depth),
33969 fingerPrint: BufferUtil.integerFromBuffer(this.fingerPrint),
33970 parentFingerPrint: BufferUtil.integerFromBuffer(this._buffers.parentFingerPrint),
33971 childIndex: BufferUtil.integerFromBuffer(this._buffers.childIndex),
33972 chainCode: BufferUtil.bufferToHex(this._buffers.chainCode),
33973 publicKey: this.publicKey.toString(),
33974 checksum: BufferUtil.integerFromBuffer(this._buffers.checksum),
33975 xpubkey: this.xpubkey
33976 };
33977};
33978
33979/**
33980 * Create a HDPublicKey from a buffer argument
33981 *
33982 * @param {Buffer} arg
33983 * @return {HDPublicKey}
33984 */
33985HDPublicKey.fromBuffer = function(arg) {
33986 return new HDPublicKey(arg);
33987};
33988
33989/**
33990 * Return a buffer representation of the xpubkey
33991 *
33992 * @return {Buffer}
33993 */
33994HDPublicKey.prototype.toBuffer = function() {
33995 return BufferUtil.copy(this._buffers.xpubkey);
33996};
33997
33998HDPublicKey.Hardened = 0x80000000;
33999HDPublicKey.RootElementAlias = ['m', 'M'];
34000
34001HDPublicKey.VersionSize = 4;
34002HDPublicKey.DepthSize = 1;
34003HDPublicKey.ParentFingerPrintSize = 4;
34004HDPublicKey.ChildIndexSize = 4;
34005HDPublicKey.ChainCodeSize = 32;
34006HDPublicKey.PublicKeySize = 33;
34007HDPublicKey.CheckSumSize = 4;
34008
34009HDPublicKey.DataSize = 78;
34010HDPublicKey.SerializedByteSize = 82;
34011
34012HDPublicKey.VersionStart = 0;
34013HDPublicKey.VersionEnd = HDPublicKey.VersionStart + HDPublicKey.VersionSize;
34014HDPublicKey.DepthStart = HDPublicKey.VersionEnd;
34015HDPublicKey.DepthEnd = HDPublicKey.DepthStart + HDPublicKey.DepthSize;
34016HDPublicKey.ParentFingerPrintStart = HDPublicKey.DepthEnd;
34017HDPublicKey.ParentFingerPrintEnd = HDPublicKey.ParentFingerPrintStart + HDPublicKey.ParentFingerPrintSize;
34018HDPublicKey.ChildIndexStart = HDPublicKey.ParentFingerPrintEnd;
34019HDPublicKey.ChildIndexEnd = HDPublicKey.ChildIndexStart + HDPublicKey.ChildIndexSize;
34020HDPublicKey.ChainCodeStart = HDPublicKey.ChildIndexEnd;
34021HDPublicKey.ChainCodeEnd = HDPublicKey.ChainCodeStart + HDPublicKey.ChainCodeSize;
34022HDPublicKey.PublicKeyStart = HDPublicKey.ChainCodeEnd;
34023HDPublicKey.PublicKeyEnd = HDPublicKey.PublicKeyStart + HDPublicKey.PublicKeySize;
34024HDPublicKey.ChecksumStart = HDPublicKey.PublicKeyEnd;
34025HDPublicKey.ChecksumEnd = HDPublicKey.ChecksumStart + HDPublicKey.CheckSumSize;
34026
34027assert(HDPublicKey.PublicKeyEnd === HDPublicKey.DataSize);
34028assert(HDPublicKey.ChecksumEnd === HDPublicKey.SerializedByteSize);
34029
34030module.exports = HDPublicKey;
34031
34032}).call(this,require("buffer").Buffer)
34033},{"./crypto/bn":271,"./crypto/hash":273,"./crypto/point":274,"./encoding/base58":277,"./encoding/base58check":278,"./errors":282,"./hdprivatekey":284,"./networks":286,"./publickey":289,"./util/buffer":308,"./util/js":309,"./util/preconditions":310,"assert":26,"buffer":146,"lodash":311}],286:[function(require,module,exports){
34034'use strict';
34035var _ = require('lodash');
34036
34037var BufferUtil = require('./util/buffer');
34038var JSUtil = require('./util/js');
34039var networks = [];
34040var networkMaps = {};
34041
34042/**
34043 * A network is merely a map containing values that correspond to version
34044 * numbers for each bitcoin network. Currently only supporting "livenet"
34045 * (a.k.a. "mainnet") and "testnet".
34046 * @constructor
34047 */
34048function Network() {}
34049
34050Network.prototype.toString = function toString() {
34051 return this.name;
34052};
34053
34054/**
34055 * @function
34056 * @member Networks#get
34057 * Retrieves the network associated with a magic number or string.
34058 * @param {string|number|Network} arg
34059 * @param {string|Array} keys - if set, only check if the magic number associated with this name matches
34060 * @return Network
34061 */
34062function get(arg, keys) {
34063 if (~networks.indexOf(arg)) {
34064 return arg;
34065 }
34066 if (keys) {
34067 if (!_.isArray(keys)) {
34068 keys = [keys];
34069 }
34070 var containsArg = function(key) {
34071 return networks[index][key] === arg;
34072 };
34073 for (var index in networks) {
34074 if (_.some(keys, containsArg)) {
34075 return networks[index];
34076 }
34077 }
34078 return undefined;
34079 }
34080 return networkMaps[arg];
34081}
34082
34083/**
34084 * @function
34085 * @member Networks#add
34086 * Will add a custom Network
34087 * @param {Object} data
34088 * @param {string} data.name - The name of the network
34089 * @param {string} data.alias - The aliased name of the network
34090 * @param {Number} data.pubkeyhash - The publickey hash prefix
34091 * @param {Number} data.privatekey - The privatekey prefix
34092 * @param {Number} data.scripthash - The scripthash prefix
34093 * @param {Number} data.xpubkey - The extended public key magic
34094 * @param {Number} data.xprivkey - The extended private key magic
34095 * @param {Number} data.networkMagic - The network magic number
34096 * @param {Number} data.port - The network port
34097 * @param {Array} data.dnsSeeds - An array of dns seeds
34098 * @return Network
34099 */
34100function addNetwork(data) {
34101
34102 var network = new Network();
34103
34104 JSUtil.defineImmutable(network, {
34105 name: data.name,
34106 alias: data.alias,
34107 pubkeyhash: data.pubkeyhash,
34108 privatekey: data.privatekey,
34109 scripthash: data.scripthash,
34110 xpubkey: data.xpubkey,
34111 xprivkey: data.xprivkey
34112 });
34113
34114 if (data.networkMagic) {
34115 JSUtil.defineImmutable(network, {
34116 networkMagic: BufferUtil.integerAsBuffer(data.networkMagic)
34117 });
34118 }
34119
34120 if (data.port) {
34121 JSUtil.defineImmutable(network, {
34122 port: data.port
34123 });
34124 }
34125
34126 if (data.dnsSeeds) {
34127 JSUtil.defineImmutable(network, {
34128 dnsSeeds: data.dnsSeeds
34129 });
34130 }
34131 _.each(network, function(value) {
34132 if (!_.isUndefined(value) && !_.isObject(value)) {
34133 networkMaps[value] = network;
34134 }
34135 });
34136
34137 networks.push(network);
34138
34139 return network;
34140
34141}
34142
34143/**
34144 * @function
34145 * @member Networks#remove
34146 * Will remove a custom network
34147 * @param {Network} network
34148 */
34149function removeNetwork(network) {
34150 for (var i = 0; i < networks.length; i++) {
34151 if (networks[i] === network) {
34152 networks.splice(i, 1);
34153 }
34154 }
34155 for (var key in networkMaps) {
34156 if (networkMaps[key] === network) {
34157 delete networkMaps[key];
34158 }
34159 }
34160}
34161
34162addNetwork({
34163 name: 'livenet',
34164 alias: 'mainnet',
34165 pubkeyhash: 0x00,
34166 privatekey: 0x80,
34167 scripthash: 0x05,
34168 xpubkey: 0x0488b21e,
34169 xprivkey: 0x0488ade4,
34170 networkMagic: 0xf9beb4d9,
34171 port: 8333,
34172 dnsSeeds: [
34173 'seed.bitcoin.sipa.be',
34174 'dnsseed.bluematt.me',
34175 'dnsseed.bitcoin.dashjr.org',
34176 'seed.bitcoinstats.com',
34177 'seed.bitnodes.io',
34178 'bitseed.xf2.org'
34179 ]
34180});
34181
34182/**
34183 * @instance
34184 * @member Networks#livenet
34185 */
34186var livenet = get('livenet');
34187
34188addNetwork({
34189 name: 'testnet',
34190 alias: 'regtest',
34191 pubkeyhash: 0x6f,
34192 privatekey: 0xef,
34193 scripthash: 0xc4,
34194 xpubkey: 0x043587cf,
34195 xprivkey: 0x04358394
34196});
34197
34198/**
34199 * @instance
34200 * @member Networks#testnet
34201 */
34202var testnet = get('testnet');
34203
34204// Add configurable values for testnet/regtest
34205
34206var TESTNET = {
34207 PORT: 18333,
34208 NETWORK_MAGIC: BufferUtil.integerAsBuffer(0x0b110907),
34209 DNS_SEEDS: [
34210 'testnet-seed.bitcoin.petertodd.org',
34211 'testnet-seed.bluematt.me',
34212 'testnet-seed.alexykot.me',
34213 'testnet-seed.bitcoin.schildbach.de'
34214 ]
34215};
34216
34217for (var key in TESTNET) {
34218 if (!_.isObject(TESTNET[key])) {
34219 networkMaps[TESTNET[key]] = testnet;
34220 }
34221}
34222
34223var REGTEST = {
34224 PORT: 18444,
34225 NETWORK_MAGIC: BufferUtil.integerAsBuffer(0xfabfb5da),
34226 DNS_SEEDS: []
34227};
34228
34229for (var key in REGTEST) {
34230 if (!_.isObject(REGTEST[key])) {
34231 networkMaps[REGTEST[key]] = testnet;
34232 }
34233}
34234
34235Object.defineProperty(testnet, 'port', {
34236 enumerable: true,
34237 configurable: false,
34238 get: function() {
34239 if (this.regtestEnabled) {
34240 return REGTEST.PORT;
34241 } else {
34242 return TESTNET.PORT;
34243 }
34244 }
34245});
34246
34247Object.defineProperty(testnet, 'networkMagic', {
34248 enumerable: true,
34249 configurable: false,
34250 get: function() {
34251 if (this.regtestEnabled) {
34252 return REGTEST.NETWORK_MAGIC;
34253 } else {
34254 return TESTNET.NETWORK_MAGIC;
34255 }
34256 }
34257});
34258
34259Object.defineProperty(testnet, 'dnsSeeds', {
34260 enumerable: true,
34261 configurable: false,
34262 get: function() {
34263 if (this.regtestEnabled) {
34264 return REGTEST.DNS_SEEDS;
34265 } else {
34266 return TESTNET.DNS_SEEDS;
34267 }
34268 }
34269});
34270
34271/**
34272 * @function
34273 * @member Networks#enableRegtest
34274 * Will enable regtest features for testnet
34275 */
34276function enableRegtest() {
34277 testnet.regtestEnabled = true;
34278}
34279
34280/**
34281 * @function
34282 * @member Networks#disableRegtest
34283 * Will disable regtest features for testnet
34284 */
34285function disableRegtest() {
34286 testnet.regtestEnabled = false;
34287}
34288
34289/**
34290 * @namespace Networks
34291 */
34292module.exports = {
34293 add: addNetwork,
34294 remove: removeNetwork,
34295 defaultNetwork: livenet,
34296 livenet: livenet,
34297 mainnet: livenet,
34298 testnet: testnet,
34299 get: get,
34300 enableRegtest: enableRegtest,
34301 disableRegtest: disableRegtest
34302};
34303
34304},{"./util/buffer":308,"./util/js":309,"lodash":311}],287:[function(require,module,exports){
34305(function (Buffer){
34306'use strict';
34307
34308var _ = require('lodash');
34309var $ = require('./util/preconditions');
34310var BufferUtil = require('./util/buffer');
34311var JSUtil = require('./util/js');
34312
34313function Opcode(num) {
34314 if (!(this instanceof Opcode)) {
34315 return new Opcode(num);
34316 }
34317
34318 var value;
34319
34320 if (_.isNumber(num)) {
34321 value = num;
34322 } else if (_.isString(num)) {
34323 value = Opcode.map[num];
34324 } else {
34325 throw new TypeError('Unrecognized num type: "' + typeof(num) + '" for Opcode');
34326 }
34327
34328 JSUtil.defineImmutable(this, {
34329 num: value
34330 });
34331
34332 return this;
34333}
34334
34335Opcode.fromBuffer = function(buf) {
34336 $.checkArgument(BufferUtil.isBuffer(buf));
34337 return new Opcode(Number('0x' + buf.toString('hex')));
34338};
34339
34340Opcode.fromNumber = function(num) {
34341 $.checkArgument(_.isNumber(num));
34342 return new Opcode(num);
34343};
34344
34345Opcode.fromString = function(str) {
34346 $.checkArgument(_.isString(str));
34347 var value = Opcode.map[str];
34348 if (typeof value === 'undefined') {
34349 throw new TypeError('Invalid opcodestr');
34350 }
34351 return new Opcode(value);
34352};
34353
34354Opcode.prototype.toHex = function() {
34355 return this.num.toString(16);
34356};
34357
34358Opcode.prototype.toBuffer = function() {
34359 return Buffer.from(this.toHex(), 'hex');
34360};
34361
34362Opcode.prototype.toNumber = function() {
34363 return this.num;
34364};
34365
34366Opcode.prototype.toString = function() {
34367 var str = Opcode.reverseMap[this.num];
34368 if (typeof str === 'undefined') {
34369 throw new Error('Opcode does not have a string representation');
34370 }
34371 return str;
34372};
34373
34374Opcode.smallInt = function(n) {
34375 $.checkArgument(_.isNumber(n), 'Invalid Argument: n should be number');
34376 $.checkArgument(n >= 0 && n <= 16, 'Invalid Argument: n must be between 0 and 16');
34377 if (n === 0) {
34378 return Opcode('OP_0');
34379 }
34380 return new Opcode(Opcode.map.OP_1 + n - 1);
34381};
34382
34383Opcode.map = {
34384 // push value
34385 OP_FALSE: 0,
34386 OP_0: 0,
34387 OP_PUSHDATA1: 76,
34388 OP_PUSHDATA2: 77,
34389 OP_PUSHDATA4: 78,
34390 OP_1NEGATE: 79,
34391 OP_RESERVED: 80,
34392 OP_TRUE: 81,
34393 OP_1: 81,
34394 OP_2: 82,
34395 OP_3: 83,
34396 OP_4: 84,
34397 OP_5: 85,
34398 OP_6: 86,
34399 OP_7: 87,
34400 OP_8: 88,
34401 OP_9: 89,
34402 OP_10: 90,
34403 OP_11: 91,
34404 OP_12: 92,
34405 OP_13: 93,
34406 OP_14: 94,
34407 OP_15: 95,
34408 OP_16: 96,
34409
34410 // control
34411 OP_NOP: 97,
34412 OP_VER: 98,
34413 OP_IF: 99,
34414 OP_NOTIF: 100,
34415 OP_VERIF: 101,
34416 OP_VERNOTIF: 102,
34417 OP_ELSE: 103,
34418 OP_ENDIF: 104,
34419 OP_VERIFY: 105,
34420 OP_RETURN: 106,
34421
34422 // stack ops
34423 OP_TOALTSTACK: 107,
34424 OP_FROMALTSTACK: 108,
34425 OP_2DROP: 109,
34426 OP_2DUP: 110,
34427 OP_3DUP: 111,
34428 OP_2OVER: 112,
34429 OP_2ROT: 113,
34430 OP_2SWAP: 114,
34431 OP_IFDUP: 115,
34432 OP_DEPTH: 116,
34433 OP_DROP: 117,
34434 OP_DUP: 118,
34435 OP_NIP: 119,
34436 OP_OVER: 120,
34437 OP_PICK: 121,
34438 OP_ROLL: 122,
34439 OP_ROT: 123,
34440 OP_SWAP: 124,
34441 OP_TUCK: 125,
34442
34443 // splice ops
34444 OP_CAT: 126,
34445 OP_SUBSTR: 127,
34446 OP_LEFT: 128,
34447 OP_RIGHT: 129,
34448 OP_SIZE: 130,
34449
34450 // bit logic
34451 OP_INVERT: 131,
34452 OP_AND: 132,
34453 OP_OR: 133,
34454 OP_XOR: 134,
34455 OP_EQUAL: 135,
34456 OP_EQUALVERIFY: 136,
34457 OP_RESERVED1: 137,
34458 OP_RESERVED2: 138,
34459
34460 // numeric
34461 OP_1ADD: 139,
34462 OP_1SUB: 140,
34463 OP_2MUL: 141,
34464 OP_2DIV: 142,
34465 OP_NEGATE: 143,
34466 OP_ABS: 144,
34467 OP_NOT: 145,
34468 OP_0NOTEQUAL: 146,
34469
34470 OP_ADD: 147,
34471 OP_SUB: 148,
34472 OP_MUL: 149,
34473 OP_DIV: 150,
34474 OP_MOD: 151,
34475 OP_LSHIFT: 152,
34476 OP_RSHIFT: 153,
34477
34478 OP_BOOLAND: 154,
34479 OP_BOOLOR: 155,
34480 OP_NUMEQUAL: 156,
34481 OP_NUMEQUALVERIFY: 157,
34482 OP_NUMNOTEQUAL: 158,
34483 OP_LESSTHAN: 159,
34484 OP_GREATERTHAN: 160,
34485 OP_LESSTHANOREQUAL: 161,
34486 OP_GREATERTHANOREQUAL: 162,
34487 OP_MIN: 163,
34488 OP_MAX: 164,
34489
34490 OP_WITHIN: 165,
34491
34492 // crypto
34493 OP_RIPEMD160: 166,
34494 OP_SHA1: 167,
34495 OP_SHA256: 168,
34496 OP_HASH160: 169,
34497 OP_HASH256: 170,
34498 OP_CODESEPARATOR: 171,
34499 OP_CHECKSIG: 172,
34500 OP_CHECKSIGVERIFY: 173,
34501 OP_CHECKMULTISIG: 174,
34502 OP_CHECKMULTISIGVERIFY: 175,
34503
34504 OP_CHECKLOCKTIMEVERIFY: 177,
34505 OP_CHECKSEQUENCEVERIFY: 178,
34506
34507 // expansion
34508 OP_NOP1: 176,
34509 OP_NOP2: 177,
34510 OP_NOP3: 178,
34511 OP_NOP4: 179,
34512 OP_NOP5: 180,
34513 OP_NOP6: 181,
34514 OP_NOP7: 182,
34515 OP_NOP8: 183,
34516 OP_NOP9: 184,
34517 OP_NOP10: 185,
34518
34519 // template matching params
34520 OP_PUBKEYHASH: 253,
34521 OP_PUBKEY: 254,
34522 OP_INVALIDOPCODE: 255
34523};
34524
34525Opcode.reverseMap = [];
34526
34527for (var k in Opcode.map) {
34528 Opcode.reverseMap[Opcode.map[k]] = k;
34529}
34530
34531// Easier access to opcodes
34532_.extend(Opcode, Opcode.map);
34533
34534/**
34535 * @returns true if opcode is one of OP_0, OP_1, ..., OP_16
34536 */
34537Opcode.isSmallIntOp = function(opcode) {
34538 if (opcode instanceof Opcode) {
34539 opcode = opcode.toNumber();
34540 }
34541 return ((opcode === Opcode.map.OP_0) ||
34542 ((opcode >= Opcode.map.OP_1) && (opcode <= Opcode.map.OP_16)));
34543};
34544
34545/**
34546 * Will return a string formatted for the console
34547 *
34548 * @returns {string} Script opcode
34549 */
34550Opcode.prototype.inspect = function() {
34551 return '<Opcode: ' + this.toString() + ', hex: '+this.toHex()+', decimal: '+this.num+'>';
34552};
34553
34554module.exports = Opcode;
34555
34556}).call(this,require("buffer").Buffer)
34557},{"./util/buffer":308,"./util/js":309,"./util/preconditions":310,"buffer":146,"lodash":311}],288:[function(require,module,exports){
34558(function (Buffer){
34559'use strict';
34560
34561var _ = require('lodash');
34562var Address = require('./address');
34563var Base58Check = require('./encoding/base58check');
34564var BN = require('./crypto/bn');
34565var JSUtil = require('./util/js');
34566var Networks = require('./networks');
34567var Point = require('./crypto/point');
34568var PublicKey = require('./publickey');
34569var Random = require('./crypto/random');
34570var $ = require('./util/preconditions');
34571
34572/**
34573 * Instantiate a PrivateKey from a BN, Buffer and WIF.
34574 *
34575 * @example
34576 * ```javascript
34577 * // generate a new random key
34578 * var key = PrivateKey();
34579 *
34580 * // get the associated address
34581 * var address = key.toAddress();
34582 *
34583 * // encode into wallet export format
34584 * var exported = key.toWIF();
34585 *
34586 * // instantiate from the exported (and saved) private key
34587 * var imported = PrivateKey.fromWIF(exported);
34588 * ```
34589 *
34590 * @param {string} data - The encoded data in various formats
34591 * @param {Network|string=} network - a {@link Network} object, or a string with the network name
34592 * @returns {PrivateKey} A new valid instance of an PrivateKey
34593 * @constructor
34594 */
34595function PrivateKey(data, network) {
34596 /* jshint maxstatements: 20 */
34597 /* jshint maxcomplexity: 8 */
34598
34599 if (!(this instanceof PrivateKey)) {
34600 return new PrivateKey(data, network);
34601 }
34602 if (data instanceof PrivateKey) {
34603 return data;
34604 }
34605
34606 var info = this._classifyArguments(data, network);
34607
34608 // validation
34609 if (!info.bn || info.bn.cmp(new BN(0)) === 0){
34610 throw new TypeError('Number can not be equal to zero, undefined, null or false');
34611 }
34612 if (!info.bn.lt(Point.getN())) {
34613 throw new TypeError('Number must be less than N');
34614 }
34615 if (typeof(info.network) === 'undefined') {
34616 throw new TypeError('Must specify the network ("livenet" or "testnet")');
34617 }
34618
34619 JSUtil.defineImmutable(this, {
34620 bn: info.bn,
34621 compressed: info.compressed,
34622 network: info.network
34623 });
34624
34625 Object.defineProperty(this, 'publicKey', {
34626 configurable: false,
34627 enumerable: true,
34628 get: this.toPublicKey.bind(this)
34629 });
34630
34631 return this;
34632
34633};
34634
34635/**
34636 * Internal helper to instantiate PrivateKey internal `info` object from
34637 * different kinds of arguments passed to the constructor.
34638 *
34639 * @param {*} data
34640 * @param {Network|string=} network - a {@link Network} object, or a string with the network name
34641 * @return {Object}
34642 */
34643PrivateKey.prototype._classifyArguments = function(data, network) {
34644 /* jshint maxcomplexity: 10 */
34645 var info = {
34646 compressed: true,
34647 network: network ? Networks.get(network) : Networks.defaultNetwork
34648 };
34649
34650 // detect type of data
34651 if (_.isUndefined(data) || _.isNull(data)){
34652 info.bn = PrivateKey._getRandomBN();
34653 } else if (data instanceof BN) {
34654 info.bn = data;
34655 } else if (data instanceof Buffer || data instanceof Uint8Array) {
34656 info = PrivateKey._transformBuffer(data, network);
34657 } else if (data.bn && data.network){
34658 info = PrivateKey._transformObject(data);
34659 } else if (!network && Networks.get(data)) {
34660 info.bn = PrivateKey._getRandomBN();
34661 info.network = Networks.get(data);
34662 } else if (typeof(data) === 'string'){
34663 if (JSUtil.isHexa(data)) {
34664 info.bn = new BN(Buffer.from(data, 'hex'));
34665 } else {
34666 info = PrivateKey._transformWIF(data, network);
34667 }
34668 } else {
34669 throw new TypeError('First argument is an unrecognized data type.');
34670 }
34671 return info;
34672};
34673
34674/**
34675 * Internal function to get a random Big Number (BN)
34676 *
34677 * @returns {BN} A new randomly generated BN
34678 * @private
34679 */
34680PrivateKey._getRandomBN = function(){
34681 var condition;
34682 var bn;
34683 do {
34684 var privbuf = Random.getRandomBuffer(32);
34685 bn = BN.fromBuffer(privbuf);
34686 condition = bn.lt(Point.getN());
34687 } while (!condition);
34688 return bn;
34689};
34690
34691/**
34692 * Internal function to transform a WIF Buffer into a private key
34693 *
34694 * @param {Buffer} buf - An WIF string
34695 * @param {Network|string=} network - a {@link Network} object, or a string with the network name
34696 * @returns {Object} An object with keys: bn, network and compressed
34697 * @private
34698 */
34699PrivateKey._transformBuffer = function(buf, network) {
34700
34701 var info = {};
34702
34703 if (buf.length === 32) {
34704 return PrivateKey._transformBNBuffer(buf, network);
34705 }
34706
34707 info.network = Networks.get(buf[0], 'privatekey');
34708
34709 if (!info.network) {
34710 throw new Error('Invalid network');
34711 }
34712
34713 if (network && info.network !== Networks.get(network)) {
34714 throw new TypeError('Private key network mismatch');
34715 }
34716
34717 if (buf.length === 1 + 32 + 1 && buf[1 + 32 + 1 - 1] === 1) {
34718 info.compressed = true;
34719 } else if (buf.length === 1 + 32) {
34720 info.compressed = false;
34721 } else {
34722 throw new Error('Length of buffer must be 33 (uncompressed) or 34 (compressed)');
34723 }
34724
34725 info.bn = BN.fromBuffer(buf.slice(1, 32 + 1));
34726
34727 return info;
34728};
34729
34730/**
34731 * Internal function to transform a BN buffer into a private key
34732 *
34733 * @param {Buffer} buf
34734 * @param {Network|string=} network - a {@link Network} object, or a string with the network name
34735 * @returns {object} an Object with keys: bn, network, and compressed
34736 * @private
34737 */
34738PrivateKey._transformBNBuffer = function(buf, network) {
34739 var info = {};
34740 info.network = Networks.get(network) || Networks.defaultNetwork;
34741 info.bn = BN.fromBuffer(buf);
34742 info.compressed = false;
34743 return info;
34744};
34745
34746/**
34747 * Internal function to transform a WIF string into a private key
34748 *
34749 * @param {string} buf - An WIF string
34750 * @returns {Object} An object with keys: bn, network and compressed
34751 * @private
34752 */
34753PrivateKey._transformWIF = function(str, network) {
34754 return PrivateKey._transformBuffer(Base58Check.decode(str), network);
34755};
34756
34757/**
34758 * Instantiate a PrivateKey from a Buffer with the DER or WIF representation
34759 *
34760 * @param {Buffer} arg
34761 * @param {Network} network
34762 * @return {PrivateKey}
34763 */
34764PrivateKey.fromBuffer = function(arg, network) {
34765 return new PrivateKey(arg, network);
34766};
34767
34768/**
34769 * Internal function to transform a JSON string on plain object into a private key
34770 * return this.
34771 *
34772 * @param {string} json - A JSON string or plain object
34773 * @returns {Object} An object with keys: bn, network and compressed
34774 * @private
34775 */
34776PrivateKey._transformObject = function(json) {
34777 var bn = new BN(json.bn, 'hex');
34778 var network = Networks.get(json.network);
34779 return {
34780 bn: bn,
34781 network: network,
34782 compressed: json.compressed
34783 };
34784};
34785
34786/**
34787 * Instantiate a PrivateKey from a WIF string
34788 *
34789 * @param {string} str - The WIF encoded private key string
34790 * @returns {PrivateKey} A new valid instance of PrivateKey
34791 */
34792PrivateKey.fromString = PrivateKey.fromWIF = function(str) {
34793 $.checkArgument(_.isString(str), 'First argument is expected to be a string.');
34794 return new PrivateKey(str);
34795};
34796
34797/**
34798 * Instantiate a PrivateKey from a plain JavaScript object
34799 *
34800 * @param {Object} obj - The output from privateKey.toObject()
34801 */
34802PrivateKey.fromObject = function(obj) {
34803 $.checkArgument(_.isObject(obj), 'First argument is expected to be an object.');
34804 return new PrivateKey(obj);
34805};
34806
34807/**
34808 * Instantiate a PrivateKey from random bytes
34809 *
34810 * @param {string=} network - Either "livenet" or "testnet"
34811 * @returns {PrivateKey} A new valid instance of PrivateKey
34812 */
34813PrivateKey.fromRandom = function(network) {
34814 var bn = PrivateKey._getRandomBN();
34815 return new PrivateKey(bn, network);
34816};
34817
34818/**
34819 * Check if there would be any errors when initializing a PrivateKey
34820 *
34821 * @param {string} data - The encoded data in various formats
34822 * @param {string=} network - Either "livenet" or "testnet"
34823 * @returns {null|Error} An error if exists
34824 */
34825
34826PrivateKey.getValidationError = function(data, network) {
34827 var error;
34828 try {
34829 /* jshint nonew: false */
34830 new PrivateKey(data, network);
34831 } catch (e) {
34832 error = e;
34833 }
34834 return error;
34835};
34836
34837/**
34838 * Check if the parameters are valid
34839 *
34840 * @param {string} data - The encoded data in various formats
34841 * @param {string=} network - Either "livenet" or "testnet"
34842 * @returns {Boolean} If the private key is would be valid
34843 */
34844PrivateKey.isValid = function(data, network){
34845 if (!data) {
34846 return false;
34847 }
34848 return !PrivateKey.getValidationError(data, network);
34849};
34850
34851/**
34852 * Will output the PrivateKey encoded as hex string
34853 *
34854 * @returns {string}
34855 */
34856PrivateKey.prototype.toString = function() {
34857 return this.toBuffer().toString('hex');
34858};
34859
34860/**
34861 * Will output the PrivateKey to a WIF string
34862 *
34863 * @returns {string} A WIP representation of the private key
34864 */
34865PrivateKey.prototype.toWIF = function() {
34866 var network = this.network;
34867 var compressed = this.compressed;
34868
34869 var buf;
34870 if (compressed) {
34871 buf = Buffer.concat([Buffer.from([network.privatekey]),
34872 this.bn.toBuffer({size: 32}),
34873 Buffer.from([0x01])]);
34874 } else {
34875 buf = Buffer.concat([Buffer.from([network.privatekey]),
34876 this.bn.toBuffer({size: 32})]);
34877 }
34878
34879 return Base58Check.encode(buf);
34880};
34881
34882/**
34883 * Will return the private key as a BN instance
34884 *
34885 * @returns {BN} A BN instance of the private key
34886 */
34887PrivateKey.prototype.toBigNumber = function(){
34888 return this.bn;
34889};
34890
34891/**
34892 * Will return the private key as a BN buffer
34893 *
34894 * @returns {Buffer} A buffer of the private key
34895 */
34896PrivateKey.prototype.toBuffer = function(){
34897 // TODO: use `return this.bn.toBuffer({ size: 32 })` in v1.0.0
34898 return this.bn.toBuffer();
34899};
34900
34901/**
34902 * WARNING: This method will not be officially supported until v1.0.0.
34903 *
34904 *
34905 * Will return the private key as a BN buffer without leading zero padding
34906 *
34907 * @returns {Buffer} A buffer of the private key
34908 */
34909PrivateKey.prototype.toBufferNoPadding = function() {
34910 return this.bn.toBuffer();
34911};
34912
34913/**
34914 * Will return the corresponding public key
34915 *
34916 * @returns {PublicKey} A public key generated from the private key
34917 */
34918PrivateKey.prototype.toPublicKey = function(){
34919 if (!this._pubkey) {
34920 this._pubkey = PublicKey.fromPrivateKey(this);
34921 }
34922 return this._pubkey;
34923};
34924
34925/**
34926 * Will return an address for the private key
34927 * @param {Network=} network - optional parameter specifying
34928 * the desired network for the address
34929 *
34930 * @returns {Address} An address generated from the private key
34931 */
34932PrivateKey.prototype.toAddress = function(network) {
34933 var pubkey = this.toPublicKey();
34934 return Address.fromPublicKey(pubkey, network || this.network);
34935};
34936
34937/**
34938 * @returns {Object} A plain object representation
34939 */
34940PrivateKey.prototype.toObject = PrivateKey.prototype.toJSON = function toObject() {
34941 return {
34942 bn: this.bn.toString('hex'),
34943 compressed: this.compressed,
34944 network: this.network.toString()
34945 };
34946};
34947
34948/**
34949 * Will return a string formatted for the console
34950 *
34951 * @returns {string} Private key
34952 */
34953PrivateKey.prototype.inspect = function() {
34954 var uncompressed = !this.compressed ? ', uncompressed' : '';
34955 return '<PrivateKey: ' + this.toString() + ', network: ' + this.network + uncompressed + '>';
34956};
34957
34958module.exports = PrivateKey;
34959
34960}).call(this,require("buffer").Buffer)
34961},{"./address":266,"./crypto/bn":271,"./crypto/point":274,"./crypto/random":275,"./encoding/base58check":278,"./networks":286,"./publickey":289,"./util/js":309,"./util/preconditions":310,"buffer":146,"lodash":311}],289:[function(require,module,exports){
34962(function (Buffer){
34963'use strict';
34964
34965var BN = require('./crypto/bn');
34966var Point = require('./crypto/point');
34967var Hash = require('./crypto/hash');
34968var JSUtil = require('./util/js');
34969var Network = require('./networks');
34970var _ = require('lodash');
34971var $ = require('./util/preconditions');
34972
34973/**
34974 * Instantiate a PublicKey from a {@link PrivateKey}, {@link Point}, `string`, or `Buffer`.
34975 *
34976 * There are two internal properties, `network` and `compressed`, that deal with importing
34977 * a PublicKey from a PrivateKey in WIF format. More details described on {@link PrivateKey}
34978 *
34979 * @example
34980 * ```javascript
34981 * // instantiate from a private key
34982 * var key = PublicKey(privateKey, true);
34983 *
34984 * // export to as a DER hex encoded string
34985 * var exported = key.toString();
34986 *
34987 * // import the public key
34988 * var imported = PublicKey.fromString(exported);
34989 * ```
34990 *
34991 * @param {string} data - The encoded data in various formats
34992 * @param {Object} extra - additional options
34993 * @param {Network=} extra.network - Which network should the address for this public key be for
34994 * @param {String=} extra.compressed - If the public key is compressed
34995 * @returns {PublicKey} A new valid instance of an PublicKey
34996 * @constructor
34997 */
34998function PublicKey(data, extra) {
34999
35000 if (!(this instanceof PublicKey)) {
35001 return new PublicKey(data, extra);
35002 }
35003
35004 $.checkArgument(data, 'First argument is required, please include public key data.');
35005
35006 if (data instanceof PublicKey) {
35007 // Return copy, but as it's an immutable object, return same argument
35008 return data;
35009 }
35010 extra = extra || {};
35011
35012 var info = this._classifyArgs(data, extra);
35013
35014 // validation
35015 info.point.validate();
35016
35017 JSUtil.defineImmutable(this, {
35018 point: info.point,
35019 compressed: info.compressed,
35020 network: info.network || Network.defaultNetwork
35021 });
35022
35023 return this;
35024};
35025
35026/**
35027 * Internal function to differentiate between arguments passed to the constructor
35028 * @param {*} data
35029 * @param {Object} extra
35030 */
35031PublicKey.prototype._classifyArgs = function(data, extra) {
35032 /* jshint maxcomplexity: 10 */
35033 var info = {
35034 compressed: _.isUndefined(extra.compressed) || extra.compressed
35035 };
35036
35037 // detect type of data
35038 if (data instanceof Point) {
35039 info.point = data;
35040 } else if (data.x && data.y) {
35041 info = PublicKey._transformObject(data);
35042 } else if (typeof(data) === 'string') {
35043 info = PublicKey._transformDER(Buffer.from(data, 'hex'));
35044 } else if (PublicKey._isBuffer(data)) {
35045 info = PublicKey._transformDER(data);
35046 } else if (PublicKey._isPrivateKey(data)) {
35047 info = PublicKey._transformPrivateKey(data);
35048 } else {
35049 throw new TypeError('First argument is an unrecognized data format.');
35050 }
35051 if (!info.network) {
35052 info.network = _.isUndefined(extra.network) ? undefined : Network.get(extra.network);
35053 }
35054 return info;
35055};
35056
35057/**
35058 * Internal function to detect if an object is a {@link PrivateKey}
35059 *
35060 * @param {*} param - object to test
35061 * @returns {boolean}
35062 * @private
35063 */
35064PublicKey._isPrivateKey = function(param) {
35065 var PrivateKey = require('./privatekey');
35066 return param instanceof PrivateKey;
35067};
35068
35069/**
35070 * Internal function to detect if an object is a Buffer
35071 *
35072 * @param {*} param - object to test
35073 * @returns {boolean}
35074 * @private
35075 */
35076PublicKey._isBuffer = function(param) {
35077 return (param instanceof Buffer) || (param instanceof Uint8Array);
35078};
35079
35080/**
35081 * Internal function to transform a private key into a public key point
35082 *
35083 * @param {PrivateKey} privkey - An instance of PrivateKey
35084 * @returns {Object} An object with keys: point and compressed
35085 * @private
35086 */
35087PublicKey._transformPrivateKey = function(privkey) {
35088 $.checkArgument(PublicKey._isPrivateKey(privkey), 'Must be an instance of PrivateKey');
35089 var info = {};
35090 info.point = Point.getG().mul(privkey.bn);
35091 info.compressed = privkey.compressed;
35092 info.network = privkey.network;
35093 return info;
35094};
35095
35096/**
35097 * Internal function to transform DER into a public key point
35098 *
35099 * @param {Buffer} buf - An hex encoded buffer
35100 * @param {bool=} strict - if set to false, will loosen some conditions
35101 * @returns {Object} An object with keys: point and compressed
35102 * @private
35103 */
35104PublicKey._transformDER = function(buf, strict) {
35105 /* jshint maxstatements: 30 */
35106 /* jshint maxcomplexity: 12 */
35107 $.checkArgument(PublicKey._isBuffer(buf), 'Must be a hex buffer of DER encoded public key');
35108 var info = {};
35109
35110 strict = _.isUndefined(strict) ? true : strict;
35111
35112 var x;
35113 var y;
35114 var xbuf;
35115 var ybuf;
35116
35117 if (buf[0] === 0x04 || (!strict && (buf[0] === 0x06 || buf[0] === 0x07))) {
35118 xbuf = buf.slice(1, 33);
35119 ybuf = buf.slice(33, 65);
35120 if (xbuf.length !== 32 || ybuf.length !== 32 || buf.length !== 65) {
35121 throw new TypeError('Length of x and y must be 32 bytes');
35122 }
35123 x = new BN(xbuf);
35124 y = new BN(ybuf);
35125 info.point = new Point(x, y);
35126 info.compressed = false;
35127 } else if (buf[0] === 0x03) {
35128 xbuf = buf.slice(1);
35129 x = new BN(xbuf);
35130 info = PublicKey._transformX(true, x);
35131 info.compressed = true;
35132 } else if (buf[0] === 0x02) {
35133 xbuf = buf.slice(1);
35134 x = new BN(xbuf);
35135 info = PublicKey._transformX(false, x);
35136 info.compressed = true;
35137 } else {
35138 throw new TypeError('Invalid DER format public key');
35139 }
35140 return info;
35141};
35142
35143/**
35144 * Internal function to transform X into a public key point
35145 *
35146 * @param {Boolean} odd - If the point is above or below the x axis
35147 * @param {Point} x - The x point
35148 * @returns {Object} An object with keys: point and compressed
35149 * @private
35150 */
35151PublicKey._transformX = function(odd, x) {
35152 $.checkArgument(typeof odd === 'boolean', 'Must specify whether y is odd or not (true or false)');
35153 var info = {};
35154 info.point = Point.fromX(odd, x);
35155 return info;
35156};
35157
35158/**
35159 * Internal function to transform a JSON into a public key point
35160 *
35161 * @param {String|Object} json - a JSON string or plain object
35162 * @returns {Object} An object with keys: point and compressed
35163 * @private
35164 */
35165PublicKey._transformObject = function(json) {
35166 var x = new BN(json.x, 'hex');
35167 var y = new BN(json.y, 'hex');
35168 var point = new Point(x, y);
35169 return new PublicKey(point, {
35170 compressed: json.compressed
35171 });
35172};
35173
35174/**
35175 * Instantiate a PublicKey from a PrivateKey
35176 *
35177 * @param {PrivateKey} privkey - An instance of PrivateKey
35178 * @returns {PublicKey} A new valid instance of PublicKey
35179 */
35180PublicKey.fromPrivateKey = function(privkey) {
35181 $.checkArgument(PublicKey._isPrivateKey(privkey), 'Must be an instance of PrivateKey');
35182 var info = PublicKey._transformPrivateKey(privkey);
35183 return new PublicKey(info.point, {
35184 compressed: info.compressed,
35185 network: info.network
35186 });
35187};
35188
35189/**
35190 * Instantiate a PublicKey from a Buffer
35191 * @param {Buffer} buf - A DER hex buffer
35192 * @param {bool=} strict - if set to false, will loosen some conditions
35193 * @returns {PublicKey} A new valid instance of PublicKey
35194 */
35195PublicKey.fromDER = PublicKey.fromBuffer = function(buf, strict) {
35196 $.checkArgument(PublicKey._isBuffer(buf), 'Must be a hex buffer of DER encoded public key');
35197 var info = PublicKey._transformDER(buf, strict);
35198 return new PublicKey(info.point, {
35199 compressed: info.compressed
35200 });
35201};
35202
35203/**
35204 * Instantiate a PublicKey from a Point
35205 *
35206 * @param {Point} point - A Point instance
35207 * @param {boolean=} compressed - whether to store this public key as compressed format
35208 * @returns {PublicKey} A new valid instance of PublicKey
35209 */
35210PublicKey.fromPoint = function(point, compressed) {
35211 $.checkArgument(point instanceof Point, 'First argument must be an instance of Point.');
35212 return new PublicKey(point, {
35213 compressed: compressed
35214 });
35215};
35216
35217/**
35218 * Instantiate a PublicKey from a DER hex encoded string
35219 *
35220 * @param {string} str - A DER hex string
35221 * @param {String=} encoding - The type of string encoding
35222 * @returns {PublicKey} A new valid instance of PublicKey
35223 */
35224PublicKey.fromString = function(str, encoding) {
35225 var buf = Buffer.from(str, encoding || 'hex');
35226 var info = PublicKey._transformDER(buf);
35227 return new PublicKey(info.point, {
35228 compressed: info.compressed
35229 });
35230};
35231
35232/**
35233 * Instantiate a PublicKey from an X Point
35234 *
35235 * @param {Boolean} odd - If the point is above or below the x axis
35236 * @param {Point} x - The x point
35237 * @returns {PublicKey} A new valid instance of PublicKey
35238 */
35239PublicKey.fromX = function(odd, x) {
35240 var info = PublicKey._transformX(odd, x);
35241 return new PublicKey(info.point, {
35242 compressed: info.compressed
35243 });
35244};
35245
35246/**
35247 * Check if there would be any errors when initializing a PublicKey
35248 *
35249 * @param {string} data - The encoded data in various formats
35250 * @returns {null|Error} An error if exists
35251 */
35252PublicKey.getValidationError = function(data) {
35253 var error;
35254 try {
35255 /* jshint nonew: false */
35256 new PublicKey(data);
35257 } catch (e) {
35258 error = e;
35259 }
35260 return error;
35261};
35262
35263/**
35264 * Check if the parameters are valid
35265 *
35266 * @param {string} data - The encoded data in various formats
35267 * @returns {Boolean} If the public key would be valid
35268 */
35269PublicKey.isValid = function(data) {
35270 return !PublicKey.getValidationError(data);
35271};
35272
35273/**
35274 * @returns {Object} A plain object of the PublicKey
35275 */
35276PublicKey.prototype.toObject = PublicKey.prototype.toJSON = function toObject() {
35277 return {
35278 x: this.point.getX().toString('hex', 2),
35279 y: this.point.getY().toString('hex', 2),
35280 compressed: this.compressed
35281 };
35282};
35283
35284/**
35285 * Will output the PublicKey to a DER Buffer
35286 *
35287 * @returns {Buffer} A DER hex encoded buffer
35288 */
35289PublicKey.prototype.toBuffer = PublicKey.prototype.toDER = function() {
35290 var x = this.point.getX();
35291 var y = this.point.getY();
35292
35293 var xbuf = x.toBuffer({
35294 size: 32
35295 });
35296 var ybuf = y.toBuffer({
35297 size: 32
35298 });
35299
35300 var prefix;
35301 if (!this.compressed) {
35302 prefix = Buffer.from([0x04]);
35303 return Buffer.concat([prefix, xbuf, ybuf]);
35304 } else {
35305 var odd = ybuf[ybuf.length - 1] % 2;
35306 if (odd) {
35307 prefix = Buffer.from([0x03]);
35308 } else {
35309 prefix = Buffer.from([0x02]);
35310 }
35311 return Buffer.concat([prefix, xbuf]);
35312 }
35313};
35314
35315/**
35316 * Will return a sha256 + ripemd160 hash of the serialized public key
35317 * @see https://github.com/bitcoin/bitcoin/blob/master/src/pubkey.h#L141
35318 * @returns {Buffer}
35319 */
35320PublicKey.prototype._getID = function _getID() {
35321 return Hash.sha256ripemd160(this.toBuffer());
35322};
35323
35324/**
35325 * Will return an address for the public key
35326 *
35327 * @param {String|Network=} network - Which network should the address be for
35328 * @returns {Address} An address generated from the public key
35329 */
35330PublicKey.prototype.toAddress = function(network) {
35331 var Address = require('./address');
35332 return Address.fromPublicKey(this, network || this.network);
35333};
35334
35335/**
35336 * Will output the PublicKey to a DER encoded hex string
35337 *
35338 * @returns {string} A DER hex encoded string
35339 */
35340PublicKey.prototype.toString = function() {
35341 return this.toDER().toString('hex');
35342};
35343
35344/**
35345 * Will return a string formatted for the console
35346 *
35347 * @returns {string} Public key
35348 */
35349PublicKey.prototype.inspect = function() {
35350 return '<PublicKey: ' + this.toString() +
35351 (this.compressed ? '' : ', uncompressed') + '>';
35352};
35353
35354
35355module.exports = PublicKey;
35356
35357}).call(this,require("buffer").Buffer)
35358},{"./address":266,"./crypto/bn":271,"./crypto/hash":273,"./crypto/point":274,"./networks":286,"./privatekey":288,"./util/js":309,"./util/preconditions":310,"buffer":146,"lodash":311}],290:[function(require,module,exports){
35359module.exports = require('./script');
35360
35361module.exports.Interpreter = require('./interpreter');
35362
35363},{"./interpreter":291,"./script":292}],291:[function(require,module,exports){
35364(function (Buffer){
35365'use strict';
35366
35367var _ = require('lodash');
35368
35369var Script = require('./script');
35370var Opcode = require('../opcode');
35371var BN = require('../crypto/bn');
35372var Hash = require('../crypto/hash');
35373var Signature = require('../crypto/signature');
35374var PublicKey = require('../publickey');
35375
35376/**
35377 * Bitcoin transactions contain scripts. Each input has a script called the
35378 * scriptSig, and each output has a script called the scriptPubkey. To validate
35379 * an input, the input's script is concatenated with the referenced output script,
35380 * and the result is executed. If at the end of execution the stack contains a
35381 * "true" value, then the transaction is valid.
35382 *
35383 * The primary way to use this class is via the verify function.
35384 * e.g., Interpreter().verify( ... );
35385 */
35386var Interpreter = function Interpreter(obj) {
35387 if (!(this instanceof Interpreter)) {
35388 return new Interpreter(obj);
35389 }
35390 if (obj) {
35391 this.initialize();
35392 this.set(obj);
35393 } else {
35394 this.initialize();
35395 }
35396};
35397
35398Interpreter.prototype.verifyWitnessProgram = function(version, program, witness, satoshis, flags) {
35399
35400 var scriptPubKey = new Script();
35401 var stack = [];
35402
35403 if (version === 0) {
35404 if (program.length === 32) {
35405 if (witness.length === 0) {
35406 this.errstr = 'SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY';
35407 return false;
35408 }
35409
35410 var scriptPubKeyBuffer = witness[witness.length - 1];
35411 scriptPubKey = new Script(scriptPubKeyBuffer);
35412 var hash = Hash.sha256(scriptPubKeyBuffer);
35413 if (hash.toString('hex') !== program.toString('hex')) {
35414 this.errstr = 'SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH';
35415 return false;
35416 }
35417
35418 stack = witness.slice(0, -1);
35419 } else if (program.length === 20) {
35420 if (witness.length !== 2) {
35421 this.errstr = 'SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH';
35422 return false;
35423 }
35424
35425 scriptPubKey.add(Opcode.OP_DUP);
35426 scriptPubKey.add(Opcode.OP_HASH160);
35427 scriptPubKey.add(program);
35428 scriptPubKey.add(Opcode.OP_EQUALVERIFY);
35429 scriptPubKey.add(Opcode.OP_CHECKSIG);
35430
35431 stack = witness;
35432
35433 } else {
35434 this.errstr = 'SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH';
35435 return false;
35436 }
35437 } else if ((flags & Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM)) {
35438 this.errstr = 'SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM';
35439 return false;
35440 } else {
35441 return true;
35442 }
35443
35444 this.initialize();
35445
35446 this.set({
35447 script: scriptPubKey,
35448 stack: stack,
35449 sigversion: 1,
35450 satoshis: satoshis,
35451 flags: flags,
35452 });
35453
35454 if (!this.evaluate()) {
35455 return false;
35456 }
35457
35458 if (this.stack.length !== 1) {
35459 this.errstr = 'SCRIPT_ERR_EVAL_FALSE';
35460 return false;
35461 }
35462
35463 var buf = this.stack[this.stack.length - 1];
35464 if (!Interpreter.castToBool(buf)) {
35465 this.errstr = 'SCRIPT_ERR_EVAL_FALSE_IN_STACK';
35466 return false;
35467 }
35468
35469 return true;
35470};
35471
35472
35473
35474/**
35475 * Verifies a Script by executing it and returns true if it is valid.
35476 * This function needs to be provided with the scriptSig and the scriptPubkey
35477 * separately.
35478 * @param {Script} scriptSig - the script's first part (corresponding to the tx input)
35479 * @param {Script} scriptPubkey - the script's last part (corresponding to the tx output)
35480 * @param {Transaction=} tx - the Transaction containing the scriptSig in one input (used
35481 * to check signature validity for some opcodes like OP_CHECKSIG)
35482 * @param {number} nin - index of the transaction input containing the scriptSig verified.
35483 * @param {number} flags - evaluation flags. See Interpreter.SCRIPT_* constants
35484 * @param {number} witness - array of witness data
35485 * @param {number} satoshis - number of satoshis created by this output
35486 *
35487 * Translated from bitcoind's VerifyScript
35488 */
35489Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags, witness, satoshis) {
35490
35491 var Transaction = require('../transaction');
35492 if (_.isUndefined(tx)) {
35493 tx = new Transaction();
35494 }
35495 if (_.isUndefined(nin)) {
35496 nin = 0;
35497 }
35498 if (_.isUndefined(flags)) {
35499 flags = 0;
35500 }
35501 if (_.isUndefined(witness)) {
35502 witness = null;
35503 }
35504 if (_.isUndefined(satoshis)) {
35505 satoshis = 0;
35506 }
35507
35508 this.set({
35509 script: scriptSig,
35510 tx: tx,
35511 nin: nin,
35512 sigversion: 0,
35513 satoshis: 0,
35514 flags: flags
35515 });
35516 var stackCopy;
35517
35518 if ((flags & Interpreter.SCRIPT_VERIFY_SIGPUSHONLY) !== 0 && !scriptSig.isPushOnly()) {
35519 this.errstr = 'SCRIPT_ERR_SIG_PUSHONLY';
35520 return false;
35521 }
35522
35523 // evaluate scriptSig
35524 if (!this.evaluate()) {
35525 return false;
35526 }
35527
35528 if (flags & Interpreter.SCRIPT_VERIFY_P2SH) {
35529 stackCopy = this.stack.slice();
35530 }
35531
35532 var stack = this.stack;
35533 this.initialize();
35534 this.set({
35535 script: scriptPubkey,
35536 stack: stack,
35537 tx: tx,
35538 nin: nin,
35539 flags: flags
35540 });
35541
35542 // evaluate scriptPubkey
35543 if (!this.evaluate()) {
35544 return false;
35545 }
35546
35547 if (this.stack.length === 0) {
35548 this.errstr = 'SCRIPT_ERR_EVAL_FALSE_NO_RESULT';
35549 return false;
35550 }
35551
35552 var buf = this.stack[this.stack.length - 1];
35553 if (!Interpreter.castToBool(buf)) {
35554 this.errstr = 'SCRIPT_ERR_EVAL_FALSE_IN_STACK';
35555 return false;
35556 }
35557
35558 var hadWitness = false;
35559 if ((flags & Interpreter.SCRIPT_VERIFY_WITNESS)) {
35560 var witnessValues = {};
35561 if (scriptPubkey.isWitnessProgram(witnessValues)) {
35562 hadWitness = true;
35563 if (scriptSig.toBuffer().length !== 0) {
35564 return false;
35565 }
35566 if (!this.verifyWitnessProgram(witnessValues.version, witnessValues.program, witness, satoshis, this.flags)) {
35567 return false;
35568 }
35569 }
35570 }
35571
35572 // Additional validation for spend-to-script-hash transactions:
35573 if ((flags & Interpreter.SCRIPT_VERIFY_P2SH) && scriptPubkey.isScriptHashOut()) {
35574 // scriptSig must be literals-only or validation fails
35575 if (!scriptSig.isPushOnly()) {
35576 this.errstr = 'SCRIPT_ERR_SIG_PUSHONLY';
35577 return false;
35578 }
35579
35580 // stackCopy cannot be empty here, because if it was the
35581 // P2SH HASH <> EQUAL scriptPubKey would be evaluated with
35582 // an empty stack and the EvalScript above would return false.
35583 if (stackCopy.length === 0) {
35584 throw new Error('internal error - stack copy empty');
35585 }
35586
35587 var redeemScriptSerialized = stackCopy[stackCopy.length - 1];
35588 var redeemScript = Script.fromBuffer(redeemScriptSerialized);
35589 stackCopy.pop();
35590
35591 this.initialize();
35592 this.set({
35593 script: redeemScript,
35594 stack: stackCopy,
35595 tx: tx,
35596 nin: nin,
35597 flags: flags
35598 });
35599
35600 // evaluate redeemScript
35601 if (!this.evaluate()) {
35602 return false;
35603 }
35604
35605 if (stackCopy.length === 0) {
35606 this.errstr = 'SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK';
35607 return false;
35608 }
35609
35610 if (!Interpreter.castToBool(stackCopy[stackCopy.length - 1])) {
35611 this.errstr = 'SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK';
35612 return false;
35613 }
35614 if ((flags & Interpreter.SCRIPT_VERIFY_WITNESS)) {
35615 var p2shWitnessValues = {};
35616 if (redeemScript.isWitnessProgram(p2shWitnessValues)) {
35617 hadWitness = true;
35618 var redeemScriptPush = new Script();
35619 redeemScriptPush.add(redeemScript.toBuffer());
35620 if (scriptSig.toHex() !== redeemScriptPush.toHex()) {
35621 this.errstr = 'SCRIPT_ERR_WITNESS_MALLEATED_P2SH';
35622 return false;
35623 }
35624
35625 if (!this.verifyWitnessProgram(p2shWitnessValues.version, p2shWitnessValues.program, witness, satoshis, this.flags)) {
35626 return false;
35627 }
35628 // Bypass the cleanstack check at the end. The actual stack is obviously not clean
35629 // for witness programs.
35630 stack = [stack[0]];
35631 }
35632 }
35633 }
35634
35635 // The CLEANSTACK check is only performed after potential P2SH evaluation,
35636 // as the non-P2SH evaluation of a P2SH script will obviously not result in
35637 // a clean stack (the P2SH inputs remain). The same holds for witness
35638 // evaluation.
35639 if ((this.flags & Interpreter.SCRIPT_VERIFY_CLEANSTACK) != 0) {
35640 // Disallow CLEANSTACK without P2SH, as otherwise a switch
35641 // CLEANSTACK->P2SH+CLEANSTACK would be possible, which is not a
35642 // softfork (and P2SH should be one).
35643 if ((this.flags & Interpreter.SCRIPT_VERIFY_P2SH) == 0)
35644 throw 'flags & SCRIPT_VERIFY_P2SH';
35645
35646 if (stackCopy.length != 1) {
35647 this.errstr = 'SCRIPT_ERR_CLEANSTACK';
35648 return false;
35649 }
35650 }
35651
35652 if ((this.flags & Interpreter.SCRIPT_VERIFY_WITNESS)) {
35653 if (!hadWitness && witness.length > 0) {
35654 this.errstr = 'SCRIPT_ERR_WITNESS_UNEXPECTED';
35655 return false;
35656 }
35657 }
35658
35659 return true;
35660};
35661
35662module.exports = Interpreter;
35663
35664Interpreter.prototype.initialize = function(obj) {
35665 this.stack = [];
35666 this.altstack = [];
35667 this.pc = 0;
35668 this.satoshis = 0;
35669 this.sigversion = 0;
35670 this.pbegincodehash = 0;
35671 this.nOpCount = 0;
35672 this.vfExec = [];
35673 this.errstr = '';
35674 this.flags = 0;
35675};
35676
35677Interpreter.prototype.set = function(obj) {
35678 this.script = obj.script || this.script;
35679 this.tx = obj.tx || this.tx;
35680 this.nin = typeof obj.nin !== 'undefined' ? obj.nin : this.nin;
35681 this.stack = obj.stack || this.stack;
35682 this.altstack = obj.altack || this.altstack;
35683 this.pc = typeof obj.pc !== 'undefined' ? obj.pc : this.pc;
35684 this.pbegincodehash = typeof obj.pbegincodehash !== 'undefined' ? obj.pbegincodehash : this.pbegincodehash;
35685 this.sigversion = typeof obj.sigversion !== 'undefined' ? obj.sigversion : this.sigversion;
35686 this.satoshis = typeof obj.satoshis !== 'undefined' ? obj.satoshis : this.satoshis;
35687 this.nOpCount = typeof obj.nOpCount !== 'undefined' ? obj.nOpCount : this.nOpCount;
35688 this.vfExec = obj.vfExec || this.vfExec;
35689 this.errstr = obj.errstr || this.errstr;
35690 this.flags = typeof obj.flags !== 'undefined' ? obj.flags : this.flags;
35691};
35692
35693Interpreter.true = Buffer.from([1]);
35694Interpreter.false = Buffer.from([]);
35695
35696Interpreter.MAX_SCRIPT_ELEMENT_SIZE = 520;
35697
35698Interpreter.LOCKTIME_THRESHOLD = 500000000;
35699Interpreter.LOCKTIME_THRESHOLD_BN = new BN(Interpreter.LOCKTIME_THRESHOLD);
35700
35701// flags taken from bitcoind
35702// bitcoind commit: b5d1b1092998bc95313856d535c632ea5a8f9104
35703Interpreter.SCRIPT_VERIFY_NONE = 0;
35704
35705// Making v1-v16 witness program non-standard
35706Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM = (1 << 12);
35707
35708// Evaluate P2SH subscripts (softfork safe, BIP16).
35709Interpreter.SCRIPT_VERIFY_P2SH = (1 << 0);
35710
35711// Passing a non-strict-DER signature or one with undefined hashtype to a checksig operation causes script failure.
35712// Passing a pubkey that is not (0x04 + 64 bytes) or (0x02 or 0x03 + 32 bytes) to checksig causes that pubkey to be
35713// skipped (not softfork safe: this flag can widen the validity of OP_CHECKSIG OP_NOT).
35714Interpreter.SCRIPT_VERIFY_STRICTENC = (1 << 1);
35715
35716// Passing a non-strict-DER signature to a checksig operation causes script failure (softfork safe, BIP62 rule 1)
35717Interpreter.SCRIPT_VERIFY_DERSIG = (1 << 2);
35718
35719// Passing a non-strict-DER signature or one with S > order/2 to a checksig operation causes script failure
35720// (softfork safe, BIP62 rule 5).
35721Interpreter.SCRIPT_VERIFY_LOW_S = (1 << 3);
35722
35723// verify dummy stack item consumed by CHECKMULTISIG is of zero-length (softfork safe, BIP62 rule 7).
35724Interpreter.SCRIPT_VERIFY_NULLDUMMY = (1 << 4);
35725
35726// Using a non-push operator in the scriptSig causes script failure (softfork safe, BIP62 rule 2).
35727Interpreter.SCRIPT_VERIFY_SIGPUSHONLY = (1 << 5);
35728
35729// Require minimal encodings for all push operations (OP_0... OP_16, OP_1NEGATE where possible, direct
35730// pushes up to 75 bytes, OP_PUSHDATA up to 255 bytes, OP_PUSHDATA2 for anything larger). Evaluating
35731// any other push causes the script to fail (BIP62 rule 3).
35732// In addition, whenever a stack element is interpreted as a number, it must be of minimal length (BIP62 rule 4).
35733// (softfork safe)
35734Interpreter.SCRIPT_VERIFY_MINIMALDATA = (1 << 6);
35735
35736// Discourage use of NOPs reserved for upgrades (NOP1-10)
35737//
35738// Provided so that nodes can avoid accepting or mining transactions
35739// containing executed NOP's whose meaning may change after a soft-fork,
35740// thus rendering the script invalid; with this flag set executing
35741// discouraged NOPs fails the script. This verification flag will never be
35742// a mandatory flag applied to scripts in a block. NOPs that are not
35743// executed, e.g. within an unexecuted IF ENDIF block, are *not* rejected.
35744Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1 << 7);
35745
35746
35747// Require that only a single stack element remains after evaluation. This
35748// changes the success criterion from "At least one stack element must
35749// remain, and when interpreted as a boolean, it must be true" to "Exactly
35750// one stack element must remain, and when interpreted as a boolean, it must
35751// be true".
35752// (softfork safe, BIP62 rule 6)
35753// Note: CLEANSTACK should never be used without P2SH or WITNESS.
35754Interpreter.SCRIPT_VERIFY_CLEANSTACK = (1 << 8),
35755
35756// CLTV See BIP65 for details.
35757Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY = (1 << 9);
35758Interpreter.SCRIPT_VERIFY_WITNESS = (1 << 10);
35759Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1 << 11);
35760
35761// support CHECKSEQUENCEVERIFY opcode
35762//
35763// See BIP112 for details
35764Interpreter.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY = (1 << 10);
35765
35766//
35767// Segwit script only: Require the argument of OP_IF/NOTIF to be exactly
35768// 0x01 or empty vector
35769//
35770Interpreter.SCRIPT_VERIFY_MINIMALIF = (1 << 13);
35771
35772
35773// Signature(s) must be empty vector if an CHECK(MULTI)SIG operation failed
35774//
35775Interpreter.SCRIPT_VERIFY_NULLFAIL = (1 << 14);
35776
35777// Public keys in scripts must be compressed
35778//
35779Interpreter.SCRIPT_VERIFY_WITNESS_PUBKEYTYPE = (1 << 15);
35780
35781// Do we accept signature using SIGHASH_FORKID
35782//
35783Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID = (1 << 16);
35784
35785// Do we accept activate replay protection using a different fork id.
35786//
35787Interpreter.SCRIPT_ENABLE_REPLAY_PROTECTION = (1 << 17);
35788
35789// Enable new opcodes.
35790//
35791Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES = (1 << 18);
35792
35793
35794
35795/* Below flags apply in the context of BIP 68*/
35796/**
35797 * If this flag set, CTxIn::nSequence is NOT interpreted as a relative
35798 * lock-time.
35799 */
35800Interpreter.SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31);
35801
35802/**
35803 * If CTxIn::nSequence encodes a relative lock-time and this flag is set,
35804 * the relative lock-time has units of 512 seconds, otherwise it specifies
35805 * blocks with a granularity of 1.
35806 */
35807Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22);
35808
35809/**
35810 * If CTxIn::nSequence encodes a relative lock-time, this mask is applied to
35811 * extract that lock-time from the sequence field.
35812 */
35813Interpreter.SEQUENCE_LOCKTIME_MASK = 0x0000ffff;
35814
35815
35816Interpreter.castToBool = function(buf) {
35817 for (var i = 0; i < buf.length; i++) {
35818 if (buf[i] !== 0) {
35819 // can be negative zero
35820 if (i === buf.length - 1 && buf[i] === 0x80) {
35821 return false;
35822 }
35823 return true;
35824 }
35825 }
35826 return false;
35827};
35828
35829/**
35830 * Translated from bitcoind's CheckSignatureEncoding
35831 */
35832Interpreter.prototype.checkSignatureEncoding = function(buf) {
35833 var sig;
35834
35835 // Empty signature. Not strictly DER encoded, but allowed to provide a
35836 // compact way to provide an invalid signature for use with CHECK(MULTI)SIG
35837 if (buf.length == 0) {
35838 return true;
35839 }
35840
35841 if ((this.flags & (Interpreter.SCRIPT_VERIFY_DERSIG | Interpreter.SCRIPT_VERIFY_LOW_S | Interpreter.SCRIPT_VERIFY_STRICTENC)) !== 0 && !Signature.isTxDER(buf)) {
35842 this.errstr = 'SCRIPT_ERR_SIG_DER_INVALID_FORMAT';
35843 return false;
35844 } else if ((this.flags & Interpreter.SCRIPT_VERIFY_LOW_S) !== 0) {
35845 sig = Signature.fromTxFormat(buf);
35846 if (!sig.hasLowS()) {
35847 this.errstr = 'SCRIPT_ERR_SIG_DER_HIGH_S';
35848 return false;
35849 }
35850 } else if ((this.flags & Interpreter.SCRIPT_VERIFY_STRICTENC) !== 0) {
35851 sig = Signature.fromTxFormat(buf);
35852 if (!sig.hasDefinedHashtype()) {
35853 this.errstr = 'SCRIPT_ERR_SIG_HASHTYPE';
35854 return false;
35855 }
35856 }
35857
35858 return true;
35859};
35860
35861/**
35862 * Translated from bitcoind's CheckPubKeyEncoding
35863 */
35864Interpreter.prototype.checkPubkeyEncoding = function(buf) {
35865 if ((this.flags & Interpreter.SCRIPT_VERIFY_STRICTENC) !== 0 && !PublicKey.isValid(buf)) {
35866 this.errstr = 'SCRIPT_ERR_PUBKEYTYPE';
35867 return false;
35868 }
35869
35870 // Only compressed keys are accepted in segwit
35871 if ((this.flags & Interpreter.SCRIPT_VERIFY_WITNESS_PUBKEYTYPE) != 0 && this.sigversion == 1 && !PublicKey.fromBuffer(buf).compressed) {
35872 this.errstr = 'SCRIPT_ERR_WITNESS_PUBKEYTYPE';
35873 return false;
35874 }
35875
35876 return true;
35877};
35878
35879/**
35880 * Based on bitcoind's EvalScript function, with the inner loop moved to
35881 * Interpreter.prototype.step()
35882 * bitcoind commit: b5d1b1092998bc95313856d535c632ea5a8f9104
35883 */
35884Interpreter.prototype.evaluate = function() {
35885 if (this.script.toBuffer().length > 10000) {
35886 this.errstr = 'SCRIPT_ERR_SCRIPT_SIZE';
35887 return false;
35888 }
35889
35890 try {
35891 while (this.pc < this.script.chunks.length) {
35892 var fSuccess = this.step();
35893 if (!fSuccess) {
35894 return false;
35895 }
35896 }
35897
35898 // Size limits
35899 if (this.stack.length + this.altstack.length > 1000) {
35900 this.errstr = 'SCRIPT_ERR_STACK_SIZE';
35901 return false;
35902 }
35903 } catch (e) {
35904 this.errstr = 'SCRIPT_ERR_UNKNOWN_ERROR: ' + e;
35905 return false;
35906 }
35907
35908 if (this.vfExec.length > 0) {
35909 this.errstr = 'SCRIPT_ERR_UNBALANCED_CONDITIONAL';
35910 return false;
35911 }
35912
35913 return true;
35914};
35915
35916/**
35917 * Checks a locktime parameter with the transaction's locktime.
35918 * There are two times of nLockTime: lock-by-blockheight and lock-by-blocktime,
35919 * distinguished by whether nLockTime < LOCKTIME_THRESHOLD = 500000000
35920 *
35921 * See the corresponding code on bitcoin core:
35922 * https://github.com/bitcoin/bitcoin/blob/ffd75adce01a78b3461b3ff05bcc2b530a9ce994/src/script/interpreter.cpp#L1129
35923 *
35924 * @param {BN} nLockTime the locktime read from the script
35925 * @return {boolean} true if the transaction's locktime is less than or equal to
35926 * the transaction's locktime
35927 */
35928Interpreter.prototype.checkLockTime = function(nLockTime) {
35929
35930 // We want to compare apples to apples, so fail the script
35931 // unless the type of nLockTime being tested is the same as
35932 // the nLockTime in the transaction.
35933 if (!(
35934 (this.tx.nLockTime < Interpreter.LOCKTIME_THRESHOLD && nLockTime.lt(Interpreter.LOCKTIME_THRESHOLD_BN)) ||
35935 (this.tx.nLockTime >= Interpreter.LOCKTIME_THRESHOLD && nLockTime.gte(Interpreter.LOCKTIME_THRESHOLD_BN))
35936 )) {
35937 return false;
35938 }
35939
35940 // Now that we know we're comparing apples-to-apples, the
35941 // comparison is a simple numeric one.
35942 if (nLockTime.gt(new BN(this.tx.nLockTime))) {
35943 return false;
35944 }
35945
35946 // Finally the nLockTime feature can be disabled and thus
35947 // CHECKLOCKTIMEVERIFY bypassed if every txin has been
35948 // finalized by setting nSequence to maxint. The
35949 // transaction would be allowed into the blockchain, making
35950 // the opcode ineffective.
35951 //
35952 // Testing if this vin is not final is sufficient to
35953 // prevent this condition. Alternatively we could test all
35954 // inputs, but testing just this input minimizes the data
35955 // required to prove correct CHECKLOCKTIMEVERIFY execution.
35956 if (!this.tx.inputs[this.nin].isFinal()) {
35957 return false;
35958 }
35959
35960 return true;
35961}
35962
35963
35964/**
35965 * Checks a sequence parameter with the transaction's sequence.
35966 * @param {BN} nSequence the sequence read from the script
35967 * @return {boolean} true if the transaction's sequence is less than or equal to
35968 * the transaction's sequence
35969 */
35970Interpreter.prototype.checkSequence = function(nSequence) {
35971
35972 // Relative lock times are supported by comparing the passed in operand to
35973 // the sequence number of the input.
35974 var txToSequence = this.tx.inputs[this.nin].sequenceNumber;
35975
35976 // Fail if the transaction's version number is not set high enough to
35977 // trigger BIP 68 rules.
35978 if (this.tx.version < 2) {
35979 return false;
35980 }
35981
35982 // Sequence numbers with their most significant bit set are not consensus
35983 // constrained. Testing that the transaction's sequence number do not have
35984 // this bit set prevents using this property to get around a
35985 // CHECKSEQUENCEVERIFY check.
35986 if (txToSequence & SEQUENCE_LOCKTIME_DISABLE_FLAG) {
35987 return false;
35988 }
35989
35990 // Mask off any bits that do not have consensus-enforced meaning before
35991 // doing the integer comparisons
35992 var nLockTimeMask =
35993 Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG | Interpreter.SEQUENCE_LOCKTIME_MASK;
35994 var txToSequenceMasked = new BN(txToSequence & nLockTimeMask);
35995 var nSequenceMasked = nSequence.and(nLockTimeMask);
35996
35997 // There are two kinds of nSequence: lock-by-blockheight and
35998 // lock-by-blocktime, distinguished by whether nSequenceMasked <
35999 // CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG.
36000 //
36001 // We want to compare apples to apples, so fail the script unless the type
36002 // of nSequenceMasked being tested is the same as the nSequenceMasked in the
36003 // transaction.
36004 var SEQUENCE_LOCKTIME_TYPE_FLAG_BN = new BN(Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG);
36005
36006 if (!((txToSequenceMasked.lt(SEQUENCE_LOCKTIME_TYPE_FLAG_BN) &&
36007 nSequenceMasked.lt(SEQUENCE_LOCKTIME_TYPE_FLAG_BN)) ||
36008 (txToSequenceMasked.gte(SEQUENCE_LOCKTIME_TYPE_FLAG_BN) &&
36009 nSequenceMasked.gte(SEQUENCE_LOCKTIME_TYPE_FLAG_BN)))) {
36010 return false;
36011 }
36012
36013 // Now that we know we're comparing apples-to-apples, the comparison is a
36014 // simple numeric one.
36015 if (nSequenceMasked.gt(txToSequenceMasked)) {
36016 return false;
36017 }
36018 return true;
36019 }
36020
36021/**
36022 * Based on the inner loop of bitcoind's EvalScript function
36023 * bitcoind commit: b5d1b1092998bc95313856d535c632ea5a8f9104
36024 */
36025Interpreter.prototype.step = function() {
36026 var fRequireMinimal = (this.flags & Interpreter.SCRIPT_VERIFY_MINIMALDATA) !== 0;
36027
36028 //bool fExec = !count(vfExec.begin(), vfExec.end(), false);
36029 var fExec = (this.vfExec.indexOf(false) === -1);
36030 var buf, buf1, buf2, spliced, n, x1, x2, bn, bn1, bn2, bufSig, bufPubkey, subscript;
36031 var sig, pubkey;
36032 var fValue, fSuccess;
36033
36034 // Read instruction
36035 var chunk = this.script.chunks[this.pc];
36036 this.pc++;
36037 var opcodenum = chunk.opcodenum;
36038 if (_.isUndefined(opcodenum)) {
36039 this.errstr = 'SCRIPT_ERR_UNDEFINED_OPCODE';
36040 return false;
36041 }
36042 if (chunk.buf && chunk.buf.length > Interpreter.MAX_SCRIPT_ELEMENT_SIZE) {
36043 this.errstr = 'SCRIPT_ERR_PUSH_SIZE';
36044 return false;
36045 }
36046
36047 // Note how Opcode.OP_RESERVED does not count towards the opcode limit.
36048 if (opcodenum > Opcode.OP_16 && ++(this.nOpCount) > 201) {
36049 this.errstr = 'SCRIPT_ERR_OP_COUNT';
36050 return false;
36051 }
36052
36053
36054 if (opcodenum === Opcode.OP_CAT ||
36055 opcodenum === Opcode.OP_SUBSTR ||
36056 opcodenum === Opcode.OP_LEFT ||
36057 opcodenum === Opcode.OP_RIGHT ||
36058 opcodenum === Opcode.OP_INVERT ||
36059 opcodenum === Opcode.OP_AND ||
36060 opcodenum === Opcode.OP_OR ||
36061 opcodenum === Opcode.OP_XOR ||
36062 opcodenum === Opcode.OP_2MUL ||
36063 opcodenum === Opcode.OP_2DIV ||
36064 opcodenum === Opcode.OP_MUL ||
36065 opcodenum === Opcode.OP_DIV ||
36066 opcodenum === Opcode.OP_MOD ||
36067 opcodenum === Opcode.OP_LSHIFT ||
36068 opcodenum === Opcode.OP_RSHIFT) {
36069 this.errstr = 'SCRIPT_ERR_DISABLED_OPCODE';
36070 return false;
36071 }
36072
36073 if (fExec && 0 <= opcodenum && opcodenum <= Opcode.OP_PUSHDATA4) {
36074 if (fRequireMinimal && !this.script.checkMinimalPush(this.pc - 1)) {
36075 this.errstr = 'SCRIPT_ERR_MINIMALDATA';
36076 return false;
36077 }
36078 if (!chunk.buf) {
36079 this.stack.push(Interpreter.false);
36080 } else if (chunk.len !== chunk.buf.length) {
36081 throw new Error('Length of push value not equal to length of data');
36082 } else {
36083 this.stack.push(chunk.buf);
36084 }
36085 } else if (fExec || (Opcode.OP_IF <= opcodenum && opcodenum <= Opcode.OP_ENDIF)) {
36086 switch (opcodenum) {
36087 // Push value
36088 case Opcode.OP_1NEGATE:
36089 case Opcode.OP_1:
36090 case Opcode.OP_2:
36091 case Opcode.OP_3:
36092 case Opcode.OP_4:
36093 case Opcode.OP_5:
36094 case Opcode.OP_6:
36095 case Opcode.OP_7:
36096 case Opcode.OP_8:
36097 case Opcode.OP_9:
36098 case Opcode.OP_10:
36099 case Opcode.OP_11:
36100 case Opcode.OP_12:
36101 case Opcode.OP_13:
36102 case Opcode.OP_14:
36103 case Opcode.OP_15:
36104 case Opcode.OP_16:
36105 {
36106 // ( -- value)
36107 // ScriptNum bn((int)opcode - (int)(Opcode.OP_1 - 1));
36108 n = opcodenum - (Opcode.OP_1 - 1);
36109 buf = new BN(n).toScriptNumBuffer();
36110 this.stack.push(buf);
36111 // The result of these opcodes should always be the minimal way to push the data
36112 // they push, so no need for a CheckMinimalPush here.
36113 }
36114 break;
36115
36116
36117 //
36118 // Control
36119 //
36120 case Opcode.OP_NOP:
36121 break;
36122
36123 case Opcode.OP_NOP2:
36124 case Opcode.OP_CHECKLOCKTIMEVERIFY:
36125
36126 if (!(this.flags & Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)) {
36127 // not enabled; treat as a NOP2
36128 if (this.flags & Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) {
36129 this.errstr = 'SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS';
36130 return false;
36131 }
36132 break;
36133 }
36134
36135 if (this.stack.length < 1) {
36136 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36137 return false;
36138 }
36139
36140 // Note that elsewhere numeric opcodes are limited to
36141 // operands in the range -2**31+1 to 2**31-1, however it is
36142 // legal for opcodes to produce results exceeding that
36143 // range. This limitation is implemented by CScriptNum's
36144 // default 4-byte limit.
36145 //
36146 // If we kept to that limit we'd have a year 2038 problem,
36147 // even though the nLockTime field in transactions
36148 // themselves is uint32 which only becomes meaningless
36149 // after the year 2106.
36150 //
36151 // Thus as a special case we tell CScriptNum to accept up
36152 // to 5-byte bignums, which are good until 2**39-1, well
36153 // beyond the 2**32-1 limit of the nLockTime field itself.
36154 var nLockTime = BN.fromScriptNumBuffer(this.stack[this.stack.length - 1], fRequireMinimal, 5);
36155
36156 // In the rare event that the argument may be < 0 due to
36157 // some arithmetic being done first, you can always use
36158 // 0 MAX CHECKLOCKTIMEVERIFY.
36159 if (nLockTime.lt(new BN(0))) {
36160 this.errstr = 'SCRIPT_ERR_NEGATIVE_LOCKTIME';
36161 return false;
36162 }
36163
36164 // Actually compare the specified lock time with the transaction.
36165 if (!this.checkLockTime(nLockTime)) {
36166 this.errstr = 'SCRIPT_ERR_UNSATISFIED_LOCKTIME';
36167 return false;
36168 }
36169 break;
36170
36171 case Opcode.OP_NOP3:
36172 case Opcode.OP_CHECKSEQUENCEVERIFY:
36173
36174 if (!(this.flags & Interpreter.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)) {
36175 // not enabled; treat as a NOP3
36176 if (this.flags & Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) {
36177 this.errstr = 'SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS';
36178 return false;
36179 }
36180 break;
36181 }
36182
36183 if (this.stack.length < 1) {
36184 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36185 return false;
36186 }
36187
36188
36189 // nSequence, like nLockTime, is a 32-bit unsigned
36190 // integer field. See the comment in CHECKLOCKTIMEVERIFY
36191 // regarding 5-byte numeric operands.
36192
36193 var nSequence = BN.fromScriptNumBuffer(this.stack[this.stack.length - 1], fRequireMinimal, 5);
36194
36195
36196 // In the rare event that the argument may be < 0 due to
36197 // some arithmetic being done first, you can always use
36198 // 0 MAX CHECKSEQUENCEVERIFY.
36199 if (nSequence.lt(new BN(0))) {
36200 this.errstr = 'SCRIPT_ERR_NEGATIVE_LOCKTIME';
36201 return false;
36202 }
36203
36204 // To provide for future soft-fork extensibility, if the
36205 // operand has the disabled lock-time flag set,
36206 // CHECKSEQUENCEVERIFY behaves as a NOP.
36207 if ((nSequence &
36208 Interpreter.SEQUENCE_LOCKTIME_DISABLE_FLAG) != 0) {
36209 break;
36210 }
36211
36212 // Actually compare the specified lock time with the transaction.
36213 if (!this.checkSequence(nSequence)) {
36214 this.errstr = 'SCRIPT_ERR_UNSATISFIED_LOCKTIME';
36215 return false;
36216 }
36217 break;
36218
36219
36220
36221 case Opcode.OP_NOP1:
36222 case Opcode.OP_NOP4:
36223 case Opcode.OP_NOP5:
36224 case Opcode.OP_NOP6:
36225 case Opcode.OP_NOP7:
36226 case Opcode.OP_NOP8:
36227 case Opcode.OP_NOP9:
36228 case Opcode.OP_NOP10:
36229 {
36230 if (this.flags & Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) {
36231 this.errstr = 'SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS';
36232 return false;
36233 }
36234 }
36235 break;
36236
36237 case Opcode.OP_IF:
36238 case Opcode.OP_NOTIF:
36239 {
36240 // <expression> if [statements] [else [statements]] endif
36241 // bool fValue = false;
36242 fValue = false;
36243 if (fExec) {
36244 if (this.stack.length < 1) {
36245 this.errstr = 'SCRIPT_ERR_UNBALANCED_CONDITIONAL';
36246 return false;
36247 }
36248
36249 buf = this.stack[this.stack.length - 1];
36250
36251 if (this.flags & Interpreter.SCRIPT_VERIFY_MINIMALIF) {
36252 buf = this.stack[this.stack.length - 1];
36253 if (buf.length > 1) {
36254 this.errstr = 'SCRIPT_ERR_MINIMALIF';
36255 return false;
36256 }
36257 if (buf.length == 1 && buf[0]!=1) {
36258 this.errstr = 'SCRIPT_ERR_MINIMALIF';
36259 return false;
36260 }
36261 }
36262 fValue = Interpreter.castToBool(buf);
36263 if (opcodenum === Opcode.OP_NOTIF) {
36264 fValue = !fValue;
36265 }
36266 this.stack.pop();
36267 }
36268 this.vfExec.push(fValue);
36269 }
36270 break;
36271
36272 case Opcode.OP_ELSE:
36273 {
36274 if (this.vfExec.length === 0) {
36275 this.errstr = 'SCRIPT_ERR_UNBALANCED_CONDITIONAL';
36276 return false;
36277 }
36278 this.vfExec[this.vfExec.length - 1] = !this.vfExec[this.vfExec.length - 1];
36279 }
36280 break;
36281
36282 case Opcode.OP_ENDIF:
36283 {
36284 if (this.vfExec.length === 0) {
36285 this.errstr = 'SCRIPT_ERR_UNBALANCED_CONDITIONAL';
36286 return false;
36287 }
36288 this.vfExec.pop();
36289 }
36290 break;
36291
36292 case Opcode.OP_VERIFY:
36293 {
36294 // (true -- ) or
36295 // (false -- false) and return
36296 if (this.stack.length < 1) {
36297 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36298 return false;
36299 }
36300 buf = this.stack[this.stack.length - 1];
36301 fValue = Interpreter.castToBool(buf);
36302 if (fValue) {
36303 this.stack.pop();
36304 } else {
36305 this.errstr = 'SCRIPT_ERR_VERIFY';
36306 return false;
36307 }
36308 }
36309 break;
36310
36311 case Opcode.OP_RETURN:
36312 {
36313 this.errstr = 'SCRIPT_ERR_OP_RETURN';
36314 return false;
36315 }
36316 break;
36317
36318
36319 //
36320 // Stack ops
36321 //
36322 case Opcode.OP_TOALTSTACK:
36323 {
36324 if (this.stack.length < 1) {
36325 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36326 return false;
36327 }
36328 this.altstack.push(this.stack.pop());
36329 }
36330 break;
36331
36332 case Opcode.OP_FROMALTSTACK:
36333 {
36334 if (this.altstack.length < 1) {
36335 this.errstr = 'SCRIPT_ERR_INVALID_ALTSTACK_OPERATION';
36336 return false;
36337 }
36338 this.stack.push(this.altstack.pop());
36339 }
36340 break;
36341
36342 case Opcode.OP_2DROP:
36343 {
36344 // (x1 x2 -- )
36345 if (this.stack.length < 2) {
36346 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36347 return false;
36348 }
36349 this.stack.pop();
36350 this.stack.pop();
36351 }
36352 break;
36353
36354 case Opcode.OP_2DUP:
36355 {
36356 // (x1 x2 -- x1 x2 x1 x2)
36357 if (this.stack.length < 2) {
36358 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36359 return false;
36360 }
36361 buf1 = this.stack[this.stack.length - 2];
36362 buf2 = this.stack[this.stack.length - 1];
36363 this.stack.push(buf1);
36364 this.stack.push(buf2);
36365 }
36366 break;
36367
36368 case Opcode.OP_3DUP:
36369 {
36370 // (x1 x2 x3 -- x1 x2 x3 x1 x2 x3)
36371 if (this.stack.length < 3) {
36372 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36373 return false;
36374 }
36375 buf1 = this.stack[this.stack.length - 3];
36376 buf2 = this.stack[this.stack.length - 2];
36377 var buf3 = this.stack[this.stack.length - 1];
36378 this.stack.push(buf1);
36379 this.stack.push(buf2);
36380 this.stack.push(buf3);
36381 }
36382 break;
36383
36384 case Opcode.OP_2OVER:
36385 {
36386 // (x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2)
36387 if (this.stack.length < 4) {
36388 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36389 return false;
36390 }
36391 buf1 = this.stack[this.stack.length - 4];
36392 buf2 = this.stack[this.stack.length - 3];
36393 this.stack.push(buf1);
36394 this.stack.push(buf2);
36395 }
36396 break;
36397
36398 case Opcode.OP_2ROT:
36399 {
36400 // (x1 x2 x3 x4 x5 x6 -- x3 x4 x5 x6 x1 x2)
36401 if (this.stack.length < 6) {
36402 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36403 return false;
36404 }
36405 spliced = this.stack.splice(this.stack.length - 6, 2);
36406 this.stack.push(spliced[0]);
36407 this.stack.push(spliced[1]);
36408 }
36409 break;
36410
36411 case Opcode.OP_2SWAP:
36412 {
36413 // (x1 x2 x3 x4 -- x3 x4 x1 x2)
36414 if (this.stack.length < 4) {
36415 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36416 return false;
36417 }
36418 spliced = this.stack.splice(this.stack.length - 4, 2);
36419 this.stack.push(spliced[0]);
36420 this.stack.push(spliced[1]);
36421 }
36422 break;
36423
36424 case Opcode.OP_IFDUP:
36425 {
36426 // (x - 0 | x x)
36427 if (this.stack.length < 1) {
36428 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36429 return false;
36430 }
36431 buf = this.stack[this.stack.length - 1];
36432 fValue = Interpreter.castToBool(buf);
36433 if (fValue) {
36434 this.stack.push(buf);
36435 }
36436 }
36437 break;
36438
36439 case Opcode.OP_DEPTH:
36440 {
36441 // -- stacksize
36442 buf = new BN(this.stack.length).toScriptNumBuffer();
36443 this.stack.push(buf);
36444 }
36445 break;
36446
36447 case Opcode.OP_DROP:
36448 {
36449 // (x -- )
36450 if (this.stack.length < 1) {
36451 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36452 return false;
36453 }
36454 this.stack.pop();
36455 }
36456 break;
36457
36458 case Opcode.OP_DUP:
36459 {
36460 // (x -- x x)
36461 if (this.stack.length < 1) {
36462 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36463 return false;
36464 }
36465 this.stack.push(this.stack[this.stack.length - 1]);
36466 }
36467 break;
36468
36469 case Opcode.OP_NIP:
36470 {
36471 // (x1 x2 -- x2)
36472 if (this.stack.length < 2) {
36473 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36474 return false;
36475 }
36476 this.stack.splice(this.stack.length - 2, 1);
36477 }
36478 break;
36479
36480 case Opcode.OP_OVER:
36481 {
36482 // (x1 x2 -- x1 x2 x1)
36483 if (this.stack.length < 2) {
36484 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36485 return false;
36486 }
36487 this.stack.push(this.stack[this.stack.length - 2]);
36488 }
36489 break;
36490
36491 case Opcode.OP_PICK:
36492 case Opcode.OP_ROLL:
36493 {
36494 // (xn ... x2 x1 x0 n - xn ... x2 x1 x0 xn)
36495 // (xn ... x2 x1 x0 n - ... x2 x1 x0 xn)
36496 if (this.stack.length < 2) {
36497 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36498 return false;
36499 }
36500 buf = this.stack[this.stack.length - 1];
36501 bn = BN.fromScriptNumBuffer(buf, fRequireMinimal);
36502 n = bn.toNumber();
36503 this.stack.pop();
36504 if (n < 0 || n >= this.stack.length) {
36505 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36506 return false;
36507 }
36508 buf = this.stack[this.stack.length - n - 1];
36509 if (opcodenum === Opcode.OP_ROLL) {
36510 this.stack.splice(this.stack.length - n - 1, 1);
36511 }
36512 this.stack.push(buf);
36513 }
36514 break;
36515
36516 case Opcode.OP_ROT:
36517 {
36518 // (x1 x2 x3 -- x2 x3 x1)
36519 // x2 x1 x3 after first swap
36520 // x2 x3 x1 after second swap
36521 if (this.stack.length < 3) {
36522 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36523 return false;
36524 }
36525 x1 = this.stack[this.stack.length - 3];
36526 x2 = this.stack[this.stack.length - 2];
36527 var x3 = this.stack[this.stack.length - 1];
36528 this.stack[this.stack.length - 3] = x2;
36529 this.stack[this.stack.length - 2] = x3;
36530 this.stack[this.stack.length - 1] = x1;
36531 }
36532 break;
36533
36534 case Opcode.OP_SWAP:
36535 {
36536 // (x1 x2 -- x2 x1)
36537 if (this.stack.length < 2) {
36538 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36539 return false;
36540 }
36541 x1 = this.stack[this.stack.length - 2];
36542 x2 = this.stack[this.stack.length - 1];
36543 this.stack[this.stack.length - 2] = x2;
36544 this.stack[this.stack.length - 1] = x1;
36545 }
36546 break;
36547
36548 case Opcode.OP_TUCK:
36549 {
36550 // (x1 x2 -- x2 x1 x2)
36551 if (this.stack.length < 2) {
36552 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36553 return false;
36554 }
36555 this.stack.splice(this.stack.length - 2, 0, this.stack[this.stack.length - 1]);
36556 }
36557 break;
36558
36559
36560 case Opcode.OP_SIZE:
36561 {
36562 // (in -- in size)
36563 if (this.stack.length < 1) {
36564 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36565 return false;
36566 }
36567 bn = new BN(this.stack[this.stack.length - 1].length);
36568 this.stack.push(bn.toScriptNumBuffer());
36569 }
36570 break;
36571
36572
36573 //
36574 // Bitwise logic
36575 //
36576 case Opcode.OP_EQUAL:
36577 case Opcode.OP_EQUALVERIFY:
36578 //case Opcode.OP_NOTEQUAL: // use Opcode.OP_NUMNOTEQUAL
36579 {
36580 // (x1 x2 - bool)
36581 if (this.stack.length < 2) {
36582 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36583 return false;
36584 }
36585 buf1 = this.stack[this.stack.length - 2];
36586 buf2 = this.stack[this.stack.length - 1];
36587 var fEqual = buf1.toString('hex') === buf2.toString('hex');
36588 this.stack.pop();
36589 this.stack.pop();
36590 this.stack.push(fEqual ? Interpreter.true : Interpreter.false);
36591 if (opcodenum === Opcode.OP_EQUALVERIFY) {
36592 if (fEqual) {
36593 this.stack.pop();
36594 } else {
36595 this.errstr = 'SCRIPT_ERR_EQUALVERIFY';
36596 return false;
36597 }
36598 }
36599 }
36600 break;
36601
36602
36603 //
36604 // Numeric
36605 //
36606 case Opcode.OP_1ADD:
36607 case Opcode.OP_1SUB:
36608 case Opcode.OP_NEGATE:
36609 case Opcode.OP_ABS:
36610 case Opcode.OP_NOT:
36611 case Opcode.OP_0NOTEQUAL:
36612 {
36613 // (in -- out)
36614 if (this.stack.length < 1) {
36615 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36616 return false;
36617 }
36618 buf = this.stack[this.stack.length - 1];
36619 bn = BN.fromScriptNumBuffer(buf, fRequireMinimal);
36620 switch (opcodenum) {
36621 case Opcode.OP_1ADD:
36622 bn = bn.add(BN.One);
36623 break;
36624 case Opcode.OP_1SUB:
36625 bn = bn.sub(BN.One);
36626 break;
36627 case Opcode.OP_NEGATE:
36628 bn = bn.neg();
36629 break;
36630 case Opcode.OP_ABS:
36631 if (bn.cmp(BN.Zero) < 0) {
36632 bn = bn.neg();
36633 }
36634 break;
36635 case Opcode.OP_NOT:
36636 bn = new BN((bn.cmp(BN.Zero) === 0) + 0);
36637 break;
36638 case Opcode.OP_0NOTEQUAL:
36639 bn = new BN((bn.cmp(BN.Zero) !== 0) + 0);
36640 break;
36641 //default: assert(!'invalid opcode'); break; // TODO: does this ever occur?
36642 }
36643 this.stack.pop();
36644 this.stack.push(bn.toScriptNumBuffer());
36645 }
36646 break;
36647
36648 case Opcode.OP_ADD:
36649 case Opcode.OP_SUB:
36650 case Opcode.OP_BOOLAND:
36651 case Opcode.OP_BOOLOR:
36652 case Opcode.OP_NUMEQUAL:
36653 case Opcode.OP_NUMEQUALVERIFY:
36654 case Opcode.OP_NUMNOTEQUAL:
36655 case Opcode.OP_LESSTHAN:
36656 case Opcode.OP_GREATERTHAN:
36657 case Opcode.OP_LESSTHANOREQUAL:
36658 case Opcode.OP_GREATERTHANOREQUAL:
36659 case Opcode.OP_MIN:
36660 case Opcode.OP_MAX:
36661 {
36662 // (x1 x2 -- out)
36663 if (this.stack.length < 2) {
36664 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36665 return false;
36666 }
36667 bn1 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 2], fRequireMinimal);
36668 bn2 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 1], fRequireMinimal);
36669 bn = new BN(0);
36670
36671 switch (opcodenum) {
36672 case Opcode.OP_ADD:
36673 bn = bn1.add(bn2);
36674 break;
36675
36676 case Opcode.OP_SUB:
36677 bn = bn1.sub(bn2);
36678 break;
36679
36680 // case Opcode.OP_BOOLAND: bn = (bn1 != bnZero && bn2 != bnZero); break;
36681 case Opcode.OP_BOOLAND:
36682 bn = new BN(((bn1.cmp(BN.Zero) !== 0) && (bn2.cmp(BN.Zero) !== 0)) + 0);
36683 break;
36684 // case Opcode.OP_BOOLOR: bn = (bn1 != bnZero || bn2 != bnZero); break;
36685 case Opcode.OP_BOOLOR:
36686 bn = new BN(((bn1.cmp(BN.Zero) !== 0) || (bn2.cmp(BN.Zero) !== 0)) + 0);
36687 break;
36688 // case Opcode.OP_NUMEQUAL: bn = (bn1 == bn2); break;
36689 case Opcode.OP_NUMEQUAL:
36690 bn = new BN((bn1.cmp(bn2) === 0) + 0);
36691 break;
36692 // case Opcode.OP_NUMEQUALVERIFY: bn = (bn1 == bn2); break;
36693 case Opcode.OP_NUMEQUALVERIFY:
36694 bn = new BN((bn1.cmp(bn2) === 0) + 0);
36695 break;
36696 // case Opcode.OP_NUMNOTEQUAL: bn = (bn1 != bn2); break;
36697 case Opcode.OP_NUMNOTEQUAL:
36698 bn = new BN((bn1.cmp(bn2) !== 0) + 0);
36699 break;
36700 // case Opcode.OP_LESSTHAN: bn = (bn1 < bn2); break;
36701 case Opcode.OP_LESSTHAN:
36702 bn = new BN((bn1.cmp(bn2) < 0) + 0);
36703 break;
36704 // case Opcode.OP_GREATERTHAN: bn = (bn1 > bn2); break;
36705 case Opcode.OP_GREATERTHAN:
36706 bn = new BN((bn1.cmp(bn2) > 0) + 0);
36707 break;
36708 // case Opcode.OP_LESSTHANOREQUAL: bn = (bn1 <= bn2); break;
36709 case Opcode.OP_LESSTHANOREQUAL:
36710 bn = new BN((bn1.cmp(bn2) <= 0) + 0);
36711 break;
36712 // case Opcode.OP_GREATERTHANOREQUAL: bn = (bn1 >= bn2); break;
36713 case Opcode.OP_GREATERTHANOREQUAL:
36714 bn = new BN((bn1.cmp(bn2) >= 0) + 0);
36715 break;
36716 case Opcode.OP_MIN:
36717 bn = (bn1.cmp(bn2) < 0 ? bn1 : bn2);
36718 break;
36719 case Opcode.OP_MAX:
36720 bn = (bn1.cmp(bn2) > 0 ? bn1 : bn2);
36721 break;
36722 // default: assert(!'invalid opcode'); break; //TODO: does this ever occur?
36723 }
36724 this.stack.pop();
36725 this.stack.pop();
36726 this.stack.push(bn.toScriptNumBuffer());
36727
36728 if (opcodenum === Opcode.OP_NUMEQUALVERIFY) {
36729 // if (CastToBool(stacktop(-1)))
36730 if (Interpreter.castToBool(this.stack[this.stack.length - 1])) {
36731 this.stack.pop();
36732 } else {
36733 this.errstr = 'SCRIPT_ERR_NUMEQUALVERIFY';
36734 return false;
36735 }
36736 }
36737 }
36738 break;
36739
36740 case Opcode.OP_WITHIN:
36741 {
36742 // (x min max -- out)
36743 if (this.stack.length < 3) {
36744 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36745 return false;
36746 }
36747 bn1 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 3], fRequireMinimal);
36748 bn2 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 2], fRequireMinimal);
36749 var bn3 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 1], fRequireMinimal);
36750 //bool fValue = (bn2 <= bn1 && bn1 < bn3);
36751 fValue = (bn2.cmp(bn1) <= 0) && (bn1.cmp(bn3) < 0);
36752 this.stack.pop();
36753 this.stack.pop();
36754 this.stack.pop();
36755 this.stack.push(fValue ? Interpreter.true : Interpreter.false);
36756 }
36757 break;
36758
36759
36760 //
36761 // Crypto
36762 //
36763 case Opcode.OP_RIPEMD160:
36764 case Opcode.OP_SHA1:
36765 case Opcode.OP_SHA256:
36766 case Opcode.OP_HASH160:
36767 case Opcode.OP_HASH256:
36768 {
36769 // (in -- hash)
36770 if (this.stack.length < 1) {
36771 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36772 return false;
36773 }
36774 buf = this.stack[this.stack.length - 1];
36775 //valtype vchHash((opcode == Opcode.OP_RIPEMD160 ||
36776 // opcode == Opcode.OP_SHA1 || opcode == Opcode.OP_HASH160) ? 20 : 32);
36777 var bufHash;
36778 if (opcodenum === Opcode.OP_RIPEMD160) {
36779 bufHash = Hash.ripemd160(buf);
36780 } else if (opcodenum === Opcode.OP_SHA1) {
36781 bufHash = Hash.sha1(buf);
36782 } else if (opcodenum === Opcode.OP_SHA256) {
36783 bufHash = Hash.sha256(buf);
36784 } else if (opcodenum === Opcode.OP_HASH160) {
36785 bufHash = Hash.sha256ripemd160(buf);
36786 } else if (opcodenum === Opcode.OP_HASH256) {
36787 bufHash = Hash.sha256sha256(buf);
36788 }
36789 this.stack.pop();
36790 this.stack.push(bufHash);
36791 }
36792 break;
36793
36794 case Opcode.OP_CODESEPARATOR:
36795 {
36796 // Hash starts after the code separator
36797 this.pbegincodehash = this.pc;
36798 }
36799 break;
36800
36801 case Opcode.OP_CHECKSIG:
36802 case Opcode.OP_CHECKSIGVERIFY:
36803 {
36804 // (sig pubkey -- bool)
36805 if (this.stack.length < 2) {
36806 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36807 return false;
36808 }
36809
36810 bufSig = this.stack[this.stack.length - 2];
36811 bufPubkey = this.stack[this.stack.length - 1];
36812 if (!this.checkSignatureEncoding(bufSig) || !this.checkPubkeyEncoding(bufPubkey)) {
36813 return false;
36814 }
36815
36816 // Subset of script starting at the most recent codeseparator
36817 // CScript scriptCode(pbegincodehash, pend);
36818 subscript = new Script().set({
36819 chunks: this.script.chunks.slice(this.pbegincodehash)
36820 });
36821
36822 // Drop the signature, since there's no way for a signature to sign itself
36823 var tmpScript = new Script().add(bufSig);
36824 subscript.findAndDelete(tmpScript);
36825
36826 try {
36827 sig = Signature.fromTxFormat(bufSig);
36828 pubkey = PublicKey.fromBuffer(bufPubkey, false);
36829 fSuccess = this.tx.verifySignature(sig, pubkey, this.nin, subscript, this.sigversion, this.satoshis);
36830 } catch (e) {
36831 //invalid sig or pubkey
36832 fSuccess = false;
36833 }
36834
36835 if (!fSuccess && (this.flags & Interpreter.SCRIPT_VERIFY_NULLFAIL) &&
36836 bufSig.length) {
36837 this.errstr = 'SCRIPT_ERR_NULLFAIL';
36838 return false;
36839 }
36840
36841 this.stack.pop();
36842 this.stack.pop();
36843
36844 // stack.push_back(fSuccess ? vchTrue : vchFalse);
36845 this.stack.push(fSuccess ? Interpreter.true : Interpreter.false);
36846 if (opcodenum === Opcode.OP_CHECKSIGVERIFY) {
36847 if (fSuccess) {
36848 this.stack.pop();
36849 } else {
36850 this.errstr = 'SCRIPT_ERR_CHECKSIGVERIFY';
36851 return false;
36852 }
36853 }
36854 }
36855 break;
36856
36857 case Opcode.OP_CHECKMULTISIG:
36858 case Opcode.OP_CHECKMULTISIGVERIFY:
36859 {
36860 // ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)
36861
36862 var i = 1;
36863 if (this.stack.length < i) {
36864 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36865 return false;
36866 }
36867
36868 var nKeysCount = BN.fromScriptNumBuffer(this.stack[this.stack.length - i], fRequireMinimal).toNumber();
36869 if (nKeysCount < 0 || nKeysCount > 20) {
36870 this.errstr = 'SCRIPT_ERR_PUBKEY_COUNT';
36871 return false;
36872 }
36873 this.nOpCount += nKeysCount;
36874 if (this.nOpCount > 201) {
36875 this.errstr = 'SCRIPT_ERR_OP_COUNT';
36876 return false;
36877 }
36878 // int ikey = ++i;
36879 var ikey = ++i;
36880 i += nKeysCount;
36881
36882 // ikey2 is the position of last non-signature item in
36883 // the stack. Top stack item = 1. With
36884 // SCRIPT_VERIFY_NULLFAIL, this is used for cleanup if
36885 // operation fails.
36886 var ikey2 = nKeysCount + 2;
36887
36888 if (this.stack.length < i) {
36889 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36890 return false;
36891 }
36892
36893 var nSigsCount = BN.fromScriptNumBuffer(this.stack[this.stack.length - i], fRequireMinimal).toNumber();
36894 if (nSigsCount < 0 || nSigsCount > nKeysCount) {
36895 this.errstr = 'SCRIPT_ERR_SIG_COUNT';
36896 return false;
36897 }
36898 // int isig = ++i;
36899 var isig = ++i;
36900 i += nSigsCount;
36901 if (this.stack.length < i) {
36902 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36903 return false;
36904 }
36905
36906 // Subset of script starting at the most recent codeseparator
36907 subscript = new Script().set({
36908 chunks: this.script.chunks.slice(this.pbegincodehash)
36909 });
36910
36911 // Drop the signatures, since there's no way for a signature to sign itself
36912 for (var k = 0; k < nSigsCount; k++) {
36913 bufSig = this.stack[this.stack.length - isig - k];
36914 subscript.findAndDelete(new Script().add(bufSig));
36915 }
36916
36917 fSuccess = true;
36918 while (fSuccess && nSigsCount > 0) {
36919 // valtype& vchSig = stacktop(-isig);
36920 bufSig = this.stack[this.stack.length - isig];
36921 // valtype& vchPubKey = stacktop(-ikey);
36922 bufPubkey = this.stack[this.stack.length - ikey];
36923
36924 if (!this.checkSignatureEncoding(bufSig) || !this.checkPubkeyEncoding(bufPubkey)) {
36925 return false;
36926 }
36927
36928 var fOk;
36929 try {
36930 sig = Signature.fromTxFormat(bufSig);
36931 pubkey = PublicKey.fromBuffer(bufPubkey, false);
36932 fOk = this.tx.verifySignature(sig, pubkey, this.nin, subscript, this.sigversion, this.satoshis);
36933 } catch (e) {
36934 //invalid sig or pubkey
36935 fOk = false;
36936 }
36937
36938 if (fOk) {
36939 isig++;
36940 nSigsCount--;
36941 }
36942 ikey++;
36943 nKeysCount--;
36944
36945 // If there are more signatures left than keys left,
36946 // then too many signatures have failed
36947 if (nSigsCount > nKeysCount) {
36948 fSuccess = false;
36949 }
36950 }
36951
36952
36953 // Clean up stack of actual arguments
36954 while (i-- > 1) {
36955 if (!fSuccess && (this.flags & Interpreter.SCRIPT_VERIFY_NULLFAIL) &&
36956 !ikey2 && this.stack[this.stack.length - 1].length) {
36957
36958 this.errstr = 'SCRIPT_ERR_NULLFAIL';
36959 return false;
36960 }
36961
36962 if (ikey2 > 0) {
36963 ikey2--;
36964 }
36965
36966 this.stack.pop();
36967 }
36968
36969 // A bug causes CHECKMULTISIG to consume one extra argument
36970 // whose contents were not checked in any way.
36971 //
36972 // Unfortunately this is a potential source of mutability,
36973 // so optionally verify it is exactly equal to zero prior
36974 // to removing it from the stack.
36975 if (this.stack.length < 1) {
36976 this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION';
36977 return false;
36978 }
36979 if ((this.flags & Interpreter.SCRIPT_VERIFY_NULLDUMMY) && this.stack[this.stack.length - 1].length) {
36980 this.errstr = 'SCRIPT_ERR_SIG_NULLDUMMY';
36981 return false;
36982 }
36983 this.stack.pop();
36984
36985 this.stack.push(fSuccess ? Interpreter.true : Interpreter.false);
36986
36987 if (opcodenum === Opcode.OP_CHECKMULTISIGVERIFY) {
36988 if (fSuccess) {
36989 this.stack.pop();
36990 } else {
36991 this.errstr = 'SCRIPT_ERR_CHECKMULTISIGVERIFY';
36992 return false;
36993 }
36994 }
36995 }
36996 break;
36997
36998 default:
36999 this.errstr = 'SCRIPT_ERR_BAD_OPCODE';
37000 return false;
37001 }
37002 }
37003
37004 return true;
37005};
37006
37007
37008}).call(this,require("buffer").Buffer)
37009},{"../crypto/bn":271,"../crypto/hash":273,"../crypto/signature":276,"../opcode":287,"../publickey":289,"../transaction":293,"./script":292,"buffer":146,"lodash":311}],292:[function(require,module,exports){
37010(function (Buffer){
37011'use strict';
37012
37013var Address = require('../address');
37014var BufferReader = require('../encoding/bufferreader');
37015var BufferWriter = require('../encoding/bufferwriter');
37016var Hash = require('../crypto/hash');
37017var Opcode = require('../opcode');
37018var PublicKey = require('../publickey');
37019var Signature = require('../crypto/signature');
37020var Networks = require('../networks');
37021var $ = require('../util/preconditions');
37022var _ = require('lodash');
37023var errors = require('../errors');
37024var buffer = require('buffer');
37025var BufferUtil = require('../util/buffer');
37026var JSUtil = require('../util/js');
37027
37028/**
37029 * A bitcoin transaction script. Each transaction's inputs and outputs
37030 * has a script that is evaluated to validate it's spending.
37031 *
37032 * See https://en.bitcoin.it/wiki/Script
37033 *
37034 * @constructor
37035 * @param {Object|string|Buffer=} from optional data to populate script
37036 */
37037var Script = function Script(from) {
37038 if (!(this instanceof Script)) {
37039 return new Script(from);
37040 }
37041 this.chunks = [];
37042
37043 if (BufferUtil.isBuffer(from)) {
37044 return Script.fromBuffer(from);
37045 } else if (from instanceof Address) {
37046 return Script.fromAddress(from);
37047 } else if (from instanceof Script) {
37048 return Script.fromBuffer(from.toBuffer());
37049 } else if (_.isString(from)) {
37050 return Script.fromString(from);
37051 } else if (_.isObject(from) && _.isArray(from.chunks)) {
37052 this.set(from);
37053 }
37054};
37055
37056Script.prototype.set = function(obj) {
37057 $.checkArgument(_.isObject(obj));
37058 $.checkArgument(_.isArray(obj.chunks));
37059 this.chunks = obj.chunks;
37060 return this;
37061};
37062
37063Script.fromBuffer = function(buffer) {
37064 var script = new Script();
37065 script.chunks = [];
37066
37067 var br = new BufferReader(buffer);
37068 while (!br.finished()) {
37069 try {
37070 var opcodenum = br.readUInt8();
37071
37072 var len, buf;
37073 if (opcodenum > 0 && opcodenum < Opcode.OP_PUSHDATA1) {
37074 len = opcodenum;
37075 script.chunks.push({
37076 buf: br.read(len),
37077 len: len,
37078 opcodenum: opcodenum
37079 });
37080 } else if (opcodenum === Opcode.OP_PUSHDATA1) {
37081 len = br.readUInt8();
37082 buf = br.read(len);
37083 script.chunks.push({
37084 buf: buf,
37085 len: len,
37086 opcodenum: opcodenum
37087 });
37088 } else if (opcodenum === Opcode.OP_PUSHDATA2) {
37089 len = br.readUInt16LE();
37090 buf = br.read(len);
37091 script.chunks.push({
37092 buf: buf,
37093 len: len,
37094 opcodenum: opcodenum
37095 });
37096 } else if (opcodenum === Opcode.OP_PUSHDATA4) {
37097 len = br.readUInt32LE();
37098 buf = br.read(len);
37099 script.chunks.push({
37100 buf: buf,
37101 len: len,
37102 opcodenum: opcodenum
37103 });
37104 } else {
37105 script.chunks.push({
37106 opcodenum: opcodenum
37107 });
37108 }
37109 } catch (e) {
37110 if (e instanceof RangeError) {
37111 throw new errors.Script.InvalidBuffer(buffer.toString('hex'));
37112 }
37113 throw e;
37114 }
37115 }
37116
37117 return script;
37118};
37119
37120Script.prototype.toBuffer = function() {
37121 var bw = new BufferWriter();
37122
37123 for (var i = 0; i < this.chunks.length; i++) {
37124 var chunk = this.chunks[i];
37125 var opcodenum = chunk.opcodenum;
37126 bw.writeUInt8(chunk.opcodenum);
37127 if (chunk.buf) {
37128 if (opcodenum < Opcode.OP_PUSHDATA1) {
37129 bw.write(chunk.buf);
37130 } else if (opcodenum === Opcode.OP_PUSHDATA1) {
37131 bw.writeUInt8(chunk.len);
37132 bw.write(chunk.buf);
37133 } else if (opcodenum === Opcode.OP_PUSHDATA2) {
37134 bw.writeUInt16LE(chunk.len);
37135 bw.write(chunk.buf);
37136 } else if (opcodenum === Opcode.OP_PUSHDATA4) {
37137 bw.writeUInt32LE(chunk.len);
37138 bw.write(chunk.buf);
37139 }
37140 }
37141 }
37142
37143 return bw.concat();
37144};
37145
37146Script.fromASM = function(str) {
37147 var script = new Script();
37148 script.chunks = [];
37149
37150 var tokens = str.split(' ');
37151 var i = 0;
37152 while (i < tokens.length) {
37153 var token = tokens[i];
37154 var opcode = Opcode(token);
37155 var opcodenum = opcode.toNumber();
37156
37157 if (_.isUndefined(opcodenum)) {
37158 var buf = Buffer.from(tokens[i], 'hex');
37159 script.chunks.push({
37160 buf: buf,
37161 len: buf.length,
37162 opcodenum: buf.length
37163 });
37164 i = i + 1;
37165 } else if (opcodenum === Opcode.OP_PUSHDATA1 ||
37166 opcodenum === Opcode.OP_PUSHDATA2 ||
37167 opcodenum === Opcode.OP_PUSHDATA4) {
37168 script.chunks.push({
37169 buf: Buffer.from(tokens[i + 2], 'hex'),
37170 len: parseInt(tokens[i + 1]),
37171 opcodenum: opcodenum
37172 });
37173 i = i + 3;
37174 } else {
37175 script.chunks.push({
37176 opcodenum: opcodenum
37177 });
37178 i = i + 1;
37179 }
37180 }
37181 return script;
37182};
37183
37184Script.fromHex = function(str) {
37185 return new Script(new buffer.Buffer(str, 'hex'));
37186};
37187
37188Script.fromString = function(str) {
37189 if (JSUtil.isHexa(str) || str.length === 0) {
37190 return new Script(new buffer.Buffer(str, 'hex'));
37191 }
37192 var script = new Script();
37193 script.chunks = [];
37194
37195 var tokens = str.split(' ');
37196 var i = 0;
37197 while (i < tokens.length) {
37198 var token = tokens[i];
37199 var opcode = Opcode(token);
37200 var opcodenum = opcode.toNumber();
37201
37202 if (_.isUndefined(opcodenum)) {
37203 opcodenum = parseInt(token);
37204 if (opcodenum > 0 && opcodenum < Opcode.OP_PUSHDATA1) {
37205 script.chunks.push({
37206 buf: Buffer.from(tokens[i + 1].slice(2), 'hex'),
37207 len: opcodenum,
37208 opcodenum: opcodenum
37209 });
37210 i = i + 2;
37211 } else {
37212 throw new Error('Invalid script: ' + JSON.stringify(str));
37213 }
37214 } else if (opcodenum === Opcode.OP_PUSHDATA1 ||
37215 opcodenum === Opcode.OP_PUSHDATA2 ||
37216 opcodenum === Opcode.OP_PUSHDATA4) {
37217 if (tokens[i + 2].slice(0, 2) !== '0x') {
37218 throw new Error('Pushdata data must start with 0x');
37219 }
37220 script.chunks.push({
37221 buf: Buffer.from(tokens[i + 2].slice(2), 'hex'),
37222 len: parseInt(tokens[i + 1]),
37223 opcodenum: opcodenum
37224 });
37225 i = i + 3;
37226 } else {
37227 script.chunks.push({
37228 opcodenum: opcodenum
37229 });
37230 i = i + 1;
37231 }
37232 }
37233 return script;
37234};
37235
37236Script.prototype._chunkToString = function(chunk, type) {
37237 var opcodenum = chunk.opcodenum;
37238 var asm = (type === 'asm');
37239 var str = '';
37240 if (!chunk.buf) {
37241 // no data chunk
37242 if (typeof Opcode.reverseMap[opcodenum] !== 'undefined') {
37243 if (asm) {
37244 // A few cases where the opcode name differs from reverseMap
37245 // aside from 1 to 16 data pushes.
37246 if (opcodenum === 0) {
37247 // OP_0 -> 0
37248 str = str + ' 0';
37249 } else if(opcodenum === 79) {
37250 // OP_1NEGATE -> 1
37251 str = str + ' -1';
37252 } else {
37253 str = str + ' ' + Opcode(opcodenum).toString();
37254 }
37255 } else {
37256 str = str + ' ' + Opcode(opcodenum).toString();
37257 }
37258 } else {
37259 var numstr = opcodenum.toString(16);
37260 if (numstr.length % 2 !== 0) {
37261 numstr = '0' + numstr;
37262 }
37263 if (asm) {
37264 str = str + ' ' + numstr;
37265 } else {
37266 str = str + ' ' + '0x' + numstr;
37267 }
37268 }
37269 } else {
37270 // data chunk
37271 if (!asm && opcodenum === Opcode.OP_PUSHDATA1 ||
37272 opcodenum === Opcode.OP_PUSHDATA2 ||
37273 opcodenum === Opcode.OP_PUSHDATA4) {
37274 str = str + ' ' + Opcode(opcodenum).toString();
37275 }
37276 if (chunk.len > 0) {
37277 if (asm) {
37278 str = str + ' ' + chunk.buf.toString('hex');
37279 } else {
37280 str = str + ' ' + chunk.len + ' ' + '0x' + chunk.buf.toString('hex');
37281 }
37282 }
37283 }
37284 return str;
37285};
37286
37287Script.prototype.toASM = function() {
37288 var str = '';
37289 for (var i = 0; i < this.chunks.length; i++) {
37290 var chunk = this.chunks[i];
37291 str += this._chunkToString(chunk, 'asm');
37292 }
37293
37294 return str.substr(1);
37295};
37296
37297Script.prototype.toString = function() {
37298 var str = '';
37299 for (var i = 0; i < this.chunks.length; i++) {
37300 var chunk = this.chunks[i];
37301 str += this._chunkToString(chunk);
37302 }
37303
37304 return str.substr(1);
37305};
37306
37307Script.prototype.toHex = function() {
37308 return this.toBuffer().toString('hex');
37309};
37310
37311Script.prototype.inspect = function() {
37312 return '<Script: ' + this.toString() + '>';
37313};
37314
37315// script classification methods
37316
37317/**
37318 * @returns {boolean} if this is a pay to pubkey hash output script
37319 */
37320Script.prototype.isPublicKeyHashOut = function() {
37321 return !!(this.chunks.length === 5 &&
37322 this.chunks[0].opcodenum === Opcode.OP_DUP &&
37323 this.chunks[1].opcodenum === Opcode.OP_HASH160 &&
37324 this.chunks[2].buf &&
37325 this.chunks[2].buf.length === 20 &&
37326 this.chunks[3].opcodenum === Opcode.OP_EQUALVERIFY &&
37327 this.chunks[4].opcodenum === Opcode.OP_CHECKSIG);
37328};
37329
37330/**
37331 * @returns {boolean} if this is a pay to public key hash input script
37332 */
37333Script.prototype.isPublicKeyHashIn = function() {
37334 if (this.chunks.length === 2) {
37335 var signatureBuf = this.chunks[0].buf;
37336 var pubkeyBuf = this.chunks[1].buf;
37337 if (signatureBuf &&
37338 signatureBuf.length &&
37339 signatureBuf[0] === 0x30 &&
37340 pubkeyBuf &&
37341 pubkeyBuf.length
37342 ) {
37343 var version = pubkeyBuf[0];
37344 if ((version === 0x04 ||
37345 version === 0x06 ||
37346 version === 0x07) && pubkeyBuf.length === 65) {
37347 return true;
37348 } else if ((version === 0x03 || version === 0x02) && pubkeyBuf.length === 33) {
37349 return true;
37350 }
37351 }
37352 }
37353 return false;
37354};
37355
37356Script.prototype.getPublicKey = function() {
37357 $.checkState(this.isPublicKeyOut(), 'Can\'t retrieve PublicKey from a non-PK output');
37358 return this.chunks[0].buf;
37359};
37360
37361Script.prototype.getPublicKeyHash = function() {
37362 $.checkState(this.isPublicKeyHashOut(), 'Can\'t retrieve PublicKeyHash from a non-PKH output');
37363 return this.chunks[2].buf;
37364};
37365
37366/**
37367 * @returns {boolean} if this is a public key output script
37368 */
37369Script.prototype.isPublicKeyOut = function() {
37370 if (this.chunks.length === 2 &&
37371 this.chunks[0].buf &&
37372 this.chunks[0].buf.length &&
37373 this.chunks[1].opcodenum === Opcode.OP_CHECKSIG) {
37374 var pubkeyBuf = this.chunks[0].buf;
37375 var version = pubkeyBuf[0];
37376 var isVersion = false;
37377 if ((version === 0x04 ||
37378 version === 0x06 ||
37379 version === 0x07) && pubkeyBuf.length === 65) {
37380 isVersion = true;
37381 } else if ((version === 0x03 || version === 0x02) && pubkeyBuf.length === 33) {
37382 isVersion = true;
37383 }
37384 if (isVersion) {
37385 return PublicKey.isValid(pubkeyBuf);
37386 }
37387 }
37388 return false;
37389};
37390
37391/**
37392 * @returns {boolean} if this is a pay to public key input script
37393 */
37394Script.prototype.isPublicKeyIn = function() {
37395 if (this.chunks.length === 1) {
37396 var signatureBuf = this.chunks[0].buf;
37397 if (signatureBuf &&
37398 signatureBuf.length &&
37399 signatureBuf[0] === 0x30) {
37400 return true;
37401 }
37402 }
37403 return false;
37404};
37405
37406/**
37407 * @returns {boolean} if this is a p2sh output script
37408 */
37409Script.prototype.isScriptHashOut = function() {
37410 var buf = this.toBuffer();
37411 return (buf.length === 23 &&
37412 buf[0] === Opcode.OP_HASH160 &&
37413 buf[1] === 0x14 &&
37414 buf[buf.length - 1] === Opcode.OP_EQUAL);
37415};
37416
37417/**
37418 * @returns {boolean} if this is a p2wsh output script
37419 */
37420Script.prototype.isWitnessScriptHashOut = function() {
37421 var buf = this.toBuffer();
37422 return (buf.length === 34 && buf[0] === 0 && buf[1] === 32);
37423};
37424
37425/**
37426 * @returns {boolean} if this is a p2wpkh output script
37427 */
37428Script.prototype.isWitnessPublicKeyHashOut = function() {
37429 var buf = this.toBuffer();
37430 return (buf.length === 22 && buf[0] === 0 && buf[1] === 20);
37431};
37432
37433/**
37434 * @param {Object=} values - The return values
37435 * @param {Number} values.version - Set with the witness version
37436 * @param {Buffer} values.program - Set with the witness program
37437 * @returns {boolean} if this is a p2wpkh output script
37438 */
37439Script.prototype.isWitnessProgram = function(values) {
37440 if (!values) {
37441 values = {};
37442 }
37443 var buf = this.toBuffer();
37444 if (buf.length < 4 || buf.length > 42) {
37445 return false;
37446 }
37447 if (buf[0] !== Opcode.OP_0 && !(buf[0] >= Opcode.OP_1 && buf[0] <= Opcode.OP_16)) {
37448 return false;
37449 }
37450
37451 if (buf.length === buf[1] + 2) {
37452 values.version = buf[0];
37453 values.program = buf.slice(2, buf.length);
37454 return true;
37455 }
37456
37457 return false;
37458};
37459
37460/**
37461 * @returns {boolean} if this is a p2sh input script
37462 * Note that these are frequently indistinguishable from pubkeyhashin
37463 */
37464Script.prototype.isScriptHashIn = function() {
37465 if (this.chunks.length <= 1) {
37466 return false;
37467 }
37468 var redeemChunk = this.chunks[this.chunks.length - 1];
37469 var redeemBuf = redeemChunk.buf;
37470 if (!redeemBuf) {
37471 return false;
37472 }
37473
37474 var redeemScript;
37475 try {
37476 redeemScript = Script.fromBuffer(redeemBuf);
37477 } catch (e) {
37478 if (e instanceof errors.Script.InvalidBuffer) {
37479 return false;
37480 }
37481 throw e;
37482 }
37483 var type = redeemScript.classify();
37484 return type !== Script.types.UNKNOWN;
37485};
37486
37487/**
37488 * @returns {boolean} if this is a mutlsig output script
37489 */
37490Script.prototype.isMultisigOut = function() {
37491 return (this.chunks.length > 3 &&
37492 Opcode.isSmallIntOp(this.chunks[0].opcodenum) &&
37493 this.chunks.slice(1, this.chunks.length - 2).every(function(obj) {
37494 return obj.buf && BufferUtil.isBuffer(obj.buf);
37495 }) &&
37496 Opcode.isSmallIntOp(this.chunks[this.chunks.length - 2].opcodenum) &&
37497 this.chunks[this.chunks.length - 1].opcodenum === Opcode.OP_CHECKMULTISIG);
37498};
37499
37500
37501/**
37502 * @returns {boolean} if this is a multisig input script
37503 */
37504Script.prototype.isMultisigIn = function() {
37505 return this.chunks.length >= 2 &&
37506 this.chunks[0].opcodenum === 0 &&
37507 this.chunks.slice(1, this.chunks.length).every(function(obj) {
37508 return obj.buf &&
37509 BufferUtil.isBuffer(obj.buf) &&
37510 Signature.isTxDER(obj.buf);
37511 });
37512};
37513
37514/**
37515 * @returns {boolean} true if this is a valid standard OP_RETURN output
37516 */
37517Script.prototype.isDataOut = function() {
37518 return this.chunks.length >= 1 &&
37519 this.chunks[0].opcodenum === Opcode.OP_RETURN &&
37520 (this.chunks.length === 1 ||
37521 (this.chunks.length === 2 &&
37522 this.chunks[1].buf &&
37523 this.chunks[1].buf.length <= Script.OP_RETURN_STANDARD_SIZE &&
37524 this.chunks[1].length === this.chunks.len));
37525};
37526
37527/**
37528 * Retrieve the associated data for this script.
37529 * In the case of a pay to public key hash or P2SH, return the hash.
37530 * In the case of a standard OP_RETURN, return the data
37531 * @returns {Buffer}
37532 */
37533Script.prototype.getData = function() {
37534 if (this.isDataOut() || this.isScriptHashOut()) {
37535 if (_.isUndefined(this.chunks[1])) {
37536 return Buffer.alloc(0);
37537 } else {
37538 return Buffer.from(this.chunks[1].buf);
37539 }
37540 }
37541 if (this.isPublicKeyHashOut()) {
37542 return Buffer.from(this.chunks[2].buf);
37543 }
37544 throw new Error('Unrecognized script type to get data from');
37545};
37546
37547/**
37548 * @returns {boolean} if the script is only composed of data pushing
37549 * opcodes or small int opcodes (OP_0, OP_1, ..., OP_16)
37550 */
37551Script.prototype.isPushOnly = function() {
37552 return _.every(this.chunks, function(chunk) {
37553 return chunk.opcodenum <= Opcode.OP_16;
37554 });
37555};
37556
37557
37558Script.types = {};
37559Script.types.UNKNOWN = 'Unknown';
37560Script.types.PUBKEY_OUT = 'Pay to public key';
37561Script.types.PUBKEY_IN = 'Spend from public key';
37562Script.types.PUBKEYHASH_OUT = 'Pay to public key hash';
37563Script.types.PUBKEYHASH_IN = 'Spend from public key hash';
37564Script.types.SCRIPTHASH_OUT = 'Pay to script hash';
37565Script.types.SCRIPTHASH_IN = 'Spend from script hash';
37566Script.types.MULTISIG_OUT = 'Pay to multisig';
37567Script.types.MULTISIG_IN = 'Spend from multisig';
37568Script.types.DATA_OUT = 'Data push';
37569
37570Script.OP_RETURN_STANDARD_SIZE = 80;
37571
37572/**
37573 * @returns {object} The Script type if it is a known form,
37574 * or Script.UNKNOWN if it isn't
37575 */
37576Script.prototype.classify = function() {
37577 if (this._isInput) {
37578 return this.classifyInput();
37579 } else if (this._isOutput) {
37580 return this.classifyOutput();
37581 } else {
37582 var outputType = this.classifyOutput();
37583 return outputType != Script.types.UNKNOWN ? outputType : this.classifyInput();
37584 }
37585};
37586
37587Script.outputIdentifiers = {};
37588Script.outputIdentifiers.PUBKEY_OUT = Script.prototype.isPublicKeyOut;
37589Script.outputIdentifiers.PUBKEYHASH_OUT = Script.prototype.isPublicKeyHashOut;
37590Script.outputIdentifiers.MULTISIG_OUT = Script.prototype.isMultisigOut;
37591Script.outputIdentifiers.SCRIPTHASH_OUT = Script.prototype.isScriptHashOut;
37592Script.outputIdentifiers.DATA_OUT = Script.prototype.isDataOut;
37593
37594/**
37595 * @returns {object} The Script type if it is a known form,
37596 * or Script.UNKNOWN if it isn't
37597 */
37598Script.prototype.classifyOutput = function() {
37599 for (var type in Script.outputIdentifiers) {
37600 if (Script.outputIdentifiers[type].bind(this)()) {
37601 return Script.types[type];
37602 }
37603 }
37604 return Script.types.UNKNOWN;
37605};
37606
37607Script.inputIdentifiers = {};
37608Script.inputIdentifiers.PUBKEY_IN = Script.prototype.isPublicKeyIn;
37609Script.inputIdentifiers.PUBKEYHASH_IN = Script.prototype.isPublicKeyHashIn;
37610Script.inputIdentifiers.MULTISIG_IN = Script.prototype.isMultisigIn;
37611Script.inputIdentifiers.SCRIPTHASH_IN = Script.prototype.isScriptHashIn;
37612
37613/**
37614 * @returns {object} The Script type if it is a known form,
37615 * or Script.UNKNOWN if it isn't
37616 */
37617Script.prototype.classifyInput = function() {
37618 for (var type in Script.inputIdentifiers) {
37619 if (Script.inputIdentifiers[type].bind(this)()) {
37620 return Script.types[type];
37621 }
37622 }
37623 return Script.types.UNKNOWN;
37624};
37625
37626
37627/**
37628 * @returns {boolean} if script is one of the known types
37629 */
37630Script.prototype.isStandard = function() {
37631 // TODO: Add BIP62 compliance
37632 return this.classify() !== Script.types.UNKNOWN;
37633};
37634
37635
37636// Script construction methods
37637
37638/**
37639 * Adds a script element at the start of the script.
37640 * @param {*} obj a string, number, Opcode, Buffer, or object to add
37641 * @returns {Script} this script instance
37642 */
37643Script.prototype.prepend = function(obj) {
37644 this._addByType(obj, true);
37645 return this;
37646};
37647
37648/**
37649 * Compares a script with another script
37650 */
37651Script.prototype.equals = function(script) {
37652 $.checkState(script instanceof Script, 'Must provide another script');
37653 if (this.chunks.length !== script.chunks.length) {
37654 return false;
37655 }
37656 var i;
37657 for (i = 0; i < this.chunks.length; i++) {
37658 if (BufferUtil.isBuffer(this.chunks[i].buf) && !BufferUtil.isBuffer(script.chunks[i].buf)) {
37659 return false;
37660 }
37661 if (BufferUtil.isBuffer(this.chunks[i].buf) && !BufferUtil.equals(this.chunks[i].buf, script.chunks[i].buf)) {
37662 return false;
37663 } else if (this.chunks[i].opcodenum !== script.chunks[i].opcodenum) {
37664 return false;
37665 }
37666 }
37667 return true;
37668};
37669
37670/**
37671 * Adds a script element to the end of the script.
37672 *
37673 * @param {*} obj a string, number, Opcode, Buffer, or object to add
37674 * @returns {Script} this script instance
37675 *
37676 */
37677Script.prototype.add = function(obj) {
37678 this._addByType(obj, false);
37679 return this;
37680};
37681
37682Script.prototype._addByType = function(obj, prepend) {
37683 if (typeof obj === 'string') {
37684 this._addOpcode(obj, prepend);
37685 } else if (typeof obj === 'number') {
37686 this._addOpcode(obj, prepend);
37687 } else if (obj instanceof Opcode) {
37688 this._addOpcode(obj, prepend);
37689 } else if (BufferUtil.isBuffer(obj)) {
37690 this._addBuffer(obj, prepend);
37691 } else if (obj instanceof Script) {
37692 this.chunks = this.chunks.concat(obj.chunks);
37693 } else if (typeof obj === 'object') {
37694 this._insertAtPosition(obj, prepend);
37695 } else {
37696 throw new Error('Invalid script chunk');
37697 }
37698};
37699
37700Script.prototype._insertAtPosition = function(op, prepend) {
37701 if (prepend) {
37702 this.chunks.unshift(op);
37703 } else {
37704 this.chunks.push(op);
37705 }
37706};
37707
37708Script.prototype._addOpcode = function(opcode, prepend) {
37709 var op;
37710 if (typeof opcode === 'number') {
37711 op = opcode;
37712 } else if (opcode instanceof Opcode) {
37713 op = opcode.toNumber();
37714 } else {
37715 op = Opcode(opcode).toNumber();
37716 }
37717 this._insertAtPosition({
37718 opcodenum: op
37719 }, prepend);
37720 return this;
37721};
37722
37723Script.prototype._addBuffer = function(buf, prepend) {
37724 var opcodenum;
37725 var len = buf.length;
37726 if (len >= 0 && len < Opcode.OP_PUSHDATA1) {
37727 opcodenum = len;
37728 } else if (len < Math.pow(2, 8)) {
37729 opcodenum = Opcode.OP_PUSHDATA1;
37730 } else if (len < Math.pow(2, 16)) {
37731 opcodenum = Opcode.OP_PUSHDATA2;
37732 } else if (len < Math.pow(2, 32)) {
37733 opcodenum = Opcode.OP_PUSHDATA4;
37734 } else {
37735 throw new Error('You can\'t push that much data');
37736 }
37737 this._insertAtPosition({
37738 buf: buf,
37739 len: len,
37740 opcodenum: opcodenum
37741 }, prepend);
37742 return this;
37743};
37744
37745Script.prototype.hasCodeseparators = function() {
37746 for (var i = 0; i < this.chunks.length; i++) {
37747 if (this.chunks[i].opcodenum === Opcode.OP_CODESEPARATOR) {
37748 return true;
37749 }
37750 }
37751 return false;
37752};
37753
37754Script.prototype.removeCodeseparators = function() {
37755 var chunks = [];
37756 for (var i = 0; i < this.chunks.length; i++) {
37757 if (this.chunks[i].opcodenum !== Opcode.OP_CODESEPARATOR) {
37758 chunks.push(this.chunks[i]);
37759 }
37760 }
37761 this.chunks = chunks;
37762 return this;
37763};
37764
37765// high level script builder methods
37766
37767/**
37768 * @returns {Script} a new Multisig output script for given public keys,
37769 * requiring m of those public keys to spend
37770 * @param {PublicKey[]} publicKeys - list of all public keys controlling the output
37771 * @param {number} threshold - amount of required signatures to spend the output
37772 * @param {Object=} opts - Several options:
37773 * - noSorting: defaults to false, if true, don't sort the given
37774 * public keys before creating the script
37775 */
37776Script.buildMultisigOut = function(publicKeys, threshold, opts) {
37777 $.checkArgument(threshold <= publicKeys.length,
37778 'Number of required signatures must be less than or equal to the number of public keys');
37779 opts = opts || {};
37780 var script = new Script();
37781 script.add(Opcode.smallInt(threshold));
37782 publicKeys = _.map(publicKeys, PublicKey);
37783 var sorted = publicKeys;
37784 if (!opts.noSorting) {
37785 sorted = _.sortBy(publicKeys, function(publicKey) {
37786 return publicKey.toString('hex');
37787 });
37788 }
37789 for (var i = 0; i < sorted.length; i++) {
37790 var publicKey = sorted[i];
37791 script.add(publicKey.toBuffer());
37792 }
37793 script.add(Opcode.smallInt(publicKeys.length));
37794 script.add(Opcode.OP_CHECKMULTISIG);
37795 return script;
37796};
37797
37798Script.buildWitnessMultisigOutFromScript = function(script) {
37799 if (script instanceof Script) {
37800 var s = new Script();
37801 s.add(Opcode.OP_0);
37802 s.add(Hash.sha256(script.toBuffer()));
37803 return s;
37804 } else {
37805 throw new TypeError('First argument is expected to be a p2sh script');
37806 }
37807};
37808
37809/**
37810 * A new Multisig input script for the given public keys, requiring m of those public keys to spend
37811 *
37812 * @param {PublicKey[]} pubkeys list of all public keys controlling the output
37813 * @param {number} threshold amount of required signatures to spend the output
37814 * @param {Array} signatures and array of signature buffers to append to the script
37815 * @param {Object=} opts
37816 * @param {boolean=} opts.noSorting don't sort the given public keys before creating the script (false by default)
37817 * @param {Script=} opts.cachedMultisig don't recalculate the redeemScript
37818 *
37819 * @returns {Script}
37820 */
37821Script.buildMultisigIn = function(pubkeys, threshold, signatures, opts) {
37822 $.checkArgument(_.isArray(pubkeys));
37823 $.checkArgument(_.isNumber(threshold));
37824 $.checkArgument(_.isArray(signatures));
37825 opts = opts || {};
37826 var s = new Script();
37827 s.add(Opcode.OP_0);
37828 _.each(signatures, function(signature) {
37829 $.checkArgument(BufferUtil.isBuffer(signature), 'Signatures must be an array of Buffers');
37830 // TODO: allow signatures to be an array of Signature objects
37831 s.add(signature);
37832 });
37833 return s;
37834};
37835
37836/**
37837 * A new P2SH Multisig input script for the given public keys, requiring m of those public keys to spend
37838 *
37839 * @param {PublicKey[]} pubkeys list of all public keys controlling the output
37840 * @param {number} threshold amount of required signatures to spend the output
37841 * @param {Array} signatures and array of signature buffers to append to the script
37842 * @param {Object=} opts
37843 * @param {boolean=} opts.noSorting don't sort the given public keys before creating the script (false by default)
37844 * @param {Script=} opts.cachedMultisig don't recalculate the redeemScript
37845 *
37846 * @returns {Script}
37847 */
37848Script.buildP2SHMultisigIn = function(pubkeys, threshold, signatures, opts) {
37849 $.checkArgument(_.isArray(pubkeys));
37850 $.checkArgument(_.isNumber(threshold));
37851 $.checkArgument(_.isArray(signatures));
37852 opts = opts || {};
37853 var s = new Script();
37854 s.add(Opcode.OP_0);
37855 _.each(signatures, function(signature) {
37856 $.checkArgument(BufferUtil.isBuffer(signature), 'Signatures must be an array of Buffers');
37857 // TODO: allow signatures to be an array of Signature objects
37858 s.add(signature);
37859 });
37860 s.add((opts.cachedMultisig || Script.buildMultisigOut(pubkeys, threshold, opts)).toBuffer());
37861 return s;
37862};
37863
37864/**
37865 * @returns {Script} a new pay to public key hash output for the given
37866 * address or public key
37867 * @param {(Address|PublicKey)} to - destination address or public key
37868 */
37869Script.buildPublicKeyHashOut = function(to) {
37870 $.checkArgument(!_.isUndefined(to));
37871 $.checkArgument(to instanceof PublicKey || to instanceof Address || _.isString(to));
37872 if (to instanceof PublicKey) {
37873 to = to.toAddress();
37874 } else if (_.isString(to)) {
37875 to = new Address(to);
37876 }
37877 var s = new Script();
37878 s.add(Opcode.OP_DUP)
37879 .add(Opcode.OP_HASH160)
37880 .add(to.hashBuffer)
37881 .add(Opcode.OP_EQUALVERIFY)
37882 .add(Opcode.OP_CHECKSIG);
37883 s._network = to.network;
37884 return s;
37885};
37886
37887/**
37888 * @returns {Script} a new pay to public key output for the given
37889 * public key
37890 */
37891Script.buildPublicKeyOut = function(pubkey) {
37892 $.checkArgument(pubkey instanceof PublicKey);
37893 var s = new Script();
37894 s.add(pubkey.toBuffer())
37895 .add(Opcode.OP_CHECKSIG);
37896 return s;
37897};
37898
37899/**
37900 * @returns {Script} a new OP_RETURN script with data
37901 * @param {(string|Buffer)} data - the data to embed in the output
37902 * @param {(string)} encoding - the type of encoding of the string
37903 */
37904Script.buildDataOut = function(data, encoding) {
37905 $.checkArgument(_.isUndefined(data) || _.isString(data) || BufferUtil.isBuffer(data));
37906 if (_.isString(data)) {
37907 data = Buffer.from(data, encoding);
37908 }
37909 var s = new Script();
37910 s.add(Opcode.OP_RETURN);
37911 if (!_.isUndefined(data)) {
37912 s.add(data);
37913 }
37914 return s;
37915};
37916
37917/**
37918 * @param {Script|Address} script - the redeemScript for the new p2sh output.
37919 * It can also be a p2sh address
37920 * @returns {Script} new pay to script hash script for given script
37921 */
37922Script.buildScriptHashOut = function(script) {
37923 $.checkArgument(script instanceof Script ||
37924 (script instanceof Address && script.isPayToScriptHash()));
37925 var s = new Script();
37926 s.add(Opcode.OP_HASH160)
37927 .add(script instanceof Address ? script.hashBuffer : Hash.sha256ripemd160(script.toBuffer()))
37928 .add(Opcode.OP_EQUAL);
37929
37930 s._network = script._network || script.network;
37931 return s;
37932};
37933
37934/**
37935 * Builds a scriptSig (a script for an input) that signs a public key output script.
37936 *
37937 * @param {Signature|Buffer} signature - a Signature object, or the signature in DER canonical encoding
37938 * @param {number=} sigtype - the type of the signature (defaults to SIGHASH_ALL)
37939 */
37940Script.buildPublicKeyIn = function(signature, sigtype) {
37941 $.checkArgument(signature instanceof Signature || BufferUtil.isBuffer(signature));
37942 $.checkArgument(_.isUndefined(sigtype) || _.isNumber(sigtype));
37943 if (signature instanceof Signature) {
37944 signature = signature.toBuffer();
37945 }
37946 var script = new Script();
37947 script.add(BufferUtil.concat([
37948 signature,
37949 BufferUtil.integerAsSingleByteBuffer(sigtype || Signature.SIGHASH_ALL)
37950 ]));
37951 return script;
37952};
37953
37954/**
37955 * Builds a scriptSig (a script for an input) that signs a public key hash
37956 * output script.
37957 *
37958 * @param {Buffer|string|PublicKey} publicKey
37959 * @param {Signature|Buffer} signature - a Signature object, or the signature in DER canonical encoding
37960 * @param {number=} sigtype - the type of the signature (defaults to SIGHASH_ALL)
37961 */
37962Script.buildPublicKeyHashIn = function(publicKey, signature, sigtype) {
37963 $.checkArgument(signature instanceof Signature || BufferUtil.isBuffer(signature));
37964 $.checkArgument(_.isUndefined(sigtype) || _.isNumber(sigtype));
37965 if (signature instanceof Signature) {
37966 signature = signature.toBuffer();
37967 }
37968 var script = new Script()
37969 .add(BufferUtil.concat([
37970 signature,
37971 BufferUtil.integerAsSingleByteBuffer(sigtype || Signature.SIGHASH_ALL)
37972 ]))
37973 .add(new PublicKey(publicKey).toBuffer());
37974 return script;
37975};
37976
37977/**
37978 * @returns {Script} an empty script
37979 */
37980Script.empty = function() {
37981 return new Script();
37982};
37983
37984/**
37985 * @returns {Script} a new pay to script hash script that pays to this script
37986 */
37987Script.prototype.toScriptHashOut = function() {
37988 return Script.buildScriptHashOut(this);
37989};
37990
37991/**
37992 * @return {Script} an output script built from the address
37993 */
37994Script.fromAddress = function(address) {
37995 address = Address(address);
37996 if (address.isPayToScriptHash()) {
37997 return Script.buildScriptHashOut(address);
37998 } else if (address.isPayToPublicKeyHash()) {
37999 return Script.buildPublicKeyHashOut(address);
38000 }
38001 throw new errors.Script.UnrecognizedAddress(address);
38002};
38003
38004/**
38005 * Will return the associated address information object
38006 * @return {Address|boolean}
38007 */
38008Script.prototype.getAddressInfo = function(opts) {
38009 if (this._isInput) {
38010 return this._getInputAddressInfo();
38011 } else if (this._isOutput) {
38012 return this._getOutputAddressInfo();
38013 } else {
38014 var info = this._getOutputAddressInfo();
38015 if (!info) {
38016 return this._getInputAddressInfo();
38017 }
38018 return info;
38019 }
38020};
38021
38022/**
38023 * Will return the associated output scriptPubKey address information object
38024 * @return {Address|boolean}
38025 * @private
38026 */
38027Script.prototype._getOutputAddressInfo = function() {
38028 var info = {};
38029 if (this.isScriptHashOut()) {
38030 info.hashBuffer = this.getData();
38031 info.type = Address.PayToScriptHash;
38032 } else if (this.isPublicKeyHashOut()) {
38033 info.hashBuffer = this.getData();
38034 info.type = Address.PayToPublicKeyHash;
38035 } else {
38036 return false;
38037 }
38038 return info;
38039};
38040
38041/**
38042 * Will return the associated input scriptSig address information object
38043 * @return {Address|boolean}
38044 * @private
38045 */
38046Script.prototype._getInputAddressInfo = function() {
38047 var info = {};
38048 if (this.isPublicKeyHashIn()) {
38049 // hash the publickey found in the scriptSig
38050 info.hashBuffer = Hash.sha256ripemd160(this.chunks[1].buf);
38051 info.type = Address.PayToPublicKeyHash;
38052 } else if (this.isScriptHashIn()) {
38053 // hash the redeemscript found at the end of the scriptSig
38054 info.hashBuffer = Hash.sha256ripemd160(this.chunks[this.chunks.length - 1].buf);
38055 info.type = Address.PayToScriptHash;
38056 } else {
38057 return false;
38058 }
38059 return info;
38060};
38061
38062/**
38063 * @param {Network=} network
38064 * @return {Address|boolean} the associated address for this script if possible, or false
38065 */
38066Script.prototype.toAddress = function(network) {
38067 var info = this.getAddressInfo();
38068 if (!info) {
38069 return false;
38070 }
38071 info.network = Networks.get(network) || this._network || Networks.defaultNetwork;
38072 return new Address(info);
38073};
38074
38075/**
38076 * Analogous to bitcoind's FindAndDelete. Find and delete equivalent chunks,
38077 * typically used with push data chunks. Note that this will find and delete
38078 * not just the same data, but the same data with the same push data op as
38079 * produced by default. i.e., if a pushdata in a tx does not use the minimal
38080 * pushdata op, then when you try to remove the data it is pushing, it will not
38081 * be removed, because they do not use the same pushdata op.
38082 */
38083Script.prototype.findAndDelete = function(script) {
38084 var buf = script.toBuffer();
38085 var hex = buf.toString('hex');
38086 for (var i = 0; i < this.chunks.length; i++) {
38087 var script2 = Script({
38088 chunks: [this.chunks[i]]
38089 });
38090 var buf2 = script2.toBuffer();
38091 var hex2 = buf2.toString('hex');
38092 if (hex === hex2) {
38093 this.chunks.splice(i, 1);
38094 }
38095 }
38096 return this;
38097};
38098
38099/**
38100 * Comes from bitcoind's script interpreter CheckMinimalPush function
38101 * @returns {boolean} if the chunk {i} is the smallest way to push that particular data.
38102 */
38103Script.prototype.checkMinimalPush = function(i) {
38104 var chunk = this.chunks[i];
38105 var buf = chunk.buf;
38106 var opcodenum = chunk.opcodenum;
38107 if (!buf) {
38108 return true;
38109 }
38110 if (buf.length === 0) {
38111 // Could have used OP_0.
38112 return opcodenum === Opcode.OP_0;
38113 } else if (buf.length === 1 && buf[0] >= 1 && buf[0] <= 16) {
38114 // Could have used OP_1 .. OP_16.
38115 return opcodenum === Opcode.OP_1 + (buf[0] - 1);
38116 } else if (buf.length === 1 && buf[0] === 0x81) {
38117 // Could have used OP_1NEGATE
38118 return opcodenum === Opcode.OP_1NEGATE;
38119 } else if (buf.length <= 75) {
38120 // Could have used a direct push (opcode indicating number of bytes pushed + those bytes).
38121 return opcodenum === buf.length;
38122 } else if (buf.length <= 255) {
38123 // Could have used OP_PUSHDATA.
38124 return opcodenum === Opcode.OP_PUSHDATA1;
38125 } else if (buf.length <= 65535) {
38126 // Could have used OP_PUSHDATA2.
38127 return opcodenum === Opcode.OP_PUSHDATA2;
38128 }
38129 return true;
38130};
38131
38132/**
38133 * Comes from bitcoind's script DecodeOP_N function
38134 * @param {number} opcode
38135 * @returns {number} numeric value in range of 0 to 16
38136 */
38137Script.prototype._decodeOP_N = function(opcode) {
38138 if (opcode === Opcode.OP_0) {
38139 return 0;
38140 } else if (opcode >= Opcode.OP_1 && opcode <= Opcode.OP_16) {
38141 return opcode - (Opcode.OP_1 - 1);
38142 } else {
38143 throw new Error('Invalid opcode: ' + JSON.stringify(opcode));
38144 }
38145};
38146
38147/**
38148 * Comes from bitcoind's script GetSigOpCount(boolean) function
38149 * @param {boolean} use current (true) or pre-version-0.6 (false) logic
38150 * @returns {number} number of signature operations required by this script
38151 */
38152Script.prototype.getSignatureOperationsCount = function(accurate) {
38153 accurate = (_.isUndefined(accurate) ? true : accurate);
38154 var self = this;
38155 var n = 0;
38156 var lastOpcode = Opcode.OP_INVALIDOPCODE;
38157 _.each(self.chunks, function getChunk(chunk) {
38158 var opcode = chunk.opcodenum;
38159 if (opcode == Opcode.OP_CHECKSIG || opcode == Opcode.OP_CHECKSIGVERIFY) {
38160 n++;
38161 } else if (opcode == Opcode.OP_CHECKMULTISIG || opcode == Opcode.OP_CHECKMULTISIGVERIFY) {
38162 if (accurate && lastOpcode >= Opcode.OP_1 && lastOpcode <= Opcode.OP_16) {
38163 n += self._decodeOP_N(lastOpcode);
38164 } else {
38165 n += 20;
38166 }
38167 }
38168 lastOpcode = opcode;
38169 });
38170 return n;
38171};
38172
38173module.exports = Script;
38174
38175}).call(this,require("buffer").Buffer)
38176},{"../address":266,"../crypto/hash":273,"../crypto/signature":276,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../errors":282,"../networks":286,"../opcode":287,"../publickey":289,"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"buffer":146,"lodash":311}],293:[function(require,module,exports){
38177module.exports = require('./transaction');
38178
38179module.exports.Input = require('./input');
38180module.exports.Output = require('./output');
38181module.exports.UnspentOutput = require('./unspentoutput');
38182module.exports.Signature = require('./signature');
38183module.exports.Sighash = require('./sighash');
38184module.exports.SighashWitness = require('./sighashwitness');
38185
38186},{"./input":294,"./output":300,"./sighash":301,"./sighashwitness":302,"./signature":303,"./transaction":304,"./unspentoutput":305}],294:[function(require,module,exports){
38187module.exports = require('./input');
38188
38189module.exports.PublicKey = require('./publickey');
38190module.exports.PublicKeyHash = require('./publickeyhash');
38191module.exports.MultiSig = require('./multisig.js');
38192module.exports.MultiSigScriptHash = require('./multisigscripthash.js');
38193
38194},{"./input":295,"./multisig.js":296,"./multisigscripthash.js":297,"./publickey":298,"./publickeyhash":299}],295:[function(require,module,exports){
38195'use strict';
38196
38197var _ = require('lodash');
38198var $ = require('../../util/preconditions');
38199var errors = require('../../errors');
38200var BufferWriter = require('../../encoding/bufferwriter');
38201var buffer = require('buffer');
38202var BufferUtil = require('../../util/buffer');
38203var JSUtil = require('../../util/js');
38204var Script = require('../../script');
38205var Sighash = require('../sighash');
38206var Output = require('../output');
38207
38208var MAXINT = 0xffffffff; // Math.pow(2, 32) - 1;
38209var DEFAULT_RBF_SEQNUMBER = MAXINT - 2;
38210var DEFAULT_SEQNUMBER = MAXINT;
38211var DEFAULT_LOCKTIME_SEQNUMBER = MAXINT - 1;
38212
38213function Input(params) {
38214 if (!(this instanceof Input)) {
38215 return new Input(params);
38216 }
38217 if (params) {
38218 return this._fromObject(params);
38219 }
38220}
38221
38222Input.MAXINT = MAXINT;
38223Input.DEFAULT_SEQNUMBER = DEFAULT_SEQNUMBER;
38224Input.DEFAULT_LOCKTIME_SEQNUMBER = DEFAULT_LOCKTIME_SEQNUMBER;
38225Input.DEFAULT_RBF_SEQNUMBER = DEFAULT_RBF_SEQNUMBER;
38226
38227Object.defineProperty(Input.prototype, 'script', {
38228 configurable: false,
38229 enumerable: true,
38230 get: function() {
38231 if (this.isNull()) {
38232 return null;
38233 }
38234 if (!this._script) {
38235 this._script = new Script(this._scriptBuffer);
38236 this._script._isInput = true;
38237 }
38238 return this._script;
38239 }
38240});
38241
38242Input.fromObject = function(obj) {
38243 $.checkArgument(_.isObject(obj));
38244 var input = new Input();
38245 return input._fromObject(obj);
38246};
38247
38248Input.prototype._fromObject = function(params) {
38249 var prevTxId;
38250 if (_.isString(params.prevTxId) && JSUtil.isHexa(params.prevTxId)) {
38251 prevTxId = new buffer.Buffer(params.prevTxId, 'hex');
38252 } else {
38253 prevTxId = params.prevTxId;
38254 }
38255 this.witnesses = [];
38256 this.output = params.output ?
38257 (params.output instanceof Output ? params.output : new Output(params.output)) : undefined;
38258 this.prevTxId = prevTxId || params.txidbuf;
38259 this.outputIndex = _.isUndefined(params.outputIndex) ? params.txoutnum : params.outputIndex;
38260 this.sequenceNumber = _.isUndefined(params.sequenceNumber) ?
38261 (_.isUndefined(params.seqnum) ? DEFAULT_SEQNUMBER : params.seqnum) : params.sequenceNumber;
38262 if (_.isUndefined(params.script) && _.isUndefined(params.scriptBuffer)) {
38263 throw new errors.Transaction.Input.MissingScript();
38264 }
38265 this.setScript(params.scriptBuffer || params.script);
38266 return this;
38267};
38268
38269Input.prototype.toObject = Input.prototype.toJSON = function toObject() {
38270 var obj = {
38271 prevTxId: this.prevTxId.toString('hex'),
38272 outputIndex: this.outputIndex,
38273 sequenceNumber: this.sequenceNumber,
38274 script: this._scriptBuffer.toString('hex'),
38275 };
38276 // add human readable form if input contains valid script
38277 if (this.script) {
38278 obj.scriptString = this.script.toString();
38279 }
38280 if (this.output) {
38281 obj.output = this.output.toObject();
38282 }
38283 return obj;
38284};
38285
38286Input.fromBufferReader = function(br) {
38287 var input = new Input();
38288 input.prevTxId = br.readReverse(32);
38289 input.outputIndex = br.readUInt32LE();
38290 input._scriptBuffer = br.readVarLengthBuffer();
38291 input.sequenceNumber = br.readUInt32LE();
38292 // TODO: return different classes according to which input it is
38293 // e.g: CoinbaseInput, PublicKeyHashInput, MultiSigScriptHashInput, etc.
38294 return input;
38295};
38296
38297Input.prototype.toBufferWriter = function(writer) {
38298 if (!writer) {
38299 writer = new BufferWriter();
38300 }
38301 writer.writeReverse(this.prevTxId);
38302 writer.writeUInt32LE(this.outputIndex);
38303 var script = this._scriptBuffer;
38304 writer.writeVarintNum(script.length);
38305 writer.write(script);
38306 writer.writeUInt32LE(this.sequenceNumber);
38307 return writer;
38308};
38309
38310Input.prototype.setScript = function(script) {
38311 this._script = null;
38312 if (script instanceof Script) {
38313 this._script = script;
38314 this._script._isInput = true;
38315 this._scriptBuffer = script.toBuffer();
38316 } else if (JSUtil.isHexa(script)) {
38317 // hex string script
38318 this._scriptBuffer = new buffer.Buffer(script, 'hex');
38319 } else if (_.isString(script)) {
38320 // human readable string script
38321 this._script = new Script(script);
38322 this._script._isInput = true;
38323 this._scriptBuffer = this._script.toBuffer();
38324 } else if (BufferUtil.isBuffer(script)) {
38325 // buffer script
38326 this._scriptBuffer = new buffer.Buffer(script);
38327 } else {
38328 throw new TypeError('Invalid argument type: script');
38329 }
38330 return this;
38331};
38332
38333/**
38334 * Retrieve signatures for the provided PrivateKey.
38335 *
38336 * @param {Transaction} transaction - the transaction to be signed
38337 * @param {PrivateKey} privateKey - the private key to use when signing
38338 * @param {number} inputIndex - the index of this input in the provided transaction
38339 * @param {number} sigType - defaults to Signature.SIGHASH_ALL
38340 * @param {Buffer} addressHash - if provided, don't calculate the hash of the
38341 * public key associated with the private key provided
38342 * @abstract
38343 */
38344Input.prototype.getSignatures = function() {
38345 throw new errors.AbstractMethodInvoked(
38346 'Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported)' +
38347 ' for input: ' + JSON.stringify(this)
38348 );
38349};
38350
38351Input.prototype.getSatoshisBuffer = function() {
38352 $.checkState(this.output instanceof Output);
38353 $.checkState(this.output._satoshisBN);
38354 return new BufferWriter().writeUInt64LEBN(this.output._satoshisBN).toBuffer();
38355};
38356
38357
38358Input.prototype.isFullySigned = function() {
38359 throw new errors.AbstractMethodInvoked('Input#isFullySigned');
38360};
38361
38362Input.prototype.isFinal = function() {
38363 return this.sequenceNumber !== 4294967295;
38364};
38365
38366Input.prototype.addSignature = function() {
38367 throw new errors.AbstractMethodInvoked('Input#addSignature');
38368};
38369
38370Input.prototype.clearSignatures = function() {
38371 throw new errors.AbstractMethodInvoked('Input#clearSignatures');
38372};
38373
38374Input.prototype.hasWitnesses = function() {
38375 if (this.witnesses && this.witnesses.length > 0) {
38376 return true;
38377 }
38378 return false;
38379};
38380
38381Input.prototype.getWitnesses = function() {
38382 return this.witnesses;
38383};
38384
38385Input.prototype.setWitnesses = function(witnesses) {
38386 this.witnesses = witnesses;
38387};
38388
38389Input.prototype.isValidSignature = function(transaction, signature) {
38390 // FIXME: Refactor signature so this is not necessary
38391 signature.signature.nhashtype = signature.sigtype;
38392 return Sighash.verify(
38393 transaction,
38394 signature.signature,
38395 signature.publicKey,
38396 signature.inputIndex,
38397 this.output.script
38398 );
38399};
38400
38401/**
38402 * @returns true if this is a coinbase input (represents no input)
38403 */
38404Input.prototype.isNull = function() {
38405 return this.prevTxId.toString('hex') === '0000000000000000000000000000000000000000000000000000000000000000' &&
38406 this.outputIndex === 0xffffffff;
38407};
38408
38409Input.prototype._estimateSize = function() {
38410 return this.toBufferWriter().toBuffer().length;
38411};
38412
38413module.exports = Input;
38414
38415},{"../../encoding/bufferwriter":280,"../../errors":282,"../../script":290,"../../util/buffer":308,"../../util/js":309,"../../util/preconditions":310,"../output":300,"../sighash":301,"buffer":146,"lodash":311}],296:[function(require,module,exports){
38416'use strict';
38417
38418var _ = require('lodash');
38419var inherits = require('inherits');
38420var Transaction = require('../transaction');
38421var Input = require('./input');
38422var Output = require('../output');
38423var $ = require('../../util/preconditions');
38424
38425var Script = require('../../script');
38426var Signature = require('../../crypto/signature');
38427var Sighash = require('../sighash');
38428var PublicKey = require('../../publickey');
38429var BufferUtil = require('../../util/buffer');
38430var TransactionSignature = require('../signature');
38431
38432/**
38433 * @constructor
38434 */
38435function MultiSigInput(input, pubkeys, threshold, signatures, opts) {
38436 opts = opts || {};
38437 Input.apply(this, arguments);
38438 var self = this;
38439 pubkeys = pubkeys || input.publicKeys;
38440 threshold = threshold || input.threshold;
38441 signatures = signatures || input.signatures;
38442 if (opts.noSorting) {
38443 this.publicKeys = pubkeys
38444 } else {
38445 this.publicKeys = _.sortBy(pubkeys, function(publicKey) { return publicKey.toString('hex'); });
38446 }
38447 $.checkState(Script.buildMultisigOut(this.publicKeys, threshold).equals(this.output.script),
38448 'Provided public keys don\'t match to the provided output script');
38449 this.publicKeyIndex = {};
38450 _.each(this.publicKeys, function(publicKey, index) {
38451 self.publicKeyIndex[publicKey.toString()] = index;
38452 });
38453 this.threshold = threshold;
38454 // Empty array of signatures
38455 this.signatures = signatures ? this._deserializeSignatures(signatures) : new Array(this.publicKeys.length);
38456}
38457inherits(MultiSigInput, Input);
38458
38459MultiSigInput.prototype.toObject = function() {
38460 var obj = Input.prototype.toObject.apply(this, arguments);
38461 obj.threshold = this.threshold;
38462 obj.publicKeys = _.map(this.publicKeys, function(publicKey) { return publicKey.toString(); });
38463 obj.signatures = this._serializeSignatures();
38464 return obj;
38465};
38466
38467MultiSigInput.prototype._deserializeSignatures = function(signatures) {
38468 return _.map(signatures, function(signature) {
38469 if (!signature) {
38470 return undefined;
38471 }
38472 return new TransactionSignature(signature);
38473 });
38474};
38475
38476MultiSigInput.prototype._serializeSignatures = function() {
38477 return _.map(this.signatures, function(signature) {
38478 if (!signature) {
38479 return undefined;
38480 }
38481 return signature.toObject();
38482 });
38483};
38484
38485MultiSigInput.prototype.getSignatures = function(transaction, privateKey, index, sigtype) {
38486 $.checkState(this.output instanceof Output);
38487 sigtype = sigtype || Signature.SIGHASH_ALL;
38488
38489 var self = this;
38490 var results = [];
38491 _.each(this.publicKeys, function(publicKey) {
38492 if (publicKey.toString() === privateKey.publicKey.toString()) {
38493 results.push(new TransactionSignature({
38494 publicKey: privateKey.publicKey,
38495 prevTxId: self.prevTxId,
38496 outputIndex: self.outputIndex,
38497 inputIndex: index,
38498 signature: Sighash.sign(transaction, privateKey, sigtype, index, self.output.script),
38499 sigtype: sigtype
38500 }));
38501 }
38502 });
38503
38504 return results;
38505};
38506
38507MultiSigInput.prototype.addSignature = function(transaction, signature) {
38508 $.checkState(!this.isFullySigned(), 'All needed signatures have already been added');
38509 $.checkArgument(!_.isUndefined(this.publicKeyIndex[signature.publicKey.toString()]),
38510 'Signature has no matching public key');
38511 $.checkState(this.isValidSignature(transaction, signature));
38512 this.signatures[this.publicKeyIndex[signature.publicKey.toString()]] = signature;
38513 this._updateScript();
38514 return this;
38515};
38516
38517MultiSigInput.prototype._updateScript = function() {
38518 this.setScript(Script.buildMultisigIn(
38519 this.publicKeys,
38520 this.threshold,
38521 this._createSignatures()
38522 ));
38523 return this;
38524};
38525
38526MultiSigInput.prototype._createSignatures = function() {
38527 return _.map(
38528 _.filter(this.signatures, function(signature) { return !_.isUndefined(signature); }),
38529 function(signature) {
38530 return BufferUtil.concat([
38531 signature.signature.toDER(),
38532 BufferUtil.integerAsSingleByteBuffer(signature.sigtype)
38533 ]);
38534 }
38535 );
38536};
38537
38538MultiSigInput.prototype.clearSignatures = function() {
38539 this.signatures = new Array(this.publicKeys.length);
38540 this._updateScript();
38541};
38542
38543MultiSigInput.prototype.isFullySigned = function() {
38544 return this.countSignatures() === this.threshold;
38545};
38546
38547MultiSigInput.prototype.countMissingSignatures = function() {
38548 return this.threshold - this.countSignatures();
38549};
38550
38551MultiSigInput.prototype.countSignatures = function() {
38552 return _.reduce(this.signatures, function(sum, signature) {
38553 return sum + (!!signature);
38554 }, 0);
38555};
38556
38557MultiSigInput.prototype.publicKeysWithoutSignature = function() {
38558 var self = this;
38559 return _.filter(this.publicKeys, function(publicKey) {
38560 return !(self.signatures[self.publicKeyIndex[publicKey.toString()]]);
38561 });
38562};
38563
38564MultiSigInput.prototype.isValidSignature = function(transaction, signature) {
38565 // FIXME: Refactor signature so this is not necessary
38566 signature.signature.nhashtype = signature.sigtype;
38567 return Sighash.verify(
38568 transaction,
38569 signature.signature,
38570 signature.publicKey,
38571 signature.inputIndex,
38572 this.output.script
38573 );
38574};
38575
38576/**
38577 *
38578 * @param {Buffer[]} signatures
38579 * @param {PublicKey[]} publicKeys
38580 * @param {Transaction} transaction
38581 * @param {Integer} inputIndex
38582 * @param {Input} input
38583 * @returns {TransactionSignature[]}
38584 */
38585MultiSigInput.normalizeSignatures = function(transaction, input, inputIndex, signatures, publicKeys) {
38586 return publicKeys.map(function (pubKey) {
38587 var signatureMatch = null;
38588 signatures = signatures.filter(function (signatureBuffer) {
38589 if (signatureMatch) {
38590 return true;
38591 }
38592
38593 var signature = new TransactionSignature({
38594 signature: Signature.fromTxFormat(signatureBuffer),
38595 publicKey: pubKey,
38596 prevTxId: input.prevTxId,
38597 outputIndex: input.outputIndex,
38598 inputIndex: inputIndex,
38599 sigtype: Signature.SIGHASH_ALL
38600 });
38601
38602 signature.signature.nhashtype = signature.sigtype;
38603 var isMatch = Sighash.verify(
38604 transaction,
38605 signature.signature,
38606 signature.publicKey,
38607 signature.inputIndex,
38608 input.output.script
38609 );
38610
38611 if (isMatch) {
38612 signatureMatch = signature;
38613 return false;
38614 }
38615
38616 return true;
38617 });
38618
38619 return signatureMatch ? signatureMatch : null;
38620 });
38621};
38622
38623MultiSigInput.OPCODES_SIZE = 1; // 0
38624MultiSigInput.SIGNATURE_SIZE = 73; // size (1) + DER (<=72)
38625
38626MultiSigInput.prototype._estimateSize = function() {
38627 return MultiSigInput.OPCODES_SIZE +
38628 this.threshold * MultiSigInput.SIGNATURE_SIZE;
38629};
38630
38631module.exports = MultiSigInput;
38632
38633},{"../../crypto/signature":276,"../../publickey":289,"../../script":290,"../../util/buffer":308,"../../util/preconditions":310,"../output":300,"../sighash":301,"../signature":303,"../transaction":304,"./input":295,"inherits":313,"lodash":311}],297:[function(require,module,exports){
38634(function (Buffer){
38635'use strict';
38636
38637/* jshint maxparams:5 */
38638
38639var _ = require('lodash');
38640var inherits = require('inherits');
38641var Input = require('./input');
38642var Output = require('../output');
38643var $ = require('../../util/preconditions');
38644
38645var Script = require('../../script');
38646var Signature = require('../../crypto/signature');
38647var Sighash = require('../sighash');
38648var SighashWitness = require('../sighashwitness');
38649var BufferWriter = require('../../encoding/bufferwriter');
38650var BufferUtil = require('../../util/buffer');
38651var TransactionSignature = require('../signature');
38652
38653/**
38654 * @constructor
38655 */
38656function MultiSigScriptHashInput(input, pubkeys, threshold, signatures, nestedWitness, opts) {
38657 /* jshint maxstatements:20 */
38658 opts = opts || {};
38659 Input.apply(this, arguments);
38660 var self = this;
38661 pubkeys = pubkeys || input.publicKeys;
38662 threshold = threshold || input.threshold;
38663 signatures = signatures || input.signatures;
38664 this.nestedWitness = nestedWitness ? true : false;
38665 if (opts.noSorting) {
38666 this.publicKeys = pubkeys
38667 } else {
38668 this.publicKeys = _.sortBy(pubkeys, function(publicKey) { return publicKey.toString('hex'); });
38669 }
38670 this.redeemScript = Script.buildMultisigOut(this.publicKeys, threshold);
38671 if (this.nestedWitness) {
38672 var nested = Script.buildWitnessMultisigOutFromScript(this.redeemScript);
38673 $.checkState(Script.buildScriptHashOut(nested).equals(this.output.script),
38674 'Provided public keys don\'t hash to the provided output (nested witness)');
38675 var scriptSig = new Script();
38676 scriptSig.add(nested.toBuffer());
38677 this.setScript(scriptSig);
38678 } else {
38679 $.checkState(Script.buildScriptHashOut(this.redeemScript).equals(this.output.script),
38680 'Provided public keys don\'t hash to the provided output');
38681 }
38682
38683 this.publicKeyIndex = {};
38684 _.each(this.publicKeys, function(publicKey, index) {
38685 self.publicKeyIndex[publicKey.toString()] = index;
38686 });
38687 this.threshold = threshold;
38688 // Empty array of signatures
38689 this.signatures = signatures ? this._deserializeSignatures(signatures) : new Array(this.publicKeys.length);
38690}
38691inherits(MultiSigScriptHashInput, Input);
38692
38693MultiSigScriptHashInput.prototype.toObject = function() {
38694 var obj = Input.prototype.toObject.apply(this, arguments);
38695 obj.threshold = this.threshold;
38696 obj.publicKeys = _.map(this.publicKeys, function(publicKey) { return publicKey.toString(); });
38697 obj.signatures = this._serializeSignatures();
38698 return obj;
38699};
38700
38701MultiSigScriptHashInput.prototype._deserializeSignatures = function(signatures) {
38702 return _.map(signatures, function(signature) {
38703 if (!signature) {
38704 return undefined;
38705 }
38706 return new TransactionSignature(signature);
38707 });
38708};
38709
38710MultiSigScriptHashInput.prototype._serializeSignatures = function() {
38711 return _.map(this.signatures, function(signature) {
38712 if (!signature) {
38713 return undefined;
38714 }
38715 return signature.toObject();
38716 });
38717};
38718
38719MultiSigScriptHashInput.prototype.getScriptCode = function() {
38720 var writer = new BufferWriter();
38721 if (!this.redeemScript.hasCodeseparators()) {
38722 var redeemScriptBuffer = this.redeemScript.toBuffer();
38723 writer.writeVarintNum(redeemScriptBuffer.length);
38724 writer.write(redeemScriptBuffer);
38725 } else {
38726 throw new Error('@TODO');
38727 }
38728 return writer.toBuffer();
38729};
38730
38731MultiSigScriptHashInput.prototype.getSighash = function(transaction, privateKey, index, sigtype) {
38732 var self = this;
38733 var hash;
38734 if (self.nestedWitness) {
38735 var scriptCode = self.getScriptCode();
38736 var satoshisBuffer = self.getSatoshisBuffer();
38737 hash = SighashWitness.sighash(transaction, sigtype, index, scriptCode, satoshisBuffer);
38738 } else {
38739 hash = Sighash.sighash(transaction, sigtype, index, self.redeemScript);
38740 }
38741 return hash;
38742};
38743
38744MultiSigScriptHashInput.prototype.getSignatures = function(transaction, privateKey, index, sigtype) {
38745 $.checkState(this.output instanceof Output);
38746 sigtype = sigtype || Signature.SIGHASH_ALL;
38747
38748 var self = this;
38749 var results = [];
38750 _.each(this.publicKeys, function(publicKey) {
38751 if (publicKey.toString() === privateKey.publicKey.toString()) {
38752 var signature;
38753 if (self.nestedWitness) {
38754 var scriptCode = self.getScriptCode();
38755 var satoshisBuffer = self.getSatoshisBuffer();
38756 signature = SighashWitness.sign(transaction, privateKey, sigtype, index, scriptCode, satoshisBuffer);
38757 } else {
38758 signature = Sighash.sign(transaction, privateKey, sigtype, index, self.redeemScript);
38759 }
38760 results.push(new TransactionSignature({
38761 publicKey: privateKey.publicKey,
38762 prevTxId: self.prevTxId,
38763 outputIndex: self.outputIndex,
38764 inputIndex: index,
38765 signature: signature,
38766 sigtype: sigtype
38767 }));
38768 }
38769 });
38770 return results;
38771};
38772
38773MultiSigScriptHashInput.prototype.addSignature = function(transaction, signature) {
38774 $.checkState(!this.isFullySigned(), 'All needed signatures have already been added');
38775 $.checkArgument(!_.isUndefined(this.publicKeyIndex[signature.publicKey.toString()]),
38776 'Signature has no matching public key');
38777 $.checkState(this.isValidSignature(transaction, signature));
38778 this.signatures[this.publicKeyIndex[signature.publicKey.toString()]] = signature;
38779 this._updateScript();
38780 return this;
38781};
38782
38783MultiSigScriptHashInput.prototype._updateScript = function() {
38784 if (this.nestedWitness) {
38785 var stack = [
38786 new Buffer(0),
38787 ];
38788 var signatures = this._createSignatures();
38789 for (var i = 0; i < signatures.length; i++) {
38790 stack.push(signatures[i]);
38791 }
38792 stack.push(this.redeemScript.toBuffer());
38793 this.setWitnesses(stack);
38794 } else {
38795 var scriptSig = Script.buildP2SHMultisigIn(
38796 this.publicKeys,
38797 this.threshold,
38798 this._createSignatures(),
38799 { cachedMultisig: this.redeemScript }
38800 );
38801 this.setScript(scriptSig);
38802 }
38803 return this;
38804};
38805
38806MultiSigScriptHashInput.prototype._createSignatures = function() {
38807 return _.map(
38808 _.filter(this.signatures, function(signature) { return !_.isUndefined(signature); }),
38809 function(signature) {
38810 return BufferUtil.concat([
38811 signature.signature.toDER(),
38812 BufferUtil.integerAsSingleByteBuffer(signature.sigtype)
38813 ]);
38814 }
38815 );
38816};
38817
38818MultiSigScriptHashInput.prototype.clearSignatures = function() {
38819 this.signatures = new Array(this.publicKeys.length);
38820 this._updateScript();
38821};
38822
38823MultiSigScriptHashInput.prototype.isFullySigned = function() {
38824 return this.countSignatures() === this.threshold;
38825};
38826
38827MultiSigScriptHashInput.prototype.countMissingSignatures = function() {
38828 return this.threshold - this.countSignatures();
38829};
38830
38831MultiSigScriptHashInput.prototype.countSignatures = function() {
38832 return _.reduce(this.signatures, function(sum, signature) {
38833 return sum + (!!signature);
38834 }, 0);
38835};
38836
38837MultiSigScriptHashInput.prototype.publicKeysWithoutSignature = function() {
38838 var self = this;
38839 return _.filter(this.publicKeys, function(publicKey) {
38840 return !(self.signatures[self.publicKeyIndex[publicKey.toString()]]);
38841 });
38842};
38843
38844MultiSigScriptHashInput.prototype.isValidSignature = function(transaction, signature) {
38845 if (this.nestedWitness) {
38846 signature.signature.nhashtype = signature.sigtype;
38847 var scriptCode = this.getScriptCode();
38848 var satoshisBuffer = this.getSatoshisBuffer();
38849 return SighashWitness.verify(
38850 transaction,
38851 signature.signature,
38852 signature.publicKey,
38853 signature.inputIndex,
38854 scriptCode,
38855 satoshisBuffer
38856 );
38857 } else {
38858 // FIXME: Refactor signature so this is not necessary
38859 signature.signature.nhashtype = signature.sigtype;
38860 return Sighash.verify(
38861 transaction,
38862 signature.signature,
38863 signature.publicKey,
38864 signature.inputIndex,
38865 this.redeemScript
38866 );
38867 }
38868};
38869
38870MultiSigScriptHashInput.OPCODES_SIZE = 7; // serialized size (<=3) + 0 .. N .. M OP_CHECKMULTISIG
38871MultiSigScriptHashInput.SIGNATURE_SIZE = 74; // size (1) + DER (<=72) + sighash (1)
38872MultiSigScriptHashInput.PUBKEY_SIZE = 34; // size (1) + DER (<=33)
38873
38874MultiSigScriptHashInput.prototype._estimateSize = function() {
38875 return MultiSigScriptHashInput.OPCODES_SIZE +
38876 this.threshold * MultiSigScriptHashInput.SIGNATURE_SIZE +
38877 this.publicKeys.length * MultiSigScriptHashInput.PUBKEY_SIZE;
38878};
38879
38880module.exports = MultiSigScriptHashInput;
38881
38882}).call(this,require("buffer").Buffer)
38883},{"../../crypto/signature":276,"../../encoding/bufferwriter":280,"../../script":290,"../../util/buffer":308,"../../util/preconditions":310,"../output":300,"../sighash":301,"../sighashwitness":302,"../signature":303,"./input":295,"buffer":146,"inherits":313,"lodash":311}],298:[function(require,module,exports){
38884'use strict';
38885
38886var inherits = require('inherits');
38887
38888var $ = require('../../util/preconditions');
38889var BufferUtil = require('../../util/buffer');
38890
38891var Input = require('./input');
38892var Output = require('../output');
38893var Sighash = require('../sighash');
38894var Script = require('../../script');
38895var Signature = require('../../crypto/signature');
38896var TransactionSignature = require('../signature');
38897
38898/**
38899 * Represents a special kind of input of PayToPublicKey kind.
38900 * @constructor
38901 */
38902function PublicKeyInput() {
38903 Input.apply(this, arguments);
38904}
38905inherits(PublicKeyInput, Input);
38906
38907/**
38908 * @param {Transaction} transaction - the transaction to be signed
38909 * @param {PrivateKey} privateKey - the private key with which to sign the transaction
38910 * @param {number} index - the index of the input in the transaction input vector
38911 * @param {number=} sigtype - the type of signature, defaults to Signature.SIGHASH_ALL
38912 * @return {Array} of objects that can be
38913 */
38914PublicKeyInput.prototype.getSignatures = function(transaction, privateKey, index, sigtype) {
38915 $.checkState(this.output instanceof Output);
38916 sigtype = sigtype || Signature.SIGHASH_ALL;
38917 var publicKey = privateKey.toPublicKey();
38918 if (publicKey.toString() === this.output.script.getPublicKey().toString('hex')) {
38919 return [new TransactionSignature({
38920 publicKey: publicKey,
38921 prevTxId: this.prevTxId,
38922 outputIndex: this.outputIndex,
38923 inputIndex: index,
38924 signature: Sighash.sign(transaction, privateKey, sigtype, index, this.output.script),
38925 sigtype: sigtype
38926 })];
38927 }
38928 return [];
38929};
38930
38931/**
38932 * Add the provided signature
38933 *
38934 * @param {Object} signature
38935 * @param {PublicKey} signature.publicKey
38936 * @param {Signature} signature.signature
38937 * @param {number=} signature.sigtype
38938 * @return {PublicKeyInput} this, for chaining
38939 */
38940PublicKeyInput.prototype.addSignature = function(transaction, signature) {
38941 $.checkState(this.isValidSignature(transaction, signature), 'Signature is invalid');
38942 this.setScript(Script.buildPublicKeyIn(
38943 signature.signature.toDER(),
38944 signature.sigtype
38945 ));
38946 return this;
38947};
38948
38949/**
38950 * Clear the input's signature
38951 * @return {PublicKeyHashInput} this, for chaining
38952 */
38953PublicKeyInput.prototype.clearSignatures = function() {
38954 this.setScript(Script.empty());
38955 return this;
38956};
38957
38958/**
38959 * Query whether the input is signed
38960 * @return {boolean}
38961 */
38962PublicKeyInput.prototype.isFullySigned = function() {
38963 return this.script.isPublicKeyIn();
38964};
38965
38966PublicKeyInput.SCRIPT_MAX_SIZE = 73; // sigsize (1 + 72)
38967
38968PublicKeyInput.prototype._estimateSize = function() {
38969 return PublicKeyInput.SCRIPT_MAX_SIZE;
38970};
38971
38972module.exports = PublicKeyInput;
38973
38974},{"../../crypto/signature":276,"../../script":290,"../../util/buffer":308,"../../util/preconditions":310,"../output":300,"../sighash":301,"../signature":303,"./input":295,"inherits":313}],299:[function(require,module,exports){
38975'use strict';
38976
38977var inherits = require('inherits');
38978
38979var $ = require('../../util/preconditions');
38980var BufferUtil = require('../../util/buffer');
38981
38982var Hash = require('../../crypto/hash');
38983var Input = require('./input');
38984var Output = require('../output');
38985var Sighash = require('../sighash');
38986var Script = require('../../script');
38987var Signature = require('../../crypto/signature');
38988var TransactionSignature = require('../signature');
38989
38990/**
38991 * Represents a special kind of input of PayToPublicKeyHash kind.
38992 * @constructor
38993 */
38994function PublicKeyHashInput() {
38995 Input.apply(this, arguments);
38996}
38997inherits(PublicKeyHashInput, Input);
38998
38999/* jshint maxparams: 5 */
39000/**
39001 * @param {Transaction} transaction - the transaction to be signed
39002 * @param {PrivateKey} privateKey - the private key with which to sign the transaction
39003 * @param {number} index - the index of the input in the transaction input vector
39004 * @param {number=} sigtype - the type of signature, defaults to Signature.SIGHASH_ALL
39005 * @param {Buffer=} hashData - the precalculated hash of the public key associated with the privateKey provided
39006 * @return {Array} of objects that can be
39007 */
39008PublicKeyHashInput.prototype.getSignatures = function(transaction, privateKey, index, sigtype, hashData) {
39009 $.checkState(this.output instanceof Output);
39010 hashData = hashData || Hash.sha256ripemd160(privateKey.publicKey.toBuffer());
39011 sigtype = sigtype || Signature.SIGHASH_ALL;
39012
39013 if (BufferUtil.equals(hashData, this.output.script.getPublicKeyHash())) {
39014 return [new TransactionSignature({
39015 publicKey: privateKey.publicKey,
39016 prevTxId: this.prevTxId,
39017 outputIndex: this.outputIndex,
39018 inputIndex: index,
39019 signature: Sighash.sign(transaction, privateKey, sigtype, index, this.output.script),
39020 sigtype: sigtype
39021 })];
39022 }
39023 return [];
39024};
39025/* jshint maxparams: 3 */
39026
39027/**
39028 * Add the provided signature
39029 *
39030 * @param {Object} signature
39031 * @param {PublicKey} signature.publicKey
39032 * @param {Signature} signature.signature
39033 * @param {number=} signature.sigtype
39034 * @return {PublicKeyHashInput} this, for chaining
39035 */
39036PublicKeyHashInput.prototype.addSignature = function(transaction, signature) {
39037 $.checkState(this.isValidSignature(transaction, signature), 'Signature is invalid');
39038 this.setScript(Script.buildPublicKeyHashIn(
39039 signature.publicKey,
39040 signature.signature.toDER(),
39041 signature.sigtype
39042 ));
39043 return this;
39044};
39045
39046/**
39047 * Clear the input's signature
39048 * @return {PublicKeyHashInput} this, for chaining
39049 */
39050PublicKeyHashInput.prototype.clearSignatures = function() {
39051 this.setScript(Script.empty());
39052 return this;
39053};
39054
39055/**
39056 * Query whether the input is signed
39057 * @return {boolean}
39058 */
39059PublicKeyHashInput.prototype.isFullySigned = function() {
39060 return this.script.isPublicKeyHashIn();
39061};
39062
39063PublicKeyHashInput.SCRIPT_MAX_SIZE = 73 + 34; // sigsize (1 + 72) + pubkey (1 + 33)
39064
39065PublicKeyHashInput.prototype._estimateSize = function() {
39066 return PublicKeyHashInput.SCRIPT_MAX_SIZE;
39067};
39068
39069module.exports = PublicKeyHashInput;
39070
39071},{"../../crypto/hash":273,"../../crypto/signature":276,"../../script":290,"../../util/buffer":308,"../../util/preconditions":310,"../output":300,"../sighash":301,"../signature":303,"./input":295,"inherits":313}],300:[function(require,module,exports){
39072'use strict';
39073
39074var _ = require('lodash');
39075var BN = require('../crypto/bn');
39076var buffer = require('buffer');
39077var bufferUtil = require('../util/buffer');
39078var JSUtil = require('../util/js');
39079var BufferWriter = require('../encoding/bufferwriter');
39080var Script = require('../script');
39081var $ = require('../util/preconditions');
39082var errors = require('../errors');
39083
39084var MAX_SAFE_INTEGER = 0x1fffffffffffff;
39085
39086function Output(args) {
39087 if (!(this instanceof Output)) {
39088 return new Output(args);
39089 }
39090 if (_.isObject(args)) {
39091 this.satoshis = args.satoshis;
39092 if (bufferUtil.isBuffer(args.script)) {
39093 this._scriptBuffer = args.script;
39094 } else {
39095 var script;
39096 if (_.isString(args.script) && JSUtil.isHexa(args.script)) {
39097 script = new buffer.Buffer(args.script, 'hex');
39098 } else {
39099 script = args.script;
39100 }
39101 this.setScript(script);
39102 }
39103 } else {
39104 throw new TypeError('Unrecognized argument for Output');
39105 }
39106}
39107
39108Object.defineProperty(Output.prototype, 'script', {
39109 configurable: false,
39110 enumerable: true,
39111 get: function() {
39112 if (this._script) {
39113 return this._script;
39114 } else {
39115 this.setScriptFromBuffer(this._scriptBuffer);
39116 return this._script;
39117 }
39118
39119 }
39120});
39121
39122Object.defineProperty(Output.prototype, 'satoshis', {
39123 configurable: false,
39124 enumerable: true,
39125 get: function() {
39126 return this._satoshis;
39127 },
39128 set: function(num) {
39129 if (num instanceof BN) {
39130 this._satoshisBN = num;
39131 this._satoshis = num.toNumber();
39132 } else if (_.isString(num)) {
39133 this._satoshis = parseInt(num);
39134 this._satoshisBN = BN.fromNumber(this._satoshis);
39135 } else {
39136 $.checkArgument(
39137 JSUtil.isNaturalNumber(num),
39138 'Output satoshis is not a natural number'
39139 );
39140 this._satoshisBN = BN.fromNumber(num);
39141 this._satoshis = num;
39142 }
39143 $.checkState(
39144 JSUtil.isNaturalNumber(this._satoshis),
39145 'Output satoshis is not a natural number'
39146 );
39147 }
39148});
39149
39150Output.prototype.invalidSatoshis = function() {
39151 if (this._satoshis > MAX_SAFE_INTEGER) {
39152 return 'transaction txout satoshis greater than max safe integer';
39153 }
39154 if (this._satoshis !== this._satoshisBN.toNumber()) {
39155 return 'transaction txout satoshis has corrupted value';
39156 }
39157 if (this._satoshis < 0) {
39158 return 'transaction txout negative';
39159 }
39160 return false;
39161};
39162
39163Output.prototype.toObject = Output.prototype.toJSON = function toObject() {
39164 var obj = {
39165 satoshis: this.satoshis
39166 };
39167 obj.script = this._scriptBuffer.toString('hex');
39168 return obj;
39169};
39170
39171Output.fromObject = function(data) {
39172 return new Output(data);
39173};
39174
39175Output.prototype.setScriptFromBuffer = function(buffer) {
39176 this._scriptBuffer = buffer;
39177 try {
39178 this._script = Script.fromBuffer(this._scriptBuffer);
39179 this._script._isOutput = true;
39180 } catch(e) {
39181 if (e instanceof errors.Script.InvalidBuffer) {
39182 this._script = null;
39183 } else {
39184 throw e;
39185 }
39186 }
39187};
39188
39189Output.prototype.setScript = function(script) {
39190 if (script instanceof Script) {
39191 this._scriptBuffer = script.toBuffer();
39192 this._script = script;
39193 this._script._isOutput = true;
39194 } else if (_.isString(script)) {
39195 this._script = Script.fromString(script);
39196 this._scriptBuffer = this._script.toBuffer();
39197 this._script._isOutput = true;
39198 } else if (bufferUtil.isBuffer(script)) {
39199 this.setScriptFromBuffer(script);
39200 } else {
39201 throw new TypeError('Invalid argument type: script');
39202 }
39203 return this;
39204};
39205
39206Output.prototype.inspect = function() {
39207 var scriptStr;
39208 if (this.script) {
39209 scriptStr = this.script.inspect();
39210 } else {
39211 scriptStr = this._scriptBuffer.toString('hex');
39212 }
39213 return '<Output (' + this.satoshis + ' sats) ' + scriptStr + '>';
39214};
39215
39216Output.fromBufferReader = function(br) {
39217 var obj = {};
39218 obj.satoshis = br.readUInt64LEBN();
39219 var size = br.readVarintNum();
39220 if (size !== 0) {
39221 obj.script = br.read(size);
39222 } else {
39223 obj.script = new buffer.Buffer([]);
39224 }
39225 return new Output(obj);
39226};
39227
39228Output.prototype.toBufferWriter = function(writer) {
39229 if (!writer) {
39230 writer = new BufferWriter();
39231 }
39232 writer.writeUInt64LEBN(this._satoshisBN);
39233 var script = this._scriptBuffer;
39234 writer.writeVarintNum(script.length);
39235 writer.write(script);
39236 return writer;
39237};
39238
39239module.exports = Output;
39240
39241},{"../crypto/bn":271,"../encoding/bufferwriter":280,"../errors":282,"../script":290,"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"buffer":146,"lodash":311}],301:[function(require,module,exports){
39242(function (Buffer){
39243'use strict';
39244
39245var buffer = require('buffer');
39246
39247var Signature = require('../crypto/signature');
39248var Script = require('../script');
39249var Output = require('./output');
39250var BufferReader = require('../encoding/bufferreader');
39251var BufferWriter = require('../encoding/bufferwriter');
39252var BN = require('../crypto/bn');
39253var Hash = require('../crypto/hash');
39254var ECDSA = require('../crypto/ecdsa');
39255var $ = require('../util/preconditions');
39256var _ = require('lodash');
39257
39258var SIGHASH_SINGLE_BUG = '0000000000000000000000000000000000000000000000000000000000000001';
39259var BITS_64_ON = 'ffffffffffffffff';
39260
39261/**
39262 * Returns a buffer of length 32 bytes with the hash that needs to be signed
39263 * for OP_CHECKSIG.
39264 *
39265 * @name Signing.sighash
39266 * @param {Transaction} transaction the transaction to sign
39267 * @param {number} sighashType the type of the hash
39268 * @param {number} inputNumber the input index for the signature
39269 * @param {Script} subscript the script that will be signed
39270 */
39271var sighash = function sighash(transaction, sighashType, inputNumber, subscript) {
39272 var Transaction = require('./transaction');
39273 var Input = require('./input');
39274
39275 var i;
39276 // Copy transaction
39277 var txcopy = Transaction.shallowCopy(transaction);
39278
39279 // Copy script
39280 subscript = new Script(subscript);
39281 subscript.removeCodeseparators();
39282
39283 for (i = 0; i < txcopy.inputs.length; i++) {
39284 // Blank signatures for other inputs
39285 txcopy.inputs[i] = new Input(txcopy.inputs[i]).setScript(Script.empty());
39286 }
39287
39288 txcopy.inputs[inputNumber] = new Input(txcopy.inputs[inputNumber]).setScript(subscript);
39289
39290 if ((sighashType & 31) === Signature.SIGHASH_NONE ||
39291 (sighashType & 31) === Signature.SIGHASH_SINGLE) {
39292
39293 // clear all sequenceNumbers
39294 for (i = 0; i < txcopy.inputs.length; i++) {
39295 if (i !== inputNumber) {
39296 txcopy.inputs[i].sequenceNumber = 0;
39297 }
39298 }
39299 }
39300
39301 if ((sighashType & 31) === Signature.SIGHASH_NONE) {
39302 txcopy.outputs = [];
39303
39304 } else if ((sighashType & 31) === Signature.SIGHASH_SINGLE) {
39305 // The SIGHASH_SINGLE bug.
39306 // https://bitcointalk.org/index.php?topic=260595.0
39307 if (inputNumber >= txcopy.outputs.length) {
39308 return Buffer.from(SIGHASH_SINGLE_BUG, 'hex');
39309 }
39310
39311 txcopy.outputs.length = inputNumber + 1;
39312
39313 for (i = 0; i < inputNumber; i++) {
39314 txcopy.outputs[i] = new Output({
39315 satoshis: BN.fromBuffer(new buffer.Buffer(BITS_64_ON, 'hex')),
39316 script: Script.empty()
39317 });
39318 }
39319 }
39320
39321 if (sighashType & Signature.SIGHASH_ANYONECANPAY) {
39322 txcopy.inputs = [txcopy.inputs[inputNumber]];
39323 }
39324
39325 var buf = new BufferWriter()
39326 .write(txcopy.toBuffer())
39327 .writeInt32LE(sighashType)
39328 .toBuffer();
39329 var ret = Hash.sha256sha256(buf);
39330 ret = new BufferReader(ret).readReverse();
39331 return ret;
39332};
39333
39334/**
39335 * Create a signature
39336 *
39337 * @name Signing.sign
39338 * @param {Transaction} transaction
39339 * @param {PrivateKey} privateKey
39340 * @param {number} sighash
39341 * @param {number} inputIndex
39342 * @param {Script} subscript
39343 * @return {Signature}
39344 */
39345function sign(transaction, privateKey, sighashType, inputIndex, subscript) {
39346 var hashbuf = sighash(transaction, sighashType, inputIndex, subscript);
39347 var sig = ECDSA.sign(hashbuf, privateKey, 'little').set({
39348 nhashtype: sighashType
39349 });
39350 return sig;
39351}
39352
39353/**
39354 * Verify a signature
39355 *
39356 * @name Signing.verify
39357 * @param {Transaction} transaction
39358 * @param {Signature} signature
39359 * @param {PublicKey} publicKey
39360 * @param {number} inputIndex
39361 * @param {Script} subscript
39362 * @return {boolean}
39363 */
39364function verify(transaction, signature, publicKey, inputIndex, subscript) {
39365 $.checkArgument(!_.isUndefined(transaction));
39366 $.checkArgument(!_.isUndefined(signature) && !_.isUndefined(signature.nhashtype));
39367 var hashbuf = sighash(transaction, signature.nhashtype, inputIndex, subscript);
39368 return ECDSA.verify(hashbuf, signature, publicKey, 'little');
39369}
39370
39371/**
39372 * @namespace Signing
39373 */
39374module.exports = {
39375 sighash: sighash,
39376 sign: sign,
39377 verify: verify
39378};
39379
39380}).call(this,require("buffer").Buffer)
39381},{"../crypto/bn":271,"../crypto/ecdsa":272,"../crypto/hash":273,"../crypto/signature":276,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../script":290,"../util/preconditions":310,"./input":294,"./output":300,"./transaction":304,"buffer":146,"lodash":311}],302:[function(require,module,exports){
39382(function (Buffer){
39383'use strict';
39384
39385/* jshint maxparams:5 */
39386
39387var Signature = require('../crypto/signature');
39388var Script = require('../script');
39389var Output = require('./output');
39390var BufferReader = require('../encoding/bufferreader');
39391var BufferWriter = require('../encoding/bufferwriter');
39392var BN = require('../crypto/bn');
39393var Hash = require('../crypto/hash');
39394var ECDSA = require('../crypto/ecdsa');
39395var $ = require('../util/preconditions');
39396var _ = require('lodash');
39397
39398/**
39399 * Returns a buffer of length 32 bytes with the hash that needs to be signed
39400 * for witness programs as defined by:
39401 * https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki
39402 *
39403 * @name Signing.sighash
39404 * @param {Transaction} transaction the transaction to sign
39405 * @param {number} sighashType the type of the hash
39406 * @param {number} inputNumber the input index for the signature
39407 * @param {Buffer} scriptCode
39408 * @param {Buffer} satoshisBuffer
39409 */
39410var sighash = function sighash(transaction, sighashType, inputNumber, scriptCode, satoshisBuffer) {
39411 /* jshint maxstatements: 50 */
39412
39413 var hashPrevouts;
39414 var hashSequence;
39415 var hashOutputs;
39416
39417 if (!(sighashType & Signature.SIGHASH_ANYONECANPAY)) {
39418 var buffers = [];
39419 for (var n = 0; n < transaction.inputs.length; n++) {
39420 var input = transaction.inputs[n];
39421 var prevTxIdBuffer = new BufferReader(input.prevTxId).readReverse();
39422 buffers.push(prevTxIdBuffer);
39423 var outputIndexBuffer = new Buffer(new Array(4));
39424 outputIndexBuffer.writeUInt32LE(input.outputIndex, 0);
39425 buffers.push(outputIndexBuffer);
39426 }
39427 hashPrevouts = Hash.sha256sha256(Buffer.concat(buffers));
39428 }
39429
39430 if (!(sighashType & Signature.SIGHASH_ANYONECANPAY) &&
39431 (sighashType & 0x1f) !== Signature.SIGHASH_SINGLE && (sighashType & 0x1f) !== Signature.SIGHASH_NONE) {
39432
39433 var sequenceBuffers = [];
39434 for (var m = 0; m < transaction.inputs.length; m++) {
39435 var sequenceBuffer = new Buffer(new Array(4));
39436 sequenceBuffer.writeUInt32LE(transaction.inputs[m].sequenceNumber, 0);
39437 sequenceBuffers.push(sequenceBuffer);
39438 }
39439 hashSequence = Hash.sha256sha256(Buffer.concat(sequenceBuffers));
39440 }
39441
39442 var outputWriter = new BufferWriter();
39443 if ((sighashType & 0x1f) !== Signature.SIGHASH_SINGLE && (sighashType & 0x1f) !== Signature.SIGHASH_NONE) {
39444 for (var p = 0; p < transaction.outputs.length; p++) {
39445 transaction.outputs[p].toBufferWriter(outputWriter);
39446 }
39447 hashOutputs = Hash.sha256sha256(outputWriter.toBuffer());
39448 } else if ((sighashType & 0x1f) === Signature.SIGHASH_SINGLE && inputNumber < transaction.outputs.length) {
39449 transaction.outputs[inputNumber].toBufferWriter(outputWriter);
39450 hashOutputs = Hash.sha256sha256(outputWriter.toBuffer());
39451 }
39452
39453 // Version
39454 var writer = new BufferWriter();
39455 writer.writeUInt32LE(transaction.version);
39456
39457 // Input prevouts/nSequence (none/all, depending on flags)
39458 writer.write(hashPrevouts);
39459 writer.write(hashSequence);
39460
39461 // The input being signed (replacing the scriptSig with scriptCode + amount)
39462 // The prevout may already be contained in hashPrevout, and the nSequence
39463 // may already be contain in hashSequence.
39464 var outpointId = new BufferReader(transaction.inputs[inputNumber].prevTxId).readReverse();
39465 writer.write(outpointId);
39466 writer.writeUInt32LE(transaction.inputs[inputNumber].outputIndex);
39467
39468 writer.write(scriptCode);
39469
39470 writer.write(satoshisBuffer);
39471
39472 writer.writeUInt32LE(transaction.inputs[inputNumber].sequenceNumber);
39473
39474 // Outputs (none/one/all, depending on flags)
39475 writer.write(hashOutputs);
39476
39477 // Locktime
39478 writer.writeUInt32LE(transaction.nLockTime);
39479
39480 // Sighash type
39481 writer.writeInt32LE(sighashType);
39482
39483 return Hash.sha256sha256(writer.toBuffer());
39484
39485};
39486
39487/**
39488 * Create a signature
39489 *
39490 * @name Signing.sign
39491 * @param {Transaction} transaction
39492 * @param {PrivateKey} privateKey
39493 * @param {number} sighash
39494 * @param {number} inputIndex
39495 * @param {Script} subscript
39496 * @return {Signature}
39497 */
39498function sign(transaction, privateKey, sighashType, inputIndex, scriptCode, satoshisBuffer) {
39499 var hashbuf = sighash(transaction, sighashType, inputIndex, scriptCode, satoshisBuffer);
39500 var sig = ECDSA.sign(hashbuf, privateKey).set({
39501 nhashtype: sighashType
39502 });
39503 return sig;
39504}
39505
39506/**
39507 * Verify a signature
39508 *
39509 * @name Signing.verify
39510 * @param {Transaction} transaction
39511 * @param {Signature} signature
39512 * @param {PublicKey} publicKey
39513 * @param {number} inputIndex
39514 * @param {Script} subscript
39515 * @return {boolean}
39516 */
39517function verify(transaction, signature, publicKey, inputIndex, scriptCode, satoshisBuffer) {
39518 $.checkArgument(!_.isUndefined(transaction));
39519 $.checkArgument(!_.isUndefined(signature) && !_.isUndefined(signature.nhashtype));
39520 var hashbuf = sighash(transaction, signature.nhashtype, inputIndex, scriptCode, satoshisBuffer);
39521 return ECDSA.verify(hashbuf, signature, publicKey);
39522}
39523
39524/**
39525 * @namespace Signing
39526 */
39527module.exports = {
39528 sighash: sighash,
39529 sign: sign,
39530 verify: verify
39531};
39532
39533}).call(this,require("buffer").Buffer)
39534},{"../crypto/bn":271,"../crypto/ecdsa":272,"../crypto/hash":273,"../crypto/signature":276,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../script":290,"../util/preconditions":310,"./output":300,"buffer":146,"lodash":311}],303:[function(require,module,exports){
39535(function (Buffer){
39536'use strict';
39537
39538var _ = require('lodash');
39539var $ = require('../util/preconditions');
39540var inherits = require('inherits');
39541var BufferUtil = require('../util/buffer');
39542var JSUtil = require('../util/js');
39543
39544var PublicKey = require('../publickey');
39545var errors = require('../errors');
39546var Signature = require('../crypto/signature');
39547
39548/**
39549 * @desc
39550 * Wrapper around Signature with fields related to signing a transaction specifically
39551 *
39552 * @param {Object|string|TransactionSignature} arg
39553 * @constructor
39554 */
39555function TransactionSignature(arg) {
39556 if (!(this instanceof TransactionSignature)) {
39557 return new TransactionSignature(arg);
39558 }
39559 if (arg instanceof TransactionSignature) {
39560 return arg;
39561 }
39562 if (_.isObject(arg)) {
39563 return this._fromObject(arg);
39564 }
39565 throw new errors.InvalidArgument('TransactionSignatures must be instantiated from an object');
39566}
39567inherits(TransactionSignature, Signature);
39568
39569TransactionSignature.prototype._fromObject = function(arg) {
39570 this._checkObjectArgs(arg);
39571 this.publicKey = new PublicKey(arg.publicKey);
39572 this.prevTxId = BufferUtil.isBuffer(arg.prevTxId) ? arg.prevTxId : Buffer.from(arg.prevTxId, 'hex');
39573 this.outputIndex = arg.outputIndex;
39574 this.inputIndex = arg.inputIndex;
39575 this.signature = (arg.signature instanceof Signature) ? arg.signature :
39576 BufferUtil.isBuffer(arg.signature) ? Signature.fromBuffer(arg.signature) :
39577 Signature.fromString(arg.signature);
39578 this.sigtype = arg.sigtype;
39579 return this;
39580};
39581
39582TransactionSignature.prototype._checkObjectArgs = function(arg) {
39583 $.checkArgument(PublicKey(arg.publicKey), 'publicKey');
39584 $.checkArgument(!_.isUndefined(arg.inputIndex), 'inputIndex');
39585 $.checkArgument(!_.isUndefined(arg.outputIndex), 'outputIndex');
39586 $.checkState(_.isNumber(arg.inputIndex), 'inputIndex must be a number');
39587 $.checkState(_.isNumber(arg.outputIndex), 'outputIndex must be a number');
39588 $.checkArgument(arg.signature, 'signature');
39589 $.checkArgument(arg.prevTxId, 'prevTxId');
39590 $.checkState(arg.signature instanceof Signature ||
39591 BufferUtil.isBuffer(arg.signature) ||
39592 JSUtil.isHexa(arg.signature), 'signature must be a buffer or hexa value');
39593 $.checkState(BufferUtil.isBuffer(arg.prevTxId) ||
39594 JSUtil.isHexa(arg.prevTxId), 'prevTxId must be a buffer or hexa value');
39595 $.checkArgument(arg.sigtype, 'sigtype');
39596 $.checkState(_.isNumber(arg.sigtype), 'sigtype must be a number');
39597};
39598
39599/**
39600 * Serializes a transaction to a plain JS object
39601 * @return {Object}
39602 */
39603TransactionSignature.prototype.toObject = TransactionSignature.prototype.toJSON = function toObject() {
39604 return {
39605 publicKey: this.publicKey.toString(),
39606 prevTxId: this.prevTxId.toString('hex'),
39607 outputIndex: this.outputIndex,
39608 inputIndex: this.inputIndex,
39609 signature: this.signature.toString(),
39610 sigtype: this.sigtype
39611 };
39612};
39613
39614/**
39615 * Builds a TransactionSignature from an object
39616 * @param {Object} object
39617 * @return {TransactionSignature}
39618 */
39619TransactionSignature.fromObject = function(object) {
39620 $.checkArgument(object);
39621 return new TransactionSignature(object);
39622};
39623
39624module.exports = TransactionSignature;
39625
39626}).call(this,require("buffer").Buffer)
39627},{"../crypto/signature":276,"../errors":282,"../publickey":289,"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"buffer":146,"inherits":313,"lodash":311}],304:[function(require,module,exports){
39628(function (Buffer){
39629'use strict';
39630
39631var _ = require('lodash');
39632var $ = require('../util/preconditions');
39633var buffer = require('buffer');
39634var compare = Buffer.compare || require('buffer-compare');
39635
39636var errors = require('../errors');
39637var BufferUtil = require('../util/buffer');
39638var JSUtil = require('../util/js');
39639var BufferReader = require('../encoding/bufferreader');
39640var BufferWriter = require('../encoding/bufferwriter');
39641var Hash = require('../crypto/hash');
39642var Signature = require('../crypto/signature');
39643var Sighash = require('./sighash');
39644var SighashWitness = require('./sighashwitness');
39645
39646var Address = require('../address');
39647var UnspentOutput = require('./unspentoutput');
39648var Input = require('./input');
39649var PublicKeyHashInput = Input.PublicKeyHash;
39650var PublicKeyInput = Input.PublicKey;
39651var MultiSigScriptHashInput = Input.MultiSigScriptHash;
39652var MultiSigInput = Input.MultiSig;
39653var Output = require('./output');
39654var Script = require('../script');
39655var PrivateKey = require('../privatekey');
39656var BN = require('../crypto/bn');
39657
39658/**
39659 * Represents a transaction, a set of inputs and outputs to change ownership of tokens
39660 *
39661 * @param {*} serialized
39662 * @constructor
39663 */
39664function Transaction(serialized) {
39665 if (!(this instanceof Transaction)) {
39666 return new Transaction(serialized);
39667 }
39668 this.inputs = [];
39669 this.outputs = [];
39670 this._inputAmount = undefined;
39671 this._outputAmount = undefined;
39672
39673 if (serialized) {
39674 if (serialized instanceof Transaction) {
39675 return Transaction.shallowCopy(serialized);
39676 } else if (JSUtil.isHexa(serialized)) {
39677 this.fromString(serialized);
39678 } else if (BufferUtil.isBuffer(serialized)) {
39679 this.fromBuffer(serialized);
39680 } else if (_.isObject(serialized)) {
39681 this.fromObject(serialized);
39682 } else {
39683 throw new errors.InvalidArgument('Must provide an object or string to deserialize a transaction');
39684 }
39685 } else {
39686 this._newTransaction();
39687 }
39688}
39689var CURRENT_VERSION = 1;
39690var DEFAULT_NLOCKTIME = 0;
39691var MAX_BLOCK_SIZE = 1000000;
39692
39693// Minimum amount for an output for it not to be considered a dust output
39694Transaction.DUST_AMOUNT = 546;
39695
39696// Margin of error to allow fees in the vecinity of the expected value but doesn't allow a big difference
39697Transaction.FEE_SECURITY_MARGIN = 150;
39698
39699// max amount of satoshis in circulation
39700Transaction.MAX_MONEY = 21000000 * 1e8;
39701
39702// nlocktime limit to be considered block height rather than a timestamp
39703Transaction.NLOCKTIME_BLOCKHEIGHT_LIMIT = 5e8;
39704
39705// Max value for an unsigned 32 bit value
39706Transaction.NLOCKTIME_MAX_VALUE = 4294967295;
39707
39708// Value used for fee estimation (satoshis per kilobyte)
39709Transaction.FEE_PER_KB = 100000;
39710
39711// Safe upper bound for change address script size in bytes
39712Transaction.CHANGE_OUTPUT_MAX_SIZE = 20 + 4 + 34 + 4;
39713Transaction.MAXIMUM_EXTRA_SIZE = 4 + 9 + 9 + 4;
39714
39715/* Constructors and Serialization */
39716
39717/**
39718 * Create a 'shallow' copy of the transaction, by serializing and deserializing
39719 * it dropping any additional information that inputs and outputs may have hold
39720 *
39721 * @param {Transaction} transaction
39722 * @return {Transaction}
39723 */
39724Transaction.shallowCopy = function(transaction) {
39725 var copy = new Transaction(transaction.toBuffer());
39726 return copy;
39727};
39728
39729var hashProperty = {
39730 configurable: false,
39731 enumerable: true,
39732 get: function() {
39733 this._hash = new BufferReader(this._getHash()).readReverse().toString('hex');
39734 return this._hash;
39735 }
39736};
39737
39738var witnessHashProperty = {
39739 configurable: false,
39740 enumerable: true,
39741 get: function() {
39742 return new BufferReader(this._getWitnessHash()).readReverse().toString('hex');
39743 }
39744};
39745
39746Object.defineProperty(Transaction.prototype, 'witnessHash', witnessHashProperty);
39747Object.defineProperty(Transaction.prototype, 'hash', hashProperty);
39748Object.defineProperty(Transaction.prototype, 'id', hashProperty);
39749
39750var ioProperty = {
39751 configurable: false,
39752 enumerable: true,
39753 get: function() {
39754 return this._getInputAmount();
39755 }
39756};
39757Object.defineProperty(Transaction.prototype, 'inputAmount', ioProperty);
39758ioProperty.get = function() {
39759 return this._getOutputAmount();
39760};
39761Object.defineProperty(Transaction.prototype, 'outputAmount', ioProperty);
39762
39763/**
39764 * Retrieve the little endian hash of the transaction (used for serialization)
39765 * @return {Buffer}
39766 */
39767Transaction.prototype._getHash = function() {
39768 return Hash.sha256sha256(this.toBuffer(true));
39769};
39770
39771/**
39772 * Retrieve the little endian hash of the transaction including witness data
39773 * @return {Buffer}
39774 */
39775Transaction.prototype._getWitnessHash = function() {
39776 return Hash.sha256sha256(this.toBuffer(false));
39777};
39778
39779/**
39780 * Retrieve a hexa string that can be used with bitcoind's CLI interface
39781 * (decoderawtransaction, sendrawtransaction)
39782 *
39783 * @param {Object|boolean=} unsafe if true, skip all tests. if it's an object,
39784 * it's expected to contain a set of flags to skip certain tests:
39785 * * `disableAll`: disable all checks
39786 * * `disableSmallFees`: disable checking for fees that are too small
39787 * * `disableLargeFees`: disable checking for fees that are too large
39788 * * `disableIsFullySigned`: disable checking if all inputs are fully signed
39789 * * `disableDustOutputs`: disable checking if there are no outputs that are dust amounts
39790 * * `disableMoreOutputThanInput`: disable checking if the transaction spends more bitcoins than the sum of the input amounts
39791 * @return {string}
39792 */
39793Transaction.prototype.serialize = function(unsafe) {
39794 if (true === unsafe || unsafe && unsafe.disableAll) {
39795 return this.uncheckedSerialize();
39796 } else {
39797 return this.checkedSerialize(unsafe);
39798 }
39799};
39800
39801Transaction.prototype.uncheckedSerialize = Transaction.prototype.toString = function() {
39802 return this.toBuffer().toString('hex');
39803};
39804
39805/**
39806 * Retrieve a hexa string that can be used with bitcoind's CLI interface
39807 * (decoderawtransaction, sendrawtransaction)
39808 *
39809 * @param {Object} opts allows to skip certain tests. {@see Transaction#serialize}
39810 * @return {string}
39811 */
39812Transaction.prototype.checkedSerialize = function(opts) {
39813 var serializationError = this.getSerializationError(opts);
39814 if (serializationError) {
39815 serializationError.message += ' - For more information please see: ' +
39816 'https://bitcore.io/api/lib/transaction#serialization-checks';
39817 throw serializationError;
39818 }
39819 return this.uncheckedSerialize();
39820};
39821
39822Transaction.prototype.invalidSatoshis = function() {
39823 var invalid = false;
39824 for (var i = 0; i < this.outputs.length; i++) {
39825 if (this.outputs[i].invalidSatoshis()) {
39826 invalid = true;
39827 }
39828 }
39829 return invalid;
39830};
39831
39832/**
39833 * Retrieve a possible error that could appear when trying to serialize and
39834 * broadcast this transaction.
39835 *
39836 * @param {Object} opts allows to skip certain tests. {@see Transaction#serialize}
39837 * @return {bitcore.Error}
39838 */
39839Transaction.prototype.getSerializationError = function(opts) {
39840 opts = opts || {};
39841
39842 if (this.invalidSatoshis()) {
39843 return new errors.Transaction.InvalidSatoshis();
39844 }
39845
39846 var unspent = this._getUnspentValue();
39847 var unspentError;
39848 if (unspent < 0) {
39849 if (!opts.disableMoreOutputThanInput) {
39850 unspentError = new errors.Transaction.InvalidOutputAmountSum();
39851 }
39852 } else {
39853 unspentError = this._hasFeeError(opts, unspent);
39854 }
39855
39856 return unspentError ||
39857 this._hasDustOutputs(opts) ||
39858 this._isMissingSignatures(opts);
39859};
39860
39861Transaction.prototype._hasFeeError = function(opts, unspent) {
39862
39863 if (!_.isUndefined(this._fee) && this._fee !== unspent) {
39864 return new errors.Transaction.FeeError.Different(
39865 'Unspent value is ' + unspent + ' but specified fee is ' + this._fee
39866 );
39867 }
39868
39869 if (!opts.disableLargeFees) {
39870 var maximumFee = Math.floor(Transaction.FEE_SECURITY_MARGIN * this._estimateFee());
39871 if (unspent > maximumFee) {
39872 if (this._missingChange()) {
39873 return new errors.Transaction.ChangeAddressMissing(
39874 'Fee is too large and no change address was provided'
39875 );
39876 }
39877 return new errors.Transaction.FeeError.TooLarge(
39878 'expected less than ' + maximumFee + ' but got ' + unspent
39879 );
39880 }
39881 }
39882
39883 if (!opts.disableSmallFees) {
39884 var minimumFee = Math.ceil(this._estimateFee() / Transaction.FEE_SECURITY_MARGIN);
39885 if (unspent < minimumFee) {
39886 return new errors.Transaction.FeeError.TooSmall(
39887 'expected more than ' + minimumFee + ' but got ' + unspent
39888 );
39889 }
39890 }
39891};
39892
39893Transaction.prototype._missingChange = function() {
39894 return !this._changeScript;
39895};
39896
39897Transaction.prototype._hasDustOutputs = function(opts) {
39898 if (opts.disableDustOutputs) {
39899 return;
39900 }
39901 var index, output;
39902 for (index in this.outputs) {
39903 output = this.outputs[index];
39904 if (output.satoshis < Transaction.DUST_AMOUNT && !output.script.isDataOut()) {
39905 return new errors.Transaction.DustOutputs();
39906 }
39907 }
39908};
39909
39910Transaction.prototype._isMissingSignatures = function(opts) {
39911 if (opts.disableIsFullySigned) {
39912 return;
39913 }
39914 if (!this.isFullySigned()) {
39915 return new errors.Transaction.MissingSignatures();
39916 }
39917};
39918
39919Transaction.prototype.inspect = function() {
39920 return '<Transaction: ' + this.uncheckedSerialize() + '>';
39921};
39922
39923Transaction.prototype.toBuffer = function(noWitness) {
39924 var writer = new BufferWriter();
39925 return this.toBufferWriter(writer, noWitness).toBuffer();
39926};
39927
39928Transaction.prototype.hasWitnesses = function() {
39929 for (var i = 0; i < this.inputs.length; i++) {
39930 if (this.inputs[i].hasWitnesses()) {
39931 return true;
39932 }
39933 }
39934 return false;
39935};
39936
39937Transaction.prototype.toBufferWriter = function(writer, noWitness) {
39938 writer.writeInt32LE(this.version);
39939
39940 var hasWitnesses = this.hasWitnesses();
39941
39942 if (hasWitnesses && !noWitness) {
39943 writer.write(new Buffer('0001', 'hex'));
39944 }
39945
39946 writer.writeVarintNum(this.inputs.length);
39947
39948 _.each(this.inputs, function(input) {
39949 input.toBufferWriter(writer);
39950 });
39951
39952 writer.writeVarintNum(this.outputs.length);
39953 _.each(this.outputs, function(output) {
39954 output.toBufferWriter(writer);
39955 });
39956
39957 if (hasWitnesses && !noWitness) {
39958 _.each(this.inputs, function(input) {
39959 var witnesses = input.getWitnesses();
39960 writer.writeVarintNum(witnesses.length);
39961 for (var j = 0; j < witnesses.length; j++) {
39962 writer.writeVarintNum(witnesses[j].length);
39963 writer.write(witnesses[j]);
39964 }
39965 });
39966 }
39967
39968 writer.writeUInt32LE(this.nLockTime);
39969 return writer;
39970};
39971
39972Transaction.prototype.fromBuffer = function(buffer) {
39973 var reader = new BufferReader(buffer);
39974 return this.fromBufferReader(reader);
39975};
39976
39977Transaction.prototype.fromBufferReader = function(reader) {
39978 $.checkArgument(!reader.finished(), 'No transaction data received');
39979
39980 this.version = reader.readInt32LE();
39981 var sizeTxIns = reader.readVarintNum();
39982
39983 // check for segwit
39984 var hasWitnesses = false;
39985 if (sizeTxIns === 0 && reader.buf[reader.pos] !== 0) {
39986 reader.pos += 1;
39987 hasWitnesses = true;
39988 sizeTxIns = reader.readVarintNum();
39989 }
39990
39991 for (var i = 0; i < sizeTxIns; i++) {
39992 var input = Input.fromBufferReader(reader);
39993 this.inputs.push(input);
39994 }
39995
39996 var sizeTxOuts = reader.readVarintNum();
39997 for (var j = 0; j < sizeTxOuts; j++) {
39998 this.outputs.push(Output.fromBufferReader(reader));
39999 }
40000
40001 if (hasWitnesses) {
40002 for (var k = 0; k < sizeTxIns; k++) {
40003 var itemCount = reader.readVarintNum();
40004 var witnesses = [];
40005 for (var l = 0; l < itemCount; l++) {
40006 var size = reader.readVarintNum();
40007 var item = reader.read(size);
40008 witnesses.push(item);
40009 }
40010 this.inputs[k].setWitnesses(witnesses);
40011 }
40012 }
40013
40014 this.nLockTime = reader.readUInt32LE();
40015 return this;
40016};
40017
40018
40019Transaction.prototype.toObject = Transaction.prototype.toJSON = function toObject() {
40020 var inputs = [];
40021 this.inputs.forEach(function(input) {
40022 inputs.push(input.toObject());
40023 });
40024 var outputs = [];
40025 this.outputs.forEach(function(output) {
40026 outputs.push(output.toObject());
40027 });
40028 var obj = {
40029 hash: this.hash,
40030 version: this.version,
40031 inputs: inputs,
40032 outputs: outputs,
40033 nLockTime: this.nLockTime
40034 };
40035 if (this._changeScript) {
40036 obj.changeScript = this._changeScript.toString();
40037 }
40038 if (!_.isUndefined(this._changeIndex)) {
40039 obj.changeIndex = this._changeIndex;
40040 }
40041 if (!_.isUndefined(this._fee)) {
40042 obj.fee = this._fee;
40043 }
40044 return obj;
40045};
40046
40047Transaction.prototype.fromObject = function fromObject(arg) {
40048 /* jshint maxstatements: 20 */
40049 $.checkArgument(_.isObject(arg) || arg instanceof Transaction);
40050 var self = this;
40051 var transaction;
40052 if (arg instanceof Transaction) {
40053 transaction = transaction.toObject();
40054 } else {
40055 transaction = arg;
40056 }
40057 _.each(transaction.inputs, function(input) {
40058 if (!input.output || !input.output.script) {
40059 self.uncheckedAddInput(new Input(input));
40060 return;
40061 }
40062 var script = new Script(input.output.script);
40063 var txin;
40064 if (script.isPublicKeyHashOut()) {
40065 txin = new Input.PublicKeyHash(input);
40066 } else if (script.isScriptHashOut() && input.publicKeys && input.threshold) {
40067 txin = new Input.MultiSigScriptHash(
40068 input, input.publicKeys, input.threshold, input.signatures
40069 );
40070 } else if (script.isPublicKeyOut()) {
40071 txin = new Input.PublicKey(input);
40072 } else {
40073 throw new errors.Transaction.Input.UnsupportedScript(input.output.script);
40074 }
40075 self.addInput(txin);
40076 });
40077 _.each(transaction.outputs, function(output) {
40078 self.addOutput(new Output(output));
40079 });
40080 if (transaction.changeIndex) {
40081 this._changeIndex = transaction.changeIndex;
40082 }
40083 if (transaction.changeScript) {
40084 this._changeScript = new Script(transaction.changeScript);
40085 }
40086 if (transaction.fee) {
40087 this._fee = transaction.fee;
40088 }
40089 this.nLockTime = transaction.nLockTime;
40090 this.version = transaction.version;
40091 this._checkConsistency(arg);
40092 return this;
40093};
40094
40095Transaction.prototype._checkConsistency = function(arg) {
40096 if (!_.isUndefined(this._changeIndex)) {
40097 $.checkState(this._changeScript, 'Change script is expected.');
40098 $.checkState(this.outputs[this._changeIndex], 'Change index points to undefined output.');
40099 $.checkState(this.outputs[this._changeIndex].script.toString() ===
40100 this._changeScript.toString(), 'Change output has an unexpected script.');
40101 }
40102 if (arg && arg.hash) {
40103 $.checkState(arg.hash === this.hash, 'Hash in object does not match transaction hash.');
40104 }
40105};
40106
40107/**
40108 * Sets nLockTime so that transaction is not valid until the desired date(a
40109 * timestamp in seconds since UNIX epoch is also accepted)
40110 *
40111 * @param {Date | Number} time
40112 * @return {Transaction} this
40113 */
40114Transaction.prototype.lockUntilDate = function(time) {
40115 $.checkArgument(time);
40116 if (_.isNumber(time) && time < Transaction.NLOCKTIME_BLOCKHEIGHT_LIMIT) {
40117 throw new errors.Transaction.LockTimeTooEarly();
40118 }
40119 if (_.isDate(time)) {
40120 time = time.getTime() / 1000;
40121 }
40122
40123 for (var i = 0; i < this.inputs.length; i++) {
40124 if (this.inputs[i].sequenceNumber === Input.DEFAULT_SEQNUMBER){
40125 this.inputs[i].sequenceNumber = Input.DEFAULT_LOCKTIME_SEQNUMBER;
40126 }
40127 }
40128
40129 this.nLockTime = time;
40130 return this;
40131};
40132
40133/**
40134 * Sets nLockTime so that transaction is not valid until the desired block
40135 * height.
40136 *
40137 * @param {Number} height
40138 * @return {Transaction} this
40139 */
40140Transaction.prototype.lockUntilBlockHeight = function(height) {
40141 $.checkArgument(_.isNumber(height));
40142 if (height >= Transaction.NLOCKTIME_BLOCKHEIGHT_LIMIT) {
40143 throw new errors.Transaction.BlockHeightTooHigh();
40144 }
40145 if (height < 0) {
40146 throw new errors.Transaction.NLockTimeOutOfRange();
40147 }
40148
40149 for (var i = 0; i < this.inputs.length; i++) {
40150 if (this.inputs[i].sequenceNumber === Input.DEFAULT_SEQNUMBER){
40151 this.inputs[i].sequenceNumber = Input.DEFAULT_LOCKTIME_SEQNUMBER;
40152 }
40153 }
40154
40155
40156 this.nLockTime = height;
40157 return this;
40158};
40159
40160/**
40161 * Returns a semantic version of the transaction's nLockTime.
40162 * @return {Number|Date}
40163 * If nLockTime is 0, it returns null,
40164 * if it is < 500000000, it returns a block height (number)
40165 * else it returns a Date object.
40166 */
40167Transaction.prototype.getLockTime = function() {
40168 if (!this.nLockTime) {
40169 return null;
40170 }
40171 if (this.nLockTime < Transaction.NLOCKTIME_BLOCKHEIGHT_LIMIT) {
40172 return this.nLockTime;
40173 }
40174 return new Date(1000 * this.nLockTime);
40175};
40176
40177Transaction.prototype.fromString = function(string) {
40178 this.fromBuffer(buffer.Buffer.from(string, 'hex'));
40179};
40180
40181Transaction.prototype._newTransaction = function() {
40182 this.version = CURRENT_VERSION;
40183 this.nLockTime = DEFAULT_NLOCKTIME;
40184};
40185
40186/* Transaction creation interface */
40187
40188/**
40189 * @typedef {Object} Transaction~fromObject
40190 * @property {string} prevTxId
40191 * @property {number} outputIndex
40192 * @property {(Buffer|string|Script)} script
40193 * @property {number} satoshis
40194 */
40195
40196/**
40197 * Add an input to this transaction. This is a high level interface
40198 * to add an input, for more control, use @{link Transaction#addInput}.
40199 *
40200 * Can receive, as output information, the output of bitcoind's `listunspent` command,
40201 * and a slightly fancier format recognized by bitcore:
40202 *
40203 * ```
40204 * {
40205 * address: 'mszYqVnqKoQx4jcTdJXxwKAissE3Jbrrc1',
40206 * txId: 'a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458',
40207 * outputIndex: 0,
40208 * script: Script.empty(),
40209 * satoshis: 1020000
40210 * }
40211 * ```
40212 * Where `address` can be either a string or a bitcore Address object. The
40213 * same is true for `script`, which can be a string or a bitcore Script.
40214 *
40215 * Beware that this resets all the signatures for inputs (in further versions,
40216 * SIGHASH_SINGLE or SIGHASH_NONE signatures will not be reset).
40217 *
40218 * @example
40219 * ```javascript
40220 * var transaction = new Transaction();
40221 *
40222 * // From a pay to public key hash output from bitcoind's listunspent
40223 * transaction.from({'txid': '0000...', vout: 0, amount: 0.1, scriptPubKey: 'OP_DUP ...'});
40224 *
40225 * // From a pay to public key hash output
40226 * transaction.from({'txId': '0000...', outputIndex: 0, satoshis: 1000, script: 'OP_DUP ...'});
40227 *
40228 * // From a multisig P2SH output
40229 * transaction.from({'txId': '0000...', inputIndex: 0, satoshis: 1000, script: '... OP_HASH'},
40230 * ['03000...', '02000...'], 2);
40231 * ```
40232 *
40233 * @param {(Array.<Transaction~fromObject>|Transaction~fromObject)} utxo
40234 * @param {Array=} pubkeys
40235 * @param {number=} threshold
40236 * @param {boolean=} nestedWitness - Indicates that the utxo is nested witness p2sh
40237 * @param {Object=} opts - Several options:
40238 * - noSorting: defaults to false, if true and is multisig, don't
40239 * sort the given public keys before creating the script
40240 */
40241Transaction.prototype.from = function(utxo, pubkeys, threshold, nestedWitness, opts) {
40242 if (_.isArray(utxo)) {
40243 var self = this;
40244 _.each(utxo, function(utxo) {
40245 self.from(utxo, pubkeys, threshold);
40246 });
40247 return this;
40248 }
40249 var exists = _.some(this.inputs, function(input) {
40250 // TODO: Maybe prevTxId should be a string? Or defined as read only property?
40251 return input.prevTxId.toString('hex') === utxo.txId && input.outputIndex === utxo.outputIndex;
40252 });
40253 if (exists) {
40254 return this;
40255 }
40256 if (pubkeys && threshold) {
40257 this._fromMultisigUtxo(utxo, pubkeys, threshold, nestedWitness, opts);
40258 } else {
40259 this._fromNonP2SH(utxo);
40260 }
40261 return this;
40262};
40263
40264Transaction.prototype._fromNonP2SH = function(utxo) {
40265 var clazz;
40266 utxo = new UnspentOutput(utxo);
40267 if (utxo.script.isPublicKeyHashOut()) {
40268 clazz = PublicKeyHashInput;
40269 } else if (utxo.script.isPublicKeyOut()) {
40270 clazz = PublicKeyInput;
40271 } else {
40272 clazz = Input;
40273 }
40274 this.addInput(new clazz({
40275 output: new Output({
40276 script: utxo.script,
40277 satoshis: utxo.satoshis
40278 }),
40279 prevTxId: utxo.txId,
40280 outputIndex: utxo.outputIndex,
40281 script: Script.empty()
40282 }));
40283};
40284
40285Transaction.prototype._fromMultisigUtxo = function(utxo, pubkeys, threshold, nestedWitness, opts) {
40286 $.checkArgument(threshold <= pubkeys.length,
40287 'Number of required signatures must be greater than the number of public keys');
40288 var clazz;
40289 utxo = new UnspentOutput(utxo);
40290 if (utxo.script.isMultisigOut()) {
40291 clazz = MultiSigInput;
40292 } else if (utxo.script.isScriptHashOut()) {
40293 clazz = MultiSigScriptHashInput;
40294 } else {
40295 throw new Error("@TODO");
40296 }
40297 this.addInput(new clazz({
40298 output: new Output({
40299 script: utxo.script,
40300 satoshis: utxo.satoshis
40301 }),
40302 prevTxId: utxo.txId,
40303 outputIndex: utxo.outputIndex,
40304 script: Script.empty()
40305 }, pubkeys, threshold, false, nestedWitness, opts));
40306};
40307
40308/**
40309 * Add an input to this transaction. The input must be an instance of the `Input` class.
40310 * It should have information about the Output that it's spending, but if it's not already
40311 * set, two additional parameters, `outputScript` and `satoshis` can be provided.
40312 *
40313 * @param {Input} input
40314 * @param {String|Script} outputScript
40315 * @param {number} satoshis
40316 * @return Transaction this, for chaining
40317 */
40318Transaction.prototype.addInput = function(input, outputScript, satoshis) {
40319 $.checkArgumentType(input, Input, 'input');
40320 if (!input.output && (_.isUndefined(outputScript) || _.isUndefined(satoshis))) {
40321 throw new errors.Transaction.NeedMoreInfo('Need information about the UTXO script and satoshis');
40322 }
40323 if (!input.output && outputScript && !_.isUndefined(satoshis)) {
40324 outputScript = outputScript instanceof Script ? outputScript : new Script(outputScript);
40325 $.checkArgumentType(satoshis, 'number', 'satoshis');
40326 input.output = new Output({
40327 script: outputScript,
40328 satoshis: satoshis
40329 });
40330 }
40331 return this.uncheckedAddInput(input);
40332};
40333
40334/**
40335 * Add an input to this transaction, without checking that the input has information about
40336 * the output that it's spending.
40337 *
40338 * @param {Input} input
40339 * @return Transaction this, for chaining
40340 */
40341Transaction.prototype.uncheckedAddInput = function(input) {
40342 $.checkArgumentType(input, Input, 'input');
40343 this.inputs.push(input);
40344 this._inputAmount = undefined;
40345 this._updateChangeOutput();
40346 return this;
40347};
40348
40349/**
40350 * Returns true if the transaction has enough info on all inputs to be correctly validated
40351 *
40352 * @return {boolean}
40353 */
40354Transaction.prototype.hasAllUtxoInfo = function() {
40355 return _.every(this.inputs.map(function(input) {
40356 return !!input.output;
40357 }));
40358};
40359
40360/**
40361 * Manually set the fee for this transaction. Beware that this resets all the signatures
40362 * for inputs (in further versions, SIGHASH_SINGLE or SIGHASH_NONE signatures will not
40363 * be reset).
40364 *
40365 * @param {number} amount satoshis to be sent
40366 * @return {Transaction} this, for chaining
40367 */
40368Transaction.prototype.fee = function(amount) {
40369 $.checkArgument(_.isNumber(amount), 'amount must be a number');
40370 this._fee = amount;
40371 this._updateChangeOutput();
40372 return this;
40373};
40374
40375/**
40376 * Manually set the fee per KB for this transaction. Beware that this resets all the signatures
40377 * for inputs (in further versions, SIGHASH_SINGLE or SIGHASH_NONE signatures will not
40378 * be reset).
40379 *
40380 * @param {number} amount satoshis per KB to be sent
40381 * @return {Transaction} this, for chaining
40382 */
40383Transaction.prototype.feePerKb = function(amount) {
40384 $.checkArgument(_.isNumber(amount), 'amount must be a number');
40385 this._feePerKb = amount;
40386 this._updateChangeOutput();
40387 return this;
40388};
40389
40390/* Output management */
40391
40392/**
40393 * Set the change address for this transaction
40394 *
40395 * Beware that this resets all the signatures for inputs (in further versions,
40396 * SIGHASH_SINGLE or SIGHASH_NONE signatures will not be reset).
40397 *
40398 * @param {Address} address An address for change to be sent to.
40399 * @return {Transaction} this, for chaining
40400 */
40401Transaction.prototype.change = function(address) {
40402 $.checkArgument(address, 'address is required');
40403 this._changeScript = Script.fromAddress(address);
40404 this._updateChangeOutput();
40405 return this;
40406};
40407
40408
40409/**
40410 * @return {Output} change output, if it exists
40411 */
40412Transaction.prototype.getChangeOutput = function() {
40413 if (!_.isUndefined(this._changeIndex)) {
40414 return this.outputs[this._changeIndex];
40415 }
40416 return null;
40417};
40418
40419/**
40420 * @typedef {Object} Transaction~toObject
40421 * @property {(string|Address)} address
40422 * @property {number} satoshis
40423 */
40424
40425/**
40426 * Add an output to the transaction.
40427 *
40428 * Beware that this resets all the signatures for inputs (in further versions,
40429 * SIGHASH_SINGLE or SIGHASH_NONE signatures will not be reset).
40430 *
40431 * @param {(string|Address|Array.<Transaction~toObject>)} address
40432 * @param {number} amount in satoshis
40433 * @return {Transaction} this, for chaining
40434 */
40435Transaction.prototype.to = function(address, amount) {
40436 if (_.isArray(address)) {
40437 var self = this;
40438 _.each(address, function(to) {
40439 self.to(to.address, to.satoshis);
40440 });
40441 return this;
40442 }
40443
40444 $.checkArgument(
40445 JSUtil.isNaturalNumber(amount),
40446 'Amount is expected to be a positive integer'
40447 );
40448 this.addOutput(new Output({
40449 script: Script(new Address(address)),
40450 satoshis: amount
40451 }));
40452 return this;
40453};
40454
40455/**
40456 * Add an OP_RETURN output to the transaction.
40457 *
40458 * Beware that this resets all the signatures for inputs (in further versions,
40459 * SIGHASH_SINGLE or SIGHASH_NONE signatures will not be reset).
40460 *
40461 * @param {Buffer|string} value the data to be stored in the OP_RETURN output.
40462 * In case of a string, the UTF-8 representation will be stored
40463 * @return {Transaction} this, for chaining
40464 */
40465Transaction.prototype.addData = function(value) {
40466 this.addOutput(new Output({
40467 script: Script.buildDataOut(value),
40468 satoshis: 0
40469 }));
40470 return this;
40471};
40472
40473
40474/**
40475 * Add an output to the transaction.
40476 *
40477 * @param {Output} output the output to add.
40478 * @return {Transaction} this, for chaining
40479 */
40480Transaction.prototype.addOutput = function(output) {
40481 $.checkArgumentType(output, Output, 'output');
40482 this._addOutput(output);
40483 this._updateChangeOutput();
40484 return this;
40485};
40486
40487
40488/**
40489 * Remove all outputs from the transaction.
40490 *
40491 * @return {Transaction} this, for chaining
40492 */
40493Transaction.prototype.clearOutputs = function() {
40494 this.outputs = [];
40495 this._clearSignatures();
40496 this._outputAmount = undefined;
40497 this._changeIndex = undefined;
40498 this._updateChangeOutput();
40499 return this;
40500};
40501
40502
40503Transaction.prototype._addOutput = function(output) {
40504 this.outputs.push(output);
40505 this._outputAmount = undefined;
40506};
40507
40508
40509/**
40510 * Calculates or gets the total output amount in satoshis
40511 *
40512 * @return {Number} the transaction total output amount
40513 */
40514Transaction.prototype._getOutputAmount = function() {
40515 if (_.isUndefined(this._outputAmount)) {
40516 var self = this;
40517 this._outputAmount = 0;
40518 _.each(this.outputs, function(output) {
40519 self._outputAmount += output.satoshis;
40520 });
40521 }
40522 return this._outputAmount;
40523};
40524
40525
40526/**
40527 * Calculates or gets the total input amount in satoshis
40528 *
40529 * @return {Number} the transaction total input amount
40530 */
40531Transaction.prototype._getInputAmount = function() {
40532 if (_.isUndefined(this._inputAmount)) {
40533 this._inputAmount = _.sumBy(this.inputs, function(input) {
40534 if (_.isUndefined(input.output)) {
40535 throw new errors.Transaction.Input.MissingPreviousOutput();
40536 }
40537 return input.output.satoshis;
40538 });
40539 }
40540 return this._inputAmount;
40541};
40542
40543Transaction.prototype._updateChangeOutput = function() {
40544 if (!this._changeScript) {
40545 return;
40546 }
40547 this._clearSignatures();
40548 if (!_.isUndefined(this._changeIndex)) {
40549 this._removeOutput(this._changeIndex);
40550 }
40551 var available = this._getUnspentValue();
40552 var fee = this.getFee();
40553 var changeAmount = available - fee;
40554 if (changeAmount > 0) {
40555 this._changeIndex = this.outputs.length;
40556 this._addOutput(new Output({
40557 script: this._changeScript,
40558 satoshis: changeAmount
40559 }));
40560 } else {
40561 this._changeIndex = undefined;
40562 }
40563};
40564/**
40565 * Calculates the fee of the transaction.
40566 *
40567 * If there's a fixed fee set, return that.
40568 *
40569 * If there is no change output set, the fee is the
40570 * total value of the outputs minus inputs. Note that
40571 * a serialized transaction only specifies the value
40572 * of its outputs. (The value of inputs are recorded
40573 * in the previous transaction outputs being spent.)
40574 * This method therefore raises a "MissingPreviousOutput"
40575 * error when called on a serialized transaction.
40576 *
40577 * If there's no fee set and no change address,
40578 * estimate the fee based on size.
40579 *
40580 * @return {Number} fee of this transaction in satoshis
40581 */
40582Transaction.prototype.getFee = function() {
40583 if (this.isCoinbase()) {
40584 return 0;
40585 }
40586 if (!_.isUndefined(this._fee)) {
40587 return this._fee;
40588 }
40589 // if no change output is set, fees should equal all the unspent amount
40590 if (!this._changeScript) {
40591 return this._getUnspentValue();
40592 }
40593 return this._estimateFee();
40594};
40595
40596/**
40597 * Estimates fee from serialized transaction size in bytes.
40598 */
40599Transaction.prototype._estimateFee = function() {
40600 var estimatedSize = this._estimateSize();
40601 var available = this._getUnspentValue();
40602 return Transaction._estimateFee(estimatedSize, available, this._feePerKb);
40603};
40604
40605Transaction.prototype._getUnspentValue = function() {
40606 return this._getInputAmount() - this._getOutputAmount();
40607};
40608
40609Transaction.prototype._clearSignatures = function() {
40610 _.each(this.inputs, function(input) {
40611 input.clearSignatures();
40612 });
40613};
40614
40615Transaction._estimateFee = function(size, amountAvailable, feePerKb) {
40616 var fee = Math.ceil(size / 1000) * (feePerKb || Transaction.FEE_PER_KB);
40617 if (amountAvailable > fee) {
40618 size += Transaction.CHANGE_OUTPUT_MAX_SIZE;
40619 }
40620 return Math.ceil(size / 1000) * (feePerKb || Transaction.FEE_PER_KB);
40621};
40622
40623Transaction.prototype._estimateSize = function() {
40624 var result = Transaction.MAXIMUM_EXTRA_SIZE;
40625 _.each(this.inputs, function(input) {
40626 result += input._estimateSize();
40627 });
40628 _.each(this.outputs, function(output) {
40629 result += output.script.toBuffer().length + 9;
40630 });
40631 return result;
40632};
40633
40634Transaction.prototype._removeOutput = function(index) {
40635 var output = this.outputs[index];
40636 this.outputs = _.without(this.outputs, output);
40637 this._outputAmount = undefined;
40638};
40639
40640Transaction.prototype.removeOutput = function(index) {
40641 this._removeOutput(index);
40642 this._updateChangeOutput();
40643};
40644
40645/**
40646 * Sort a transaction's inputs and outputs according to BIP69
40647 *
40648 * @see {https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki}
40649 * @return {Transaction} this
40650 */
40651Transaction.prototype.sort = function() {
40652 this.sortInputs(function(inputs) {
40653 var copy = Array.prototype.concat.apply([], inputs);
40654 copy.sort(function(first, second) {
40655 return compare(first.prevTxId, second.prevTxId)
40656 || first.outputIndex - second.outputIndex;
40657 });
40658 return copy;
40659 });
40660 this.sortOutputs(function(outputs) {
40661 var copy = Array.prototype.concat.apply([], outputs);
40662 copy.sort(function(first, second) {
40663 return first.satoshis - second.satoshis
40664 || compare(first.script.toBuffer(), second.script.toBuffer());
40665 });
40666 return copy;
40667 });
40668 return this;
40669};
40670
40671/**
40672 * Randomize this transaction's outputs ordering. The shuffling algorithm is a
40673 * version of the Fisher-Yates shuffle, provided by lodash's _.shuffle().
40674 *
40675 * @return {Transaction} this
40676 */
40677Transaction.prototype.shuffleOutputs = function() {
40678 return this.sortOutputs(_.shuffle);
40679};
40680
40681/**
40682 * Sort this transaction's outputs, according to a given sorting function that
40683 * takes an array as argument and returns a new array, with the same elements
40684 * but with a different order. The argument function MUST NOT modify the order
40685 * of the original array
40686 *
40687 * @param {Function} sortingFunction
40688 * @return {Transaction} this
40689 */
40690Transaction.prototype.sortOutputs = function(sortingFunction) {
40691 var outs = sortingFunction(this.outputs);
40692 return this._newOutputOrder(outs);
40693};
40694
40695/**
40696 * Sort this transaction's inputs, according to a given sorting function that
40697 * takes an array as argument and returns a new array, with the same elements
40698 * but with a different order.
40699 *
40700 * @param {Function} sortingFunction
40701 * @return {Transaction} this
40702 */
40703Transaction.prototype.sortInputs = function(sortingFunction) {
40704 this.inputs = sortingFunction(this.inputs);
40705 this._clearSignatures();
40706 return this;
40707};
40708
40709Transaction.prototype._newOutputOrder = function(newOutputs) {
40710 var isInvalidSorting = (this.outputs.length !== newOutputs.length ||
40711 _.difference(this.outputs, newOutputs).length !== 0);
40712 if (isInvalidSorting) {
40713 throw new errors.Transaction.InvalidSorting();
40714 }
40715
40716 if (!_.isUndefined(this._changeIndex)) {
40717 var changeOutput = this.outputs[this._changeIndex];
40718 this._changeIndex = _.findIndex(newOutputs, changeOutput);
40719 }
40720
40721 this.outputs = newOutputs;
40722 return this;
40723};
40724
40725Transaction.prototype.removeInput = function(txId, outputIndex) {
40726 var index;
40727 if (!outputIndex && _.isNumber(txId)) {
40728 index = txId;
40729 } else {
40730 index = _.findIndex(this.inputs, function(input) {
40731 return input.prevTxId.toString('hex') === txId && input.outputIndex === outputIndex;
40732 });
40733 }
40734 if (index < 0 || index >= this.inputs.length) {
40735 throw new errors.Transaction.InvalidIndex(index, this.inputs.length);
40736 }
40737 var input = this.inputs[index];
40738 this.inputs = _.without(this.inputs, input);
40739 this._inputAmount = undefined;
40740 this._updateChangeOutput();
40741};
40742
40743/* Signature handling */
40744
40745/**
40746 * Sign the transaction using one or more private keys.
40747 *
40748 * It tries to sign each input, verifying that the signature will be valid
40749 * (matches a public key).
40750 *
40751 * @param {Array|String|PrivateKey} privateKey
40752 * @param {number} sigtype
40753 * @return {Transaction} this, for chaining
40754 */
40755Transaction.prototype.sign = function(privateKey, sigtype) {
40756 $.checkState(this.hasAllUtxoInfo(), 'Not all utxo information is available to sign the transaction.');
40757 var self = this;
40758 if (_.isArray(privateKey)) {
40759 _.each(privateKey, function(privateKey) {
40760 self.sign(privateKey, sigtype);
40761 });
40762 return this;
40763 }
40764 _.each(this.getSignatures(privateKey, sigtype), function(signature) {
40765 self.applySignature(signature);
40766 });
40767 return this;
40768};
40769
40770Transaction.prototype.getSignatures = function(privKey, sigtype) {
40771 privKey = new PrivateKey(privKey);
40772 sigtype = sigtype || Signature.SIGHASH_ALL;
40773 var transaction = this;
40774 var results = [];
40775 var hashData = Hash.sha256ripemd160(privKey.publicKey.toBuffer());
40776 _.each(this.inputs, function forEachInput(input, index) {
40777 _.each(input.getSignatures(transaction, privKey, index, sigtype, hashData), function(signature) {
40778 results.push(signature);
40779 });
40780 });
40781 return results;
40782};
40783
40784/**
40785 * Add a signature to the transaction
40786 *
40787 * @param {Object} signature
40788 * @param {number} signature.inputIndex
40789 * @param {number} signature.sigtype
40790 * @param {PublicKey} signature.publicKey
40791 * @param {Signature} signature.signature
40792 * @return {Transaction} this, for chaining
40793 */
40794Transaction.prototype.applySignature = function(signature) {
40795 this.inputs[signature.inputIndex].addSignature(this, signature);
40796 return this;
40797};
40798
40799Transaction.prototype.isFullySigned = function() {
40800 _.each(this.inputs, function(input) {
40801 if (input.isFullySigned === Input.prototype.isFullySigned) {
40802 throw new errors.Transaction.UnableToVerifySignature(
40803 'Unrecognized script kind, or not enough information to execute script.' +
40804 'This usually happens when creating a transaction from a serialized transaction'
40805 );
40806 }
40807 });
40808 return _.every(_.map(this.inputs, function(input) {
40809 return input.isFullySigned();
40810 }));
40811};
40812
40813Transaction.prototype.isValidSignature = function(signature) {
40814 var self = this;
40815 if (this.inputs[signature.inputIndex].isValidSignature === Input.prototype.isValidSignature) {
40816 throw new errors.Transaction.UnableToVerifySignature(
40817 'Unrecognized script kind, or not enough information to execute script.' +
40818 'This usually happens when creating a transaction from a serialized transaction'
40819 );
40820 }
40821 return this.inputs[signature.inputIndex].isValidSignature(self, signature);
40822};
40823
40824/**
40825 * @returns {bool} whether the signature is valid for this transaction input
40826 */
40827Transaction.prototype.verifySignature = function(sig, pubkey, nin, subscript, sigversion, satoshis) {
40828
40829 if (_.isUndefined(sigversion)) {
40830 sigversion = 0;
40831 }
40832
40833 if (sigversion === 1) {
40834 var subscriptBuffer = subscript.toBuffer();
40835 var scriptCodeWriter = new BufferWriter();
40836 scriptCodeWriter.writeVarintNum(subscriptBuffer.length);
40837 scriptCodeWriter.write(subscriptBuffer);
40838
40839 var satoshisBuffer;
40840 if (satoshis) {
40841 $.checkState(JSUtil.isNaturalNumber(satoshis));
40842 satoshisBuffer = new BufferWriter().writeUInt64LEBN(new BN(satoshis)).toBuffer();
40843 } else {
40844 satoshisBuffer = this.inputs[nin].getSatoshisBuffer();
40845 }
40846 var verified = SighashWitness.verify(
40847 this,
40848 sig,
40849 pubkey,
40850 nin,
40851 scriptCodeWriter.toBuffer(),
40852 satoshisBuffer
40853 );
40854 return verified;
40855 }
40856
40857 return Sighash.verify(this, sig, pubkey, nin, subscript);
40858};
40859
40860/**
40861 * Check that a transaction passes basic sanity tests. If not, return a string
40862 * describing the error. This function contains the same logic as
40863 * CheckTransaction in bitcoin core.
40864 */
40865Transaction.prototype.verify = function() {
40866 // Basic checks that don't depend on any context
40867 if (this.inputs.length === 0) {
40868 return 'transaction txins empty';
40869 }
40870
40871 if (this.outputs.length === 0) {
40872 return 'transaction txouts empty';
40873 }
40874
40875 // Check for negative or overflow output values
40876 var valueoutbn = new BN(0);
40877 for (var i = 0; i < this.outputs.length; i++) {
40878 var txout = this.outputs[i];
40879
40880 if (txout.invalidSatoshis()) {
40881 return 'transaction txout ' + i + ' satoshis is invalid';
40882 }
40883 if (txout._satoshisBN.gt(new BN(Transaction.MAX_MONEY, 10))) {
40884 return 'transaction txout ' + i + ' greater than MAX_MONEY';
40885 }
40886 valueoutbn = valueoutbn.add(txout._satoshisBN);
40887 if (valueoutbn.gt(new BN(Transaction.MAX_MONEY))) {
40888 return 'transaction txout ' + i + ' total output greater than MAX_MONEY';
40889 }
40890 }
40891
40892 // Size limits
40893 if (this.toBuffer().length > MAX_BLOCK_SIZE) {
40894 return 'transaction over the maximum block size';
40895 }
40896
40897 // Check for duplicate inputs
40898 var txinmap = {};
40899 for (i = 0; i < this.inputs.length; i++) {
40900 var txin = this.inputs[i];
40901
40902 var inputid = txin.prevTxId + ':' + txin.outputIndex;
40903 if (!_.isUndefined(txinmap[inputid])) {
40904 return 'transaction input ' + i + ' duplicate input';
40905 }
40906 txinmap[inputid] = true;
40907 }
40908
40909 var isCoinbase = this.isCoinbase();
40910 if (isCoinbase) {
40911 var buf = this.inputs[0]._scriptBuffer;
40912 if (buf.length < 2 || buf.length > 100) {
40913 return 'coinbase transaction script size invalid';
40914 }
40915 } else {
40916 for (i = 0; i < this.inputs.length; i++) {
40917 if (this.inputs[i].isNull()) {
40918 return 'transaction input ' + i + ' has null input';
40919 }
40920 }
40921 }
40922 return true;
40923};
40924
40925/**
40926 * Analogous to bitcoind's IsCoinBase function in transaction.h
40927 */
40928Transaction.prototype.isCoinbase = function() {
40929 return (this.inputs.length === 1 && this.inputs[0].isNull());
40930};
40931
40932/**
40933 * Determines if this transaction can be replaced in the mempool with another
40934 * transaction that provides a sufficiently higher fee (RBF).
40935 */
40936Transaction.prototype.isRBF = function() {
40937 for (var i = 0; i < this.inputs.length; i++) {
40938 var input = this.inputs[i];
40939 if (input.sequenceNumber < Input.MAXINT - 1) {
40940 return true;
40941 }
40942 }
40943 return false;
40944};
40945
40946/**
40947 * Enable this transaction to be replaced in the mempool (RBF) if a transaction
40948 * includes a sufficiently higher fee. It will set the sequenceNumber to
40949 * DEFAULT_RBF_SEQNUMBER for all inputs if the sequence number does not
40950 * already enable RBF.
40951 */
40952Transaction.prototype.enableRBF = function() {
40953 for (var i = 0; i < this.inputs.length; i++) {
40954 var input = this.inputs[i];
40955 if (input.sequenceNumber >= Input.MAXINT - 1) {
40956 input.sequenceNumber = Input.DEFAULT_RBF_SEQNUMBER;
40957 }
40958 }
40959 return this;
40960};
40961
40962module.exports = Transaction;
40963
40964}).call(this,require("buffer").Buffer)
40965},{"../address":266,"../crypto/bn":271,"../crypto/hash":273,"../crypto/signature":276,"../encoding/bufferreader":279,"../encoding/bufferwriter":280,"../errors":282,"../privatekey":288,"../script":290,"../util/buffer":308,"../util/js":309,"../util/preconditions":310,"./input":294,"./output":300,"./sighash":301,"./sighashwitness":302,"./unspentoutput":305,"buffer":146,"buffer-compare":143,"lodash":311}],305:[function(require,module,exports){
40966'use strict';
40967
40968var _ = require('lodash');
40969var $ = require('../util/preconditions');
40970var JSUtil = require('../util/js');
40971
40972var Script = require('../script');
40973var Address = require('../address');
40974var Unit = require('../unit');
40975
40976/**
40977 * Represents an unspent output information: its script, associated amount and address,
40978 * transaction id and output index.
40979 *
40980 * @constructor
40981 * @param {object} data
40982 * @param {string} data.txid the previous transaction id
40983 * @param {string=} data.txId alias for `txid`
40984 * @param {number} data.vout the index in the transaction
40985 * @param {number=} data.outputIndex alias for `vout`
40986 * @param {string|Script} data.scriptPubKey the script that must be resolved to release the funds
40987 * @param {string|Script=} data.script alias for `scriptPubKey`
40988 * @param {number} data.amount amount of bitcoins associated
40989 * @param {number=} data.satoshis alias for `amount`, but expressed in satoshis (1 BTC = 1e8 satoshis)
40990 * @param {string|Address=} data.address the associated address to the script, if provided
40991 */
40992function UnspentOutput(data) {
40993 /* jshint maxcomplexity: 20 */
40994 /* jshint maxstatements: 20 */
40995 if (!(this instanceof UnspentOutput)) {
40996 return new UnspentOutput(data);
40997 }
40998 $.checkArgument(_.isObject(data), 'Must provide an object from where to extract data');
40999 var address = data.address ? new Address(data.address) : undefined;
41000 var txId = data.txid ? data.txid : data.txId;
41001 if (!txId || !JSUtil.isHexaString(txId) || txId.length > 64) {
41002 // TODO: Use the errors library
41003 throw new Error('Invalid TXID in object', data);
41004 }
41005 var outputIndex = _.isUndefined(data.vout) ? data.outputIndex : data.vout;
41006 if (!_.isNumber(outputIndex)) {
41007 throw new Error('Invalid outputIndex, received ' + outputIndex);
41008 }
41009 $.checkArgument(!_.isUndefined(data.scriptPubKey) || !_.isUndefined(data.script),
41010 'Must provide the scriptPubKey for that output!');
41011 var script = new Script(data.scriptPubKey || data.script);
41012 $.checkArgument(!_.isUndefined(data.amount) || !_.isUndefined(data.satoshis),
41013 'Must provide an amount for the output');
41014 var amount = !_.isUndefined(data.amount) ? new Unit.fromBTC(data.amount).toSatoshis() : data.satoshis;
41015 $.checkArgument(_.isNumber(amount), 'Amount must be a number');
41016 JSUtil.defineImmutable(this, {
41017 address: address,
41018 txId: txId,
41019 outputIndex: outputIndex,
41020 script: script,
41021 satoshis: amount
41022 });
41023}
41024
41025/**
41026 * Provide an informative output when displaying this object in the console
41027 * @returns string
41028 */
41029UnspentOutput.prototype.inspect = function() {
41030 return '<UnspentOutput: ' + this.txId + ':' + this.outputIndex +
41031 ', satoshis: ' + this.satoshis + ', address: ' + this.address + '>';
41032};
41033
41034/**
41035 * String representation: just "txid:index"
41036 * @returns string
41037 */
41038UnspentOutput.prototype.toString = function() {
41039 return this.txId + ':' + this.outputIndex;
41040};
41041
41042/**
41043 * Deserialize an UnspentOutput from an object
41044 * @param {object|string} data
41045 * @return UnspentOutput
41046 */
41047UnspentOutput.fromObject = function(data) {
41048 return new UnspentOutput(data);
41049};
41050
41051/**
41052 * Returns a plain object (no prototype or methods) with the associated info for this output
41053 * @return {object}
41054 */
41055UnspentOutput.prototype.toObject = UnspentOutput.prototype.toJSON = function toObject() {
41056 return {
41057 address: this.address ? this.address.toString() : undefined,
41058 txid: this.txId,
41059 vout: this.outputIndex,
41060 scriptPubKey: this.script.toBuffer().toString('hex'),
41061 amount: Unit.fromSatoshis(this.satoshis).toBTC()
41062 };
41063};
41064
41065module.exports = UnspentOutput;
41066
41067},{"../address":266,"../script":290,"../unit":306,"../util/js":309,"../util/preconditions":310,"lodash":311}],306:[function(require,module,exports){
41068'use strict';
41069
41070var _ = require('lodash');
41071
41072var errors = require('./errors');
41073var $ = require('./util/preconditions');
41074
41075var UNITS = {
41076 'BTC' : [1e8, 8],
41077 'mBTC' : [1e5, 5],
41078 'uBTC' : [1e2, 2],
41079 'bits' : [1e2, 2],
41080 'satoshis' : [1, 0]
41081};
41082
41083/**
41084 * Utility for handling and converting bitcoins units. The supported units are
41085 * BTC, mBTC, bits (also named uBTC) and satoshis. A unit instance can be created with an
41086 * amount and a unit code, or alternatively using static methods like {fromBTC}.
41087 * It also allows to be created from a fiat amount and the exchange rate, or
41088 * alternatively using the {fromFiat} static method.
41089 * You can consult for different representation of a unit instance using it's
41090 * {to} method, the fixed unit methods like {toSatoshis} or alternatively using
41091 * the unit accessors. It also can be converted to a fiat amount by providing the
41092 * corresponding BTC/fiat exchange rate.
41093 *
41094 * @example
41095 * ```javascript
41096 * var sats = Unit.fromBTC(1.3).toSatoshis();
41097 * var mili = Unit.fromBits(1.3).to(Unit.mBTC);
41098 * var bits = Unit.fromFiat(1.3, 350).bits;
41099 * var btc = new Unit(1.3, Unit.bits).BTC;
41100 * ```
41101 *
41102 * @param {Number} amount - The amount to be represented
41103 * @param {String|Number} code - The unit of the amount or the exchange rate
41104 * @returns {Unit} A new instance of an Unit
41105 * @constructor
41106 */
41107function Unit(amount, code) {
41108 if (!(this instanceof Unit)) {
41109 return new Unit(amount, code);
41110 }
41111
41112 // convert fiat to BTC
41113 if (_.isNumber(code)) {
41114 if (code <= 0) {
41115 throw new errors.Unit.InvalidRate(code);
41116 }
41117 amount = amount / code;
41118 code = Unit.BTC;
41119 }
41120
41121 this._value = this._from(amount, code);
41122
41123 var self = this;
41124 var defineAccesor = function(key) {
41125 Object.defineProperty(self, key, {
41126 get: function() { return self.to(key); },
41127 enumerable: true,
41128 });
41129 };
41130
41131 Object.keys(UNITS).forEach(defineAccesor);
41132}
41133
41134Object.keys(UNITS).forEach(function(key) {
41135 Unit[key] = key;
41136});
41137
41138/**
41139 * Returns a Unit instance created from JSON string or object
41140 *
41141 * @param {String|Object} json - JSON with keys: amount and code
41142 * @returns {Unit} A Unit instance
41143 */
41144Unit.fromObject = function fromObject(data){
41145 $.checkArgument(_.isObject(data), 'Argument is expected to be an object');
41146 return new Unit(data.amount, data.code);
41147};
41148
41149/**
41150 * Returns a Unit instance created from an amount in BTC
41151 *
41152 * @param {Number} amount - The amount in BTC
41153 * @returns {Unit} A Unit instance
41154 */
41155Unit.fromBTC = function(amount) {
41156 return new Unit(amount, Unit.BTC);
41157};
41158
41159/**
41160 * Returns a Unit instance created from an amount in mBTC
41161 *
41162 * @param {Number} amount - The amount in mBTC
41163 * @returns {Unit} A Unit instance
41164 */
41165Unit.fromMillis = Unit.fromMilis = function(amount) {
41166 return new Unit(amount, Unit.mBTC);
41167};
41168
41169/**
41170 * Returns a Unit instance created from an amount in bits
41171 *
41172 * @param {Number} amount - The amount in bits
41173 * @returns {Unit} A Unit instance
41174 */
41175Unit.fromMicros = Unit.fromBits = function(amount) {
41176 return new Unit(amount, Unit.bits);
41177};
41178
41179/**
41180 * Returns a Unit instance created from an amount in satoshis
41181 *
41182 * @param {Number} amount - The amount in satoshis
41183 * @returns {Unit} A Unit instance
41184 */
41185Unit.fromSatoshis = function(amount) {
41186 return new Unit(amount, Unit.satoshis);
41187};
41188
41189/**
41190 * Returns a Unit instance created from a fiat amount and exchange rate.
41191 *
41192 * @param {Number} amount - The amount in fiat
41193 * @param {Number} rate - The exchange rate BTC/fiat
41194 * @returns {Unit} A Unit instance
41195 */
41196Unit.fromFiat = function(amount, rate) {
41197 return new Unit(amount, rate);
41198};
41199
41200Unit.prototype._from = function(amount, code) {
41201 if (!UNITS[code]) {
41202 throw new errors.Unit.UnknownCode(code);
41203 }
41204 return parseInt((amount * UNITS[code][0]).toFixed());
41205};
41206
41207/**
41208 * Returns the value represented in the specified unit
41209 *
41210 * @param {String|Number} code - The unit code or exchange rate
41211 * @returns {Number} The converted value
41212 */
41213Unit.prototype.to = function(code) {
41214 if (_.isNumber(code)) {
41215 if (code <= 0) {
41216 throw new errors.Unit.InvalidRate(code);
41217 }
41218 return parseFloat((this.BTC * code).toFixed(2));
41219 }
41220
41221 if (!UNITS[code]) {
41222 throw new errors.Unit.UnknownCode(code);
41223 }
41224
41225 var value = this._value / UNITS[code][0];
41226 return parseFloat(value.toFixed(UNITS[code][1]));
41227};
41228
41229/**
41230 * Returns the value represented in BTC
41231 *
41232 * @returns {Number} The value converted to BTC
41233 */
41234Unit.prototype.toBTC = function() {
41235 return this.to(Unit.BTC);
41236};
41237
41238/**
41239 * Returns the value represented in mBTC
41240 *
41241 * @returns {Number} The value converted to mBTC
41242 */
41243Unit.prototype.toMillis = Unit.prototype.toMilis = function() {
41244 return this.to(Unit.mBTC);
41245};
41246
41247/**
41248 * Returns the value represented in bits
41249 *
41250 * @returns {Number} The value converted to bits
41251 */
41252Unit.prototype.toMicros = Unit.prototype.toBits = function() {
41253 return this.to(Unit.bits);
41254};
41255
41256/**
41257 * Returns the value represented in satoshis
41258 *
41259 * @returns {Number} The value converted to satoshis
41260 */
41261Unit.prototype.toSatoshis = function() {
41262 return this.to(Unit.satoshis);
41263};
41264
41265/**
41266 * Returns the value represented in fiat
41267 *
41268 * @param {string} rate - The exchange rate between BTC/currency
41269 * @returns {Number} The value converted to satoshis
41270 */
41271Unit.prototype.atRate = function(rate) {
41272 return this.to(rate);
41273};
41274
41275/**
41276 * Returns a the string representation of the value in satoshis
41277 *
41278 * @returns {string} the value in satoshis
41279 */
41280Unit.prototype.toString = function() {
41281 return this.satoshis + ' satoshis';
41282};
41283
41284/**
41285 * Returns a plain object representation of the Unit
41286 *
41287 * @returns {Object} An object with the keys: amount and code
41288 */
41289Unit.prototype.toObject = Unit.prototype.toJSON = function toObject() {
41290 return {
41291 amount: this.BTC,
41292 code: Unit.BTC
41293 };
41294};
41295
41296/**
41297 * Returns a string formatted for the console
41298 *
41299 * @returns {string} the value in satoshis
41300 */
41301Unit.prototype.inspect = function() {
41302 return '<Unit: ' + this.toString() + '>';
41303};
41304
41305module.exports = Unit;
41306
41307},{"./errors":282,"./util/preconditions":310,"lodash":311}],307:[function(require,module,exports){
41308'use strict';
41309
41310var _ = require('lodash');
41311var URL = require('url');
41312
41313var Address = require('./address');
41314var Unit = require('./unit');
41315
41316/**
41317 * Bitcore URI
41318 *
41319 * Instantiate an URI from a bitcoin URI String or an Object. An URI instance
41320 * can be created with a bitcoin uri string or an object. All instances of
41321 * URI are valid, the static method isValid allows checking before instantiation.
41322 *
41323 * All standard parameters can be found as members of the class, the address
41324 * is represented using an {Address} instance and the amount is represented in
41325 * satoshis. Any other non-standard parameters can be found under the extra member.
41326 *
41327 * @example
41328 * ```javascript
41329 *
41330 * var uri = new URI('bitcoin:12A1MyfXbW6RhdRAZEqofac5jCQQjwEPBu?amount=1.2');
41331 * console.log(uri.address, uri.amount);
41332 * ```
41333 *
41334 * @param {string|Object} data - A bitcoin URI string or an Object
41335 * @param {Array.<string>=} knownParams - Required non-standard params
41336 * @throws {TypeError} Invalid bitcoin address
41337 * @throws {TypeError} Invalid amount
41338 * @throws {Error} Unknown required argument
41339 * @returns {URI} A new valid and frozen instance of URI
41340 * @constructor
41341 */
41342var URI = function(data, knownParams) {
41343 if (!(this instanceof URI)) {
41344 return new URI(data, knownParams);
41345 }
41346
41347 this.extras = {};
41348 this.knownParams = knownParams || [];
41349 this.address = this.network = this.amount = this.message = null;
41350
41351 if (typeof(data) === 'string') {
41352 var params = URI.parse(data);
41353 if (params.amount) {
41354 params.amount = this._parseAmount(params.amount);
41355 }
41356 this._fromObject(params);
41357 } else if (typeof(data) === 'object') {
41358 this._fromObject(data);
41359 } else {
41360 throw new TypeError('Unrecognized data format.');
41361 }
41362};
41363
41364/**
41365 * Instantiate a URI from a String
41366 *
41367 * @param {string} str - JSON string or object of the URI
41368 * @returns {URI} A new instance of a URI
41369 */
41370URI.fromString = function fromString(str) {
41371 if (typeof(str) !== 'string') {
41372 throw new TypeError('Expected a string');
41373 }
41374 return new URI(str);
41375};
41376
41377/**
41378 * Instantiate a URI from an Object
41379 *
41380 * @param {Object} data - object of the URI
41381 * @returns {URI} A new instance of a URI
41382 */
41383URI.fromObject = function fromObject(json) {
41384 return new URI(json);
41385};
41386
41387/**
41388 * Check if an bitcoin URI string is valid
41389 *
41390 * @example
41391 * ```javascript
41392 *
41393 * var valid = URI.isValid('bitcoin:12A1MyfXbW6RhdRAZEqofac5jCQQjwEPBu');
41394 * // true
41395 * ```
41396 *
41397 * @param {string|Object} data - A bitcoin URI string or an Object
41398 * @param {Array.<string>=} knownParams - Required non-standard params
41399 * @returns {boolean} Result of uri validation
41400 */
41401URI.isValid = function(arg, knownParams) {
41402 try {
41403 new URI(arg, knownParams);
41404 } catch (err) {
41405 return false;
41406 }
41407 return true;
41408};
41409
41410/**
41411 * Convert a bitcoin URI string into a simple object.
41412 *
41413 * @param {string} uri - A bitcoin URI string
41414 * @throws {TypeError} Invalid bitcoin URI
41415 * @returns {Object} An object with the parsed params
41416 */
41417URI.parse = function(uri) {
41418 var info = URL.parse(uri, true);
41419
41420 if (info.protocol !== 'bitcoin:') {
41421 throw new TypeError('Invalid bitcoin URI');
41422 }
41423
41424 // workaround to host insensitiveness
41425 var group = /[^:]*:\/?\/?([^?]*)/.exec(uri);
41426 info.query.address = group && group[1] || undefined;
41427
41428 return info.query;
41429};
41430
41431URI.Members = ['address', 'amount', 'message', 'label', 'r'];
41432
41433/**
41434 * Internal function to load the URI instance with an object.
41435 *
41436 * @param {Object} obj - Object with the information
41437 * @throws {TypeError} Invalid bitcoin address
41438 * @throws {TypeError} Invalid amount
41439 * @throws {Error} Unknown required argument
41440 */
41441URI.prototype._fromObject = function(obj) {
41442 /* jshint maxcomplexity: 10 */
41443
41444 if (!Address.isValid(obj.address)) {
41445 throw new TypeError('Invalid bitcoin address');
41446 }
41447
41448 this.address = new Address(obj.address);
41449 this.network = this.address.network;
41450 this.amount = obj.amount;
41451
41452 for (var key in obj) {
41453 if (key === 'address' || key === 'amount') {
41454 continue;
41455 }
41456
41457 if (/^req-/.exec(key) && this.knownParams.indexOf(key) === -1) {
41458 throw Error('Unknown required argument ' + key);
41459 }
41460
41461 var destination = URI.Members.indexOf(key) > -1 ? this : this.extras;
41462 destination[key] = obj[key];
41463 }
41464};
41465
41466/**
41467 * Internal function to transform a BTC string amount into satoshis
41468 *
41469 * @param {string} amount - Amount BTC string
41470 * @throws {TypeError} Invalid amount
41471 * @returns {Object} Amount represented in satoshis
41472 */
41473URI.prototype._parseAmount = function(amount) {
41474 amount = Number(amount);
41475 if (isNaN(amount)) {
41476 throw new TypeError('Invalid amount');
41477 }
41478 return Unit.fromBTC(amount).toSatoshis();
41479};
41480
41481URI.prototype.toObject = URI.prototype.toJSON = function toObject() {
41482 var json = {};
41483 for (var i = 0; i < URI.Members.length; i++) {
41484 var m = URI.Members[i];
41485 if (this.hasOwnProperty(m) && typeof(this[m]) !== 'undefined') {
41486 json[m] = this[m].toString();
41487 }
41488 }
41489 _.extend(json, this.extras);
41490 return json;
41491};
41492
41493/**
41494 * Will return a the string representation of the URI
41495 *
41496 * @returns {string} Bitcoin URI string
41497 */
41498URI.prototype.toString = function() {
41499 var query = {};
41500 if (this.amount) {
41501 query.amount = Unit.fromSatoshis(this.amount).toBTC();
41502 }
41503 if (this.message) {
41504 query.message = this.message;
41505 }
41506 if (this.label) {
41507 query.label = this.label;
41508 }
41509 if (this.r) {
41510 query.r = this.r;
41511 }
41512 _.extend(query, this.extras);
41513
41514 return URL.format({
41515 protocol: 'bitcoin:',
41516 host: this.address,
41517 query: query
41518 });
41519};
41520
41521/**
41522 * Will return a string formatted for the console
41523 *
41524 * @returns {string} Bitcoin URI
41525 */
41526URI.prototype.inspect = function() {
41527 return '<URI: ' + this.toString() + '>';
41528};
41529
41530module.exports = URI;
41531
41532},{"./address":266,"./unit":306,"lodash":311,"url":819}],308:[function(require,module,exports){
41533(function (Buffer){
41534'use strict';
41535
41536var buffer = require('buffer');
41537var assert = require('assert');
41538
41539var js = require('./js');
41540var $ = require('./preconditions');
41541
41542function equals(a, b) {
41543 if (a.length !== b.length) {
41544 return false;
41545 }
41546 var length = a.length;
41547 for (var i = 0; i < length; i++) {
41548 if (a[i] !== b[i]) {
41549 return false;
41550 }
41551 }
41552 return true;
41553}
41554
41555module.exports = {
41556 /**
41557 * Fill a buffer with a value.
41558 *
41559 * @param {Buffer} buffer
41560 * @param {number} value
41561 * @return {Buffer}
41562 */
41563 fill: function fill(buffer, value) {
41564 $.checkArgumentType(buffer, 'Buffer', 'buffer');
41565 $.checkArgumentType(value, 'number', 'value');
41566 var length = buffer.length;
41567 for (var i = 0; i < length; i++) {
41568 buffer[i] = value;
41569 }
41570 return buffer;
41571 },
41572
41573 /**
41574 * Return a copy of a buffer
41575 *
41576 * @param {Buffer} original
41577 * @return {Buffer}
41578 */
41579 copy: function(original) {
41580 var buffer = Buffer.alloc(original.length);
41581 original.copy(buffer);
41582 return buffer;
41583 },
41584
41585 /**
41586 * Returns true if the given argument is an instance of a buffer. Tests for
41587 * both node's Buffer and Uint8Array
41588 *
41589 * @param {*} arg
41590 * @return {boolean}
41591 */
41592 isBuffer: function isBuffer(arg) {
41593 return buffer.Buffer.isBuffer(arg) || arg instanceof Uint8Array;
41594 },
41595
41596 /**
41597 * Returns a zero-filled byte array
41598 *
41599 * @param {number} bytes
41600 * @return {Buffer}
41601 */
41602 emptyBuffer: function emptyBuffer(bytes) {
41603 $.checkArgumentType(bytes, 'number', 'bytes');
41604 var result = new buffer.Buffer(bytes);
41605 for (var i = 0; i < bytes; i++) {
41606 result.write('\0', i);
41607 }
41608 return result;
41609 },
41610
41611 /**
41612 * Concatenates a buffer
41613 *
41614 * Shortcut for <tt>buffer.Buffer.concat</tt>
41615 */
41616 concat: buffer.Buffer.concat,
41617
41618 equals: equals,
41619 equal: equals,
41620
41621 /**
41622 * Transforms a number from 0 to 255 into a Buffer of size 1 with that value
41623 *
41624 * @param {number} integer
41625 * @return {Buffer}
41626 */
41627 integerAsSingleByteBuffer: function integerAsSingleByteBuffer(integer) {
41628 $.checkArgumentType(integer, 'number', 'integer');
41629 return new buffer.Buffer([integer & 0xff]);
41630 },
41631
41632 /**
41633 * Transform a 4-byte integer into a Buffer of length 4.
41634 *
41635 * @param {number} integer
41636 * @return {Buffer}
41637 */
41638 integerAsBuffer: function integerAsBuffer(integer) {
41639 $.checkArgumentType(integer, 'number', 'integer');
41640 var bytes = [];
41641 bytes.push((integer >> 24) & 0xff);
41642 bytes.push((integer >> 16) & 0xff);
41643 bytes.push((integer >> 8) & 0xff);
41644 bytes.push(integer & 0xff);
41645 return Buffer.from(bytes);
41646 },
41647
41648 /**
41649 * Transform the first 4 values of a Buffer into a number, in little endian encoding
41650 *
41651 * @param {Buffer} buffer
41652 * @return {number}
41653 */
41654 integerFromBuffer: function integerFromBuffer(buffer) {
41655 $.checkArgumentType(buffer, 'Buffer', 'buffer');
41656 return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
41657 },
41658
41659 /**
41660 * Transforms the first byte of an array into a number ranging from -128 to 127
41661 * @param {Buffer} buffer
41662 * @return {number}
41663 */
41664 integerFromSingleByteBuffer: function integerFromBuffer(buffer) {
41665 $.checkArgumentType(buffer, 'Buffer', 'buffer');
41666 return buffer[0];
41667 },
41668
41669 /**
41670 * Transforms a buffer into a string with a number in hexa representation
41671 *
41672 * Shorthand for <tt>buffer.toString('hex')</tt>
41673 *
41674 * @param {Buffer} buffer
41675 * @return {string}
41676 */
41677 bufferToHex: function bufferToHex(buffer) {
41678 $.checkArgumentType(buffer, 'Buffer', 'buffer');
41679 return buffer.toString('hex');
41680 },
41681
41682 /**
41683 * Reverse a buffer
41684 * @param {Buffer} param
41685 * @return {Buffer}
41686 */
41687 reverse: function reverse(param) {
41688 var ret = new buffer.Buffer(param.length);
41689 for (var i = 0; i < param.length; i++) {
41690 ret[i] = param[param.length - i - 1];
41691 }
41692 return ret;
41693 },
41694
41695 /**
41696 * Transforms an hexa encoded string into a Buffer with binary values
41697 *
41698 * Shorthand for <tt>Buffer(string, 'hex')</tt>
41699 *
41700 * @param {string} string
41701 * @return {Buffer}
41702 */
41703 hexToBuffer: function hexToBuffer(string) {
41704 assert(js.isHexa(string));
41705 return new buffer.Buffer(string, 'hex');
41706 }
41707};
41708
41709module.exports.NULL_HASH = module.exports.fill(Buffer.alloc(32), 0);
41710module.exports.EMPTY_BUFFER = Buffer.alloc(0);
41711
41712}).call(this,require("buffer").Buffer)
41713},{"./js":309,"./preconditions":310,"assert":26,"buffer":146}],309:[function(require,module,exports){
41714'use strict';
41715
41716var _ = require('lodash');
41717
41718/**
41719 * Determines whether a string contains only hexadecimal values
41720 *
41721 * @name JSUtil.isHexa
41722 * @param {string} value
41723 * @return {boolean} true if the string is the hexa representation of a number
41724 */
41725var isHexa = function isHexa(value) {
41726 if (!_.isString(value)) {
41727 return false;
41728 }
41729 return /^[0-9a-fA-F]+$/.test(value);
41730};
41731
41732/**
41733 * @namespace JSUtil
41734 */
41735module.exports = {
41736 /**
41737 * Test if an argument is a valid JSON object. If it is, returns a truthy
41738 * value (the json object decoded), so no double JSON.parse call is necessary
41739 *
41740 * @param {string} arg
41741 * @return {Object|boolean} false if the argument is not a JSON string.
41742 */
41743 isValidJSON: function isValidJSON(arg) {
41744 var parsed;
41745 if (!_.isString(arg)) {
41746 return false;
41747 }
41748 try {
41749 parsed = JSON.parse(arg);
41750 } catch (e) {
41751 return false;
41752 }
41753 if (typeof(parsed) === 'object') {
41754 return true;
41755 }
41756 return false;
41757 },
41758 isHexa: isHexa,
41759 isHexaString: isHexa,
41760
41761 /**
41762 * Clone an array
41763 */
41764 cloneArray: function(array) {
41765 return [].concat(array);
41766 },
41767
41768 /**
41769 * Define immutable properties on a target object
41770 *
41771 * @param {Object} target - An object to be extended
41772 * @param {Object} values - An object of properties
41773 * @return {Object} The target object
41774 */
41775 defineImmutable: function defineImmutable(target, values) {
41776 Object.keys(values).forEach(function(key){
41777 Object.defineProperty(target, key, {
41778 configurable: false,
41779 enumerable: true,
41780 value: values[key]
41781 });
41782 });
41783 return target;
41784 },
41785 /**
41786 * Checks that a value is a natural number, a positive integer or zero.
41787 *
41788 * @param {*} value
41789 * @return {Boolean}
41790 */
41791 isNaturalNumber: function isNaturalNumber(value) {
41792 return typeof value === 'number' &&
41793 isFinite(value) &&
41794 Math.floor(value) === value &&
41795 value >= 0;
41796 }
41797};
41798
41799},{"lodash":311}],310:[function(require,module,exports){
41800'use strict';
41801
41802var errors = require('../errors');
41803var _ = require('lodash');
41804
41805module.exports = {
41806 checkState: function(condition, message) {
41807 if (!condition) {
41808 throw new errors.InvalidState(message);
41809 }
41810 },
41811 checkArgument: function(condition, argumentName, message, docsPath) {
41812 if (!condition) {
41813 throw new errors.InvalidArgument(argumentName, message, docsPath);
41814 }
41815 },
41816 checkArgumentType: function(argument, type, argumentName) {
41817 argumentName = argumentName || '(unknown name)';
41818 if (_.isString(type)) {
41819 if (type === 'Buffer') {
41820 var buffer = require('buffer'); // './buffer' fails on cordova & RN
41821 if (!buffer.Buffer.isBuffer(argument)) {
41822 throw new errors.InvalidArgumentType(argument, type, argumentName);
41823 }
41824 } else if (typeof argument !== type) {
41825 throw new errors.InvalidArgumentType(argument, type, argumentName);
41826 }
41827 } else {
41828 if (!(argument instanceof type)) {
41829 throw new errors.InvalidArgumentType(argument, type.name, argumentName);
41830 }
41831 }
41832 }
41833};
41834
41835},{"../errors":282,"buffer":146,"lodash":311}],311:[function(require,module,exports){
41836(function (global){
41837/**
41838 * @license
41839 * Lodash <https://lodash.com/>
41840 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
41841 * Released under MIT license <https://lodash.com/license>
41842 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
41843 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
41844 */
41845;(function() {
41846
41847 /** Used as a safe reference for `undefined` in pre-ES5 environments. */
41848 var undefined;
41849
41850 /** Used as the semantic version number. */
41851 var VERSION = '4.17.12';
41852
41853 /** Used as the size to enable large array optimizations. */
41854 var LARGE_ARRAY_SIZE = 200;
41855
41856 /** Error message constants. */
41857 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
41858 FUNC_ERROR_TEXT = 'Expected a function';
41859
41860 /** Used to stand-in for `undefined` hash values. */
41861 var HASH_UNDEFINED = '__lodash_hash_undefined__';
41862
41863 /** Used as the maximum memoize cache size. */
41864 var MAX_MEMOIZE_SIZE = 500;
41865
41866 /** Used as the internal argument placeholder. */
41867 var PLACEHOLDER = '__lodash_placeholder__';
41868
41869 /** Used to compose bitmasks for cloning. */
41870 var CLONE_DEEP_FLAG = 1,
41871 CLONE_FLAT_FLAG = 2,
41872 CLONE_SYMBOLS_FLAG = 4;
41873
41874 /** Used to compose bitmasks for value comparisons. */
41875 var COMPARE_PARTIAL_FLAG = 1,
41876 COMPARE_UNORDERED_FLAG = 2;
41877
41878 /** Used to compose bitmasks for function metadata. */
41879 var WRAP_BIND_FLAG = 1,
41880 WRAP_BIND_KEY_FLAG = 2,
41881 WRAP_CURRY_BOUND_FLAG = 4,
41882 WRAP_CURRY_FLAG = 8,
41883 WRAP_CURRY_RIGHT_FLAG = 16,
41884 WRAP_PARTIAL_FLAG = 32,
41885 WRAP_PARTIAL_RIGHT_FLAG = 64,
41886 WRAP_ARY_FLAG = 128,
41887 WRAP_REARG_FLAG = 256,
41888 WRAP_FLIP_FLAG = 512;
41889
41890 /** Used as default options for `_.truncate`. */
41891 var DEFAULT_TRUNC_LENGTH = 30,
41892 DEFAULT_TRUNC_OMISSION = '...';
41893
41894 /** Used to detect hot functions by number of calls within a span of milliseconds. */
41895 var HOT_COUNT = 800,
41896 HOT_SPAN = 16;
41897
41898 /** Used to indicate the type of lazy iteratees. */
41899 var LAZY_FILTER_FLAG = 1,
41900 LAZY_MAP_FLAG = 2,
41901 LAZY_WHILE_FLAG = 3;
41902
41903 /** Used as references for various `Number` constants. */
41904 var INFINITY = 1 / 0,
41905 MAX_SAFE_INTEGER = 9007199254740991,
41906 MAX_INTEGER = 1.7976931348623157e+308,
41907 NAN = 0 / 0;
41908
41909 /** Used as references for the maximum length and index of an array. */
41910 var MAX_ARRAY_LENGTH = 4294967295,
41911 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
41912 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
41913
41914 /** Used to associate wrap methods with their bit flags. */
41915 var wrapFlags = [
41916 ['ary', WRAP_ARY_FLAG],
41917 ['bind', WRAP_BIND_FLAG],
41918 ['bindKey', WRAP_BIND_KEY_FLAG],
41919 ['curry', WRAP_CURRY_FLAG],
41920 ['curryRight', WRAP_CURRY_RIGHT_FLAG],
41921 ['flip', WRAP_FLIP_FLAG],
41922 ['partial', WRAP_PARTIAL_FLAG],
41923 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
41924 ['rearg', WRAP_REARG_FLAG]
41925 ];
41926
41927 /** `Object#toString` result references. */
41928 var argsTag = '[object Arguments]',
41929 arrayTag = '[object Array]',
41930 asyncTag = '[object AsyncFunction]',
41931 boolTag = '[object Boolean]',
41932 dateTag = '[object Date]',
41933 domExcTag = '[object DOMException]',
41934 errorTag = '[object Error]',
41935 funcTag = '[object Function]',
41936 genTag = '[object GeneratorFunction]',
41937 mapTag = '[object Map]',
41938 numberTag = '[object Number]',
41939 nullTag = '[object Null]',
41940 objectTag = '[object Object]',
41941 promiseTag = '[object Promise]',
41942 proxyTag = '[object Proxy]',
41943 regexpTag = '[object RegExp]',
41944 setTag = '[object Set]',
41945 stringTag = '[object String]',
41946 symbolTag = '[object Symbol]',
41947 undefinedTag = '[object Undefined]',
41948 weakMapTag = '[object WeakMap]',
41949 weakSetTag = '[object WeakSet]';
41950
41951 var arrayBufferTag = '[object ArrayBuffer]',
41952 dataViewTag = '[object DataView]',
41953 float32Tag = '[object Float32Array]',
41954 float64Tag = '[object Float64Array]',
41955 int8Tag = '[object Int8Array]',
41956 int16Tag = '[object Int16Array]',
41957 int32Tag = '[object Int32Array]',
41958 uint8Tag = '[object Uint8Array]',
41959 uint8ClampedTag = '[object Uint8ClampedArray]',
41960 uint16Tag = '[object Uint16Array]',
41961 uint32Tag = '[object Uint32Array]';
41962
41963 /** Used to match empty string literals in compiled template source. */
41964 var reEmptyStringLeading = /\b__p \+= '';/g,
41965 reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
41966 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
41967
41968 /** Used to match HTML entities and HTML characters. */
41969 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
41970 reUnescapedHtml = /[&<>"']/g,
41971 reHasEscapedHtml = RegExp(reEscapedHtml.source),
41972 reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
41973
41974 /** Used to match template delimiters. */
41975 var reEscape = /<%-([\s\S]+?)%>/g,
41976 reEvaluate = /<%([\s\S]+?)%>/g,
41977 reInterpolate = /<%=([\s\S]+?)%>/g;
41978
41979 /** Used to match property names within property paths. */
41980 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
41981 reIsPlainProp = /^\w*$/,
41982 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
41983
41984 /**
41985 * Used to match `RegExp`
41986 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
41987 */
41988 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
41989 reHasRegExpChar = RegExp(reRegExpChar.source);
41990
41991 /** Used to match leading and trailing whitespace. */
41992 var reTrim = /^\s+|\s+$/g,
41993 reTrimStart = /^\s+/,
41994 reTrimEnd = /\s+$/;
41995
41996 /** Used to match wrap detail comments. */
41997 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
41998 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
41999 reSplitDetails = /,? & /;
42000
42001 /** Used to match words composed of alphanumeric characters. */
42002 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
42003
42004 /** Used to match backslashes in property paths. */
42005 var reEscapeChar = /\\(\\)?/g;
42006
42007 /**
42008 * Used to match
42009 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
42010 */
42011 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
42012
42013 /** Used to match `RegExp` flags from their coerced string values. */
42014 var reFlags = /\w*$/;
42015
42016 /** Used to detect bad signed hexadecimal string values. */
42017 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
42018
42019 /** Used to detect binary string values. */
42020 var reIsBinary = /^0b[01]+$/i;
42021
42022 /** Used to detect host constructors (Safari). */
42023 var reIsHostCtor = /^\[object .+?Constructor\]$/;
42024
42025 /** Used to detect octal string values. */
42026 var reIsOctal = /^0o[0-7]+$/i;
42027
42028 /** Used to detect unsigned integer values. */
42029 var reIsUint = /^(?:0|[1-9]\d*)$/;
42030
42031 /** Used to match Latin Unicode letters (excluding mathematical operators). */
42032 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
42033
42034 /** Used to ensure capturing order of template delimiters. */
42035 var reNoMatch = /($^)/;
42036
42037 /** Used to match unescaped characters in compiled string literals. */
42038 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
42039
42040 /** Used to compose unicode character classes. */
42041 var rsAstralRange = '\\ud800-\\udfff',
42042 rsComboMarksRange = '\\u0300-\\u036f',
42043 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
42044 rsComboSymbolsRange = '\\u20d0-\\u20ff',
42045 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
42046 rsDingbatRange = '\\u2700-\\u27bf',
42047 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
42048 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
42049 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
42050 rsPunctuationRange = '\\u2000-\\u206f',
42051 rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
42052 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
42053 rsVarRange = '\\ufe0e\\ufe0f',
42054 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
42055
42056 /** Used to compose unicode capture groups. */
42057 var rsApos = "['\u2019]",
42058 rsAstral = '[' + rsAstralRange + ']',
42059 rsBreak = '[' + rsBreakRange + ']',
42060 rsCombo = '[' + rsComboRange + ']',
42061 rsDigits = '\\d+',
42062 rsDingbat = '[' + rsDingbatRange + ']',
42063 rsLower = '[' + rsLowerRange + ']',
42064 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
42065 rsFitz = '\\ud83c[\\udffb-\\udfff]',
42066 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
42067 rsNonAstral = '[^' + rsAstralRange + ']',
42068 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
42069 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
42070 rsUpper = '[' + rsUpperRange + ']',
42071 rsZWJ = '\\u200d';
42072
42073 /** Used to compose unicode regexes. */
42074 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
42075 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
42076 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
42077 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
42078 reOptMod = rsModifier + '?',
42079 rsOptVar = '[' + rsVarRange + ']?',
42080 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
42081 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
42082 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
42083 rsSeq = rsOptVar + reOptMod + rsOptJoin,
42084 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
42085 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
42086
42087 /** Used to match apostrophes. */
42088 var reApos = RegExp(rsApos, 'g');
42089
42090 /**
42091 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
42092 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
42093 */
42094 var reComboMark = RegExp(rsCombo, 'g');
42095
42096 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
42097 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
42098
42099 /** Used to match complex or compound words. */
42100 var reUnicodeWord = RegExp([
42101 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
42102 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
42103 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
42104 rsUpper + '+' + rsOptContrUpper,
42105 rsOrdUpper,
42106 rsOrdLower,
42107 rsDigits,
42108 rsEmoji
42109 ].join('|'), 'g');
42110
42111 /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
42112 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
42113
42114 /** Used to detect strings that need a more robust regexp to match words. */
42115 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
42116
42117 /** Used to assign default `context` object properties. */
42118 var contextProps = [
42119 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
42120 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
42121 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
42122 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
42123 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
42124 ];
42125
42126 /** Used to make template sourceURLs easier to identify. */
42127 var templateCounter = -1;
42128
42129 /** Used to identify `toStringTag` values of typed arrays. */
42130 var typedArrayTags = {};
42131 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
42132 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
42133 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
42134 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
42135 typedArrayTags[uint32Tag] = true;
42136 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
42137 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
42138 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
42139 typedArrayTags[errorTag] = typedArrayTags[funcTag] =
42140 typedArrayTags[mapTag] = typedArrayTags[numberTag] =
42141 typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
42142 typedArrayTags[setTag] = typedArrayTags[stringTag] =
42143 typedArrayTags[weakMapTag] = false;
42144
42145 /** Used to identify `toStringTag` values supported by `_.clone`. */
42146 var cloneableTags = {};
42147 cloneableTags[argsTag] = cloneableTags[arrayTag] =
42148 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
42149 cloneableTags[boolTag] = cloneableTags[dateTag] =
42150 cloneableTags[float32Tag] = cloneableTags[float64Tag] =
42151 cloneableTags[int8Tag] = cloneableTags[int16Tag] =
42152 cloneableTags[int32Tag] = cloneableTags[mapTag] =
42153 cloneableTags[numberTag] = cloneableTags[objectTag] =
42154 cloneableTags[regexpTag] = cloneableTags[setTag] =
42155 cloneableTags[stringTag] = cloneableTags[symbolTag] =
42156 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
42157 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
42158 cloneableTags[errorTag] = cloneableTags[funcTag] =
42159 cloneableTags[weakMapTag] = false;
42160
42161 /** Used to map Latin Unicode letters to basic Latin letters. */
42162 var deburredLetters = {
42163 // Latin-1 Supplement block.
42164 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
42165 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
42166 '\xc7': 'C', '\xe7': 'c',
42167 '\xd0': 'D', '\xf0': 'd',
42168 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
42169 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
42170 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
42171 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
42172 '\xd1': 'N', '\xf1': 'n',
42173 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
42174 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
42175 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
42176 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
42177 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
42178 '\xc6': 'Ae', '\xe6': 'ae',
42179 '\xde': 'Th', '\xfe': 'th',
42180 '\xdf': 'ss',
42181 // Latin Extended-A block.
42182 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
42183 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
42184 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
42185 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
42186 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
42187 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
42188 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
42189 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
42190 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
42191 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
42192 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
42193 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
42194 '\u0134': 'J', '\u0135': 'j',
42195 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
42196 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
42197 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
42198 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
42199 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
42200 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
42201 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
42202 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
42203 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
42204 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
42205 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
42206 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
42207 '\u0163': 't', '\u0165': 't', '\u0167': 't',
42208 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
42209 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
42210 '\u0174': 'W', '\u0175': 'w',
42211 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
42212 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
42213 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
42214 '\u0132': 'IJ', '\u0133': 'ij',
42215 '\u0152': 'Oe', '\u0153': 'oe',
42216 '\u0149': "'n", '\u017f': 's'
42217 };
42218
42219 /** Used to map characters to HTML entities. */
42220 var htmlEscapes = {
42221 '&': '&amp;',
42222 '<': '&lt;',
42223 '>': '&gt;',
42224 '"': '&quot;',
42225 "'": '&#39;'
42226 };
42227
42228 /** Used to map HTML entities to characters. */
42229 var htmlUnescapes = {
42230 '&amp;': '&',
42231 '&lt;': '<',
42232 '&gt;': '>',
42233 '&quot;': '"',
42234 '&#39;': "'"
42235 };
42236
42237 /** Used to escape characters for inclusion in compiled string literals. */
42238 var stringEscapes = {
42239 '\\': '\\',
42240 "'": "'",
42241 '\n': 'n',
42242 '\r': 'r',
42243 '\u2028': 'u2028',
42244 '\u2029': 'u2029'
42245 };
42246
42247 /** Built-in method references without a dependency on `root`. */
42248 var freeParseFloat = parseFloat,
42249 freeParseInt = parseInt;
42250
42251 /** Detect free variable `global` from Node.js. */
42252 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
42253
42254 /** Detect free variable `self`. */
42255 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
42256
42257 /** Used as a reference to the global object. */
42258 var root = freeGlobal || freeSelf || Function('return this')();
42259
42260 /** Detect free variable `exports`. */
42261 var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
42262
42263 /** Detect free variable `module`. */
42264 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
42265
42266 /** Detect the popular CommonJS extension `module.exports`. */
42267 var moduleExports = freeModule && freeModule.exports === freeExports;
42268
42269 /** Detect free variable `process` from Node.js. */
42270 var freeProcess = moduleExports && freeGlobal.process;
42271
42272 /** Used to access faster Node.js helpers. */
42273 var nodeUtil = (function() {
42274 try {
42275 // Use `util.types` for Node.js 10+.
42276 var types = freeModule && freeModule.require && freeModule.require('util').types;
42277
42278 if (types) {
42279 return types;
42280 }
42281
42282 // Legacy `process.binding('util')` for Node.js < 10.
42283 return freeProcess && freeProcess.binding && freeProcess.binding('util');
42284 } catch (e) {}
42285 }());
42286
42287 /* Node.js helper references. */
42288 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
42289 nodeIsDate = nodeUtil && nodeUtil.isDate,
42290 nodeIsMap = nodeUtil && nodeUtil.isMap,
42291 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
42292 nodeIsSet = nodeUtil && nodeUtil.isSet,
42293 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
42294
42295 /*--------------------------------------------------------------------------*/
42296
42297 /**
42298 * A faster alternative to `Function#apply`, this function invokes `func`
42299 * with the `this` binding of `thisArg` and the arguments of `args`.
42300 *
42301 * @private
42302 * @param {Function} func The function to invoke.
42303 * @param {*} thisArg The `this` binding of `func`.
42304 * @param {Array} args The arguments to invoke `func` with.
42305 * @returns {*} Returns the result of `func`.
42306 */
42307 function apply(func, thisArg, args) {
42308 switch (args.length) {
42309 case 0: return func.call(thisArg);
42310 case 1: return func.call(thisArg, args[0]);
42311 case 2: return func.call(thisArg, args[0], args[1]);
42312 case 3: return func.call(thisArg, args[0], args[1], args[2]);
42313 }
42314 return func.apply(thisArg, args);
42315 }
42316
42317 /**
42318 * A specialized version of `baseAggregator` for arrays.
42319 *
42320 * @private
42321 * @param {Array} [array] The array to iterate over.
42322 * @param {Function} setter The function to set `accumulator` values.
42323 * @param {Function} iteratee The iteratee to transform keys.
42324 * @param {Object} accumulator The initial aggregated object.
42325 * @returns {Function} Returns `accumulator`.
42326 */
42327 function arrayAggregator(array, setter, iteratee, accumulator) {
42328 var index = -1,
42329 length = array == null ? 0 : array.length;
42330
42331 while (++index < length) {
42332 var value = array[index];
42333 setter(accumulator, value, iteratee(value), array);
42334 }
42335 return accumulator;
42336 }
42337
42338 /**
42339 * A specialized version of `_.forEach` for arrays without support for
42340 * iteratee shorthands.
42341 *
42342 * @private
42343 * @param {Array} [array] The array to iterate over.
42344 * @param {Function} iteratee The function invoked per iteration.
42345 * @returns {Array} Returns `array`.
42346 */
42347 function arrayEach(array, iteratee) {
42348 var index = -1,
42349 length = array == null ? 0 : array.length;
42350
42351 while (++index < length) {
42352 if (iteratee(array[index], index, array) === false) {
42353 break;
42354 }
42355 }
42356 return array;
42357 }
42358
42359 /**
42360 * A specialized version of `_.forEachRight` for arrays without support for
42361 * iteratee shorthands.
42362 *
42363 * @private
42364 * @param {Array} [array] The array to iterate over.
42365 * @param {Function} iteratee The function invoked per iteration.
42366 * @returns {Array} Returns `array`.
42367 */
42368 function arrayEachRight(array, iteratee) {
42369 var length = array == null ? 0 : array.length;
42370
42371 while (length--) {
42372 if (iteratee(array[length], length, array) === false) {
42373 break;
42374 }
42375 }
42376 return array;
42377 }
42378
42379 /**
42380 * A specialized version of `_.every` for arrays without support for
42381 * iteratee shorthands.
42382 *
42383 * @private
42384 * @param {Array} [array] The array to iterate over.
42385 * @param {Function} predicate The function invoked per iteration.
42386 * @returns {boolean} Returns `true` if all elements pass the predicate check,
42387 * else `false`.
42388 */
42389 function arrayEvery(array, predicate) {
42390 var index = -1,
42391 length = array == null ? 0 : array.length;
42392
42393 while (++index < length) {
42394 if (!predicate(array[index], index, array)) {
42395 return false;
42396 }
42397 }
42398 return true;
42399 }
42400
42401 /**
42402 * A specialized version of `_.filter` for arrays without support for
42403 * iteratee shorthands.
42404 *
42405 * @private
42406 * @param {Array} [array] The array to iterate over.
42407 * @param {Function} predicate The function invoked per iteration.
42408 * @returns {Array} Returns the new filtered array.
42409 */
42410 function arrayFilter(array, predicate) {
42411 var index = -1,
42412 length = array == null ? 0 : array.length,
42413 resIndex = 0,
42414 result = [];
42415
42416 while (++index < length) {
42417 var value = array[index];
42418 if (predicate(value, index, array)) {
42419 result[resIndex++] = value;
42420 }
42421 }
42422 return result;
42423 }
42424
42425 /**
42426 * A specialized version of `_.includes` for arrays without support for
42427 * specifying an index to search from.
42428 *
42429 * @private
42430 * @param {Array} [array] The array to inspect.
42431 * @param {*} target The value to search for.
42432 * @returns {boolean} Returns `true` if `target` is found, else `false`.
42433 */
42434 function arrayIncludes(array, value) {
42435 var length = array == null ? 0 : array.length;
42436 return !!length && baseIndexOf(array, value, 0) > -1;
42437 }
42438
42439 /**
42440 * This function is like `arrayIncludes` except that it accepts a comparator.
42441 *
42442 * @private
42443 * @param {Array} [array] The array to inspect.
42444 * @param {*} target The value to search for.
42445 * @param {Function} comparator The comparator invoked per element.
42446 * @returns {boolean} Returns `true` if `target` is found, else `false`.
42447 */
42448 function arrayIncludesWith(array, value, comparator) {
42449 var index = -1,
42450 length = array == null ? 0 : array.length;
42451
42452 while (++index < length) {
42453 if (comparator(value, array[index])) {
42454 return true;
42455 }
42456 }
42457 return false;
42458 }
42459
42460 /**
42461 * A specialized version of `_.map` for arrays without support for iteratee
42462 * shorthands.
42463 *
42464 * @private
42465 * @param {Array} [array] The array to iterate over.
42466 * @param {Function} iteratee The function invoked per iteration.
42467 * @returns {Array} Returns the new mapped array.
42468 */
42469 function arrayMap(array, iteratee) {
42470 var index = -1,
42471 length = array == null ? 0 : array.length,
42472 result = Array(length);
42473
42474 while (++index < length) {
42475 result[index] = iteratee(array[index], index, array);
42476 }
42477 return result;
42478 }
42479
42480 /**
42481 * Appends the elements of `values` to `array`.
42482 *
42483 * @private
42484 * @param {Array} array The array to modify.
42485 * @param {Array} values The values to append.
42486 * @returns {Array} Returns `array`.
42487 */
42488 function arrayPush(array, values) {
42489 var index = -1,
42490 length = values.length,
42491 offset = array.length;
42492
42493 while (++index < length) {
42494 array[offset + index] = values[index];
42495 }
42496 return array;
42497 }
42498
42499 /**
42500 * A specialized version of `_.reduce` for arrays without support for
42501 * iteratee shorthands.
42502 *
42503 * @private
42504 * @param {Array} [array] The array to iterate over.
42505 * @param {Function} iteratee The function invoked per iteration.
42506 * @param {*} [accumulator] The initial value.
42507 * @param {boolean} [initAccum] Specify using the first element of `array` as
42508 * the initial value.
42509 * @returns {*} Returns the accumulated value.
42510 */
42511 function arrayReduce(array, iteratee, accumulator, initAccum) {
42512 var index = -1,
42513 length = array == null ? 0 : array.length;
42514
42515 if (initAccum && length) {
42516 accumulator = array[++index];
42517 }
42518 while (++index < length) {
42519 accumulator = iteratee(accumulator, array[index], index, array);
42520 }
42521 return accumulator;
42522 }
42523
42524 /**
42525 * A specialized version of `_.reduceRight` for arrays without support for
42526 * iteratee shorthands.
42527 *
42528 * @private
42529 * @param {Array} [array] The array to iterate over.
42530 * @param {Function} iteratee The function invoked per iteration.
42531 * @param {*} [accumulator] The initial value.
42532 * @param {boolean} [initAccum] Specify using the last element of `array` as
42533 * the initial value.
42534 * @returns {*} Returns the accumulated value.
42535 */
42536 function arrayReduceRight(array, iteratee, accumulator, initAccum) {
42537 var length = array == null ? 0 : array.length;
42538 if (initAccum && length) {
42539 accumulator = array[--length];
42540 }
42541 while (length--) {
42542 accumulator = iteratee(accumulator, array[length], length, array);
42543 }
42544 return accumulator;
42545 }
42546
42547 /**
42548 * A specialized version of `_.some` for arrays without support for iteratee
42549 * shorthands.
42550 *
42551 * @private
42552 * @param {Array} [array] The array to iterate over.
42553 * @param {Function} predicate The function invoked per iteration.
42554 * @returns {boolean} Returns `true` if any element passes the predicate check,
42555 * else `false`.
42556 */
42557 function arraySome(array, predicate) {
42558 var index = -1,
42559 length = array == null ? 0 : array.length;
42560
42561 while (++index < length) {
42562 if (predicate(array[index], index, array)) {
42563 return true;
42564 }
42565 }
42566 return false;
42567 }
42568
42569 /**
42570 * Gets the size of an ASCII `string`.
42571 *
42572 * @private
42573 * @param {string} string The string inspect.
42574 * @returns {number} Returns the string size.
42575 */
42576 var asciiSize = baseProperty('length');
42577
42578 /**
42579 * Converts an ASCII `string` to an array.
42580 *
42581 * @private
42582 * @param {string} string The string to convert.
42583 * @returns {Array} Returns the converted array.
42584 */
42585 function asciiToArray(string) {
42586 return string.split('');
42587 }
42588
42589 /**
42590 * Splits an ASCII `string` into an array of its words.
42591 *
42592 * @private
42593 * @param {string} The string to inspect.
42594 * @returns {Array} Returns the words of `string`.
42595 */
42596 function asciiWords(string) {
42597 return string.match(reAsciiWord) || [];
42598 }
42599
42600 /**
42601 * The base implementation of methods like `_.findKey` and `_.findLastKey`,
42602 * without support for iteratee shorthands, which iterates over `collection`
42603 * using `eachFunc`.
42604 *
42605 * @private
42606 * @param {Array|Object} collection The collection to inspect.
42607 * @param {Function} predicate The function invoked per iteration.
42608 * @param {Function} eachFunc The function to iterate over `collection`.
42609 * @returns {*} Returns the found element or its key, else `undefined`.
42610 */
42611 function baseFindKey(collection, predicate, eachFunc) {
42612 var result;
42613 eachFunc(collection, function(value, key, collection) {
42614 if (predicate(value, key, collection)) {
42615 result = key;
42616 return false;
42617 }
42618 });
42619 return result;
42620 }
42621
42622 /**
42623 * The base implementation of `_.findIndex` and `_.findLastIndex` without
42624 * support for iteratee shorthands.
42625 *
42626 * @private
42627 * @param {Array} array The array to inspect.
42628 * @param {Function} predicate The function invoked per iteration.
42629 * @param {number} fromIndex The index to search from.
42630 * @param {boolean} [fromRight] Specify iterating from right to left.
42631 * @returns {number} Returns the index of the matched value, else `-1`.
42632 */
42633 function baseFindIndex(array, predicate, fromIndex, fromRight) {
42634 var length = array.length,
42635 index = fromIndex + (fromRight ? 1 : -1);
42636
42637 while ((fromRight ? index-- : ++index < length)) {
42638 if (predicate(array[index], index, array)) {
42639 return index;
42640 }
42641 }
42642 return -1;
42643 }
42644
42645 /**
42646 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
42647 *
42648 * @private
42649 * @param {Array} array The array to inspect.
42650 * @param {*} value The value to search for.
42651 * @param {number} fromIndex The index to search from.
42652 * @returns {number} Returns the index of the matched value, else `-1`.
42653 */
42654 function baseIndexOf(array, value, fromIndex) {
42655 return value === value
42656 ? strictIndexOf(array, value, fromIndex)
42657 : baseFindIndex(array, baseIsNaN, fromIndex);
42658 }
42659
42660 /**
42661 * This function is like `baseIndexOf` except that it accepts a comparator.
42662 *
42663 * @private
42664 * @param {Array} array The array to inspect.
42665 * @param {*} value The value to search for.
42666 * @param {number} fromIndex The index to search from.
42667 * @param {Function} comparator The comparator invoked per element.
42668 * @returns {number} Returns the index of the matched value, else `-1`.
42669 */
42670 function baseIndexOfWith(array, value, fromIndex, comparator) {
42671 var index = fromIndex - 1,
42672 length = array.length;
42673
42674 while (++index < length) {
42675 if (comparator(array[index], value)) {
42676 return index;
42677 }
42678 }
42679 return -1;
42680 }
42681
42682 /**
42683 * The base implementation of `_.isNaN` without support for number objects.
42684 *
42685 * @private
42686 * @param {*} value The value to check.
42687 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
42688 */
42689 function baseIsNaN(value) {
42690 return value !== value;
42691 }
42692
42693 /**
42694 * The base implementation of `_.mean` and `_.meanBy` without support for
42695 * iteratee shorthands.
42696 *
42697 * @private
42698 * @param {Array} array The array to iterate over.
42699 * @param {Function} iteratee The function invoked per iteration.
42700 * @returns {number} Returns the mean.
42701 */
42702 function baseMean(array, iteratee) {
42703 var length = array == null ? 0 : array.length;
42704 return length ? (baseSum(array, iteratee) / length) : NAN;
42705 }
42706
42707 /**
42708 * The base implementation of `_.property` without support for deep paths.
42709 *
42710 * @private
42711 * @param {string} key The key of the property to get.
42712 * @returns {Function} Returns the new accessor function.
42713 */
42714 function baseProperty(key) {
42715 return function(object) {
42716 return object == null ? undefined : object[key];
42717 };
42718 }
42719
42720 /**
42721 * The base implementation of `_.propertyOf` without support for deep paths.
42722 *
42723 * @private
42724 * @param {Object} object The object to query.
42725 * @returns {Function} Returns the new accessor function.
42726 */
42727 function basePropertyOf(object) {
42728 return function(key) {
42729 return object == null ? undefined : object[key];
42730 };
42731 }
42732
42733 /**
42734 * The base implementation of `_.reduce` and `_.reduceRight`, without support
42735 * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
42736 *
42737 * @private
42738 * @param {Array|Object} collection The collection to iterate over.
42739 * @param {Function} iteratee The function invoked per iteration.
42740 * @param {*} accumulator The initial value.
42741 * @param {boolean} initAccum Specify using the first or last element of
42742 * `collection` as the initial value.
42743 * @param {Function} eachFunc The function to iterate over `collection`.
42744 * @returns {*} Returns the accumulated value.
42745 */
42746 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
42747 eachFunc(collection, function(value, index, collection) {
42748 accumulator = initAccum
42749 ? (initAccum = false, value)
42750 : iteratee(accumulator, value, index, collection);
42751 });
42752 return accumulator;
42753 }
42754
42755 /**
42756 * The base implementation of `_.sortBy` which uses `comparer` to define the
42757 * sort order of `array` and replaces criteria objects with their corresponding
42758 * values.
42759 *
42760 * @private
42761 * @param {Array} array The array to sort.
42762 * @param {Function} comparer The function to define sort order.
42763 * @returns {Array} Returns `array`.
42764 */
42765 function baseSortBy(array, comparer) {
42766 var length = array.length;
42767
42768 array.sort(comparer);
42769 while (length--) {
42770 array[length] = array[length].value;
42771 }
42772 return array;
42773 }
42774
42775 /**
42776 * The base implementation of `_.sum` and `_.sumBy` without support for
42777 * iteratee shorthands.
42778 *
42779 * @private
42780 * @param {Array} array The array to iterate over.
42781 * @param {Function} iteratee The function invoked per iteration.
42782 * @returns {number} Returns the sum.
42783 */
42784 function baseSum(array, iteratee) {
42785 var result,
42786 index = -1,
42787 length = array.length;
42788
42789 while (++index < length) {
42790 var current = iteratee(array[index]);
42791 if (current !== undefined) {
42792 result = result === undefined ? current : (result + current);
42793 }
42794 }
42795 return result;
42796 }
42797
42798 /**
42799 * The base implementation of `_.times` without support for iteratee shorthands
42800 * or max array length checks.
42801 *
42802 * @private
42803 * @param {number} n The number of times to invoke `iteratee`.
42804 * @param {Function} iteratee The function invoked per iteration.
42805 * @returns {Array} Returns the array of results.
42806 */
42807 function baseTimes(n, iteratee) {
42808 var index = -1,
42809 result = Array(n);
42810
42811 while (++index < n) {
42812 result[index] = iteratee(index);
42813 }
42814 return result;
42815 }
42816
42817 /**
42818 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
42819 * of key-value pairs for `object` corresponding to the property names of `props`.
42820 *
42821 * @private
42822 * @param {Object} object The object to query.
42823 * @param {Array} props The property names to get values for.
42824 * @returns {Object} Returns the key-value pairs.
42825 */
42826 function baseToPairs(object, props) {
42827 return arrayMap(props, function(key) {
42828 return [key, object[key]];
42829 });
42830 }
42831
42832 /**
42833 * The base implementation of `_.unary` without support for storing metadata.
42834 *
42835 * @private
42836 * @param {Function} func The function to cap arguments for.
42837 * @returns {Function} Returns the new capped function.
42838 */
42839 function baseUnary(func) {
42840 return function(value) {
42841 return func(value);
42842 };
42843 }
42844
42845 /**
42846 * The base implementation of `_.values` and `_.valuesIn` which creates an
42847 * array of `object` property values corresponding to the property names
42848 * of `props`.
42849 *
42850 * @private
42851 * @param {Object} object The object to query.
42852 * @param {Array} props The property names to get values for.
42853 * @returns {Object} Returns the array of property values.
42854 */
42855 function baseValues(object, props) {
42856 return arrayMap(props, function(key) {
42857 return object[key];
42858 });
42859 }
42860
42861 /**
42862 * Checks if a `cache` value for `key` exists.
42863 *
42864 * @private
42865 * @param {Object} cache The cache to query.
42866 * @param {string} key The key of the entry to check.
42867 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
42868 */
42869 function cacheHas(cache, key) {
42870 return cache.has(key);
42871 }
42872
42873 /**
42874 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
42875 * that is not found in the character symbols.
42876 *
42877 * @private
42878 * @param {Array} strSymbols The string symbols to inspect.
42879 * @param {Array} chrSymbols The character symbols to find.
42880 * @returns {number} Returns the index of the first unmatched string symbol.
42881 */
42882 function charsStartIndex(strSymbols, chrSymbols) {
42883 var index = -1,
42884 length = strSymbols.length;
42885
42886 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
42887 return index;
42888 }
42889
42890 /**
42891 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
42892 * that is not found in the character symbols.
42893 *
42894 * @private
42895 * @param {Array} strSymbols The string symbols to inspect.
42896 * @param {Array} chrSymbols The character symbols to find.
42897 * @returns {number} Returns the index of the last unmatched string symbol.
42898 */
42899 function charsEndIndex(strSymbols, chrSymbols) {
42900 var index = strSymbols.length;
42901
42902 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
42903 return index;
42904 }
42905
42906 /**
42907 * Gets the number of `placeholder` occurrences in `array`.
42908 *
42909 * @private
42910 * @param {Array} array The array to inspect.
42911 * @param {*} placeholder The placeholder to search for.
42912 * @returns {number} Returns the placeholder count.
42913 */
42914 function countHolders(array, placeholder) {
42915 var length = array.length,
42916 result = 0;
42917
42918 while (length--) {
42919 if (array[length] === placeholder) {
42920 ++result;
42921 }
42922 }
42923 return result;
42924 }
42925
42926 /**
42927 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
42928 * letters to basic Latin letters.
42929 *
42930 * @private
42931 * @param {string} letter The matched letter to deburr.
42932 * @returns {string} Returns the deburred letter.
42933 */
42934 var deburrLetter = basePropertyOf(deburredLetters);
42935
42936 /**
42937 * Used by `_.escape` to convert characters to HTML entities.
42938 *
42939 * @private
42940 * @param {string} chr The matched character to escape.
42941 * @returns {string} Returns the escaped character.
42942 */
42943 var escapeHtmlChar = basePropertyOf(htmlEscapes);
42944
42945 /**
42946 * Used by `_.template` to escape characters for inclusion in compiled string literals.
42947 *
42948 * @private
42949 * @param {string} chr The matched character to escape.
42950 * @returns {string} Returns the escaped character.
42951 */
42952 function escapeStringChar(chr) {
42953 return '\\' + stringEscapes[chr];
42954 }
42955
42956 /**
42957 * Gets the value at `key` of `object`.
42958 *
42959 * @private
42960 * @param {Object} [object] The object to query.
42961 * @param {string} key The key of the property to get.
42962 * @returns {*} Returns the property value.
42963 */
42964 function getValue(object, key) {
42965 return object == null ? undefined : object[key];
42966 }
42967
42968 /**
42969 * Checks if `string` contains Unicode symbols.
42970 *
42971 * @private
42972 * @param {string} string The string to inspect.
42973 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
42974 */
42975 function hasUnicode(string) {
42976 return reHasUnicode.test(string);
42977 }
42978
42979 /**
42980 * Checks if `string` contains a word composed of Unicode symbols.
42981 *
42982 * @private
42983 * @param {string} string The string to inspect.
42984 * @returns {boolean} Returns `true` if a word is found, else `false`.
42985 */
42986 function hasUnicodeWord(string) {
42987 return reHasUnicodeWord.test(string);
42988 }
42989
42990 /**
42991 * Converts `iterator` to an array.
42992 *
42993 * @private
42994 * @param {Object} iterator The iterator to convert.
42995 * @returns {Array} Returns the converted array.
42996 */
42997 function iteratorToArray(iterator) {
42998 var data,
42999 result = [];
43000
43001 while (!(data = iterator.next()).done) {
43002 result.push(data.value);
43003 }
43004 return result;
43005 }
43006
43007 /**
43008 * Converts `map` to its key-value pairs.
43009 *
43010 * @private
43011 * @param {Object} map The map to convert.
43012 * @returns {Array} Returns the key-value pairs.
43013 */
43014 function mapToArray(map) {
43015 var index = -1,
43016 result = Array(map.size);
43017
43018 map.forEach(function(value, key) {
43019 result[++index] = [key, value];
43020 });
43021 return result;
43022 }
43023
43024 /**
43025 * Creates a unary function that invokes `func` with its argument transformed.
43026 *
43027 * @private
43028 * @param {Function} func The function to wrap.
43029 * @param {Function} transform The argument transform.
43030 * @returns {Function} Returns the new function.
43031 */
43032 function overArg(func, transform) {
43033 return function(arg) {
43034 return func(transform(arg));
43035 };
43036 }
43037
43038 /**
43039 * Replaces all `placeholder` elements in `array` with an internal placeholder
43040 * and returns an array of their indexes.
43041 *
43042 * @private
43043 * @param {Array} array The array to modify.
43044 * @param {*} placeholder The placeholder to replace.
43045 * @returns {Array} Returns the new array of placeholder indexes.
43046 */
43047 function replaceHolders(array, placeholder) {
43048 var index = -1,
43049 length = array.length,
43050 resIndex = 0,
43051 result = [];
43052
43053 while (++index < length) {
43054 var value = array[index];
43055 if (value === placeholder || value === PLACEHOLDER) {
43056 array[index] = PLACEHOLDER;
43057 result[resIndex++] = index;
43058 }
43059 }
43060 return result;
43061 }
43062
43063 /**
43064 * Converts `set` to an array of its values.
43065 *
43066 * @private
43067 * @param {Object} set The set to convert.
43068 * @returns {Array} Returns the values.
43069 */
43070 function setToArray(set) {
43071 var index = -1,
43072 result = Array(set.size);
43073
43074 set.forEach(function(value) {
43075 result[++index] = value;
43076 });
43077 return result;
43078 }
43079
43080 /**
43081 * Converts `set` to its value-value pairs.
43082 *
43083 * @private
43084 * @param {Object} set The set to convert.
43085 * @returns {Array} Returns the value-value pairs.
43086 */
43087 function setToPairs(set) {
43088 var index = -1,
43089 result = Array(set.size);
43090
43091 set.forEach(function(value) {
43092 result[++index] = [value, value];
43093 });
43094 return result;
43095 }
43096
43097 /**
43098 * A specialized version of `_.indexOf` which performs strict equality
43099 * comparisons of values, i.e. `===`.
43100 *
43101 * @private
43102 * @param {Array} array The array to inspect.
43103 * @param {*} value The value to search for.
43104 * @param {number} fromIndex The index to search from.
43105 * @returns {number} Returns the index of the matched value, else `-1`.
43106 */
43107 function strictIndexOf(array, value, fromIndex) {
43108 var index = fromIndex - 1,
43109 length = array.length;
43110
43111 while (++index < length) {
43112 if (array[index] === value) {
43113 return index;
43114 }
43115 }
43116 return -1;
43117 }
43118
43119 /**
43120 * A specialized version of `_.lastIndexOf` which performs strict equality
43121 * comparisons of values, i.e. `===`.
43122 *
43123 * @private
43124 * @param {Array} array The array to inspect.
43125 * @param {*} value The value to search for.
43126 * @param {number} fromIndex The index to search from.
43127 * @returns {number} Returns the index of the matched value, else `-1`.
43128 */
43129 function strictLastIndexOf(array, value, fromIndex) {
43130 var index = fromIndex + 1;
43131 while (index--) {
43132 if (array[index] === value) {
43133 return index;
43134 }
43135 }
43136 return index;
43137 }
43138
43139 /**
43140 * Gets the number of symbols in `string`.
43141 *
43142 * @private
43143 * @param {string} string The string to inspect.
43144 * @returns {number} Returns the string size.
43145 */
43146 function stringSize(string) {
43147 return hasUnicode(string)
43148 ? unicodeSize(string)
43149 : asciiSize(string);
43150 }
43151
43152 /**
43153 * Converts `string` to an array.
43154 *
43155 * @private
43156 * @param {string} string The string to convert.
43157 * @returns {Array} Returns the converted array.
43158 */
43159 function stringToArray(string) {
43160 return hasUnicode(string)
43161 ? unicodeToArray(string)
43162 : asciiToArray(string);
43163 }
43164
43165 /**
43166 * Used by `_.unescape` to convert HTML entities to characters.
43167 *
43168 * @private
43169 * @param {string} chr The matched character to unescape.
43170 * @returns {string} Returns the unescaped character.
43171 */
43172 var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
43173
43174 /**
43175 * Gets the size of a Unicode `string`.
43176 *
43177 * @private
43178 * @param {string} string The string inspect.
43179 * @returns {number} Returns the string size.
43180 */
43181 function unicodeSize(string) {
43182 var result = reUnicode.lastIndex = 0;
43183 while (reUnicode.test(string)) {
43184 ++result;
43185 }
43186 return result;
43187 }
43188
43189 /**
43190 * Converts a Unicode `string` to an array.
43191 *
43192 * @private
43193 * @param {string} string The string to convert.
43194 * @returns {Array} Returns the converted array.
43195 */
43196 function unicodeToArray(string) {
43197 return string.match(reUnicode) || [];
43198 }
43199
43200 /**
43201 * Splits a Unicode `string` into an array of its words.
43202 *
43203 * @private
43204 * @param {string} The string to inspect.
43205 * @returns {Array} Returns the words of `string`.
43206 */
43207 function unicodeWords(string) {
43208 return string.match(reUnicodeWord) || [];
43209 }
43210
43211 /*--------------------------------------------------------------------------*/
43212
43213 /**
43214 * Create a new pristine `lodash` function using the `context` object.
43215 *
43216 * @static
43217 * @memberOf _
43218 * @since 1.1.0
43219 * @category Util
43220 * @param {Object} [context=root] The context object.
43221 * @returns {Function} Returns a new `lodash` function.
43222 * @example
43223 *
43224 * _.mixin({ 'foo': _.constant('foo') });
43225 *
43226 * var lodash = _.runInContext();
43227 * lodash.mixin({ 'bar': lodash.constant('bar') });
43228 *
43229 * _.isFunction(_.foo);
43230 * // => true
43231 * _.isFunction(_.bar);
43232 * // => false
43233 *
43234 * lodash.isFunction(lodash.foo);
43235 * // => false
43236 * lodash.isFunction(lodash.bar);
43237 * // => true
43238 *
43239 * // Create a suped-up `defer` in Node.js.
43240 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
43241 */
43242 var runInContext = (function runInContext(context) {
43243 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
43244
43245 /** Built-in constructor references. */
43246 var Array = context.Array,
43247 Date = context.Date,
43248 Error = context.Error,
43249 Function = context.Function,
43250 Math = context.Math,
43251 Object = context.Object,
43252 RegExp = context.RegExp,
43253 String = context.String,
43254 TypeError = context.TypeError;
43255
43256 /** Used for built-in method references. */
43257 var arrayProto = Array.prototype,
43258 funcProto = Function.prototype,
43259 objectProto = Object.prototype;
43260
43261 /** Used to detect overreaching core-js shims. */
43262 var coreJsData = context['__core-js_shared__'];
43263
43264 /** Used to resolve the decompiled source of functions. */
43265 var funcToString = funcProto.toString;
43266
43267 /** Used to check objects for own properties. */
43268 var hasOwnProperty = objectProto.hasOwnProperty;
43269
43270 /** Used to generate unique IDs. */
43271 var idCounter = 0;
43272
43273 /** Used to detect methods masquerading as native. */
43274 var maskSrcKey = (function() {
43275 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
43276 return uid ? ('Symbol(src)_1.' + uid) : '';
43277 }());
43278
43279 /**
43280 * Used to resolve the
43281 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
43282 * of values.
43283 */
43284 var nativeObjectToString = objectProto.toString;
43285
43286 /** Used to infer the `Object` constructor. */
43287 var objectCtorString = funcToString.call(Object);
43288
43289 /** Used to restore the original `_` reference in `_.noConflict`. */
43290 var oldDash = root._;
43291
43292 /** Used to detect if a method is native. */
43293 var reIsNative = RegExp('^' +
43294 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
43295 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
43296 );
43297
43298 /** Built-in value references. */
43299 var Buffer = moduleExports ? context.Buffer : undefined,
43300 Symbol = context.Symbol,
43301 Uint8Array = context.Uint8Array,
43302 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
43303 getPrototype = overArg(Object.getPrototypeOf, Object),
43304 objectCreate = Object.create,
43305 propertyIsEnumerable = objectProto.propertyIsEnumerable,
43306 splice = arrayProto.splice,
43307 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
43308 symIterator = Symbol ? Symbol.iterator : undefined,
43309 symToStringTag = Symbol ? Symbol.toStringTag : undefined;
43310
43311 var defineProperty = (function() {
43312 try {
43313 var func = getNative(Object, 'defineProperty');
43314 func({}, '', {});
43315 return func;
43316 } catch (e) {}
43317 }());
43318
43319 /** Mocked built-ins. */
43320 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
43321 ctxNow = Date && Date.now !== root.Date.now && Date.now,
43322 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
43323
43324 /* Built-in method references for those with the same name as other `lodash` methods. */
43325 var nativeCeil = Math.ceil,
43326 nativeFloor = Math.floor,
43327 nativeGetSymbols = Object.getOwnPropertySymbols,
43328 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
43329 nativeIsFinite = context.isFinite,
43330 nativeJoin = arrayProto.join,
43331 nativeKeys = overArg(Object.keys, Object),
43332 nativeMax = Math.max,
43333 nativeMin = Math.min,
43334 nativeNow = Date.now,
43335 nativeParseInt = context.parseInt,
43336 nativeRandom = Math.random,
43337 nativeReverse = arrayProto.reverse;
43338
43339 /* Built-in method references that are verified to be native. */
43340 var DataView = getNative(context, 'DataView'),
43341 Map = getNative(context, 'Map'),
43342 Promise = getNative(context, 'Promise'),
43343 Set = getNative(context, 'Set'),
43344 WeakMap = getNative(context, 'WeakMap'),
43345 nativeCreate = getNative(Object, 'create');
43346
43347 /** Used to store function metadata. */
43348 var metaMap = WeakMap && new WeakMap;
43349
43350 /** Used to lookup unminified function names. */
43351 var realNames = {};
43352
43353 /** Used to detect maps, sets, and weakmaps. */
43354 var dataViewCtorString = toSource(DataView),
43355 mapCtorString = toSource(Map),
43356 promiseCtorString = toSource(Promise),
43357 setCtorString = toSource(Set),
43358 weakMapCtorString = toSource(WeakMap);
43359
43360 /** Used to convert symbols to primitives and strings. */
43361 var symbolProto = Symbol ? Symbol.prototype : undefined,
43362 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
43363 symbolToString = symbolProto ? symbolProto.toString : undefined;
43364
43365 /*------------------------------------------------------------------------*/
43366
43367 /**
43368 * Creates a `lodash` object which wraps `value` to enable implicit method
43369 * chain sequences. Methods that operate on and return arrays, collections,
43370 * and functions can be chained together. Methods that retrieve a single value
43371 * or may return a primitive value will automatically end the chain sequence
43372 * and return the unwrapped value. Otherwise, the value must be unwrapped
43373 * with `_#value`.
43374 *
43375 * Explicit chain sequences, which must be unwrapped with `_#value`, may be
43376 * enabled using `_.chain`.
43377 *
43378 * The execution of chained methods is lazy, that is, it's deferred until
43379 * `_#value` is implicitly or explicitly called.
43380 *
43381 * Lazy evaluation allows several methods to support shortcut fusion.
43382 * Shortcut fusion is an optimization to merge iteratee calls; this avoids
43383 * the creation of intermediate arrays and can greatly reduce the number of
43384 * iteratee executions. Sections of a chain sequence qualify for shortcut
43385 * fusion if the section is applied to an array and iteratees accept only
43386 * one argument. The heuristic for whether a section qualifies for shortcut
43387 * fusion is subject to change.
43388 *
43389 * Chaining is supported in custom builds as long as the `_#value` method is
43390 * directly or indirectly included in the build.
43391 *
43392 * In addition to lodash methods, wrappers have `Array` and `String` methods.
43393 *
43394 * The wrapper `Array` methods are:
43395 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
43396 *
43397 * The wrapper `String` methods are:
43398 * `replace` and `split`
43399 *
43400 * The wrapper methods that support shortcut fusion are:
43401 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
43402 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
43403 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
43404 *
43405 * The chainable wrapper methods are:
43406 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
43407 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
43408 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
43409 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
43410 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
43411 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
43412 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
43413 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
43414 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
43415 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
43416 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
43417 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
43418 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
43419 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
43420 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
43421 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
43422 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
43423 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
43424 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
43425 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
43426 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
43427 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
43428 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
43429 * `zipObject`, `zipObjectDeep`, and `zipWith`
43430 *
43431 * The wrapper methods that are **not** chainable by default are:
43432 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
43433 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
43434 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
43435 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
43436 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
43437 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
43438 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
43439 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
43440 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
43441 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
43442 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
43443 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
43444 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
43445 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
43446 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
43447 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
43448 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
43449 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
43450 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
43451 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
43452 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
43453 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
43454 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
43455 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
43456 * `upperFirst`, `value`, and `words`
43457 *
43458 * @name _
43459 * @constructor
43460 * @category Seq
43461 * @param {*} value The value to wrap in a `lodash` instance.
43462 * @returns {Object} Returns the new `lodash` wrapper instance.
43463 * @example
43464 *
43465 * function square(n) {
43466 * return n * n;
43467 * }
43468 *
43469 * var wrapped = _([1, 2, 3]);
43470 *
43471 * // Returns an unwrapped value.
43472 * wrapped.reduce(_.add);
43473 * // => 6
43474 *
43475 * // Returns a wrapped value.
43476 * var squares = wrapped.map(square);
43477 *
43478 * _.isArray(squares);
43479 * // => false
43480 *
43481 * _.isArray(squares.value());
43482 * // => true
43483 */
43484 function lodash(value) {
43485 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
43486 if (value instanceof LodashWrapper) {
43487 return value;
43488 }
43489 if (hasOwnProperty.call(value, '__wrapped__')) {
43490 return wrapperClone(value);
43491 }
43492 }
43493 return new LodashWrapper(value);
43494 }
43495
43496 /**
43497 * The base implementation of `_.create` without support for assigning
43498 * properties to the created object.
43499 *
43500 * @private
43501 * @param {Object} proto The object to inherit from.
43502 * @returns {Object} Returns the new object.
43503 */
43504 var baseCreate = (function() {
43505 function object() {}
43506 return function(proto) {
43507 if (!isObject(proto)) {
43508 return {};
43509 }
43510 if (objectCreate) {
43511 return objectCreate(proto);
43512 }
43513 object.prototype = proto;
43514 var result = new object;
43515 object.prototype = undefined;
43516 return result;
43517 };
43518 }());
43519
43520 /**
43521 * The function whose prototype chain sequence wrappers inherit from.
43522 *
43523 * @private
43524 */
43525 function baseLodash() {
43526 // No operation performed.
43527 }
43528
43529 /**
43530 * The base constructor for creating `lodash` wrapper objects.
43531 *
43532 * @private
43533 * @param {*} value The value to wrap.
43534 * @param {boolean} [chainAll] Enable explicit method chain sequences.
43535 */
43536 function LodashWrapper(value, chainAll) {
43537 this.__wrapped__ = value;
43538 this.__actions__ = [];
43539 this.__chain__ = !!chainAll;
43540 this.__index__ = 0;
43541 this.__values__ = undefined;
43542 }
43543
43544 /**
43545 * By default, the template delimiters used by lodash are like those in
43546 * embedded Ruby (ERB) as well as ES2015 template strings. Change the
43547 * following template settings to use alternative delimiters.
43548 *
43549 * @static
43550 * @memberOf _
43551 * @type {Object}
43552 */
43553 lodash.templateSettings = {
43554
43555 /**
43556 * Used to detect `data` property values to be HTML-escaped.
43557 *
43558 * @memberOf _.templateSettings
43559 * @type {RegExp}
43560 */
43561 'escape': reEscape,
43562
43563 /**
43564 * Used to detect code to be evaluated.
43565 *
43566 * @memberOf _.templateSettings
43567 * @type {RegExp}
43568 */
43569 'evaluate': reEvaluate,
43570
43571 /**
43572 * Used to detect `data` property values to inject.
43573 *
43574 * @memberOf _.templateSettings
43575 * @type {RegExp}
43576 */
43577 'interpolate': reInterpolate,
43578
43579 /**
43580 * Used to reference the data object in the template text.
43581 *
43582 * @memberOf _.templateSettings
43583 * @type {string}
43584 */
43585 'variable': '',
43586
43587 /**
43588 * Used to import variables into the compiled template.
43589 *
43590 * @memberOf _.templateSettings
43591 * @type {Object}
43592 */
43593 'imports': {
43594
43595 /**
43596 * A reference to the `lodash` function.
43597 *
43598 * @memberOf _.templateSettings.imports
43599 * @type {Function}
43600 */
43601 '_': lodash
43602 }
43603 };
43604
43605 // Ensure wrappers are instances of `baseLodash`.
43606 lodash.prototype = baseLodash.prototype;
43607 lodash.prototype.constructor = lodash;
43608
43609 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
43610 LodashWrapper.prototype.constructor = LodashWrapper;
43611
43612 /*------------------------------------------------------------------------*/
43613
43614 /**
43615 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
43616 *
43617 * @private
43618 * @constructor
43619 * @param {*} value The value to wrap.
43620 */
43621 function LazyWrapper(value) {
43622 this.__wrapped__ = value;
43623 this.__actions__ = [];
43624 this.__dir__ = 1;
43625 this.__filtered__ = false;
43626 this.__iteratees__ = [];
43627 this.__takeCount__ = MAX_ARRAY_LENGTH;
43628 this.__views__ = [];
43629 }
43630
43631 /**
43632 * Creates a clone of the lazy wrapper object.
43633 *
43634 * @private
43635 * @name clone
43636 * @memberOf LazyWrapper
43637 * @returns {Object} Returns the cloned `LazyWrapper` object.
43638 */
43639 function lazyClone() {
43640 var result = new LazyWrapper(this.__wrapped__);
43641 result.__actions__ = copyArray(this.__actions__);
43642 result.__dir__ = this.__dir__;
43643 result.__filtered__ = this.__filtered__;
43644 result.__iteratees__ = copyArray(this.__iteratees__);
43645 result.__takeCount__ = this.__takeCount__;
43646 result.__views__ = copyArray(this.__views__);
43647 return result;
43648 }
43649
43650 /**
43651 * Reverses the direction of lazy iteration.
43652 *
43653 * @private
43654 * @name reverse
43655 * @memberOf LazyWrapper
43656 * @returns {Object} Returns the new reversed `LazyWrapper` object.
43657 */
43658 function lazyReverse() {
43659 if (this.__filtered__) {
43660 var result = new LazyWrapper(this);
43661 result.__dir__ = -1;
43662 result.__filtered__ = true;
43663 } else {
43664 result = this.clone();
43665 result.__dir__ *= -1;
43666 }
43667 return result;
43668 }
43669
43670 /**
43671 * Extracts the unwrapped value from its lazy wrapper.
43672 *
43673 * @private
43674 * @name value
43675 * @memberOf LazyWrapper
43676 * @returns {*} Returns the unwrapped value.
43677 */
43678 function lazyValue() {
43679 var array = this.__wrapped__.value(),
43680 dir = this.__dir__,
43681 isArr = isArray(array),
43682 isRight = dir < 0,
43683 arrLength = isArr ? array.length : 0,
43684 view = getView(0, arrLength, this.__views__),
43685 start = view.start,
43686 end = view.end,
43687 length = end - start,
43688 index = isRight ? end : (start - 1),
43689 iteratees = this.__iteratees__,
43690 iterLength = iteratees.length,
43691 resIndex = 0,
43692 takeCount = nativeMin(length, this.__takeCount__);
43693
43694 if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
43695 return baseWrapperValue(array, this.__actions__);
43696 }
43697 var result = [];
43698
43699 outer:
43700 while (length-- && resIndex < takeCount) {
43701 index += dir;
43702
43703 var iterIndex = -1,
43704 value = array[index];
43705
43706 while (++iterIndex < iterLength) {
43707 var data = iteratees[iterIndex],
43708 iteratee = data.iteratee,
43709 type = data.type,
43710 computed = iteratee(value);
43711
43712 if (type == LAZY_MAP_FLAG) {
43713 value = computed;
43714 } else if (!computed) {
43715 if (type == LAZY_FILTER_FLAG) {
43716 continue outer;
43717 } else {
43718 break outer;
43719 }
43720 }
43721 }
43722 result[resIndex++] = value;
43723 }
43724 return result;
43725 }
43726
43727 // Ensure `LazyWrapper` is an instance of `baseLodash`.
43728 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
43729 LazyWrapper.prototype.constructor = LazyWrapper;
43730
43731 /*------------------------------------------------------------------------*/
43732
43733 /**
43734 * Creates a hash object.
43735 *
43736 * @private
43737 * @constructor
43738 * @param {Array} [entries] The key-value pairs to cache.
43739 */
43740 function Hash(entries) {
43741 var index = -1,
43742 length = entries == null ? 0 : entries.length;
43743
43744 this.clear();
43745 while (++index < length) {
43746 var entry = entries[index];
43747 this.set(entry[0], entry[1]);
43748 }
43749 }
43750
43751 /**
43752 * Removes all key-value entries from the hash.
43753 *
43754 * @private
43755 * @name clear
43756 * @memberOf Hash
43757 */
43758 function hashClear() {
43759 this.__data__ = nativeCreate ? nativeCreate(null) : {};
43760 this.size = 0;
43761 }
43762
43763 /**
43764 * Removes `key` and its value from the hash.
43765 *
43766 * @private
43767 * @name delete
43768 * @memberOf Hash
43769 * @param {Object} hash The hash to modify.
43770 * @param {string} key The key of the value to remove.
43771 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
43772 */
43773 function hashDelete(key) {
43774 var result = this.has(key) && delete this.__data__[key];
43775 this.size -= result ? 1 : 0;
43776 return result;
43777 }
43778
43779 /**
43780 * Gets the hash value for `key`.
43781 *
43782 * @private
43783 * @name get
43784 * @memberOf Hash
43785 * @param {string} key The key of the value to get.
43786 * @returns {*} Returns the entry value.
43787 */
43788 function hashGet(key) {
43789 var data = this.__data__;
43790 if (nativeCreate) {
43791 var result = data[key];
43792 return result === HASH_UNDEFINED ? undefined : result;
43793 }
43794 return hasOwnProperty.call(data, key) ? data[key] : undefined;
43795 }
43796
43797 /**
43798 * Checks if a hash value for `key` exists.
43799 *
43800 * @private
43801 * @name has
43802 * @memberOf Hash
43803 * @param {string} key The key of the entry to check.
43804 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
43805 */
43806 function hashHas(key) {
43807 var data = this.__data__;
43808 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
43809 }
43810
43811 /**
43812 * Sets the hash `key` to `value`.
43813 *
43814 * @private
43815 * @name set
43816 * @memberOf Hash
43817 * @param {string} key The key of the value to set.
43818 * @param {*} value The value to set.
43819 * @returns {Object} Returns the hash instance.
43820 */
43821 function hashSet(key, value) {
43822 var data = this.__data__;
43823 this.size += this.has(key) ? 0 : 1;
43824 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
43825 return this;
43826 }
43827
43828 // Add methods to `Hash`.
43829 Hash.prototype.clear = hashClear;
43830 Hash.prototype['delete'] = hashDelete;
43831 Hash.prototype.get = hashGet;
43832 Hash.prototype.has = hashHas;
43833 Hash.prototype.set = hashSet;
43834
43835 /*------------------------------------------------------------------------*/
43836
43837 /**
43838 * Creates an list cache object.
43839 *
43840 * @private
43841 * @constructor
43842 * @param {Array} [entries] The key-value pairs to cache.
43843 */
43844 function ListCache(entries) {
43845 var index = -1,
43846 length = entries == null ? 0 : entries.length;
43847
43848 this.clear();
43849 while (++index < length) {
43850 var entry = entries[index];
43851 this.set(entry[0], entry[1]);
43852 }
43853 }
43854
43855 /**
43856 * Removes all key-value entries from the list cache.
43857 *
43858 * @private
43859 * @name clear
43860 * @memberOf ListCache
43861 */
43862 function listCacheClear() {
43863 this.__data__ = [];
43864 this.size = 0;
43865 }
43866
43867 /**
43868 * Removes `key` and its value from the list cache.
43869 *
43870 * @private
43871 * @name delete
43872 * @memberOf ListCache
43873 * @param {string} key The key of the value to remove.
43874 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
43875 */
43876 function listCacheDelete(key) {
43877 var data = this.__data__,
43878 index = assocIndexOf(data, key);
43879
43880 if (index < 0) {
43881 return false;
43882 }
43883 var lastIndex = data.length - 1;
43884 if (index == lastIndex) {
43885 data.pop();
43886 } else {
43887 splice.call(data, index, 1);
43888 }
43889 --this.size;
43890 return true;
43891 }
43892
43893 /**
43894 * Gets the list cache value for `key`.
43895 *
43896 * @private
43897 * @name get
43898 * @memberOf ListCache
43899 * @param {string} key The key of the value to get.
43900 * @returns {*} Returns the entry value.
43901 */
43902 function listCacheGet(key) {
43903 var data = this.__data__,
43904 index = assocIndexOf(data, key);
43905
43906 return index < 0 ? undefined : data[index][1];
43907 }
43908
43909 /**
43910 * Checks if a list cache value for `key` exists.
43911 *
43912 * @private
43913 * @name has
43914 * @memberOf ListCache
43915 * @param {string} key The key of the entry to check.
43916 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
43917 */
43918 function listCacheHas(key) {
43919 return assocIndexOf(this.__data__, key) > -1;
43920 }
43921
43922 /**
43923 * Sets the list cache `key` to `value`.
43924 *
43925 * @private
43926 * @name set
43927 * @memberOf ListCache
43928 * @param {string} key The key of the value to set.
43929 * @param {*} value The value to set.
43930 * @returns {Object} Returns the list cache instance.
43931 */
43932 function listCacheSet(key, value) {
43933 var data = this.__data__,
43934 index = assocIndexOf(data, key);
43935
43936 if (index < 0) {
43937 ++this.size;
43938 data.push([key, value]);
43939 } else {
43940 data[index][1] = value;
43941 }
43942 return this;
43943 }
43944
43945 // Add methods to `ListCache`.
43946 ListCache.prototype.clear = listCacheClear;
43947 ListCache.prototype['delete'] = listCacheDelete;
43948 ListCache.prototype.get = listCacheGet;
43949 ListCache.prototype.has = listCacheHas;
43950 ListCache.prototype.set = listCacheSet;
43951
43952 /*------------------------------------------------------------------------*/
43953
43954 /**
43955 * Creates a map cache object to store key-value pairs.
43956 *
43957 * @private
43958 * @constructor
43959 * @param {Array} [entries] The key-value pairs to cache.
43960 */
43961 function MapCache(entries) {
43962 var index = -1,
43963 length = entries == null ? 0 : entries.length;
43964
43965 this.clear();
43966 while (++index < length) {
43967 var entry = entries[index];
43968 this.set(entry[0], entry[1]);
43969 }
43970 }
43971
43972 /**
43973 * Removes all key-value entries from the map.
43974 *
43975 * @private
43976 * @name clear
43977 * @memberOf MapCache
43978 */
43979 function mapCacheClear() {
43980 this.size = 0;
43981 this.__data__ = {
43982 'hash': new Hash,
43983 'map': new (Map || ListCache),
43984 'string': new Hash
43985 };
43986 }
43987
43988 /**
43989 * Removes `key` and its value from the map.
43990 *
43991 * @private
43992 * @name delete
43993 * @memberOf MapCache
43994 * @param {string} key The key of the value to remove.
43995 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
43996 */
43997 function mapCacheDelete(key) {
43998 var result = getMapData(this, key)['delete'](key);
43999 this.size -= result ? 1 : 0;
44000 return result;
44001 }
44002
44003 /**
44004 * Gets the map value for `key`.
44005 *
44006 * @private
44007 * @name get
44008 * @memberOf MapCache
44009 * @param {string} key The key of the value to get.
44010 * @returns {*} Returns the entry value.
44011 */
44012 function mapCacheGet(key) {
44013 return getMapData(this, key).get(key);
44014 }
44015
44016 /**
44017 * Checks if a map value for `key` exists.
44018 *
44019 * @private
44020 * @name has
44021 * @memberOf MapCache
44022 * @param {string} key The key of the entry to check.
44023 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
44024 */
44025 function mapCacheHas(key) {
44026 return getMapData(this, key).has(key);
44027 }
44028
44029 /**
44030 * Sets the map `key` to `value`.
44031 *
44032 * @private
44033 * @name set
44034 * @memberOf MapCache
44035 * @param {string} key The key of the value to set.
44036 * @param {*} value The value to set.
44037 * @returns {Object} Returns the map cache instance.
44038 */
44039 function mapCacheSet(key, value) {
44040 var data = getMapData(this, key),
44041 size = data.size;
44042
44043 data.set(key, value);
44044 this.size += data.size == size ? 0 : 1;
44045 return this;
44046 }
44047
44048 // Add methods to `MapCache`.
44049 MapCache.prototype.clear = mapCacheClear;
44050 MapCache.prototype['delete'] = mapCacheDelete;
44051 MapCache.prototype.get = mapCacheGet;
44052 MapCache.prototype.has = mapCacheHas;
44053 MapCache.prototype.set = mapCacheSet;
44054
44055 /*------------------------------------------------------------------------*/
44056
44057 /**
44058 *
44059 * Creates an array cache object to store unique values.
44060 *
44061 * @private
44062 * @constructor
44063 * @param {Array} [values] The values to cache.
44064 */
44065 function SetCache(values) {
44066 var index = -1,
44067 length = values == null ? 0 : values.length;
44068
44069 this.__data__ = new MapCache;
44070 while (++index < length) {
44071 this.add(values[index]);
44072 }
44073 }
44074
44075 /**
44076 * Adds `value` to the array cache.
44077 *
44078 * @private
44079 * @name add
44080 * @memberOf SetCache
44081 * @alias push
44082 * @param {*} value The value to cache.
44083 * @returns {Object} Returns the cache instance.
44084 */
44085 function setCacheAdd(value) {
44086 this.__data__.set(value, HASH_UNDEFINED);
44087 return this;
44088 }
44089
44090 /**
44091 * Checks if `value` is in the array cache.
44092 *
44093 * @private
44094 * @name has
44095 * @memberOf SetCache
44096 * @param {*} value The value to search for.
44097 * @returns {number} Returns `true` if `value` is found, else `false`.
44098 */
44099 function setCacheHas(value) {
44100 return this.__data__.has(value);
44101 }
44102
44103 // Add methods to `SetCache`.
44104 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
44105 SetCache.prototype.has = setCacheHas;
44106
44107 /*------------------------------------------------------------------------*/
44108
44109 /**
44110 * Creates a stack cache object to store key-value pairs.
44111 *
44112 * @private
44113 * @constructor
44114 * @param {Array} [entries] The key-value pairs to cache.
44115 */
44116 function Stack(entries) {
44117 var data = this.__data__ = new ListCache(entries);
44118 this.size = data.size;
44119 }
44120
44121 /**
44122 * Removes all key-value entries from the stack.
44123 *
44124 * @private
44125 * @name clear
44126 * @memberOf Stack
44127 */
44128 function stackClear() {
44129 this.__data__ = new ListCache;
44130 this.size = 0;
44131 }
44132
44133 /**
44134 * Removes `key` and its value from the stack.
44135 *
44136 * @private
44137 * @name delete
44138 * @memberOf Stack
44139 * @param {string} key The key of the value to remove.
44140 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
44141 */
44142 function stackDelete(key) {
44143 var data = this.__data__,
44144 result = data['delete'](key);
44145
44146 this.size = data.size;
44147 return result;
44148 }
44149
44150 /**
44151 * Gets the stack value for `key`.
44152 *
44153 * @private
44154 * @name get
44155 * @memberOf Stack
44156 * @param {string} key The key of the value to get.
44157 * @returns {*} Returns the entry value.
44158 */
44159 function stackGet(key) {
44160 return this.__data__.get(key);
44161 }
44162
44163 /**
44164 * Checks if a stack value for `key` exists.
44165 *
44166 * @private
44167 * @name has
44168 * @memberOf Stack
44169 * @param {string} key The key of the entry to check.
44170 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
44171 */
44172 function stackHas(key) {
44173 return this.__data__.has(key);
44174 }
44175
44176 /**
44177 * Sets the stack `key` to `value`.
44178 *
44179 * @private
44180 * @name set
44181 * @memberOf Stack
44182 * @param {string} key The key of the value to set.
44183 * @param {*} value The value to set.
44184 * @returns {Object} Returns the stack cache instance.
44185 */
44186 function stackSet(key, value) {
44187 var data = this.__data__;
44188 if (data instanceof ListCache) {
44189 var pairs = data.__data__;
44190 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
44191 pairs.push([key, value]);
44192 this.size = ++data.size;
44193 return this;
44194 }
44195 data = this.__data__ = new MapCache(pairs);
44196 }
44197 data.set(key, value);
44198 this.size = data.size;
44199 return this;
44200 }
44201
44202 // Add methods to `Stack`.
44203 Stack.prototype.clear = stackClear;
44204 Stack.prototype['delete'] = stackDelete;
44205 Stack.prototype.get = stackGet;
44206 Stack.prototype.has = stackHas;
44207 Stack.prototype.set = stackSet;
44208
44209 /*------------------------------------------------------------------------*/
44210
44211 /**
44212 * Creates an array of the enumerable property names of the array-like `value`.
44213 *
44214 * @private
44215 * @param {*} value The value to query.
44216 * @param {boolean} inherited Specify returning inherited property names.
44217 * @returns {Array} Returns the array of property names.
44218 */
44219 function arrayLikeKeys(value, inherited) {
44220 var isArr = isArray(value),
44221 isArg = !isArr && isArguments(value),
44222 isBuff = !isArr && !isArg && isBuffer(value),
44223 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
44224 skipIndexes = isArr || isArg || isBuff || isType,
44225 result = skipIndexes ? baseTimes(value.length, String) : [],
44226 length = result.length;
44227
44228 for (var key in value) {
44229 if ((inherited || hasOwnProperty.call(value, key)) &&
44230 !(skipIndexes && (
44231 // Safari 9 has enumerable `arguments.length` in strict mode.
44232 key == 'length' ||
44233 // Node.js 0.10 has enumerable non-index properties on buffers.
44234 (isBuff && (key == 'offset' || key == 'parent')) ||
44235 // PhantomJS 2 has enumerable non-index properties on typed arrays.
44236 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
44237 // Skip index properties.
44238 isIndex(key, length)
44239 ))) {
44240 result.push(key);
44241 }
44242 }
44243 return result;
44244 }
44245
44246 /**
44247 * A specialized version of `_.sample` for arrays.
44248 *
44249 * @private
44250 * @param {Array} array The array to sample.
44251 * @returns {*} Returns the random element.
44252 */
44253 function arraySample(array) {
44254 var length = array.length;
44255 return length ? array[baseRandom(0, length - 1)] : undefined;
44256 }
44257
44258 /**
44259 * A specialized version of `_.sampleSize` for arrays.
44260 *
44261 * @private
44262 * @param {Array} array The array to sample.
44263 * @param {number} n The number of elements to sample.
44264 * @returns {Array} Returns the random elements.
44265 */
44266 function arraySampleSize(array, n) {
44267 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
44268 }
44269
44270 /**
44271 * A specialized version of `_.shuffle` for arrays.
44272 *
44273 * @private
44274 * @param {Array} array The array to shuffle.
44275 * @returns {Array} Returns the new shuffled array.
44276 */
44277 function arrayShuffle(array) {
44278 return shuffleSelf(copyArray(array));
44279 }
44280
44281 /**
44282 * This function is like `assignValue` except that it doesn't assign
44283 * `undefined` values.
44284 *
44285 * @private
44286 * @param {Object} object The object to modify.
44287 * @param {string} key The key of the property to assign.
44288 * @param {*} value The value to assign.
44289 */
44290 function assignMergeValue(object, key, value) {
44291 if ((value !== undefined && !eq(object[key], value)) ||
44292 (value === undefined && !(key in object))) {
44293 baseAssignValue(object, key, value);
44294 }
44295 }
44296
44297 /**
44298 * Assigns `value` to `key` of `object` if the existing value is not equivalent
44299 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
44300 * for equality comparisons.
44301 *
44302 * @private
44303 * @param {Object} object The object to modify.
44304 * @param {string} key The key of the property to assign.
44305 * @param {*} value The value to assign.
44306 */
44307 function assignValue(object, key, value) {
44308 var objValue = object[key];
44309 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
44310 (value === undefined && !(key in object))) {
44311 baseAssignValue(object, key, value);
44312 }
44313 }
44314
44315 /**
44316 * Gets the index at which the `key` is found in `array` of key-value pairs.
44317 *
44318 * @private
44319 * @param {Array} array The array to inspect.
44320 * @param {*} key The key to search for.
44321 * @returns {number} Returns the index of the matched value, else `-1`.
44322 */
44323 function assocIndexOf(array, key) {
44324 var length = array.length;
44325 while (length--) {
44326 if (eq(array[length][0], key)) {
44327 return length;
44328 }
44329 }
44330 return -1;
44331 }
44332
44333 /**
44334 * Aggregates elements of `collection` on `accumulator` with keys transformed
44335 * by `iteratee` and values set by `setter`.
44336 *
44337 * @private
44338 * @param {Array|Object} collection The collection to iterate over.
44339 * @param {Function} setter The function to set `accumulator` values.
44340 * @param {Function} iteratee The iteratee to transform keys.
44341 * @param {Object} accumulator The initial aggregated object.
44342 * @returns {Function} Returns `accumulator`.
44343 */
44344 function baseAggregator(collection, setter, iteratee, accumulator) {
44345 baseEach(collection, function(value, key, collection) {
44346 setter(accumulator, value, iteratee(value), collection);
44347 });
44348 return accumulator;
44349 }
44350
44351 /**
44352 * The base implementation of `_.assign` without support for multiple sources
44353 * or `customizer` functions.
44354 *
44355 * @private
44356 * @param {Object} object The destination object.
44357 * @param {Object} source The source object.
44358 * @returns {Object} Returns `object`.
44359 */
44360 function baseAssign(object, source) {
44361 return object && copyObject(source, keys(source), object);
44362 }
44363
44364 /**
44365 * The base implementation of `_.assignIn` without support for multiple sources
44366 * or `customizer` functions.
44367 *
44368 * @private
44369 * @param {Object} object The destination object.
44370 * @param {Object} source The source object.
44371 * @returns {Object} Returns `object`.
44372 */
44373 function baseAssignIn(object, source) {
44374 return object && copyObject(source, keysIn(source), object);
44375 }
44376
44377 /**
44378 * The base implementation of `assignValue` and `assignMergeValue` without
44379 * value checks.
44380 *
44381 * @private
44382 * @param {Object} object The object to modify.
44383 * @param {string} key The key of the property to assign.
44384 * @param {*} value The value to assign.
44385 */
44386 function baseAssignValue(object, key, value) {
44387 if (key == '__proto__' && defineProperty) {
44388 defineProperty(object, key, {
44389 'configurable': true,
44390 'enumerable': true,
44391 'value': value,
44392 'writable': true
44393 });
44394 } else {
44395 object[key] = value;
44396 }
44397 }
44398
44399 /**
44400 * The base implementation of `_.at` without support for individual paths.
44401 *
44402 * @private
44403 * @param {Object} object The object to iterate over.
44404 * @param {string[]} paths The property paths to pick.
44405 * @returns {Array} Returns the picked elements.
44406 */
44407 function baseAt(object, paths) {
44408 var index = -1,
44409 length = paths.length,
44410 result = Array(length),
44411 skip = object == null;
44412
44413 while (++index < length) {
44414 result[index] = skip ? undefined : get(object, paths[index]);
44415 }
44416 return result;
44417 }
44418
44419 /**
44420 * The base implementation of `_.clamp` which doesn't coerce arguments.
44421 *
44422 * @private
44423 * @param {number} number The number to clamp.
44424 * @param {number} [lower] The lower bound.
44425 * @param {number} upper The upper bound.
44426 * @returns {number} Returns the clamped number.
44427 */
44428 function baseClamp(number, lower, upper) {
44429 if (number === number) {
44430 if (upper !== undefined) {
44431 number = number <= upper ? number : upper;
44432 }
44433 if (lower !== undefined) {
44434 number = number >= lower ? number : lower;
44435 }
44436 }
44437 return number;
44438 }
44439
44440 /**
44441 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
44442 * traversed objects.
44443 *
44444 * @private
44445 * @param {*} value The value to clone.
44446 * @param {boolean} bitmask The bitmask flags.
44447 * 1 - Deep clone
44448 * 2 - Flatten inherited properties
44449 * 4 - Clone symbols
44450 * @param {Function} [customizer] The function to customize cloning.
44451 * @param {string} [key] The key of `value`.
44452 * @param {Object} [object] The parent object of `value`.
44453 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
44454 * @returns {*} Returns the cloned value.
44455 */
44456 function baseClone(value, bitmask, customizer, key, object, stack) {
44457 var result,
44458 isDeep = bitmask & CLONE_DEEP_FLAG,
44459 isFlat = bitmask & CLONE_FLAT_FLAG,
44460 isFull = bitmask & CLONE_SYMBOLS_FLAG;
44461
44462 if (customizer) {
44463 result = object ? customizer(value, key, object, stack) : customizer(value);
44464 }
44465 if (result !== undefined) {
44466 return result;
44467 }
44468 if (!isObject(value)) {
44469 return value;
44470 }
44471 var isArr = isArray(value);
44472 if (isArr) {
44473 result = initCloneArray(value);
44474 if (!isDeep) {
44475 return copyArray(value, result);
44476 }
44477 } else {
44478 var tag = getTag(value),
44479 isFunc = tag == funcTag || tag == genTag;
44480
44481 if (isBuffer(value)) {
44482 return cloneBuffer(value, isDeep);
44483 }
44484 if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
44485 result = (isFlat || isFunc) ? {} : initCloneObject(value);
44486 if (!isDeep) {
44487 return isFlat
44488 ? copySymbolsIn(value, baseAssignIn(result, value))
44489 : copySymbols(value, baseAssign(result, value));
44490 }
44491 } else {
44492 if (!cloneableTags[tag]) {
44493 return object ? value : {};
44494 }
44495 result = initCloneByTag(value, tag, isDeep);
44496 }
44497 }
44498 // Check for circular references and return its corresponding clone.
44499 stack || (stack = new Stack);
44500 var stacked = stack.get(value);
44501 if (stacked) {
44502 return stacked;
44503 }
44504 stack.set(value, result);
44505
44506 if (isSet(value)) {
44507 value.forEach(function(subValue) {
44508 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
44509 });
44510 } else if (isMap(value)) {
44511 value.forEach(function(subValue, key) {
44512 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
44513 });
44514 }
44515
44516 var keysFunc = isFull
44517 ? (isFlat ? getAllKeysIn : getAllKeys)
44518 : (isFlat ? keysIn : keys);
44519
44520 var props = isArr ? undefined : keysFunc(value);
44521 arrayEach(props || value, function(subValue, key) {
44522 if (props) {
44523 key = subValue;
44524 subValue = value[key];
44525 }
44526 // Recursively populate clone (susceptible to call stack limits).
44527 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
44528 });
44529 return result;
44530 }
44531
44532 /**
44533 * The base implementation of `_.conforms` which doesn't clone `source`.
44534 *
44535 * @private
44536 * @param {Object} source The object of property predicates to conform to.
44537 * @returns {Function} Returns the new spec function.
44538 */
44539 function baseConforms(source) {
44540 var props = keys(source);
44541 return function(object) {
44542 return baseConformsTo(object, source, props);
44543 };
44544 }
44545
44546 /**
44547 * The base implementation of `_.conformsTo` which accepts `props` to check.
44548 *
44549 * @private
44550 * @param {Object} object The object to inspect.
44551 * @param {Object} source The object of property predicates to conform to.
44552 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
44553 */
44554 function baseConformsTo(object, source, props) {
44555 var length = props.length;
44556 if (object == null) {
44557 return !length;
44558 }
44559 object = Object(object);
44560 while (length--) {
44561 var key = props[length],
44562 predicate = source[key],
44563 value = object[key];
44564
44565 if ((value === undefined && !(key in object)) || !predicate(value)) {
44566 return false;
44567 }
44568 }
44569 return true;
44570 }
44571
44572 /**
44573 * The base implementation of `_.delay` and `_.defer` which accepts `args`
44574 * to provide to `func`.
44575 *
44576 * @private
44577 * @param {Function} func The function to delay.
44578 * @param {number} wait The number of milliseconds to delay invocation.
44579 * @param {Array} args The arguments to provide to `func`.
44580 * @returns {number|Object} Returns the timer id or timeout object.
44581 */
44582 function baseDelay(func, wait, args) {
44583 if (typeof func != 'function') {
44584 throw new TypeError(FUNC_ERROR_TEXT);
44585 }
44586 return setTimeout(function() { func.apply(undefined, args); }, wait);
44587 }
44588
44589 /**
44590 * The base implementation of methods like `_.difference` without support
44591 * for excluding multiple arrays or iteratee shorthands.
44592 *
44593 * @private
44594 * @param {Array} array The array to inspect.
44595 * @param {Array} values The values to exclude.
44596 * @param {Function} [iteratee] The iteratee invoked per element.
44597 * @param {Function} [comparator] The comparator invoked per element.
44598 * @returns {Array} Returns the new array of filtered values.
44599 */
44600 function baseDifference(array, values, iteratee, comparator) {
44601 var index = -1,
44602 includes = arrayIncludes,
44603 isCommon = true,
44604 length = array.length,
44605 result = [],
44606 valuesLength = values.length;
44607
44608 if (!length) {
44609 return result;
44610 }
44611 if (iteratee) {
44612 values = arrayMap(values, baseUnary(iteratee));
44613 }
44614 if (comparator) {
44615 includes = arrayIncludesWith;
44616 isCommon = false;
44617 }
44618 else if (values.length >= LARGE_ARRAY_SIZE) {
44619 includes = cacheHas;
44620 isCommon = false;
44621 values = new SetCache(values);
44622 }
44623 outer:
44624 while (++index < length) {
44625 var value = array[index],
44626 computed = iteratee == null ? value : iteratee(value);
44627
44628 value = (comparator || value !== 0) ? value : 0;
44629 if (isCommon && computed === computed) {
44630 var valuesIndex = valuesLength;
44631 while (valuesIndex--) {
44632 if (values[valuesIndex] === computed) {
44633 continue outer;
44634 }
44635 }
44636 result.push(value);
44637 }
44638 else if (!includes(values, computed, comparator)) {
44639 result.push(value);
44640 }
44641 }
44642 return result;
44643 }
44644
44645 /**
44646 * The base implementation of `_.forEach` without support for iteratee shorthands.
44647 *
44648 * @private
44649 * @param {Array|Object} collection The collection to iterate over.
44650 * @param {Function} iteratee The function invoked per iteration.
44651 * @returns {Array|Object} Returns `collection`.
44652 */
44653 var baseEach = createBaseEach(baseForOwn);
44654
44655 /**
44656 * The base implementation of `_.forEachRight` without support for iteratee shorthands.
44657 *
44658 * @private
44659 * @param {Array|Object} collection The collection to iterate over.
44660 * @param {Function} iteratee The function invoked per iteration.
44661 * @returns {Array|Object} Returns `collection`.
44662 */
44663 var baseEachRight = createBaseEach(baseForOwnRight, true);
44664
44665 /**
44666 * The base implementation of `_.every` without support for iteratee shorthands.
44667 *
44668 * @private
44669 * @param {Array|Object} collection The collection to iterate over.
44670 * @param {Function} predicate The function invoked per iteration.
44671 * @returns {boolean} Returns `true` if all elements pass the predicate check,
44672 * else `false`
44673 */
44674 function baseEvery(collection, predicate) {
44675 var result = true;
44676 baseEach(collection, function(value, index, collection) {
44677 result = !!predicate(value, index, collection);
44678 return result;
44679 });
44680 return result;
44681 }
44682
44683 /**
44684 * The base implementation of methods like `_.max` and `_.min` which accepts a
44685 * `comparator` to determine the extremum value.
44686 *
44687 * @private
44688 * @param {Array} array The array to iterate over.
44689 * @param {Function} iteratee The iteratee invoked per iteration.
44690 * @param {Function} comparator The comparator used to compare values.
44691 * @returns {*} Returns the extremum value.
44692 */
44693 function baseExtremum(array, iteratee, comparator) {
44694 var index = -1,
44695 length = array.length;
44696
44697 while (++index < length) {
44698 var value = array[index],
44699 current = iteratee(value);
44700
44701 if (current != null && (computed === undefined
44702 ? (current === current && !isSymbol(current))
44703 : comparator(current, computed)
44704 )) {
44705 var computed = current,
44706 result = value;
44707 }
44708 }
44709 return result;
44710 }
44711
44712 /**
44713 * The base implementation of `_.fill` without an iteratee call guard.
44714 *
44715 * @private
44716 * @param {Array} array The array to fill.
44717 * @param {*} value The value to fill `array` with.
44718 * @param {number} [start=0] The start position.
44719 * @param {number} [end=array.length] The end position.
44720 * @returns {Array} Returns `array`.
44721 */
44722 function baseFill(array, value, start, end) {
44723 var length = array.length;
44724
44725 start = toInteger(start);
44726 if (start < 0) {
44727 start = -start > length ? 0 : (length + start);
44728 }
44729 end = (end === undefined || end > length) ? length : toInteger(end);
44730 if (end < 0) {
44731 end += length;
44732 }
44733 end = start > end ? 0 : toLength(end);
44734 while (start < end) {
44735 array[start++] = value;
44736 }
44737 return array;
44738 }
44739
44740 /**
44741 * The base implementation of `_.filter` without support for iteratee shorthands.
44742 *
44743 * @private
44744 * @param {Array|Object} collection The collection to iterate over.
44745 * @param {Function} predicate The function invoked per iteration.
44746 * @returns {Array} Returns the new filtered array.
44747 */
44748 function baseFilter(collection, predicate) {
44749 var result = [];
44750 baseEach(collection, function(value, index, collection) {
44751 if (predicate(value, index, collection)) {
44752 result.push(value);
44753 }
44754 });
44755 return result;
44756 }
44757
44758 /**
44759 * The base implementation of `_.flatten` with support for restricting flattening.
44760 *
44761 * @private
44762 * @param {Array} array The array to flatten.
44763 * @param {number} depth The maximum recursion depth.
44764 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
44765 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
44766 * @param {Array} [result=[]] The initial result value.
44767 * @returns {Array} Returns the new flattened array.
44768 */
44769 function baseFlatten(array, depth, predicate, isStrict, result) {
44770 var index = -1,
44771 length = array.length;
44772
44773 predicate || (predicate = isFlattenable);
44774 result || (result = []);
44775
44776 while (++index < length) {
44777 var value = array[index];
44778 if (depth > 0 && predicate(value)) {
44779 if (depth > 1) {
44780 // Recursively flatten arrays (susceptible to call stack limits).
44781 baseFlatten(value, depth - 1, predicate, isStrict, result);
44782 } else {
44783 arrayPush(result, value);
44784 }
44785 } else if (!isStrict) {
44786 result[result.length] = value;
44787 }
44788 }
44789 return result;
44790 }
44791
44792 /**
44793 * The base implementation of `baseForOwn` which iterates over `object`
44794 * properties returned by `keysFunc` and invokes `iteratee` for each property.
44795 * Iteratee functions may exit iteration early by explicitly returning `false`.
44796 *
44797 * @private
44798 * @param {Object} object The object to iterate over.
44799 * @param {Function} iteratee The function invoked per iteration.
44800 * @param {Function} keysFunc The function to get the keys of `object`.
44801 * @returns {Object} Returns `object`.
44802 */
44803 var baseFor = createBaseFor();
44804
44805 /**
44806 * This function is like `baseFor` except that it iterates over properties
44807 * in the opposite order.
44808 *
44809 * @private
44810 * @param {Object} object The object to iterate over.
44811 * @param {Function} iteratee The function invoked per iteration.
44812 * @param {Function} keysFunc The function to get the keys of `object`.
44813 * @returns {Object} Returns `object`.
44814 */
44815 var baseForRight = createBaseFor(true);
44816
44817 /**
44818 * The base implementation of `_.forOwn` without support for iteratee shorthands.
44819 *
44820 * @private
44821 * @param {Object} object The object to iterate over.
44822 * @param {Function} iteratee The function invoked per iteration.
44823 * @returns {Object} Returns `object`.
44824 */
44825 function baseForOwn(object, iteratee) {
44826 return object && baseFor(object, iteratee, keys);
44827 }
44828
44829 /**
44830 * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
44831 *
44832 * @private
44833 * @param {Object} object The object to iterate over.
44834 * @param {Function} iteratee The function invoked per iteration.
44835 * @returns {Object} Returns `object`.
44836 */
44837 function baseForOwnRight(object, iteratee) {
44838 return object && baseForRight(object, iteratee, keys);
44839 }
44840
44841 /**
44842 * The base implementation of `_.functions` which creates an array of
44843 * `object` function property names filtered from `props`.
44844 *
44845 * @private
44846 * @param {Object} object The object to inspect.
44847 * @param {Array} props The property names to filter.
44848 * @returns {Array} Returns the function names.
44849 */
44850 function baseFunctions(object, props) {
44851 return arrayFilter(props, function(key) {
44852 return isFunction(object[key]);
44853 });
44854 }
44855
44856 /**
44857 * The base implementation of `_.get` without support for default values.
44858 *
44859 * @private
44860 * @param {Object} object The object to query.
44861 * @param {Array|string} path The path of the property to get.
44862 * @returns {*} Returns the resolved value.
44863 */
44864 function baseGet(object, path) {
44865 path = castPath(path, object);
44866
44867 var index = 0,
44868 length = path.length;
44869
44870 while (object != null && index < length) {
44871 object = object[toKey(path[index++])];
44872 }
44873 return (index && index == length) ? object : undefined;
44874 }
44875
44876 /**
44877 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
44878 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
44879 * symbols of `object`.
44880 *
44881 * @private
44882 * @param {Object} object The object to query.
44883 * @param {Function} keysFunc The function to get the keys of `object`.
44884 * @param {Function} symbolsFunc The function to get the symbols of `object`.
44885 * @returns {Array} Returns the array of property names and symbols.
44886 */
44887 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
44888 var result = keysFunc(object);
44889 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
44890 }
44891
44892 /**
44893 * The base implementation of `getTag` without fallbacks for buggy environments.
44894 *
44895 * @private
44896 * @param {*} value The value to query.
44897 * @returns {string} Returns the `toStringTag`.
44898 */
44899 function baseGetTag(value) {
44900 if (value == null) {
44901 return value === undefined ? undefinedTag : nullTag;
44902 }
44903 return (symToStringTag && symToStringTag in Object(value))
44904 ? getRawTag(value)
44905 : objectToString(value);
44906 }
44907
44908 /**
44909 * The base implementation of `_.gt` which doesn't coerce arguments.
44910 *
44911 * @private
44912 * @param {*} value The value to compare.
44913 * @param {*} other The other value to compare.
44914 * @returns {boolean} Returns `true` if `value` is greater than `other`,
44915 * else `false`.
44916 */
44917 function baseGt(value, other) {
44918 return value > other;
44919 }
44920
44921 /**
44922 * The base implementation of `_.has` without support for deep paths.
44923 *
44924 * @private
44925 * @param {Object} [object] The object to query.
44926 * @param {Array|string} key The key to check.
44927 * @returns {boolean} Returns `true` if `key` exists, else `false`.
44928 */
44929 function baseHas(object, key) {
44930 return object != null && hasOwnProperty.call(object, key);
44931 }
44932
44933 /**
44934 * The base implementation of `_.hasIn` without support for deep paths.
44935 *
44936 * @private
44937 * @param {Object} [object] The object to query.
44938 * @param {Array|string} key The key to check.
44939 * @returns {boolean} Returns `true` if `key` exists, else `false`.
44940 */
44941 function baseHasIn(object, key) {
44942 return object != null && key in Object(object);
44943 }
44944
44945 /**
44946 * The base implementation of `_.inRange` which doesn't coerce arguments.
44947 *
44948 * @private
44949 * @param {number} number The number to check.
44950 * @param {number} start The start of the range.
44951 * @param {number} end The end of the range.
44952 * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
44953 */
44954 function baseInRange(number, start, end) {
44955 return number >= nativeMin(start, end) && number < nativeMax(start, end);
44956 }
44957
44958 /**
44959 * The base implementation of methods like `_.intersection`, without support
44960 * for iteratee shorthands, that accepts an array of arrays to inspect.
44961 *
44962 * @private
44963 * @param {Array} arrays The arrays to inspect.
44964 * @param {Function} [iteratee] The iteratee invoked per element.
44965 * @param {Function} [comparator] The comparator invoked per element.
44966 * @returns {Array} Returns the new array of shared values.
44967 */
44968 function baseIntersection(arrays, iteratee, comparator) {
44969 var includes = comparator ? arrayIncludesWith : arrayIncludes,
44970 length = arrays[0].length,
44971 othLength = arrays.length,
44972 othIndex = othLength,
44973 caches = Array(othLength),
44974 maxLength = Infinity,
44975 result = [];
44976
44977 while (othIndex--) {
44978 var array = arrays[othIndex];
44979 if (othIndex && iteratee) {
44980 array = arrayMap(array, baseUnary(iteratee));
44981 }
44982 maxLength = nativeMin(array.length, maxLength);
44983 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
44984 ? new SetCache(othIndex && array)
44985 : undefined;
44986 }
44987 array = arrays[0];
44988
44989 var index = -1,
44990 seen = caches[0];
44991
44992 outer:
44993 while (++index < length && result.length < maxLength) {
44994 var value = array[index],
44995 computed = iteratee ? iteratee(value) : value;
44996
44997 value = (comparator || value !== 0) ? value : 0;
44998 if (!(seen
44999 ? cacheHas(seen, computed)
45000 : includes(result, computed, comparator)
45001 )) {
45002 othIndex = othLength;
45003 while (--othIndex) {
45004 var cache = caches[othIndex];
45005 if (!(cache
45006 ? cacheHas(cache, computed)
45007 : includes(arrays[othIndex], computed, comparator))
45008 ) {
45009 continue outer;
45010 }
45011 }
45012 if (seen) {
45013 seen.push(computed);
45014 }
45015 result.push(value);
45016 }
45017 }
45018 return result;
45019 }
45020
45021 /**
45022 * The base implementation of `_.invert` and `_.invertBy` which inverts
45023 * `object` with values transformed by `iteratee` and set by `setter`.
45024 *
45025 * @private
45026 * @param {Object} object The object to iterate over.
45027 * @param {Function} setter The function to set `accumulator` values.
45028 * @param {Function} iteratee The iteratee to transform values.
45029 * @param {Object} accumulator The initial inverted object.
45030 * @returns {Function} Returns `accumulator`.
45031 */
45032 function baseInverter(object, setter, iteratee, accumulator) {
45033 baseForOwn(object, function(value, key, object) {
45034 setter(accumulator, iteratee(value), key, object);
45035 });
45036 return accumulator;
45037 }
45038
45039 /**
45040 * The base implementation of `_.invoke` without support for individual
45041 * method arguments.
45042 *
45043 * @private
45044 * @param {Object} object The object to query.
45045 * @param {Array|string} path The path of the method to invoke.
45046 * @param {Array} args The arguments to invoke the method with.
45047 * @returns {*} Returns the result of the invoked method.
45048 */
45049 function baseInvoke(object, path, args) {
45050 path = castPath(path, object);
45051 object = parent(object, path);
45052 var func = object == null ? object : object[toKey(last(path))];
45053 return func == null ? undefined : apply(func, object, args);
45054 }
45055
45056 /**
45057 * The base implementation of `_.isArguments`.
45058 *
45059 * @private
45060 * @param {*} value The value to check.
45061 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
45062 */
45063 function baseIsArguments(value) {
45064 return isObjectLike(value) && baseGetTag(value) == argsTag;
45065 }
45066
45067 /**
45068 * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
45069 *
45070 * @private
45071 * @param {*} value The value to check.
45072 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
45073 */
45074 function baseIsArrayBuffer(value) {
45075 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
45076 }
45077
45078 /**
45079 * The base implementation of `_.isDate` without Node.js optimizations.
45080 *
45081 * @private
45082 * @param {*} value The value to check.
45083 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
45084 */
45085 function baseIsDate(value) {
45086 return isObjectLike(value) && baseGetTag(value) == dateTag;
45087 }
45088
45089 /**
45090 * The base implementation of `_.isEqual` which supports partial comparisons
45091 * and tracks traversed objects.
45092 *
45093 * @private
45094 * @param {*} value The value to compare.
45095 * @param {*} other The other value to compare.
45096 * @param {boolean} bitmask The bitmask flags.
45097 * 1 - Unordered comparison
45098 * 2 - Partial comparison
45099 * @param {Function} [customizer] The function to customize comparisons.
45100 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
45101 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
45102 */
45103 function baseIsEqual(value, other, bitmask, customizer, stack) {
45104 if (value === other) {
45105 return true;
45106 }
45107 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
45108 return value !== value && other !== other;
45109 }
45110 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
45111 }
45112
45113 /**
45114 * A specialized version of `baseIsEqual` for arrays and objects which performs
45115 * deep comparisons and tracks traversed objects enabling objects with circular
45116 * references to be compared.
45117 *
45118 * @private
45119 * @param {Object} object The object to compare.
45120 * @param {Object} other The other object to compare.
45121 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
45122 * @param {Function} customizer The function to customize comparisons.
45123 * @param {Function} equalFunc The function to determine equivalents of values.
45124 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
45125 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
45126 */
45127 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
45128 var objIsArr = isArray(object),
45129 othIsArr = isArray(other),
45130 objTag = objIsArr ? arrayTag : getTag(object),
45131 othTag = othIsArr ? arrayTag : getTag(other);
45132
45133 objTag = objTag == argsTag ? objectTag : objTag;
45134 othTag = othTag == argsTag ? objectTag : othTag;
45135
45136 var objIsObj = objTag == objectTag,
45137 othIsObj = othTag == objectTag,
45138 isSameTag = objTag == othTag;
45139
45140 if (isSameTag && isBuffer(object)) {
45141 if (!isBuffer(other)) {
45142 return false;
45143 }
45144 objIsArr = true;
45145 objIsObj = false;
45146 }
45147 if (isSameTag && !objIsObj) {
45148 stack || (stack = new Stack);
45149 return (objIsArr || isTypedArray(object))
45150 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
45151 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
45152 }
45153 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
45154 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
45155 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
45156
45157 if (objIsWrapped || othIsWrapped) {
45158 var objUnwrapped = objIsWrapped ? object.value() : object,
45159 othUnwrapped = othIsWrapped ? other.value() : other;
45160
45161 stack || (stack = new Stack);
45162 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
45163 }
45164 }
45165 if (!isSameTag) {
45166 return false;
45167 }
45168 stack || (stack = new Stack);
45169 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
45170 }
45171
45172 /**
45173 * The base implementation of `_.isMap` without Node.js optimizations.
45174 *
45175 * @private
45176 * @param {*} value The value to check.
45177 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
45178 */
45179 function baseIsMap(value) {
45180 return isObjectLike(value) && getTag(value) == mapTag;
45181 }
45182
45183 /**
45184 * The base implementation of `_.isMatch` without support for iteratee shorthands.
45185 *
45186 * @private
45187 * @param {Object} object The object to inspect.
45188 * @param {Object} source The object of property values to match.
45189 * @param {Array} matchData The property names, values, and compare flags to match.
45190 * @param {Function} [customizer] The function to customize comparisons.
45191 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
45192 */
45193 function baseIsMatch(object, source, matchData, customizer) {
45194 var index = matchData.length,
45195 length = index,
45196 noCustomizer = !customizer;
45197
45198 if (object == null) {
45199 return !length;
45200 }
45201 object = Object(object);
45202 while (index--) {
45203 var data = matchData[index];
45204 if ((noCustomizer && data[2])
45205 ? data[1] !== object[data[0]]
45206 : !(data[0] in object)
45207 ) {
45208 return false;
45209 }
45210 }
45211 while (++index < length) {
45212 data = matchData[index];
45213 var key = data[0],
45214 objValue = object[key],
45215 srcValue = data[1];
45216
45217 if (noCustomizer && data[2]) {
45218 if (objValue === undefined && !(key in object)) {
45219 return false;
45220 }
45221 } else {
45222 var stack = new Stack;
45223 if (customizer) {
45224 var result = customizer(objValue, srcValue, key, object, source, stack);
45225 }
45226 if (!(result === undefined
45227 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
45228 : result
45229 )) {
45230 return false;
45231 }
45232 }
45233 }
45234 return true;
45235 }
45236
45237 /**
45238 * The base implementation of `_.isNative` without bad shim checks.
45239 *
45240 * @private
45241 * @param {*} value The value to check.
45242 * @returns {boolean} Returns `true` if `value` is a native function,
45243 * else `false`.
45244 */
45245 function baseIsNative(value) {
45246 if (!isObject(value) || isMasked(value)) {
45247 return false;
45248 }
45249 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
45250 return pattern.test(toSource(value));
45251 }
45252
45253 /**
45254 * The base implementation of `_.isRegExp` without Node.js optimizations.
45255 *
45256 * @private
45257 * @param {*} value The value to check.
45258 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
45259 */
45260 function baseIsRegExp(value) {
45261 return isObjectLike(value) && baseGetTag(value) == regexpTag;
45262 }
45263
45264 /**
45265 * The base implementation of `_.isSet` without Node.js optimizations.
45266 *
45267 * @private
45268 * @param {*} value The value to check.
45269 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
45270 */
45271 function baseIsSet(value) {
45272 return isObjectLike(value) && getTag(value) == setTag;
45273 }
45274
45275 /**
45276 * The base implementation of `_.isTypedArray` without Node.js optimizations.
45277 *
45278 * @private
45279 * @param {*} value The value to check.
45280 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
45281 */
45282 function baseIsTypedArray(value) {
45283 return isObjectLike(value) &&
45284 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
45285 }
45286
45287 /**
45288 * The base implementation of `_.iteratee`.
45289 *
45290 * @private
45291 * @param {*} [value=_.identity] The value to convert to an iteratee.
45292 * @returns {Function} Returns the iteratee.
45293 */
45294 function baseIteratee(value) {
45295 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
45296 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
45297 if (typeof value == 'function') {
45298 return value;
45299 }
45300 if (value == null) {
45301 return identity;
45302 }
45303 if (typeof value == 'object') {
45304 return isArray(value)
45305 ? baseMatchesProperty(value[0], value[1])
45306 : baseMatches(value);
45307 }
45308 return property(value);
45309 }
45310
45311 /**
45312 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
45313 *
45314 * @private
45315 * @param {Object} object The object to query.
45316 * @returns {Array} Returns the array of property names.
45317 */
45318 function baseKeys(object) {
45319 if (!isPrototype(object)) {
45320 return nativeKeys(object);
45321 }
45322 var result = [];
45323 for (var key in Object(object)) {
45324 if (hasOwnProperty.call(object, key) && key != 'constructor') {
45325 result.push(key);
45326 }
45327 }
45328 return result;
45329 }
45330
45331 /**
45332 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
45333 *
45334 * @private
45335 * @param {Object} object The object to query.
45336 * @returns {Array} Returns the array of property names.
45337 */
45338 function baseKeysIn(object) {
45339 if (!isObject(object)) {
45340 return nativeKeysIn(object);
45341 }
45342 var isProto = isPrototype(object),
45343 result = [];
45344
45345 for (var key in object) {
45346 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
45347 result.push(key);
45348 }
45349 }
45350 return result;
45351 }
45352
45353 /**
45354 * The base implementation of `_.lt` which doesn't coerce arguments.
45355 *
45356 * @private
45357 * @param {*} value The value to compare.
45358 * @param {*} other The other value to compare.
45359 * @returns {boolean} Returns `true` if `value` is less than `other`,
45360 * else `false`.
45361 */
45362 function baseLt(value, other) {
45363 return value < other;
45364 }
45365
45366 /**
45367 * The base implementation of `_.map` without support for iteratee shorthands.
45368 *
45369 * @private
45370 * @param {Array|Object} collection The collection to iterate over.
45371 * @param {Function} iteratee The function invoked per iteration.
45372 * @returns {Array} Returns the new mapped array.
45373 */
45374 function baseMap(collection, iteratee) {
45375 var index = -1,
45376 result = isArrayLike(collection) ? Array(collection.length) : [];
45377
45378 baseEach(collection, function(value, key, collection) {
45379 result[++index] = iteratee(value, key, collection);
45380 });
45381 return result;
45382 }
45383
45384 /**
45385 * The base implementation of `_.matches` which doesn't clone `source`.
45386 *
45387 * @private
45388 * @param {Object} source The object of property values to match.
45389 * @returns {Function} Returns the new spec function.
45390 */
45391 function baseMatches(source) {
45392 var matchData = getMatchData(source);
45393 if (matchData.length == 1 && matchData[0][2]) {
45394 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
45395 }
45396 return function(object) {
45397 return object === source || baseIsMatch(object, source, matchData);
45398 };
45399 }
45400
45401 /**
45402 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
45403 *
45404 * @private
45405 * @param {string} path The path of the property to get.
45406 * @param {*} srcValue The value to match.
45407 * @returns {Function} Returns the new spec function.
45408 */
45409 function baseMatchesProperty(path, srcValue) {
45410 if (isKey(path) && isStrictComparable(srcValue)) {
45411 return matchesStrictComparable(toKey(path), srcValue);
45412 }
45413 return function(object) {
45414 var objValue = get(object, path);
45415 return (objValue === undefined && objValue === srcValue)
45416 ? hasIn(object, path)
45417 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
45418 };
45419 }
45420
45421 /**
45422 * The base implementation of `_.merge` without support for multiple sources.
45423 *
45424 * @private
45425 * @param {Object} object The destination object.
45426 * @param {Object} source The source object.
45427 * @param {number} srcIndex The index of `source`.
45428 * @param {Function} [customizer] The function to customize merged values.
45429 * @param {Object} [stack] Tracks traversed source values and their merged
45430 * counterparts.
45431 */
45432 function baseMerge(object, source, srcIndex, customizer, stack) {
45433 if (object === source) {
45434 return;
45435 }
45436 baseFor(source, function(srcValue, key) {
45437 stack || (stack = new Stack);
45438 if (isObject(srcValue)) {
45439 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
45440 }
45441 else {
45442 var newValue = customizer
45443 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
45444 : undefined;
45445
45446 if (newValue === undefined) {
45447 newValue = srcValue;
45448 }
45449 assignMergeValue(object, key, newValue);
45450 }
45451 }, keysIn);
45452 }
45453
45454 /**
45455 * A specialized version of `baseMerge` for arrays and objects which performs
45456 * deep merges and tracks traversed objects enabling objects with circular
45457 * references to be merged.
45458 *
45459 * @private
45460 * @param {Object} object The destination object.
45461 * @param {Object} source The source object.
45462 * @param {string} key The key of the value to merge.
45463 * @param {number} srcIndex The index of `source`.
45464 * @param {Function} mergeFunc The function to merge values.
45465 * @param {Function} [customizer] The function to customize assigned values.
45466 * @param {Object} [stack] Tracks traversed source values and their merged
45467 * counterparts.
45468 */
45469 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
45470 var objValue = safeGet(object, key),
45471 srcValue = safeGet(source, key),
45472 stacked = stack.get(srcValue);
45473
45474 if (stacked) {
45475 assignMergeValue(object, key, stacked);
45476 return;
45477 }
45478 var newValue = customizer
45479 ? customizer(objValue, srcValue, (key + ''), object, source, stack)
45480 : undefined;
45481
45482 var isCommon = newValue === undefined;
45483
45484 if (isCommon) {
45485 var isArr = isArray(srcValue),
45486 isBuff = !isArr && isBuffer(srcValue),
45487 isTyped = !isArr && !isBuff && isTypedArray(srcValue);
45488
45489 newValue = srcValue;
45490 if (isArr || isBuff || isTyped) {
45491 if (isArray(objValue)) {
45492 newValue = objValue;
45493 }
45494 else if (isArrayLikeObject(objValue)) {
45495 newValue = copyArray(objValue);
45496 }
45497 else if (isBuff) {
45498 isCommon = false;
45499 newValue = cloneBuffer(srcValue, true);
45500 }
45501 else if (isTyped) {
45502 isCommon = false;
45503 newValue = cloneTypedArray(srcValue, true);
45504 }
45505 else {
45506 newValue = [];
45507 }
45508 }
45509 else if (isPlainObject(srcValue) || isArguments(srcValue)) {
45510 newValue = objValue;
45511 if (isArguments(objValue)) {
45512 newValue = toPlainObject(objValue);
45513 }
45514 else if (!isObject(objValue) || isFunction(objValue)) {
45515 newValue = initCloneObject(srcValue);
45516 }
45517 }
45518 else {
45519 isCommon = false;
45520 }
45521 }
45522 if (isCommon) {
45523 // Recursively merge objects and arrays (susceptible to call stack limits).
45524 stack.set(srcValue, newValue);
45525 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
45526 stack['delete'](srcValue);
45527 }
45528 assignMergeValue(object, key, newValue);
45529 }
45530
45531 /**
45532 * The base implementation of `_.nth` which doesn't coerce arguments.
45533 *
45534 * @private
45535 * @param {Array} array The array to query.
45536 * @param {number} n The index of the element to return.
45537 * @returns {*} Returns the nth element of `array`.
45538 */
45539 function baseNth(array, n) {
45540 var length = array.length;
45541 if (!length) {
45542 return;
45543 }
45544 n += n < 0 ? length : 0;
45545 return isIndex(n, length) ? array[n] : undefined;
45546 }
45547
45548 /**
45549 * The base implementation of `_.orderBy` without param guards.
45550 *
45551 * @private
45552 * @param {Array|Object} collection The collection to iterate over.
45553 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
45554 * @param {string[]} orders The sort orders of `iteratees`.
45555 * @returns {Array} Returns the new sorted array.
45556 */
45557 function baseOrderBy(collection, iteratees, orders) {
45558 var index = -1;
45559 iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
45560
45561 var result = baseMap(collection, function(value, key, collection) {
45562 var criteria = arrayMap(iteratees, function(iteratee) {
45563 return iteratee(value);
45564 });
45565 return { 'criteria': criteria, 'index': ++index, 'value': value };
45566 });
45567
45568 return baseSortBy(result, function(object, other) {
45569 return compareMultiple(object, other, orders);
45570 });
45571 }
45572
45573 /**
45574 * The base implementation of `_.pick` without support for individual
45575 * property identifiers.
45576 *
45577 * @private
45578 * @param {Object} object The source object.
45579 * @param {string[]} paths The property paths to pick.
45580 * @returns {Object} Returns the new object.
45581 */
45582 function basePick(object, paths) {
45583 return basePickBy(object, paths, function(value, path) {
45584 return hasIn(object, path);
45585 });
45586 }
45587
45588 /**
45589 * The base implementation of `_.pickBy` without support for iteratee shorthands.
45590 *
45591 * @private
45592 * @param {Object} object The source object.
45593 * @param {string[]} paths The property paths to pick.
45594 * @param {Function} predicate The function invoked per property.
45595 * @returns {Object} Returns the new object.
45596 */
45597 function basePickBy(object, paths, predicate) {
45598 var index = -1,
45599 length = paths.length,
45600 result = {};
45601
45602 while (++index < length) {
45603 var path = paths[index],
45604 value = baseGet(object, path);
45605
45606 if (predicate(value, path)) {
45607 baseSet(result, castPath(path, object), value);
45608 }
45609 }
45610 return result;
45611 }
45612
45613 /**
45614 * A specialized version of `baseProperty` which supports deep paths.
45615 *
45616 * @private
45617 * @param {Array|string} path The path of the property to get.
45618 * @returns {Function} Returns the new accessor function.
45619 */
45620 function basePropertyDeep(path) {
45621 return function(object) {
45622 return baseGet(object, path);
45623 };
45624 }
45625
45626 /**
45627 * The base implementation of `_.pullAllBy` without support for iteratee
45628 * shorthands.
45629 *
45630 * @private
45631 * @param {Array} array The array to modify.
45632 * @param {Array} values The values to remove.
45633 * @param {Function} [iteratee] The iteratee invoked per element.
45634 * @param {Function} [comparator] The comparator invoked per element.
45635 * @returns {Array} Returns `array`.
45636 */
45637 function basePullAll(array, values, iteratee, comparator) {
45638 var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
45639 index = -1,
45640 length = values.length,
45641 seen = array;
45642
45643 if (array === values) {
45644 values = copyArray(values);
45645 }
45646 if (iteratee) {
45647 seen = arrayMap(array, baseUnary(iteratee));
45648 }
45649 while (++index < length) {
45650 var fromIndex = 0,
45651 value = values[index],
45652 computed = iteratee ? iteratee(value) : value;
45653
45654 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
45655 if (seen !== array) {
45656 splice.call(seen, fromIndex, 1);
45657 }
45658 splice.call(array, fromIndex, 1);
45659 }
45660 }
45661 return array;
45662 }
45663
45664 /**
45665 * The base implementation of `_.pullAt` without support for individual
45666 * indexes or capturing the removed elements.
45667 *
45668 * @private
45669 * @param {Array} array The array to modify.
45670 * @param {number[]} indexes The indexes of elements to remove.
45671 * @returns {Array} Returns `array`.
45672 */
45673 function basePullAt(array, indexes) {
45674 var length = array ? indexes.length : 0,
45675 lastIndex = length - 1;
45676
45677 while (length--) {
45678 var index = indexes[length];
45679 if (length == lastIndex || index !== previous) {
45680 var previous = index;
45681 if (isIndex(index)) {
45682 splice.call(array, index, 1);
45683 } else {
45684 baseUnset(array, index);
45685 }
45686 }
45687 }
45688 return array;
45689 }
45690
45691 /**
45692 * The base implementation of `_.random` without support for returning
45693 * floating-point numbers.
45694 *
45695 * @private
45696 * @param {number} lower The lower bound.
45697 * @param {number} upper The upper bound.
45698 * @returns {number} Returns the random number.
45699 */
45700 function baseRandom(lower, upper) {
45701 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
45702 }
45703
45704 /**
45705 * The base implementation of `_.range` and `_.rangeRight` which doesn't
45706 * coerce arguments.
45707 *
45708 * @private
45709 * @param {number} start The start of the range.
45710 * @param {number} end The end of the range.
45711 * @param {number} step The value to increment or decrement by.
45712 * @param {boolean} [fromRight] Specify iterating from right to left.
45713 * @returns {Array} Returns the range of numbers.
45714 */
45715 function baseRange(start, end, step, fromRight) {
45716 var index = -1,
45717 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
45718 result = Array(length);
45719
45720 while (length--) {
45721 result[fromRight ? length : ++index] = start;
45722 start += step;
45723 }
45724 return result;
45725 }
45726
45727 /**
45728 * The base implementation of `_.repeat` which doesn't coerce arguments.
45729 *
45730 * @private
45731 * @param {string} string The string to repeat.
45732 * @param {number} n The number of times to repeat the string.
45733 * @returns {string} Returns the repeated string.
45734 */
45735 function baseRepeat(string, n) {
45736 var result = '';
45737 if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
45738 return result;
45739 }
45740 // Leverage the exponentiation by squaring algorithm for a faster repeat.
45741 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
45742 do {
45743 if (n % 2) {
45744 result += string;
45745 }
45746 n = nativeFloor(n / 2);
45747 if (n) {
45748 string += string;
45749 }
45750 } while (n);
45751
45752 return result;
45753 }
45754
45755 /**
45756 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
45757 *
45758 * @private
45759 * @param {Function} func The function to apply a rest parameter to.
45760 * @param {number} [start=func.length-1] The start position of the rest parameter.
45761 * @returns {Function} Returns the new function.
45762 */
45763 function baseRest(func, start) {
45764 return setToString(overRest(func, start, identity), func + '');
45765 }
45766
45767 /**
45768 * The base implementation of `_.sample`.
45769 *
45770 * @private
45771 * @param {Array|Object} collection The collection to sample.
45772 * @returns {*} Returns the random element.
45773 */
45774 function baseSample(collection) {
45775 return arraySample(values(collection));
45776 }
45777
45778 /**
45779 * The base implementation of `_.sampleSize` without param guards.
45780 *
45781 * @private
45782 * @param {Array|Object} collection The collection to sample.
45783 * @param {number} n The number of elements to sample.
45784 * @returns {Array} Returns the random elements.
45785 */
45786 function baseSampleSize(collection, n) {
45787 var array = values(collection);
45788 return shuffleSelf(array, baseClamp(n, 0, array.length));
45789 }
45790
45791 /**
45792 * The base implementation of `_.set`.
45793 *
45794 * @private
45795 * @param {Object} object The object to modify.
45796 * @param {Array|string} path The path of the property to set.
45797 * @param {*} value The value to set.
45798 * @param {Function} [customizer] The function to customize path creation.
45799 * @returns {Object} Returns `object`.
45800 */
45801 function baseSet(object, path, value, customizer) {
45802 if (!isObject(object)) {
45803 return object;
45804 }
45805 path = castPath(path, object);
45806
45807 var index = -1,
45808 length = path.length,
45809 lastIndex = length - 1,
45810 nested = object;
45811
45812 while (nested != null && ++index < length) {
45813 var key = toKey(path[index]),
45814 newValue = value;
45815
45816 if (index != lastIndex) {
45817 var objValue = nested[key];
45818 newValue = customizer ? customizer(objValue, key, nested) : undefined;
45819 if (newValue === undefined) {
45820 newValue = isObject(objValue)
45821 ? objValue
45822 : (isIndex(path[index + 1]) ? [] : {});
45823 }
45824 }
45825 assignValue(nested, key, newValue);
45826 nested = nested[key];
45827 }
45828 return object;
45829 }
45830
45831 /**
45832 * The base implementation of `setData` without support for hot loop shorting.
45833 *
45834 * @private
45835 * @param {Function} func The function to associate metadata with.
45836 * @param {*} data The metadata.
45837 * @returns {Function} Returns `func`.
45838 */
45839 var baseSetData = !metaMap ? identity : function(func, data) {
45840 metaMap.set(func, data);
45841 return func;
45842 };
45843
45844 /**
45845 * The base implementation of `setToString` without support for hot loop shorting.
45846 *
45847 * @private
45848 * @param {Function} func The function to modify.
45849 * @param {Function} string The `toString` result.
45850 * @returns {Function} Returns `func`.
45851 */
45852 var baseSetToString = !defineProperty ? identity : function(func, string) {
45853 return defineProperty(func, 'toString', {
45854 'configurable': true,
45855 'enumerable': false,
45856 'value': constant(string),
45857 'writable': true
45858 });
45859 };
45860
45861 /**
45862 * The base implementation of `_.shuffle`.
45863 *
45864 * @private
45865 * @param {Array|Object} collection The collection to shuffle.
45866 * @returns {Array} Returns the new shuffled array.
45867 */
45868 function baseShuffle(collection) {
45869 return shuffleSelf(values(collection));
45870 }
45871
45872 /**
45873 * The base implementation of `_.slice` without an iteratee call guard.
45874 *
45875 * @private
45876 * @param {Array} array The array to slice.
45877 * @param {number} [start=0] The start position.
45878 * @param {number} [end=array.length] The end position.
45879 * @returns {Array} Returns the slice of `array`.
45880 */
45881 function baseSlice(array, start, end) {
45882 var index = -1,
45883 length = array.length;
45884
45885 if (start < 0) {
45886 start = -start > length ? 0 : (length + start);
45887 }
45888 end = end > length ? length : end;
45889 if (end < 0) {
45890 end += length;
45891 }
45892 length = start > end ? 0 : ((end - start) >>> 0);
45893 start >>>= 0;
45894
45895 var result = Array(length);
45896 while (++index < length) {
45897 result[index] = array[index + start];
45898 }
45899 return result;
45900 }
45901
45902 /**
45903 * The base implementation of `_.some` without support for iteratee shorthands.
45904 *
45905 * @private
45906 * @param {Array|Object} collection The collection to iterate over.
45907 * @param {Function} predicate The function invoked per iteration.
45908 * @returns {boolean} Returns `true` if any element passes the predicate check,
45909 * else `false`.
45910 */
45911 function baseSome(collection, predicate) {
45912 var result;
45913
45914 baseEach(collection, function(value, index, collection) {
45915 result = predicate(value, index, collection);
45916 return !result;
45917 });
45918 return !!result;
45919 }
45920
45921 /**
45922 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
45923 * performs a binary search of `array` to determine the index at which `value`
45924 * should be inserted into `array` in order to maintain its sort order.
45925 *
45926 * @private
45927 * @param {Array} array The sorted array to inspect.
45928 * @param {*} value The value to evaluate.
45929 * @param {boolean} [retHighest] Specify returning the highest qualified index.
45930 * @returns {number} Returns the index at which `value` should be inserted
45931 * into `array`.
45932 */
45933 function baseSortedIndex(array, value, retHighest) {
45934 var low = 0,
45935 high = array == null ? low : array.length;
45936
45937 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
45938 while (low < high) {
45939 var mid = (low + high) >>> 1,
45940 computed = array[mid];
45941
45942 if (computed !== null && !isSymbol(computed) &&
45943 (retHighest ? (computed <= value) : (computed < value))) {
45944 low = mid + 1;
45945 } else {
45946 high = mid;
45947 }
45948 }
45949 return high;
45950 }
45951 return baseSortedIndexBy(array, value, identity, retHighest);
45952 }
45953
45954 /**
45955 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
45956 * which invokes `iteratee` for `value` and each element of `array` to compute
45957 * their sort ranking. The iteratee is invoked with one argument; (value).
45958 *
45959 * @private
45960 * @param {Array} array The sorted array to inspect.
45961 * @param {*} value The value to evaluate.
45962 * @param {Function} iteratee The iteratee invoked per element.
45963 * @param {boolean} [retHighest] Specify returning the highest qualified index.
45964 * @returns {number} Returns the index at which `value` should be inserted
45965 * into `array`.
45966 */
45967 function baseSortedIndexBy(array, value, iteratee, retHighest) {
45968 value = iteratee(value);
45969
45970 var low = 0,
45971 high = array == null ? 0 : array.length,
45972 valIsNaN = value !== value,
45973 valIsNull = value === null,
45974 valIsSymbol = isSymbol(value),
45975 valIsUndefined = value === undefined;
45976
45977 while (low < high) {
45978 var mid = nativeFloor((low + high) / 2),
45979 computed = iteratee(array[mid]),
45980 othIsDefined = computed !== undefined,
45981 othIsNull = computed === null,
45982 othIsReflexive = computed === computed,
45983 othIsSymbol = isSymbol(computed);
45984
45985 if (valIsNaN) {
45986 var setLow = retHighest || othIsReflexive;
45987 } else if (valIsUndefined) {
45988 setLow = othIsReflexive && (retHighest || othIsDefined);
45989 } else if (valIsNull) {
45990 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
45991 } else if (valIsSymbol) {
45992 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
45993 } else if (othIsNull || othIsSymbol) {
45994 setLow = false;
45995 } else {
45996 setLow = retHighest ? (computed <= value) : (computed < value);
45997 }
45998 if (setLow) {
45999 low = mid + 1;
46000 } else {
46001 high = mid;
46002 }
46003 }
46004 return nativeMin(high, MAX_ARRAY_INDEX);
46005 }
46006
46007 /**
46008 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
46009 * support for iteratee shorthands.
46010 *
46011 * @private
46012 * @param {Array} array The array to inspect.
46013 * @param {Function} [iteratee] The iteratee invoked per element.
46014 * @returns {Array} Returns the new duplicate free array.
46015 */
46016 function baseSortedUniq(array, iteratee) {
46017 var index = -1,
46018 length = array.length,
46019 resIndex = 0,
46020 result = [];
46021
46022 while (++index < length) {
46023 var value = array[index],
46024 computed = iteratee ? iteratee(value) : value;
46025
46026 if (!index || !eq(computed, seen)) {
46027 var seen = computed;
46028 result[resIndex++] = value === 0 ? 0 : value;
46029 }
46030 }
46031 return result;
46032 }
46033
46034 /**
46035 * The base implementation of `_.toNumber` which doesn't ensure correct
46036 * conversions of binary, hexadecimal, or octal string values.
46037 *
46038 * @private
46039 * @param {*} value The value to process.
46040 * @returns {number} Returns the number.
46041 */
46042 function baseToNumber(value) {
46043 if (typeof value == 'number') {
46044 return value;
46045 }
46046 if (isSymbol(value)) {
46047 return NAN;
46048 }
46049 return +value;
46050 }
46051
46052 /**
46053 * The base implementation of `_.toString` which doesn't convert nullish
46054 * values to empty strings.
46055 *
46056 * @private
46057 * @param {*} value The value to process.
46058 * @returns {string} Returns the string.
46059 */
46060 function baseToString(value) {
46061 // Exit early for strings to avoid a performance hit in some environments.
46062 if (typeof value == 'string') {
46063 return value;
46064 }
46065 if (isArray(value)) {
46066 // Recursively convert values (susceptible to call stack limits).
46067 return arrayMap(value, baseToString) + '';
46068 }
46069 if (isSymbol(value)) {
46070 return symbolToString ? symbolToString.call(value) : '';
46071 }
46072 var result = (value + '');
46073 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
46074 }
46075
46076 /**
46077 * The base implementation of `_.uniqBy` without support for iteratee shorthands.
46078 *
46079 * @private
46080 * @param {Array} array The array to inspect.
46081 * @param {Function} [iteratee] The iteratee invoked per element.
46082 * @param {Function} [comparator] The comparator invoked per element.
46083 * @returns {Array} Returns the new duplicate free array.
46084 */
46085 function baseUniq(array, iteratee, comparator) {
46086 var index = -1,
46087 includes = arrayIncludes,
46088 length = array.length,
46089 isCommon = true,
46090 result = [],
46091 seen = result;
46092
46093 if (comparator) {
46094 isCommon = false;
46095 includes = arrayIncludesWith;
46096 }
46097 else if (length >= LARGE_ARRAY_SIZE) {
46098 var set = iteratee ? null : createSet(array);
46099 if (set) {
46100 return setToArray(set);
46101 }
46102 isCommon = false;
46103 includes = cacheHas;
46104 seen = new SetCache;
46105 }
46106 else {
46107 seen = iteratee ? [] : result;
46108 }
46109 outer:
46110 while (++index < length) {
46111 var value = array[index],
46112 computed = iteratee ? iteratee(value) : value;
46113
46114 value = (comparator || value !== 0) ? value : 0;
46115 if (isCommon && computed === computed) {
46116 var seenIndex = seen.length;
46117 while (seenIndex--) {
46118 if (seen[seenIndex] === computed) {
46119 continue outer;
46120 }
46121 }
46122 if (iteratee) {
46123 seen.push(computed);
46124 }
46125 result.push(value);
46126 }
46127 else if (!includes(seen, computed, comparator)) {
46128 if (seen !== result) {
46129 seen.push(computed);
46130 }
46131 result.push(value);
46132 }
46133 }
46134 return result;
46135 }
46136
46137 /**
46138 * The base implementation of `_.unset`.
46139 *
46140 * @private
46141 * @param {Object} object The object to modify.
46142 * @param {Array|string} path The property path to unset.
46143 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
46144 */
46145 function baseUnset(object, path) {
46146 path = castPath(path, object);
46147 object = parent(object, path);
46148 return object == null || delete object[toKey(last(path))];
46149 }
46150
46151 /**
46152 * The base implementation of `_.update`.
46153 *
46154 * @private
46155 * @param {Object} object The object to modify.
46156 * @param {Array|string} path The path of the property to update.
46157 * @param {Function} updater The function to produce the updated value.
46158 * @param {Function} [customizer] The function to customize path creation.
46159 * @returns {Object} Returns `object`.
46160 */
46161 function baseUpdate(object, path, updater, customizer) {
46162 return baseSet(object, path, updater(baseGet(object, path)), customizer);
46163 }
46164
46165 /**
46166 * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
46167 * without support for iteratee shorthands.
46168 *
46169 * @private
46170 * @param {Array} array The array to query.
46171 * @param {Function} predicate The function invoked per iteration.
46172 * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
46173 * @param {boolean} [fromRight] Specify iterating from right to left.
46174 * @returns {Array} Returns the slice of `array`.
46175 */
46176 function baseWhile(array, predicate, isDrop, fromRight) {
46177 var length = array.length,
46178 index = fromRight ? length : -1;
46179
46180 while ((fromRight ? index-- : ++index < length) &&
46181 predicate(array[index], index, array)) {}
46182
46183 return isDrop
46184 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
46185 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
46186 }
46187
46188 /**
46189 * The base implementation of `wrapperValue` which returns the result of
46190 * performing a sequence of actions on the unwrapped `value`, where each
46191 * successive action is supplied the return value of the previous.
46192 *
46193 * @private
46194 * @param {*} value The unwrapped value.
46195 * @param {Array} actions Actions to perform to resolve the unwrapped value.
46196 * @returns {*} Returns the resolved value.
46197 */
46198 function baseWrapperValue(value, actions) {
46199 var result = value;
46200 if (result instanceof LazyWrapper) {
46201 result = result.value();
46202 }
46203 return arrayReduce(actions, function(result, action) {
46204 return action.func.apply(action.thisArg, arrayPush([result], action.args));
46205 }, result);
46206 }
46207
46208 /**
46209 * The base implementation of methods like `_.xor`, without support for
46210 * iteratee shorthands, that accepts an array of arrays to inspect.
46211 *
46212 * @private
46213 * @param {Array} arrays The arrays to inspect.
46214 * @param {Function} [iteratee] The iteratee invoked per element.
46215 * @param {Function} [comparator] The comparator invoked per element.
46216 * @returns {Array} Returns the new array of values.
46217 */
46218 function baseXor(arrays, iteratee, comparator) {
46219 var length = arrays.length;
46220 if (length < 2) {
46221 return length ? baseUniq(arrays[0]) : [];
46222 }
46223 var index = -1,
46224 result = Array(length);
46225
46226 while (++index < length) {
46227 var array = arrays[index],
46228 othIndex = -1;
46229
46230 while (++othIndex < length) {
46231 if (othIndex != index) {
46232 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
46233 }
46234 }
46235 }
46236 return baseUniq(baseFlatten(result, 1), iteratee, comparator);
46237 }
46238
46239 /**
46240 * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
46241 *
46242 * @private
46243 * @param {Array} props The property identifiers.
46244 * @param {Array} values The property values.
46245 * @param {Function} assignFunc The function to assign values.
46246 * @returns {Object} Returns the new object.
46247 */
46248 function baseZipObject(props, values, assignFunc) {
46249 var index = -1,
46250 length = props.length,
46251 valsLength = values.length,
46252 result = {};
46253
46254 while (++index < length) {
46255 var value = index < valsLength ? values[index] : undefined;
46256 assignFunc(result, props[index], value);
46257 }
46258 return result;
46259 }
46260
46261 /**
46262 * Casts `value` to an empty array if it's not an array like object.
46263 *
46264 * @private
46265 * @param {*} value The value to inspect.
46266 * @returns {Array|Object} Returns the cast array-like object.
46267 */
46268 function castArrayLikeObject(value) {
46269 return isArrayLikeObject(value) ? value : [];
46270 }
46271
46272 /**
46273 * Casts `value` to `identity` if it's not a function.
46274 *
46275 * @private
46276 * @param {*} value The value to inspect.
46277 * @returns {Function} Returns cast function.
46278 */
46279 function castFunction(value) {
46280 return typeof value == 'function' ? value : identity;
46281 }
46282
46283 /**
46284 * Casts `value` to a path array if it's not one.
46285 *
46286 * @private
46287 * @param {*} value The value to inspect.
46288 * @param {Object} [object] The object to query keys on.
46289 * @returns {Array} Returns the cast property path array.
46290 */
46291 function castPath(value, object) {
46292 if (isArray(value)) {
46293 return value;
46294 }
46295 return isKey(value, object) ? [value] : stringToPath(toString(value));
46296 }
46297
46298 /**
46299 * A `baseRest` alias which can be replaced with `identity` by module
46300 * replacement plugins.
46301 *
46302 * @private
46303 * @type {Function}
46304 * @param {Function} func The function to apply a rest parameter to.
46305 * @returns {Function} Returns the new function.
46306 */
46307 var castRest = baseRest;
46308
46309 /**
46310 * Casts `array` to a slice if it's needed.
46311 *
46312 * @private
46313 * @param {Array} array The array to inspect.
46314 * @param {number} start The start position.
46315 * @param {number} [end=array.length] The end position.
46316 * @returns {Array} Returns the cast slice.
46317 */
46318 function castSlice(array, start, end) {
46319 var length = array.length;
46320 end = end === undefined ? length : end;
46321 return (!start && end >= length) ? array : baseSlice(array, start, end);
46322 }
46323
46324 /**
46325 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
46326 *
46327 * @private
46328 * @param {number|Object} id The timer id or timeout object of the timer to clear.
46329 */
46330 var clearTimeout = ctxClearTimeout || function(id) {
46331 return root.clearTimeout(id);
46332 };
46333
46334 /**
46335 * Creates a clone of `buffer`.
46336 *
46337 * @private
46338 * @param {Buffer} buffer The buffer to clone.
46339 * @param {boolean} [isDeep] Specify a deep clone.
46340 * @returns {Buffer} Returns the cloned buffer.
46341 */
46342 function cloneBuffer(buffer, isDeep) {
46343 if (isDeep) {
46344 return buffer.slice();
46345 }
46346 var length = buffer.length,
46347 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
46348
46349 buffer.copy(result);
46350 return result;
46351 }
46352
46353 /**
46354 * Creates a clone of `arrayBuffer`.
46355 *
46356 * @private
46357 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
46358 * @returns {ArrayBuffer} Returns the cloned array buffer.
46359 */
46360 function cloneArrayBuffer(arrayBuffer) {
46361 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
46362 new Uint8Array(result).set(new Uint8Array(arrayBuffer));
46363 return result;
46364 }
46365
46366 /**
46367 * Creates a clone of `dataView`.
46368 *
46369 * @private
46370 * @param {Object} dataView The data view to clone.
46371 * @param {boolean} [isDeep] Specify a deep clone.
46372 * @returns {Object} Returns the cloned data view.
46373 */
46374 function cloneDataView(dataView, isDeep) {
46375 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
46376 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
46377 }
46378
46379 /**
46380 * Creates a clone of `regexp`.
46381 *
46382 * @private
46383 * @param {Object} regexp The regexp to clone.
46384 * @returns {Object} Returns the cloned regexp.
46385 */
46386 function cloneRegExp(regexp) {
46387 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
46388 result.lastIndex = regexp.lastIndex;
46389 return result;
46390 }
46391
46392 /**
46393 * Creates a clone of the `symbol` object.
46394 *
46395 * @private
46396 * @param {Object} symbol The symbol object to clone.
46397 * @returns {Object} Returns the cloned symbol object.
46398 */
46399 function cloneSymbol(symbol) {
46400 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
46401 }
46402
46403 /**
46404 * Creates a clone of `typedArray`.
46405 *
46406 * @private
46407 * @param {Object} typedArray The typed array to clone.
46408 * @param {boolean} [isDeep] Specify a deep clone.
46409 * @returns {Object} Returns the cloned typed array.
46410 */
46411 function cloneTypedArray(typedArray, isDeep) {
46412 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
46413 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
46414 }
46415
46416 /**
46417 * Compares values to sort them in ascending order.
46418 *
46419 * @private
46420 * @param {*} value The value to compare.
46421 * @param {*} other The other value to compare.
46422 * @returns {number} Returns the sort order indicator for `value`.
46423 */
46424 function compareAscending(value, other) {
46425 if (value !== other) {
46426 var valIsDefined = value !== undefined,
46427 valIsNull = value === null,
46428 valIsReflexive = value === value,
46429 valIsSymbol = isSymbol(value);
46430
46431 var othIsDefined = other !== undefined,
46432 othIsNull = other === null,
46433 othIsReflexive = other === other,
46434 othIsSymbol = isSymbol(other);
46435
46436 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
46437 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
46438 (valIsNull && othIsDefined && othIsReflexive) ||
46439 (!valIsDefined && othIsReflexive) ||
46440 !valIsReflexive) {
46441 return 1;
46442 }
46443 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
46444 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
46445 (othIsNull && valIsDefined && valIsReflexive) ||
46446 (!othIsDefined && valIsReflexive) ||
46447 !othIsReflexive) {
46448 return -1;
46449 }
46450 }
46451 return 0;
46452 }
46453
46454 /**
46455 * Used by `_.orderBy` to compare multiple properties of a value to another
46456 * and stable sort them.
46457 *
46458 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
46459 * specify an order of "desc" for descending or "asc" for ascending sort order
46460 * of corresponding values.
46461 *
46462 * @private
46463 * @param {Object} object The object to compare.
46464 * @param {Object} other The other object to compare.
46465 * @param {boolean[]|string[]} orders The order to sort by for each property.
46466 * @returns {number} Returns the sort order indicator for `object`.
46467 */
46468 function compareMultiple(object, other, orders) {
46469 var index = -1,
46470 objCriteria = object.criteria,
46471 othCriteria = other.criteria,
46472 length = objCriteria.length,
46473 ordersLength = orders.length;
46474
46475 while (++index < length) {
46476 var result = compareAscending(objCriteria[index], othCriteria[index]);
46477 if (result) {
46478 if (index >= ordersLength) {
46479 return result;
46480 }
46481 var order = orders[index];
46482 return result * (order == 'desc' ? -1 : 1);
46483 }
46484 }
46485 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
46486 // that causes it, under certain circumstances, to provide the same value for
46487 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
46488 // for more details.
46489 //
46490 // This also ensures a stable sort in V8 and other engines.
46491 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
46492 return object.index - other.index;
46493 }
46494
46495 /**
46496 * Creates an array that is the composition of partially applied arguments,
46497 * placeholders, and provided arguments into a single array of arguments.
46498 *
46499 * @private
46500 * @param {Array} args The provided arguments.
46501 * @param {Array} partials The arguments to prepend to those provided.
46502 * @param {Array} holders The `partials` placeholder indexes.
46503 * @params {boolean} [isCurried] Specify composing for a curried function.
46504 * @returns {Array} Returns the new array of composed arguments.
46505 */
46506 function composeArgs(args, partials, holders, isCurried) {
46507 var argsIndex = -1,
46508 argsLength = args.length,
46509 holdersLength = holders.length,
46510 leftIndex = -1,
46511 leftLength = partials.length,
46512 rangeLength = nativeMax(argsLength - holdersLength, 0),
46513 result = Array(leftLength + rangeLength),
46514 isUncurried = !isCurried;
46515
46516 while (++leftIndex < leftLength) {
46517 result[leftIndex] = partials[leftIndex];
46518 }
46519 while (++argsIndex < holdersLength) {
46520 if (isUncurried || argsIndex < argsLength) {
46521 result[holders[argsIndex]] = args[argsIndex];
46522 }
46523 }
46524 while (rangeLength--) {
46525 result[leftIndex++] = args[argsIndex++];
46526 }
46527 return result;
46528 }
46529
46530 /**
46531 * This function is like `composeArgs` except that the arguments composition
46532 * is tailored for `_.partialRight`.
46533 *
46534 * @private
46535 * @param {Array} args The provided arguments.
46536 * @param {Array} partials The arguments to append to those provided.
46537 * @param {Array} holders The `partials` placeholder indexes.
46538 * @params {boolean} [isCurried] Specify composing for a curried function.
46539 * @returns {Array} Returns the new array of composed arguments.
46540 */
46541 function composeArgsRight(args, partials, holders, isCurried) {
46542 var argsIndex = -1,
46543 argsLength = args.length,
46544 holdersIndex = -1,
46545 holdersLength = holders.length,
46546 rightIndex = -1,
46547 rightLength = partials.length,
46548 rangeLength = nativeMax(argsLength - holdersLength, 0),
46549 result = Array(rangeLength + rightLength),
46550 isUncurried = !isCurried;
46551
46552 while (++argsIndex < rangeLength) {
46553 result[argsIndex] = args[argsIndex];
46554 }
46555 var offset = argsIndex;
46556 while (++rightIndex < rightLength) {
46557 result[offset + rightIndex] = partials[rightIndex];
46558 }
46559 while (++holdersIndex < holdersLength) {
46560 if (isUncurried || argsIndex < argsLength) {
46561 result[offset + holders[holdersIndex]] = args[argsIndex++];
46562 }
46563 }
46564 return result;
46565 }
46566
46567 /**
46568 * Copies the values of `source` to `array`.
46569 *
46570 * @private
46571 * @param {Array} source The array to copy values from.
46572 * @param {Array} [array=[]] The array to copy values to.
46573 * @returns {Array} Returns `array`.
46574 */
46575 function copyArray(source, array) {
46576 var index = -1,
46577 length = source.length;
46578
46579 array || (array = Array(length));
46580 while (++index < length) {
46581 array[index] = source[index];
46582 }
46583 return array;
46584 }
46585
46586 /**
46587 * Copies properties of `source` to `object`.
46588 *
46589 * @private
46590 * @param {Object} source The object to copy properties from.
46591 * @param {Array} props The property identifiers to copy.
46592 * @param {Object} [object={}] The object to copy properties to.
46593 * @param {Function} [customizer] The function to customize copied values.
46594 * @returns {Object} Returns `object`.
46595 */
46596 function copyObject(source, props, object, customizer) {
46597 var isNew = !object;
46598 object || (object = {});
46599
46600 var index = -1,
46601 length = props.length;
46602
46603 while (++index < length) {
46604 var key = props[index];
46605
46606 var newValue = customizer
46607 ? customizer(object[key], source[key], key, object, source)
46608 : undefined;
46609
46610 if (newValue === undefined) {
46611 newValue = source[key];
46612 }
46613 if (isNew) {
46614 baseAssignValue(object, key, newValue);
46615 } else {
46616 assignValue(object, key, newValue);
46617 }
46618 }
46619 return object;
46620 }
46621
46622 /**
46623 * Copies own symbols of `source` to `object`.
46624 *
46625 * @private
46626 * @param {Object} source The object to copy symbols from.
46627 * @param {Object} [object={}] The object to copy symbols to.
46628 * @returns {Object} Returns `object`.
46629 */
46630 function copySymbols(source, object) {
46631 return copyObject(source, getSymbols(source), object);
46632 }
46633
46634 /**
46635 * Copies own and inherited symbols of `source` to `object`.
46636 *
46637 * @private
46638 * @param {Object} source The object to copy symbols from.
46639 * @param {Object} [object={}] The object to copy symbols to.
46640 * @returns {Object} Returns `object`.
46641 */
46642 function copySymbolsIn(source, object) {
46643 return copyObject(source, getSymbolsIn(source), object);
46644 }
46645
46646 /**
46647 * Creates a function like `_.groupBy`.
46648 *
46649 * @private
46650 * @param {Function} setter The function to set accumulator values.
46651 * @param {Function} [initializer] The accumulator object initializer.
46652 * @returns {Function} Returns the new aggregator function.
46653 */
46654 function createAggregator(setter, initializer) {
46655 return function(collection, iteratee) {
46656 var func = isArray(collection) ? arrayAggregator : baseAggregator,
46657 accumulator = initializer ? initializer() : {};
46658
46659 return func(collection, setter, getIteratee(iteratee, 2), accumulator);
46660 };
46661 }
46662
46663 /**
46664 * Creates a function like `_.assign`.
46665 *
46666 * @private
46667 * @param {Function} assigner The function to assign values.
46668 * @returns {Function} Returns the new assigner function.
46669 */
46670 function createAssigner(assigner) {
46671 return baseRest(function(object, sources) {
46672 var index = -1,
46673 length = sources.length,
46674 customizer = length > 1 ? sources[length - 1] : undefined,
46675 guard = length > 2 ? sources[2] : undefined;
46676
46677 customizer = (assigner.length > 3 && typeof customizer == 'function')
46678 ? (length--, customizer)
46679 : undefined;
46680
46681 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
46682 customizer = length < 3 ? undefined : customizer;
46683 length = 1;
46684 }
46685 object = Object(object);
46686 while (++index < length) {
46687 var source = sources[index];
46688 if (source) {
46689 assigner(object, source, index, customizer);
46690 }
46691 }
46692 return object;
46693 });
46694 }
46695
46696 /**
46697 * Creates a `baseEach` or `baseEachRight` function.
46698 *
46699 * @private
46700 * @param {Function} eachFunc The function to iterate over a collection.
46701 * @param {boolean} [fromRight] Specify iterating from right to left.
46702 * @returns {Function} Returns the new base function.
46703 */
46704 function createBaseEach(eachFunc, fromRight) {
46705 return function(collection, iteratee) {
46706 if (collection == null) {
46707 return collection;
46708 }
46709 if (!isArrayLike(collection)) {
46710 return eachFunc(collection, iteratee);
46711 }
46712 var length = collection.length,
46713 index = fromRight ? length : -1,
46714 iterable = Object(collection);
46715
46716 while ((fromRight ? index-- : ++index < length)) {
46717 if (iteratee(iterable[index], index, iterable) === false) {
46718 break;
46719 }
46720 }
46721 return collection;
46722 };
46723 }
46724
46725 /**
46726 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
46727 *
46728 * @private
46729 * @param {boolean} [fromRight] Specify iterating from right to left.
46730 * @returns {Function} Returns the new base function.
46731 */
46732 function createBaseFor(fromRight) {
46733 return function(object, iteratee, keysFunc) {
46734 var index = -1,
46735 iterable = Object(object),
46736 props = keysFunc(object),
46737 length = props.length;
46738
46739 while (length--) {
46740 var key = props[fromRight ? length : ++index];
46741 if (iteratee(iterable[key], key, iterable) === false) {
46742 break;
46743 }
46744 }
46745 return object;
46746 };
46747 }
46748
46749 /**
46750 * Creates a function that wraps `func` to invoke it with the optional `this`
46751 * binding of `thisArg`.
46752 *
46753 * @private
46754 * @param {Function} func The function to wrap.
46755 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
46756 * @param {*} [thisArg] The `this` binding of `func`.
46757 * @returns {Function} Returns the new wrapped function.
46758 */
46759 function createBind(func, bitmask, thisArg) {
46760 var isBind = bitmask & WRAP_BIND_FLAG,
46761 Ctor = createCtor(func);
46762
46763 function wrapper() {
46764 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
46765 return fn.apply(isBind ? thisArg : this, arguments);
46766 }
46767 return wrapper;
46768 }
46769
46770 /**
46771 * Creates a function like `_.lowerFirst`.
46772 *
46773 * @private
46774 * @param {string} methodName The name of the `String` case method to use.
46775 * @returns {Function} Returns the new case function.
46776 */
46777 function createCaseFirst(methodName) {
46778 return function(string) {
46779 string = toString(string);
46780
46781 var strSymbols = hasUnicode(string)
46782 ? stringToArray(string)
46783 : undefined;
46784
46785 var chr = strSymbols
46786 ? strSymbols[0]
46787 : string.charAt(0);
46788
46789 var trailing = strSymbols
46790 ? castSlice(strSymbols, 1).join('')
46791 : string.slice(1);
46792
46793 return chr[methodName]() + trailing;
46794 };
46795 }
46796
46797 /**
46798 * Creates a function like `_.camelCase`.
46799 *
46800 * @private
46801 * @param {Function} callback The function to combine each word.
46802 * @returns {Function} Returns the new compounder function.
46803 */
46804 function createCompounder(callback) {
46805 return function(string) {
46806 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
46807 };
46808 }
46809
46810 /**
46811 * Creates a function that produces an instance of `Ctor` regardless of
46812 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
46813 *
46814 * @private
46815 * @param {Function} Ctor The constructor to wrap.
46816 * @returns {Function} Returns the new wrapped function.
46817 */
46818 function createCtor(Ctor) {
46819 return function() {
46820 // Use a `switch` statement to work with class constructors. See
46821 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
46822 // for more details.
46823 var args = arguments;
46824 switch (args.length) {
46825 case 0: return new Ctor;
46826 case 1: return new Ctor(args[0]);
46827 case 2: return new Ctor(args[0], args[1]);
46828 case 3: return new Ctor(args[0], args[1], args[2]);
46829 case 4: return new Ctor(args[0], args[1], args[2], args[3]);
46830 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
46831 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
46832 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
46833 }
46834 var thisBinding = baseCreate(Ctor.prototype),
46835 result = Ctor.apply(thisBinding, args);
46836
46837 // Mimic the constructor's `return` behavior.
46838 // See https://es5.github.io/#x13.2.2 for more details.
46839 return isObject(result) ? result : thisBinding;
46840 };
46841 }
46842
46843 /**
46844 * Creates a function that wraps `func` to enable currying.
46845 *
46846 * @private
46847 * @param {Function} func The function to wrap.
46848 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
46849 * @param {number} arity The arity of `func`.
46850 * @returns {Function} Returns the new wrapped function.
46851 */
46852 function createCurry(func, bitmask, arity) {
46853 var Ctor = createCtor(func);
46854
46855 function wrapper() {
46856 var length = arguments.length,
46857 args = Array(length),
46858 index = length,
46859 placeholder = getHolder(wrapper);
46860
46861 while (index--) {
46862 args[index] = arguments[index];
46863 }
46864 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
46865 ? []
46866 : replaceHolders(args, placeholder);
46867
46868 length -= holders.length;
46869 if (length < arity) {
46870 return createRecurry(
46871 func, bitmask, createHybrid, wrapper.placeholder, undefined,
46872 args, holders, undefined, undefined, arity - length);
46873 }
46874 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
46875 return apply(fn, this, args);
46876 }
46877 return wrapper;
46878 }
46879
46880 /**
46881 * Creates a `_.find` or `_.findLast` function.
46882 *
46883 * @private
46884 * @param {Function} findIndexFunc The function to find the collection index.
46885 * @returns {Function} Returns the new find function.
46886 */
46887 function createFind(findIndexFunc) {
46888 return function(collection, predicate, fromIndex) {
46889 var iterable = Object(collection);
46890 if (!isArrayLike(collection)) {
46891 var iteratee = getIteratee(predicate, 3);
46892 collection = keys(collection);
46893 predicate = function(key) { return iteratee(iterable[key], key, iterable); };
46894 }
46895 var index = findIndexFunc(collection, predicate, fromIndex);
46896 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
46897 };
46898 }
46899
46900 /**
46901 * Creates a `_.flow` or `_.flowRight` function.
46902 *
46903 * @private
46904 * @param {boolean} [fromRight] Specify iterating from right to left.
46905 * @returns {Function} Returns the new flow function.
46906 */
46907 function createFlow(fromRight) {
46908 return flatRest(function(funcs) {
46909 var length = funcs.length,
46910 index = length,
46911 prereq = LodashWrapper.prototype.thru;
46912
46913 if (fromRight) {
46914 funcs.reverse();
46915 }
46916 while (index--) {
46917 var func = funcs[index];
46918 if (typeof func != 'function') {
46919 throw new TypeError(FUNC_ERROR_TEXT);
46920 }
46921 if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
46922 var wrapper = new LodashWrapper([], true);
46923 }
46924 }
46925 index = wrapper ? index : length;
46926 while (++index < length) {
46927 func = funcs[index];
46928
46929 var funcName = getFuncName(func),
46930 data = funcName == 'wrapper' ? getData(func) : undefined;
46931
46932 if (data && isLaziable(data[0]) &&
46933 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
46934 !data[4].length && data[9] == 1
46935 ) {
46936 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
46937 } else {
46938 wrapper = (func.length == 1 && isLaziable(func))
46939 ? wrapper[funcName]()
46940 : wrapper.thru(func);
46941 }
46942 }
46943 return function() {
46944 var args = arguments,
46945 value = args[0];
46946
46947 if (wrapper && args.length == 1 && isArray(value)) {
46948 return wrapper.plant(value).value();
46949 }
46950 var index = 0,
46951 result = length ? funcs[index].apply(this, args) : value;
46952
46953 while (++index < length) {
46954 result = funcs[index].call(this, result);
46955 }
46956 return result;
46957 };
46958 });
46959 }
46960
46961 /**
46962 * Creates a function that wraps `func` to invoke it with optional `this`
46963 * binding of `thisArg`, partial application, and currying.
46964 *
46965 * @private
46966 * @param {Function|string} func The function or method name to wrap.
46967 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
46968 * @param {*} [thisArg] The `this` binding of `func`.
46969 * @param {Array} [partials] The arguments to prepend to those provided to
46970 * the new function.
46971 * @param {Array} [holders] The `partials` placeholder indexes.
46972 * @param {Array} [partialsRight] The arguments to append to those provided
46973 * to the new function.
46974 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
46975 * @param {Array} [argPos] The argument positions of the new function.
46976 * @param {number} [ary] The arity cap of `func`.
46977 * @param {number} [arity] The arity of `func`.
46978 * @returns {Function} Returns the new wrapped function.
46979 */
46980 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
46981 var isAry = bitmask & WRAP_ARY_FLAG,
46982 isBind = bitmask & WRAP_BIND_FLAG,
46983 isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
46984 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
46985 isFlip = bitmask & WRAP_FLIP_FLAG,
46986 Ctor = isBindKey ? undefined : createCtor(func);
46987
46988 function wrapper() {
46989 var length = arguments.length,
46990 args = Array(length),
46991 index = length;
46992
46993 while (index--) {
46994 args[index] = arguments[index];
46995 }
46996 if (isCurried) {
46997 var placeholder = getHolder(wrapper),
46998 holdersCount = countHolders(args, placeholder);
46999 }
47000 if (partials) {
47001 args = composeArgs(args, partials, holders, isCurried);
47002 }
47003 if (partialsRight) {
47004 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
47005 }
47006 length -= holdersCount;
47007 if (isCurried && length < arity) {
47008 var newHolders = replaceHolders(args, placeholder);
47009 return createRecurry(
47010 func, bitmask, createHybrid, wrapper.placeholder, thisArg,
47011 args, newHolders, argPos, ary, arity - length
47012 );
47013 }
47014 var thisBinding = isBind ? thisArg : this,
47015 fn = isBindKey ? thisBinding[func] : func;
47016
47017 length = args.length;
47018 if (argPos) {
47019 args = reorder(args, argPos);
47020 } else if (isFlip && length > 1) {
47021 args.reverse();
47022 }
47023 if (isAry && ary < length) {
47024 args.length = ary;
47025 }
47026 if (this && this !== root && this instanceof wrapper) {
47027 fn = Ctor || createCtor(fn);
47028 }
47029 return fn.apply(thisBinding, args);
47030 }
47031 return wrapper;
47032 }
47033
47034 /**
47035 * Creates a function like `_.invertBy`.
47036 *
47037 * @private
47038 * @param {Function} setter The function to set accumulator values.
47039 * @param {Function} toIteratee The function to resolve iteratees.
47040 * @returns {Function} Returns the new inverter function.
47041 */
47042 function createInverter(setter, toIteratee) {
47043 return function(object, iteratee) {
47044 return baseInverter(object, setter, toIteratee(iteratee), {});
47045 };
47046 }
47047
47048 /**
47049 * Creates a function that performs a mathematical operation on two values.
47050 *
47051 * @private
47052 * @param {Function} operator The function to perform the operation.
47053 * @param {number} [defaultValue] The value used for `undefined` arguments.
47054 * @returns {Function} Returns the new mathematical operation function.
47055 */
47056 function createMathOperation(operator, defaultValue) {
47057 return function(value, other) {
47058 var result;
47059 if (value === undefined && other === undefined) {
47060 return defaultValue;
47061 }
47062 if (value !== undefined) {
47063 result = value;
47064 }
47065 if (other !== undefined) {
47066 if (result === undefined) {
47067 return other;
47068 }
47069 if (typeof value == 'string' || typeof other == 'string') {
47070 value = baseToString(value);
47071 other = baseToString(other);
47072 } else {
47073 value = baseToNumber(value);
47074 other = baseToNumber(other);
47075 }
47076 result = operator(value, other);
47077 }
47078 return result;
47079 };
47080 }
47081
47082 /**
47083 * Creates a function like `_.over`.
47084 *
47085 * @private
47086 * @param {Function} arrayFunc The function to iterate over iteratees.
47087 * @returns {Function} Returns the new over function.
47088 */
47089 function createOver(arrayFunc) {
47090 return flatRest(function(iteratees) {
47091 iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
47092 return baseRest(function(args) {
47093 var thisArg = this;
47094 return arrayFunc(iteratees, function(iteratee) {
47095 return apply(iteratee, thisArg, args);
47096 });
47097 });
47098 });
47099 }
47100
47101 /**
47102 * Creates the padding for `string` based on `length`. The `chars` string
47103 * is truncated if the number of characters exceeds `length`.
47104 *
47105 * @private
47106 * @param {number} length The padding length.
47107 * @param {string} [chars=' '] The string used as padding.
47108 * @returns {string} Returns the padding for `string`.
47109 */
47110 function createPadding(length, chars) {
47111 chars = chars === undefined ? ' ' : baseToString(chars);
47112
47113 var charsLength = chars.length;
47114 if (charsLength < 2) {
47115 return charsLength ? baseRepeat(chars, length) : chars;
47116 }
47117 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
47118 return hasUnicode(chars)
47119 ? castSlice(stringToArray(result), 0, length).join('')
47120 : result.slice(0, length);
47121 }
47122
47123 /**
47124 * Creates a function that wraps `func` to invoke it with the `this` binding
47125 * of `thisArg` and `partials` prepended to the arguments it receives.
47126 *
47127 * @private
47128 * @param {Function} func The function to wrap.
47129 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
47130 * @param {*} thisArg The `this` binding of `func`.
47131 * @param {Array} partials The arguments to prepend to those provided to
47132 * the new function.
47133 * @returns {Function} Returns the new wrapped function.
47134 */
47135 function createPartial(func, bitmask, thisArg, partials) {
47136 var isBind = bitmask & WRAP_BIND_FLAG,
47137 Ctor = createCtor(func);
47138
47139 function wrapper() {
47140 var argsIndex = -1,
47141 argsLength = arguments.length,
47142 leftIndex = -1,
47143 leftLength = partials.length,
47144 args = Array(leftLength + argsLength),
47145 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
47146
47147 while (++leftIndex < leftLength) {
47148 args[leftIndex] = partials[leftIndex];
47149 }
47150 while (argsLength--) {
47151 args[leftIndex++] = arguments[++argsIndex];
47152 }
47153 return apply(fn, isBind ? thisArg : this, args);
47154 }
47155 return wrapper;
47156 }
47157
47158 /**
47159 * Creates a `_.range` or `_.rangeRight` function.
47160 *
47161 * @private
47162 * @param {boolean} [fromRight] Specify iterating from right to left.
47163 * @returns {Function} Returns the new range function.
47164 */
47165 function createRange(fromRight) {
47166 return function(start, end, step) {
47167 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
47168 end = step = undefined;
47169 }
47170 // Ensure the sign of `-0` is preserved.
47171 start = toFinite(start);
47172 if (end === undefined) {
47173 end = start;
47174 start = 0;
47175 } else {
47176 end = toFinite(end);
47177 }
47178 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
47179 return baseRange(start, end, step, fromRight);
47180 };
47181 }
47182
47183 /**
47184 * Creates a function that performs a relational operation on two values.
47185 *
47186 * @private
47187 * @param {Function} operator The function to perform the operation.
47188 * @returns {Function} Returns the new relational operation function.
47189 */
47190 function createRelationalOperation(operator) {
47191 return function(value, other) {
47192 if (!(typeof value == 'string' && typeof other == 'string')) {
47193 value = toNumber(value);
47194 other = toNumber(other);
47195 }
47196 return operator(value, other);
47197 };
47198 }
47199
47200 /**
47201 * Creates a function that wraps `func` to continue currying.
47202 *
47203 * @private
47204 * @param {Function} func The function to wrap.
47205 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
47206 * @param {Function} wrapFunc The function to create the `func` wrapper.
47207 * @param {*} placeholder The placeholder value.
47208 * @param {*} [thisArg] The `this` binding of `func`.
47209 * @param {Array} [partials] The arguments to prepend to those provided to
47210 * the new function.
47211 * @param {Array} [holders] The `partials` placeholder indexes.
47212 * @param {Array} [argPos] The argument positions of the new function.
47213 * @param {number} [ary] The arity cap of `func`.
47214 * @param {number} [arity] The arity of `func`.
47215 * @returns {Function} Returns the new wrapped function.
47216 */
47217 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
47218 var isCurry = bitmask & WRAP_CURRY_FLAG,
47219 newHolders = isCurry ? holders : undefined,
47220 newHoldersRight = isCurry ? undefined : holders,
47221 newPartials = isCurry ? partials : undefined,
47222 newPartialsRight = isCurry ? undefined : partials;
47223
47224 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
47225 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
47226
47227 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
47228 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
47229 }
47230 var newData = [
47231 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
47232 newHoldersRight, argPos, ary, arity
47233 ];
47234
47235 var result = wrapFunc.apply(undefined, newData);
47236 if (isLaziable(func)) {
47237 setData(result, newData);
47238 }
47239 result.placeholder = placeholder;
47240 return setWrapToString(result, func, bitmask);
47241 }
47242
47243 /**
47244 * Creates a function like `_.round`.
47245 *
47246 * @private
47247 * @param {string} methodName The name of the `Math` method to use when rounding.
47248 * @returns {Function} Returns the new round function.
47249 */
47250 function createRound(methodName) {
47251 var func = Math[methodName];
47252 return function(number, precision) {
47253 number = toNumber(number);
47254 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
47255 if (precision && nativeIsFinite(number)) {
47256 // Shift with exponential notation to avoid floating-point issues.
47257 // See [MDN](https://mdn.io/round#Examples) for more details.
47258 var pair = (toString(number) + 'e').split('e'),
47259 value = func(pair[0] + 'e' + (+pair[1] + precision));
47260
47261 pair = (toString(value) + 'e').split('e');
47262 return +(pair[0] + 'e' + (+pair[1] - precision));
47263 }
47264 return func(number);
47265 };
47266 }
47267
47268 /**
47269 * Creates a set object of `values`.
47270 *
47271 * @private
47272 * @param {Array} values The values to add to the set.
47273 * @returns {Object} Returns the new set.
47274 */
47275 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
47276 return new Set(values);
47277 };
47278
47279 /**
47280 * Creates a `_.toPairs` or `_.toPairsIn` function.
47281 *
47282 * @private
47283 * @param {Function} keysFunc The function to get the keys of a given object.
47284 * @returns {Function} Returns the new pairs function.
47285 */
47286 function createToPairs(keysFunc) {
47287 return function(object) {
47288 var tag = getTag(object);
47289 if (tag == mapTag) {
47290 return mapToArray(object);
47291 }
47292 if (tag == setTag) {
47293 return setToPairs(object);
47294 }
47295 return baseToPairs(object, keysFunc(object));
47296 };
47297 }
47298
47299 /**
47300 * Creates a function that either curries or invokes `func` with optional
47301 * `this` binding and partially applied arguments.
47302 *
47303 * @private
47304 * @param {Function|string} func The function or method name to wrap.
47305 * @param {number} bitmask The bitmask flags.
47306 * 1 - `_.bind`
47307 * 2 - `_.bindKey`
47308 * 4 - `_.curry` or `_.curryRight` of a bound function
47309 * 8 - `_.curry`
47310 * 16 - `_.curryRight`
47311 * 32 - `_.partial`
47312 * 64 - `_.partialRight`
47313 * 128 - `_.rearg`
47314 * 256 - `_.ary`
47315 * 512 - `_.flip`
47316 * @param {*} [thisArg] The `this` binding of `func`.
47317 * @param {Array} [partials] The arguments to be partially applied.
47318 * @param {Array} [holders] The `partials` placeholder indexes.
47319 * @param {Array} [argPos] The argument positions of the new function.
47320 * @param {number} [ary] The arity cap of `func`.
47321 * @param {number} [arity] The arity of `func`.
47322 * @returns {Function} Returns the new wrapped function.
47323 */
47324 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
47325 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
47326 if (!isBindKey && typeof func != 'function') {
47327 throw new TypeError(FUNC_ERROR_TEXT);
47328 }
47329 var length = partials ? partials.length : 0;
47330 if (!length) {
47331 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
47332 partials = holders = undefined;
47333 }
47334 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
47335 arity = arity === undefined ? arity : toInteger(arity);
47336 length -= holders ? holders.length : 0;
47337
47338 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
47339 var partialsRight = partials,
47340 holdersRight = holders;
47341
47342 partials = holders = undefined;
47343 }
47344 var data = isBindKey ? undefined : getData(func);
47345
47346 var newData = [
47347 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
47348 argPos, ary, arity
47349 ];
47350
47351 if (data) {
47352 mergeData(newData, data);
47353 }
47354 func = newData[0];
47355 bitmask = newData[1];
47356 thisArg = newData[2];
47357 partials = newData[3];
47358 holders = newData[4];
47359 arity = newData[9] = newData[9] === undefined
47360 ? (isBindKey ? 0 : func.length)
47361 : nativeMax(newData[9] - length, 0);
47362
47363 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
47364 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
47365 }
47366 if (!bitmask || bitmask == WRAP_BIND_FLAG) {
47367 var result = createBind(func, bitmask, thisArg);
47368 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
47369 result = createCurry(func, bitmask, arity);
47370 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
47371 result = createPartial(func, bitmask, thisArg, partials);
47372 } else {
47373 result = createHybrid.apply(undefined, newData);
47374 }
47375 var setter = data ? baseSetData : setData;
47376 return setWrapToString(setter(result, newData), func, bitmask);
47377 }
47378
47379 /**
47380 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
47381 * of source objects to the destination object for all destination properties
47382 * that resolve to `undefined`.
47383 *
47384 * @private
47385 * @param {*} objValue The destination value.
47386 * @param {*} srcValue The source value.
47387 * @param {string} key The key of the property to assign.
47388 * @param {Object} object The parent object of `objValue`.
47389 * @returns {*} Returns the value to assign.
47390 */
47391 function customDefaultsAssignIn(objValue, srcValue, key, object) {
47392 if (objValue === undefined ||
47393 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
47394 return srcValue;
47395 }
47396 return objValue;
47397 }
47398
47399 /**
47400 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
47401 * objects into destination objects that are passed thru.
47402 *
47403 * @private
47404 * @param {*} objValue The destination value.
47405 * @param {*} srcValue The source value.
47406 * @param {string} key The key of the property to merge.
47407 * @param {Object} object The parent object of `objValue`.
47408 * @param {Object} source The parent object of `srcValue`.
47409 * @param {Object} [stack] Tracks traversed source values and their merged
47410 * counterparts.
47411 * @returns {*} Returns the value to assign.
47412 */
47413 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
47414 if (isObject(objValue) && isObject(srcValue)) {
47415 // Recursively merge objects and arrays (susceptible to call stack limits).
47416 stack.set(srcValue, objValue);
47417 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
47418 stack['delete'](srcValue);
47419 }
47420 return objValue;
47421 }
47422
47423 /**
47424 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
47425 * objects.
47426 *
47427 * @private
47428 * @param {*} value The value to inspect.
47429 * @param {string} key The key of the property to inspect.
47430 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
47431 */
47432 function customOmitClone(value) {
47433 return isPlainObject(value) ? undefined : value;
47434 }
47435
47436 /**
47437 * A specialized version of `baseIsEqualDeep` for arrays with support for
47438 * partial deep comparisons.
47439 *
47440 * @private
47441 * @param {Array} array The array to compare.
47442 * @param {Array} other The other array to compare.
47443 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
47444 * @param {Function} customizer The function to customize comparisons.
47445 * @param {Function} equalFunc The function to determine equivalents of values.
47446 * @param {Object} stack Tracks traversed `array` and `other` objects.
47447 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
47448 */
47449 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
47450 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
47451 arrLength = array.length,
47452 othLength = other.length;
47453
47454 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
47455 return false;
47456 }
47457 // Assume cyclic values are equal.
47458 var stacked = stack.get(array);
47459 if (stacked && stack.get(other)) {
47460 return stacked == other;
47461 }
47462 var index = -1,
47463 result = true,
47464 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
47465
47466 stack.set(array, other);
47467 stack.set(other, array);
47468
47469 // Ignore non-index properties.
47470 while (++index < arrLength) {
47471 var arrValue = array[index],
47472 othValue = other[index];
47473
47474 if (customizer) {
47475 var compared = isPartial
47476 ? customizer(othValue, arrValue, index, other, array, stack)
47477 : customizer(arrValue, othValue, index, array, other, stack);
47478 }
47479 if (compared !== undefined) {
47480 if (compared) {
47481 continue;
47482 }
47483 result = false;
47484 break;
47485 }
47486 // Recursively compare arrays (susceptible to call stack limits).
47487 if (seen) {
47488 if (!arraySome(other, function(othValue, othIndex) {
47489 if (!cacheHas(seen, othIndex) &&
47490 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
47491 return seen.push(othIndex);
47492 }
47493 })) {
47494 result = false;
47495 break;
47496 }
47497 } else if (!(
47498 arrValue === othValue ||
47499 equalFunc(arrValue, othValue, bitmask, customizer, stack)
47500 )) {
47501 result = false;
47502 break;
47503 }
47504 }
47505 stack['delete'](array);
47506 stack['delete'](other);
47507 return result;
47508 }
47509
47510 /**
47511 * A specialized version of `baseIsEqualDeep` for comparing objects of
47512 * the same `toStringTag`.
47513 *
47514 * **Note:** This function only supports comparing values with tags of
47515 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
47516 *
47517 * @private
47518 * @param {Object} object The object to compare.
47519 * @param {Object} other The other object to compare.
47520 * @param {string} tag The `toStringTag` of the objects to compare.
47521 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
47522 * @param {Function} customizer The function to customize comparisons.
47523 * @param {Function} equalFunc The function to determine equivalents of values.
47524 * @param {Object} stack Tracks traversed `object` and `other` objects.
47525 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
47526 */
47527 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
47528 switch (tag) {
47529 case dataViewTag:
47530 if ((object.byteLength != other.byteLength) ||
47531 (object.byteOffset != other.byteOffset)) {
47532 return false;
47533 }
47534 object = object.buffer;
47535 other = other.buffer;
47536
47537 case arrayBufferTag:
47538 if ((object.byteLength != other.byteLength) ||
47539 !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
47540 return false;
47541 }
47542 return true;
47543
47544 case boolTag:
47545 case dateTag:
47546 case numberTag:
47547 // Coerce booleans to `1` or `0` and dates to milliseconds.
47548 // Invalid dates are coerced to `NaN`.
47549 return eq(+object, +other);
47550
47551 case errorTag:
47552 return object.name == other.name && object.message == other.message;
47553
47554 case regexpTag:
47555 case stringTag:
47556 // Coerce regexes to strings and treat strings, primitives and objects,
47557 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
47558 // for more details.
47559 return object == (other + '');
47560
47561 case mapTag:
47562 var convert = mapToArray;
47563
47564 case setTag:
47565 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
47566 convert || (convert = setToArray);
47567
47568 if (object.size != other.size && !isPartial) {
47569 return false;
47570 }
47571 // Assume cyclic values are equal.
47572 var stacked = stack.get(object);
47573 if (stacked) {
47574 return stacked == other;
47575 }
47576 bitmask |= COMPARE_UNORDERED_FLAG;
47577
47578 // Recursively compare objects (susceptible to call stack limits).
47579 stack.set(object, other);
47580 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
47581 stack['delete'](object);
47582 return result;
47583
47584 case symbolTag:
47585 if (symbolValueOf) {
47586 return symbolValueOf.call(object) == symbolValueOf.call(other);
47587 }
47588 }
47589 return false;
47590 }
47591
47592 /**
47593 * A specialized version of `baseIsEqualDeep` for objects with support for
47594 * partial deep comparisons.
47595 *
47596 * @private
47597 * @param {Object} object The object to compare.
47598 * @param {Object} other The other object to compare.
47599 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
47600 * @param {Function} customizer The function to customize comparisons.
47601 * @param {Function} equalFunc The function to determine equivalents of values.
47602 * @param {Object} stack Tracks traversed `object` and `other` objects.
47603 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
47604 */
47605 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
47606 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
47607 objProps = getAllKeys(object),
47608 objLength = objProps.length,
47609 othProps = getAllKeys(other),
47610 othLength = othProps.length;
47611
47612 if (objLength != othLength && !isPartial) {
47613 return false;
47614 }
47615 var index = objLength;
47616 while (index--) {
47617 var key = objProps[index];
47618 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
47619 return false;
47620 }
47621 }
47622 // Assume cyclic values are equal.
47623 var stacked = stack.get(object);
47624 if (stacked && stack.get(other)) {
47625 return stacked == other;
47626 }
47627 var result = true;
47628 stack.set(object, other);
47629 stack.set(other, object);
47630
47631 var skipCtor = isPartial;
47632 while (++index < objLength) {
47633 key = objProps[index];
47634 var objValue = object[key],
47635 othValue = other[key];
47636
47637 if (customizer) {
47638 var compared = isPartial
47639 ? customizer(othValue, objValue, key, other, object, stack)
47640 : customizer(objValue, othValue, key, object, other, stack);
47641 }
47642 // Recursively compare objects (susceptible to call stack limits).
47643 if (!(compared === undefined
47644 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
47645 : compared
47646 )) {
47647 result = false;
47648 break;
47649 }
47650 skipCtor || (skipCtor = key == 'constructor');
47651 }
47652 if (result && !skipCtor) {
47653 var objCtor = object.constructor,
47654 othCtor = other.constructor;
47655
47656 // Non `Object` object instances with different constructors are not equal.
47657 if (objCtor != othCtor &&
47658 ('constructor' in object && 'constructor' in other) &&
47659 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
47660 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
47661 result = false;
47662 }
47663 }
47664 stack['delete'](object);
47665 stack['delete'](other);
47666 return result;
47667 }
47668
47669 /**
47670 * A specialized version of `baseRest` which flattens the rest array.
47671 *
47672 * @private
47673 * @param {Function} func The function to apply a rest parameter to.
47674 * @returns {Function} Returns the new function.
47675 */
47676 function flatRest(func) {
47677 return setToString(overRest(func, undefined, flatten), func + '');
47678 }
47679
47680 /**
47681 * Creates an array of own enumerable property names and symbols of `object`.
47682 *
47683 * @private
47684 * @param {Object} object The object to query.
47685 * @returns {Array} Returns the array of property names and symbols.
47686 */
47687 function getAllKeys(object) {
47688 return baseGetAllKeys(object, keys, getSymbols);
47689 }
47690
47691 /**
47692 * Creates an array of own and inherited enumerable property names and
47693 * symbols of `object`.
47694 *
47695 * @private
47696 * @param {Object} object The object to query.
47697 * @returns {Array} Returns the array of property names and symbols.
47698 */
47699 function getAllKeysIn(object) {
47700 return baseGetAllKeys(object, keysIn, getSymbolsIn);
47701 }
47702
47703 /**
47704 * Gets metadata for `func`.
47705 *
47706 * @private
47707 * @param {Function} func The function to query.
47708 * @returns {*} Returns the metadata for `func`.
47709 */
47710 var getData = !metaMap ? noop : function(func) {
47711 return metaMap.get(func);
47712 };
47713
47714 /**
47715 * Gets the name of `func`.
47716 *
47717 * @private
47718 * @param {Function} func The function to query.
47719 * @returns {string} Returns the function name.
47720 */
47721 function getFuncName(func) {
47722 var result = (func.name + ''),
47723 array = realNames[result],
47724 length = hasOwnProperty.call(realNames, result) ? array.length : 0;
47725
47726 while (length--) {
47727 var data = array[length],
47728 otherFunc = data.func;
47729 if (otherFunc == null || otherFunc == func) {
47730 return data.name;
47731 }
47732 }
47733 return result;
47734 }
47735
47736 /**
47737 * Gets the argument placeholder value for `func`.
47738 *
47739 * @private
47740 * @param {Function} func The function to inspect.
47741 * @returns {*} Returns the placeholder value.
47742 */
47743 function getHolder(func) {
47744 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
47745 return object.placeholder;
47746 }
47747
47748 /**
47749 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
47750 * this function returns the custom method, otherwise it returns `baseIteratee`.
47751 * If arguments are provided, the chosen function is invoked with them and
47752 * its result is returned.
47753 *
47754 * @private
47755 * @param {*} [value] The value to convert to an iteratee.
47756 * @param {number} [arity] The arity of the created iteratee.
47757 * @returns {Function} Returns the chosen function or its result.
47758 */
47759 function getIteratee() {
47760 var result = lodash.iteratee || iteratee;
47761 result = result === iteratee ? baseIteratee : result;
47762 return arguments.length ? result(arguments[0], arguments[1]) : result;
47763 }
47764
47765 /**
47766 * Gets the data for `map`.
47767 *
47768 * @private
47769 * @param {Object} map The map to query.
47770 * @param {string} key The reference key.
47771 * @returns {*} Returns the map data.
47772 */
47773 function getMapData(map, key) {
47774 var data = map.__data__;
47775 return isKeyable(key)
47776 ? data[typeof key == 'string' ? 'string' : 'hash']
47777 : data.map;
47778 }
47779
47780 /**
47781 * Gets the property names, values, and compare flags of `object`.
47782 *
47783 * @private
47784 * @param {Object} object The object to query.
47785 * @returns {Array} Returns the match data of `object`.
47786 */
47787 function getMatchData(object) {
47788 var result = keys(object),
47789 length = result.length;
47790
47791 while (length--) {
47792 var key = result[length],
47793 value = object[key];
47794
47795 result[length] = [key, value, isStrictComparable(value)];
47796 }
47797 return result;
47798 }
47799
47800 /**
47801 * Gets the native function at `key` of `object`.
47802 *
47803 * @private
47804 * @param {Object} object The object to query.
47805 * @param {string} key The key of the method to get.
47806 * @returns {*} Returns the function if it's native, else `undefined`.
47807 */
47808 function getNative(object, key) {
47809 var value = getValue(object, key);
47810 return baseIsNative(value) ? value : undefined;
47811 }
47812
47813 /**
47814 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
47815 *
47816 * @private
47817 * @param {*} value The value to query.
47818 * @returns {string} Returns the raw `toStringTag`.
47819 */
47820 function getRawTag(value) {
47821 var isOwn = hasOwnProperty.call(value, symToStringTag),
47822 tag = value[symToStringTag];
47823
47824 try {
47825 value[symToStringTag] = undefined;
47826 var unmasked = true;
47827 } catch (e) {}
47828
47829 var result = nativeObjectToString.call(value);
47830 if (unmasked) {
47831 if (isOwn) {
47832 value[symToStringTag] = tag;
47833 } else {
47834 delete value[symToStringTag];
47835 }
47836 }
47837 return result;
47838 }
47839
47840 /**
47841 * Creates an array of the own enumerable symbols of `object`.
47842 *
47843 * @private
47844 * @param {Object} object The object to query.
47845 * @returns {Array} Returns the array of symbols.
47846 */
47847 var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
47848 if (object == null) {
47849 return [];
47850 }
47851 object = Object(object);
47852 return arrayFilter(nativeGetSymbols(object), function(symbol) {
47853 return propertyIsEnumerable.call(object, symbol);
47854 });
47855 };
47856
47857 /**
47858 * Creates an array of the own and inherited enumerable symbols of `object`.
47859 *
47860 * @private
47861 * @param {Object} object The object to query.
47862 * @returns {Array} Returns the array of symbols.
47863 */
47864 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
47865 var result = [];
47866 while (object) {
47867 arrayPush(result, getSymbols(object));
47868 object = getPrototype(object);
47869 }
47870 return result;
47871 };
47872
47873 /**
47874 * Gets the `toStringTag` of `value`.
47875 *
47876 * @private
47877 * @param {*} value The value to query.
47878 * @returns {string} Returns the `toStringTag`.
47879 */
47880 var getTag = baseGetTag;
47881
47882 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
47883 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
47884 (Map && getTag(new Map) != mapTag) ||
47885 (Promise && getTag(Promise.resolve()) != promiseTag) ||
47886 (Set && getTag(new Set) != setTag) ||
47887 (WeakMap && getTag(new WeakMap) != weakMapTag)) {
47888 getTag = function(value) {
47889 var result = baseGetTag(value),
47890 Ctor = result == objectTag ? value.constructor : undefined,
47891 ctorString = Ctor ? toSource(Ctor) : '';
47892
47893 if (ctorString) {
47894 switch (ctorString) {
47895 case dataViewCtorString: return dataViewTag;
47896 case mapCtorString: return mapTag;
47897 case promiseCtorString: return promiseTag;
47898 case setCtorString: return setTag;
47899 case weakMapCtorString: return weakMapTag;
47900 }
47901 }
47902 return result;
47903 };
47904 }
47905
47906 /**
47907 * Gets the view, applying any `transforms` to the `start` and `end` positions.
47908 *
47909 * @private
47910 * @param {number} start The start of the view.
47911 * @param {number} end The end of the view.
47912 * @param {Array} transforms The transformations to apply to the view.
47913 * @returns {Object} Returns an object containing the `start` and `end`
47914 * positions of the view.
47915 */
47916 function getView(start, end, transforms) {
47917 var index = -1,
47918 length = transforms.length;
47919
47920 while (++index < length) {
47921 var data = transforms[index],
47922 size = data.size;
47923
47924 switch (data.type) {
47925 case 'drop': start += size; break;
47926 case 'dropRight': end -= size; break;
47927 case 'take': end = nativeMin(end, start + size); break;
47928 case 'takeRight': start = nativeMax(start, end - size); break;
47929 }
47930 }
47931 return { 'start': start, 'end': end };
47932 }
47933
47934 /**
47935 * Extracts wrapper details from the `source` body comment.
47936 *
47937 * @private
47938 * @param {string} source The source to inspect.
47939 * @returns {Array} Returns the wrapper details.
47940 */
47941 function getWrapDetails(source) {
47942 var match = source.match(reWrapDetails);
47943 return match ? match[1].split(reSplitDetails) : [];
47944 }
47945
47946 /**
47947 * Checks if `path` exists on `object`.
47948 *
47949 * @private
47950 * @param {Object} object The object to query.
47951 * @param {Array|string} path The path to check.
47952 * @param {Function} hasFunc The function to check properties.
47953 * @returns {boolean} Returns `true` if `path` exists, else `false`.
47954 */
47955 function hasPath(object, path, hasFunc) {
47956 path = castPath(path, object);
47957
47958 var index = -1,
47959 length = path.length,
47960 result = false;
47961
47962 while (++index < length) {
47963 var key = toKey(path[index]);
47964 if (!(result = object != null && hasFunc(object, key))) {
47965 break;
47966 }
47967 object = object[key];
47968 }
47969 if (result || ++index != length) {
47970 return result;
47971 }
47972 length = object == null ? 0 : object.length;
47973 return !!length && isLength(length) && isIndex(key, length) &&
47974 (isArray(object) || isArguments(object));
47975 }
47976
47977 /**
47978 * Initializes an array clone.
47979 *
47980 * @private
47981 * @param {Array} array The array to clone.
47982 * @returns {Array} Returns the initialized clone.
47983 */
47984 function initCloneArray(array) {
47985 var length = array.length,
47986 result = new array.constructor(length);
47987
47988 // Add properties assigned by `RegExp#exec`.
47989 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
47990 result.index = array.index;
47991 result.input = array.input;
47992 }
47993 return result;
47994 }
47995
47996 /**
47997 * Initializes an object clone.
47998 *
47999 * @private
48000 * @param {Object} object The object to clone.
48001 * @returns {Object} Returns the initialized clone.
48002 */
48003 function initCloneObject(object) {
48004 return (typeof object.constructor == 'function' && !isPrototype(object))
48005 ? baseCreate(getPrototype(object))
48006 : {};
48007 }
48008
48009 /**
48010 * Initializes an object clone based on its `toStringTag`.
48011 *
48012 * **Note:** This function only supports cloning values with tags of
48013 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
48014 *
48015 * @private
48016 * @param {Object} object The object to clone.
48017 * @param {string} tag The `toStringTag` of the object to clone.
48018 * @param {boolean} [isDeep] Specify a deep clone.
48019 * @returns {Object} Returns the initialized clone.
48020 */
48021 function initCloneByTag(object, tag, isDeep) {
48022 var Ctor = object.constructor;
48023 switch (tag) {
48024 case arrayBufferTag:
48025 return cloneArrayBuffer(object);
48026
48027 case boolTag:
48028 case dateTag:
48029 return new Ctor(+object);
48030
48031 case dataViewTag:
48032 return cloneDataView(object, isDeep);
48033
48034 case float32Tag: case float64Tag:
48035 case int8Tag: case int16Tag: case int32Tag:
48036 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
48037 return cloneTypedArray(object, isDeep);
48038
48039 case mapTag:
48040 return new Ctor;
48041
48042 case numberTag:
48043 case stringTag:
48044 return new Ctor(object);
48045
48046 case regexpTag:
48047 return cloneRegExp(object);
48048
48049 case setTag:
48050 return new Ctor;
48051
48052 case symbolTag:
48053 return cloneSymbol(object);
48054 }
48055 }
48056
48057 /**
48058 * Inserts wrapper `details` in a comment at the top of the `source` body.
48059 *
48060 * @private
48061 * @param {string} source The source to modify.
48062 * @returns {Array} details The details to insert.
48063 * @returns {string} Returns the modified source.
48064 */
48065 function insertWrapDetails(source, details) {
48066 var length = details.length;
48067 if (!length) {
48068 return source;
48069 }
48070 var lastIndex = length - 1;
48071 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
48072 details = details.join(length > 2 ? ', ' : ' ');
48073 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
48074 }
48075
48076 /**
48077 * Checks if `value` is a flattenable `arguments` object or array.
48078 *
48079 * @private
48080 * @param {*} value The value to check.
48081 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
48082 */
48083 function isFlattenable(value) {
48084 return isArray(value) || isArguments(value) ||
48085 !!(spreadableSymbol && value && value[spreadableSymbol]);
48086 }
48087
48088 /**
48089 * Checks if `value` is a valid array-like index.
48090 *
48091 * @private
48092 * @param {*} value The value to check.
48093 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
48094 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
48095 */
48096 function isIndex(value, length) {
48097 var type = typeof value;
48098 length = length == null ? MAX_SAFE_INTEGER : length;
48099
48100 return !!length &&
48101 (type == 'number' ||
48102 (type != 'symbol' && reIsUint.test(value))) &&
48103 (value > -1 && value % 1 == 0 && value < length);
48104 }
48105
48106 /**
48107 * Checks if the given arguments are from an iteratee call.
48108 *
48109 * @private
48110 * @param {*} value The potential iteratee value argument.
48111 * @param {*} index The potential iteratee index or key argument.
48112 * @param {*} object The potential iteratee object argument.
48113 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
48114 * else `false`.
48115 */
48116 function isIterateeCall(value, index, object) {
48117 if (!isObject(object)) {
48118 return false;
48119 }
48120 var type = typeof index;
48121 if (type == 'number'
48122 ? (isArrayLike(object) && isIndex(index, object.length))
48123 : (type == 'string' && index in object)
48124 ) {
48125 return eq(object[index], value);
48126 }
48127 return false;
48128 }
48129
48130 /**
48131 * Checks if `value` is a property name and not a property path.
48132 *
48133 * @private
48134 * @param {*} value The value to check.
48135 * @param {Object} [object] The object to query keys on.
48136 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
48137 */
48138 function isKey(value, object) {
48139 if (isArray(value)) {
48140 return false;
48141 }
48142 var type = typeof value;
48143 if (type == 'number' || type == 'symbol' || type == 'boolean' ||
48144 value == null || isSymbol(value)) {
48145 return true;
48146 }
48147 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
48148 (object != null && value in Object(object));
48149 }
48150
48151 /**
48152 * Checks if `value` is suitable for use as unique object key.
48153 *
48154 * @private
48155 * @param {*} value The value to check.
48156 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
48157 */
48158 function isKeyable(value) {
48159 var type = typeof value;
48160 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
48161 ? (value !== '__proto__')
48162 : (value === null);
48163 }
48164
48165 /**
48166 * Checks if `func` has a lazy counterpart.
48167 *
48168 * @private
48169 * @param {Function} func The function to check.
48170 * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
48171 * else `false`.
48172 */
48173 function isLaziable(func) {
48174 var funcName = getFuncName(func),
48175 other = lodash[funcName];
48176
48177 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
48178 return false;
48179 }
48180 if (func === other) {
48181 return true;
48182 }
48183 var data = getData(other);
48184 return !!data && func === data[0];
48185 }
48186
48187 /**
48188 * Checks if `func` has its source masked.
48189 *
48190 * @private
48191 * @param {Function} func The function to check.
48192 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
48193 */
48194 function isMasked(func) {
48195 return !!maskSrcKey && (maskSrcKey in func);
48196 }
48197
48198 /**
48199 * Checks if `func` is capable of being masked.
48200 *
48201 * @private
48202 * @param {*} value The value to check.
48203 * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
48204 */
48205 var isMaskable = coreJsData ? isFunction : stubFalse;
48206
48207 /**
48208 * Checks if `value` is likely a prototype object.
48209 *
48210 * @private
48211 * @param {*} value The value to check.
48212 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
48213 */
48214 function isPrototype(value) {
48215 var Ctor = value && value.constructor,
48216 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
48217
48218 return value === proto;
48219 }
48220
48221 /**
48222 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
48223 *
48224 * @private
48225 * @param {*} value The value to check.
48226 * @returns {boolean} Returns `true` if `value` if suitable for strict
48227 * equality comparisons, else `false`.
48228 */
48229 function isStrictComparable(value) {
48230 return value === value && !isObject(value);
48231 }
48232
48233 /**
48234 * A specialized version of `matchesProperty` for source values suitable
48235 * for strict equality comparisons, i.e. `===`.
48236 *
48237 * @private
48238 * @param {string} key The key of the property to get.
48239 * @param {*} srcValue The value to match.
48240 * @returns {Function} Returns the new spec function.
48241 */
48242 function matchesStrictComparable(key, srcValue) {
48243 return function(object) {
48244 if (object == null) {
48245 return false;
48246 }
48247 return object[key] === srcValue &&
48248 (srcValue !== undefined || (key in Object(object)));
48249 };
48250 }
48251
48252 /**
48253 * A specialized version of `_.memoize` which clears the memoized function's
48254 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
48255 *
48256 * @private
48257 * @param {Function} func The function to have its output memoized.
48258 * @returns {Function} Returns the new memoized function.
48259 */
48260 function memoizeCapped(func) {
48261 var result = memoize(func, function(key) {
48262 if (cache.size === MAX_MEMOIZE_SIZE) {
48263 cache.clear();
48264 }
48265 return key;
48266 });
48267
48268 var cache = result.cache;
48269 return result;
48270 }
48271
48272 /**
48273 * Merges the function metadata of `source` into `data`.
48274 *
48275 * Merging metadata reduces the number of wrappers used to invoke a function.
48276 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
48277 * may be applied regardless of execution order. Methods like `_.ary` and
48278 * `_.rearg` modify function arguments, making the order in which they are
48279 * executed important, preventing the merging of metadata. However, we make
48280 * an exception for a safe combined case where curried functions have `_.ary`
48281 * and or `_.rearg` applied.
48282 *
48283 * @private
48284 * @param {Array} data The destination metadata.
48285 * @param {Array} source The source metadata.
48286 * @returns {Array} Returns `data`.
48287 */
48288 function mergeData(data, source) {
48289 var bitmask = data[1],
48290 srcBitmask = source[1],
48291 newBitmask = bitmask | srcBitmask,
48292 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
48293
48294 var isCombo =
48295 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
48296 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
48297 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
48298
48299 // Exit early if metadata can't be merged.
48300 if (!(isCommon || isCombo)) {
48301 return data;
48302 }
48303 // Use source `thisArg` if available.
48304 if (srcBitmask & WRAP_BIND_FLAG) {
48305 data[2] = source[2];
48306 // Set when currying a bound function.
48307 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
48308 }
48309 // Compose partial arguments.
48310 var value = source[3];
48311 if (value) {
48312 var partials = data[3];
48313 data[3] = partials ? composeArgs(partials, value, source[4]) : value;
48314 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
48315 }
48316 // Compose partial right arguments.
48317 value = source[5];
48318 if (value) {
48319 partials = data[5];
48320 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
48321 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
48322 }
48323 // Use source `argPos` if available.
48324 value = source[7];
48325 if (value) {
48326 data[7] = value;
48327 }
48328 // Use source `ary` if it's smaller.
48329 if (srcBitmask & WRAP_ARY_FLAG) {
48330 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
48331 }
48332 // Use source `arity` if one is not provided.
48333 if (data[9] == null) {
48334 data[9] = source[9];
48335 }
48336 // Use source `func` and merge bitmasks.
48337 data[0] = source[0];
48338 data[1] = newBitmask;
48339
48340 return data;
48341 }
48342
48343 /**
48344 * This function is like
48345 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
48346 * except that it includes inherited enumerable properties.
48347 *
48348 * @private
48349 * @param {Object} object The object to query.
48350 * @returns {Array} Returns the array of property names.
48351 */
48352 function nativeKeysIn(object) {
48353 var result = [];
48354 if (object != null) {
48355 for (var key in Object(object)) {
48356 result.push(key);
48357 }
48358 }
48359 return result;
48360 }
48361
48362 /**
48363 * Converts `value` to a string using `Object.prototype.toString`.
48364 *
48365 * @private
48366 * @param {*} value The value to convert.
48367 * @returns {string} Returns the converted string.
48368 */
48369 function objectToString(value) {
48370 return nativeObjectToString.call(value);
48371 }
48372
48373 /**
48374 * A specialized version of `baseRest` which transforms the rest array.
48375 *
48376 * @private
48377 * @param {Function} func The function to apply a rest parameter to.
48378 * @param {number} [start=func.length-1] The start position of the rest parameter.
48379 * @param {Function} transform The rest array transform.
48380 * @returns {Function} Returns the new function.
48381 */
48382 function overRest(func, start, transform) {
48383 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
48384 return function() {
48385 var args = arguments,
48386 index = -1,
48387 length = nativeMax(args.length - start, 0),
48388 array = Array(length);
48389
48390 while (++index < length) {
48391 array[index] = args[start + index];
48392 }
48393 index = -1;
48394 var otherArgs = Array(start + 1);
48395 while (++index < start) {
48396 otherArgs[index] = args[index];
48397 }
48398 otherArgs[start] = transform(array);
48399 return apply(func, this, otherArgs);
48400 };
48401 }
48402
48403 /**
48404 * Gets the parent value at `path` of `object`.
48405 *
48406 * @private
48407 * @param {Object} object The object to query.
48408 * @param {Array} path The path to get the parent value of.
48409 * @returns {*} Returns the parent value.
48410 */
48411 function parent(object, path) {
48412 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
48413 }
48414
48415 /**
48416 * Reorder `array` according to the specified indexes where the element at
48417 * the first index is assigned as the first element, the element at
48418 * the second index is assigned as the second element, and so on.
48419 *
48420 * @private
48421 * @param {Array} array The array to reorder.
48422 * @param {Array} indexes The arranged array indexes.
48423 * @returns {Array} Returns `array`.
48424 */
48425 function reorder(array, indexes) {
48426 var arrLength = array.length,
48427 length = nativeMin(indexes.length, arrLength),
48428 oldArray = copyArray(array);
48429
48430 while (length--) {
48431 var index = indexes[length];
48432 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
48433 }
48434 return array;
48435 }
48436
48437 /**
48438 * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
48439 *
48440 * @private
48441 * @param {Object} object The object to query.
48442 * @param {string} key The key of the property to get.
48443 * @returns {*} Returns the property value.
48444 */
48445 function safeGet(object, key) {
48446 if (key === 'constructor' && typeof object[key] === 'function') {
48447 return;
48448 }
48449
48450 if (key == '__proto__') {
48451 return;
48452 }
48453
48454 return object[key];
48455 }
48456
48457 /**
48458 * Sets metadata for `func`.
48459 *
48460 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
48461 * period of time, it will trip its breaker and transition to an identity
48462 * function to avoid garbage collection pauses in V8. See
48463 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
48464 * for more details.
48465 *
48466 * @private
48467 * @param {Function} func The function to associate metadata with.
48468 * @param {*} data The metadata.
48469 * @returns {Function} Returns `func`.
48470 */
48471 var setData = shortOut(baseSetData);
48472
48473 /**
48474 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
48475 *
48476 * @private
48477 * @param {Function} func The function to delay.
48478 * @param {number} wait The number of milliseconds to delay invocation.
48479 * @returns {number|Object} Returns the timer id or timeout object.
48480 */
48481 var setTimeout = ctxSetTimeout || function(func, wait) {
48482 return root.setTimeout(func, wait);
48483 };
48484
48485 /**
48486 * Sets the `toString` method of `func` to return `string`.
48487 *
48488 * @private
48489 * @param {Function} func The function to modify.
48490 * @param {Function} string The `toString` result.
48491 * @returns {Function} Returns `func`.
48492 */
48493 var setToString = shortOut(baseSetToString);
48494
48495 /**
48496 * Sets the `toString` method of `wrapper` to mimic the source of `reference`
48497 * with wrapper details in a comment at the top of the source body.
48498 *
48499 * @private
48500 * @param {Function} wrapper The function to modify.
48501 * @param {Function} reference The reference function.
48502 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
48503 * @returns {Function} Returns `wrapper`.
48504 */
48505 function setWrapToString(wrapper, reference, bitmask) {
48506 var source = (reference + '');
48507 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
48508 }
48509
48510 /**
48511 * Creates a function that'll short out and invoke `identity` instead
48512 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
48513 * milliseconds.
48514 *
48515 * @private
48516 * @param {Function} func The function to restrict.
48517 * @returns {Function} Returns the new shortable function.
48518 */
48519 function shortOut(func) {
48520 var count = 0,
48521 lastCalled = 0;
48522
48523 return function() {
48524 var stamp = nativeNow(),
48525 remaining = HOT_SPAN - (stamp - lastCalled);
48526
48527 lastCalled = stamp;
48528 if (remaining > 0) {
48529 if (++count >= HOT_COUNT) {
48530 return arguments[0];
48531 }
48532 } else {
48533 count = 0;
48534 }
48535 return func.apply(undefined, arguments);
48536 };
48537 }
48538
48539 /**
48540 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
48541 *
48542 * @private
48543 * @param {Array} array The array to shuffle.
48544 * @param {number} [size=array.length] The size of `array`.
48545 * @returns {Array} Returns `array`.
48546 */
48547 function shuffleSelf(array, size) {
48548 var index = -1,
48549 length = array.length,
48550 lastIndex = length - 1;
48551
48552 size = size === undefined ? length : size;
48553 while (++index < size) {
48554 var rand = baseRandom(index, lastIndex),
48555 value = array[rand];
48556
48557 array[rand] = array[index];
48558 array[index] = value;
48559 }
48560 array.length = size;
48561 return array;
48562 }
48563
48564 /**
48565 * Converts `string` to a property path array.
48566 *
48567 * @private
48568 * @param {string} string The string to convert.
48569 * @returns {Array} Returns the property path array.
48570 */
48571 var stringToPath = memoizeCapped(function(string) {
48572 var result = [];
48573 if (string.charCodeAt(0) === 46 /* . */) {
48574 result.push('');
48575 }
48576 string.replace(rePropName, function(match, number, quote, subString) {
48577 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
48578 });
48579 return result;
48580 });
48581
48582 /**
48583 * Converts `value` to a string key if it's not a string or symbol.
48584 *
48585 * @private
48586 * @param {*} value The value to inspect.
48587 * @returns {string|symbol} Returns the key.
48588 */
48589 function toKey(value) {
48590 if (typeof value == 'string' || isSymbol(value)) {
48591 return value;
48592 }
48593 var result = (value + '');
48594 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
48595 }
48596
48597 /**
48598 * Converts `func` to its source code.
48599 *
48600 * @private
48601 * @param {Function} func The function to convert.
48602 * @returns {string} Returns the source code.
48603 */
48604 function toSource(func) {
48605 if (func != null) {
48606 try {
48607 return funcToString.call(func);
48608 } catch (e) {}
48609 try {
48610 return (func + '');
48611 } catch (e) {}
48612 }
48613 return '';
48614 }
48615
48616 /**
48617 * Updates wrapper `details` based on `bitmask` flags.
48618 *
48619 * @private
48620 * @returns {Array} details The details to modify.
48621 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
48622 * @returns {Array} Returns `details`.
48623 */
48624 function updateWrapDetails(details, bitmask) {
48625 arrayEach(wrapFlags, function(pair) {
48626 var value = '_.' + pair[0];
48627 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
48628 details.push(value);
48629 }
48630 });
48631 return details.sort();
48632 }
48633
48634 /**
48635 * Creates a clone of `wrapper`.
48636 *
48637 * @private
48638 * @param {Object} wrapper The wrapper to clone.
48639 * @returns {Object} Returns the cloned wrapper.
48640 */
48641 function wrapperClone(wrapper) {
48642 if (wrapper instanceof LazyWrapper) {
48643 return wrapper.clone();
48644 }
48645 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
48646 result.__actions__ = copyArray(wrapper.__actions__);
48647 result.__index__ = wrapper.__index__;
48648 result.__values__ = wrapper.__values__;
48649 return result;
48650 }
48651
48652 /*------------------------------------------------------------------------*/
48653
48654 /**
48655 * Creates an array of elements split into groups the length of `size`.
48656 * If `array` can't be split evenly, the final chunk will be the remaining
48657 * elements.
48658 *
48659 * @static
48660 * @memberOf _
48661 * @since 3.0.0
48662 * @category Array
48663 * @param {Array} array The array to process.
48664 * @param {number} [size=1] The length of each chunk
48665 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
48666 * @returns {Array} Returns the new array of chunks.
48667 * @example
48668 *
48669 * _.chunk(['a', 'b', 'c', 'd'], 2);
48670 * // => [['a', 'b'], ['c', 'd']]
48671 *
48672 * _.chunk(['a', 'b', 'c', 'd'], 3);
48673 * // => [['a', 'b', 'c'], ['d']]
48674 */
48675 function chunk(array, size, guard) {
48676 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
48677 size = 1;
48678 } else {
48679 size = nativeMax(toInteger(size), 0);
48680 }
48681 var length = array == null ? 0 : array.length;
48682 if (!length || size < 1) {
48683 return [];
48684 }
48685 var index = 0,
48686 resIndex = 0,
48687 result = Array(nativeCeil(length / size));
48688
48689 while (index < length) {
48690 result[resIndex++] = baseSlice(array, index, (index += size));
48691 }
48692 return result;
48693 }
48694
48695 /**
48696 * Creates an array with all falsey values removed. The values `false`, `null`,
48697 * `0`, `""`, `undefined`, and `NaN` are falsey.
48698 *
48699 * @static
48700 * @memberOf _
48701 * @since 0.1.0
48702 * @category Array
48703 * @param {Array} array The array to compact.
48704 * @returns {Array} Returns the new array of filtered values.
48705 * @example
48706 *
48707 * _.compact([0, 1, false, 2, '', 3]);
48708 * // => [1, 2, 3]
48709 */
48710 function compact(array) {
48711 var index = -1,
48712 length = array == null ? 0 : array.length,
48713 resIndex = 0,
48714 result = [];
48715
48716 while (++index < length) {
48717 var value = array[index];
48718 if (value) {
48719 result[resIndex++] = value;
48720 }
48721 }
48722 return result;
48723 }
48724
48725 /**
48726 * Creates a new array concatenating `array` with any additional arrays
48727 * and/or values.
48728 *
48729 * @static
48730 * @memberOf _
48731 * @since 4.0.0
48732 * @category Array
48733 * @param {Array} array The array to concatenate.
48734 * @param {...*} [values] The values to concatenate.
48735 * @returns {Array} Returns the new concatenated array.
48736 * @example
48737 *
48738 * var array = [1];
48739 * var other = _.concat(array, 2, [3], [[4]]);
48740 *
48741 * console.log(other);
48742 * // => [1, 2, 3, [4]]
48743 *
48744 * console.log(array);
48745 * // => [1]
48746 */
48747 function concat() {
48748 var length = arguments.length;
48749 if (!length) {
48750 return [];
48751 }
48752 var args = Array(length - 1),
48753 array = arguments[0],
48754 index = length;
48755
48756 while (index--) {
48757 args[index - 1] = arguments[index];
48758 }
48759 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
48760 }
48761
48762 /**
48763 * Creates an array of `array` values not included in the other given arrays
48764 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
48765 * for equality comparisons. The order and references of result values are
48766 * determined by the first array.
48767 *
48768 * **Note:** Unlike `_.pullAll`, this method returns a new array.
48769 *
48770 * @static
48771 * @memberOf _
48772 * @since 0.1.0
48773 * @category Array
48774 * @param {Array} array The array to inspect.
48775 * @param {...Array} [values] The values to exclude.
48776 * @returns {Array} Returns the new array of filtered values.
48777 * @see _.without, _.xor
48778 * @example
48779 *
48780 * _.difference([2, 1], [2, 3]);
48781 * // => [1]
48782 */
48783 var difference = baseRest(function(array, values) {
48784 return isArrayLikeObject(array)
48785 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
48786 : [];
48787 });
48788
48789 /**
48790 * This method is like `_.difference` except that it accepts `iteratee` which
48791 * is invoked for each element of `array` and `values` to generate the criterion
48792 * by which they're compared. The order and references of result values are
48793 * determined by the first array. The iteratee is invoked with one argument:
48794 * (value).
48795 *
48796 * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
48797 *
48798 * @static
48799 * @memberOf _
48800 * @since 4.0.0
48801 * @category Array
48802 * @param {Array} array The array to inspect.
48803 * @param {...Array} [values] The values to exclude.
48804 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
48805 * @returns {Array} Returns the new array of filtered values.
48806 * @example
48807 *
48808 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
48809 * // => [1.2]
48810 *
48811 * // The `_.property` iteratee shorthand.
48812 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
48813 * // => [{ 'x': 2 }]
48814 */
48815 var differenceBy = baseRest(function(array, values) {
48816 var iteratee = last(values);
48817 if (isArrayLikeObject(iteratee)) {
48818 iteratee = undefined;
48819 }
48820 return isArrayLikeObject(array)
48821 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
48822 : [];
48823 });
48824
48825 /**
48826 * This method is like `_.difference` except that it accepts `comparator`
48827 * which is invoked to compare elements of `array` to `values`. The order and
48828 * references of result values are determined by the first array. The comparator
48829 * is invoked with two arguments: (arrVal, othVal).
48830 *
48831 * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
48832 *
48833 * @static
48834 * @memberOf _
48835 * @since 4.0.0
48836 * @category Array
48837 * @param {Array} array The array to inspect.
48838 * @param {...Array} [values] The values to exclude.
48839 * @param {Function} [comparator] The comparator invoked per element.
48840 * @returns {Array} Returns the new array of filtered values.
48841 * @example
48842 *
48843 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
48844 *
48845 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
48846 * // => [{ 'x': 2, 'y': 1 }]
48847 */
48848 var differenceWith = baseRest(function(array, values) {
48849 var comparator = last(values);
48850 if (isArrayLikeObject(comparator)) {
48851 comparator = undefined;
48852 }
48853 return isArrayLikeObject(array)
48854 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
48855 : [];
48856 });
48857
48858 /**
48859 * Creates a slice of `array` with `n` elements dropped from the beginning.
48860 *
48861 * @static
48862 * @memberOf _
48863 * @since 0.5.0
48864 * @category Array
48865 * @param {Array} array The array to query.
48866 * @param {number} [n=1] The number of elements to drop.
48867 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
48868 * @returns {Array} Returns the slice of `array`.
48869 * @example
48870 *
48871 * _.drop([1, 2, 3]);
48872 * // => [2, 3]
48873 *
48874 * _.drop([1, 2, 3], 2);
48875 * // => [3]
48876 *
48877 * _.drop([1, 2, 3], 5);
48878 * // => []
48879 *
48880 * _.drop([1, 2, 3], 0);
48881 * // => [1, 2, 3]
48882 */
48883 function drop(array, n, guard) {
48884 var length = array == null ? 0 : array.length;
48885 if (!length) {
48886 return [];
48887 }
48888 n = (guard || n === undefined) ? 1 : toInteger(n);
48889 return baseSlice(array, n < 0 ? 0 : n, length);
48890 }
48891
48892 /**
48893 * Creates a slice of `array` with `n` elements dropped from the end.
48894 *
48895 * @static
48896 * @memberOf _
48897 * @since 3.0.0
48898 * @category Array
48899 * @param {Array} array The array to query.
48900 * @param {number} [n=1] The number of elements to drop.
48901 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
48902 * @returns {Array} Returns the slice of `array`.
48903 * @example
48904 *
48905 * _.dropRight([1, 2, 3]);
48906 * // => [1, 2]
48907 *
48908 * _.dropRight([1, 2, 3], 2);
48909 * // => [1]
48910 *
48911 * _.dropRight([1, 2, 3], 5);
48912 * // => []
48913 *
48914 * _.dropRight([1, 2, 3], 0);
48915 * // => [1, 2, 3]
48916 */
48917 function dropRight(array, n, guard) {
48918 var length = array == null ? 0 : array.length;
48919 if (!length) {
48920 return [];
48921 }
48922 n = (guard || n === undefined) ? 1 : toInteger(n);
48923 n = length - n;
48924 return baseSlice(array, 0, n < 0 ? 0 : n);
48925 }
48926
48927 /**
48928 * Creates a slice of `array` excluding elements dropped from the end.
48929 * Elements are dropped until `predicate` returns falsey. The predicate is
48930 * invoked with three arguments: (value, index, array).
48931 *
48932 * @static
48933 * @memberOf _
48934 * @since 3.0.0
48935 * @category Array
48936 * @param {Array} array The array to query.
48937 * @param {Function} [predicate=_.identity] The function invoked per iteration.
48938 * @returns {Array} Returns the slice of `array`.
48939 * @example
48940 *
48941 * var users = [
48942 * { 'user': 'barney', 'active': true },
48943 * { 'user': 'fred', 'active': false },
48944 * { 'user': 'pebbles', 'active': false }
48945 * ];
48946 *
48947 * _.dropRightWhile(users, function(o) { return !o.active; });
48948 * // => objects for ['barney']
48949 *
48950 * // The `_.matches` iteratee shorthand.
48951 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
48952 * // => objects for ['barney', 'fred']
48953 *
48954 * // The `_.matchesProperty` iteratee shorthand.
48955 * _.dropRightWhile(users, ['active', false]);
48956 * // => objects for ['barney']
48957 *
48958 * // The `_.property` iteratee shorthand.
48959 * _.dropRightWhile(users, 'active');
48960 * // => objects for ['barney', 'fred', 'pebbles']
48961 */
48962 function dropRightWhile(array, predicate) {
48963 return (array && array.length)
48964 ? baseWhile(array, getIteratee(predicate, 3), true, true)
48965 : [];
48966 }
48967
48968 /**
48969 * Creates a slice of `array` excluding elements dropped from the beginning.
48970 * Elements are dropped until `predicate` returns falsey. The predicate is
48971 * invoked with three arguments: (value, index, array).
48972 *
48973 * @static
48974 * @memberOf _
48975 * @since 3.0.0
48976 * @category Array
48977 * @param {Array} array The array to query.
48978 * @param {Function} [predicate=_.identity] The function invoked per iteration.
48979 * @returns {Array} Returns the slice of `array`.
48980 * @example
48981 *
48982 * var users = [
48983 * { 'user': 'barney', 'active': false },
48984 * { 'user': 'fred', 'active': false },
48985 * { 'user': 'pebbles', 'active': true }
48986 * ];
48987 *
48988 * _.dropWhile(users, function(o) { return !o.active; });
48989 * // => objects for ['pebbles']
48990 *
48991 * // The `_.matches` iteratee shorthand.
48992 * _.dropWhile(users, { 'user': 'barney', 'active': false });
48993 * // => objects for ['fred', 'pebbles']
48994 *
48995 * // The `_.matchesProperty` iteratee shorthand.
48996 * _.dropWhile(users, ['active', false]);
48997 * // => objects for ['pebbles']
48998 *
48999 * // The `_.property` iteratee shorthand.
49000 * _.dropWhile(users, 'active');
49001 * // => objects for ['barney', 'fred', 'pebbles']
49002 */
49003 function dropWhile(array, predicate) {
49004 return (array && array.length)
49005 ? baseWhile(array, getIteratee(predicate, 3), true)
49006 : [];
49007 }
49008
49009 /**
49010 * Fills elements of `array` with `value` from `start` up to, but not
49011 * including, `end`.
49012 *
49013 * **Note:** This method mutates `array`.
49014 *
49015 * @static
49016 * @memberOf _
49017 * @since 3.2.0
49018 * @category Array
49019 * @param {Array} array The array to fill.
49020 * @param {*} value The value to fill `array` with.
49021 * @param {number} [start=0] The start position.
49022 * @param {number} [end=array.length] The end position.
49023 * @returns {Array} Returns `array`.
49024 * @example
49025 *
49026 * var array = [1, 2, 3];
49027 *
49028 * _.fill(array, 'a');
49029 * console.log(array);
49030 * // => ['a', 'a', 'a']
49031 *
49032 * _.fill(Array(3), 2);
49033 * // => [2, 2, 2]
49034 *
49035 * _.fill([4, 6, 8, 10], '*', 1, 3);
49036 * // => [4, '*', '*', 10]
49037 */
49038 function fill(array, value, start, end) {
49039 var length = array == null ? 0 : array.length;
49040 if (!length) {
49041 return [];
49042 }
49043 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
49044 start = 0;
49045 end = length;
49046 }
49047 return baseFill(array, value, start, end);
49048 }
49049
49050 /**
49051 * This method is like `_.find` except that it returns the index of the first
49052 * element `predicate` returns truthy for instead of the element itself.
49053 *
49054 * @static
49055 * @memberOf _
49056 * @since 1.1.0
49057 * @category Array
49058 * @param {Array} array The array to inspect.
49059 * @param {Function} [predicate=_.identity] The function invoked per iteration.
49060 * @param {number} [fromIndex=0] The index to search from.
49061 * @returns {number} Returns the index of the found element, else `-1`.
49062 * @example
49063 *
49064 * var users = [
49065 * { 'user': 'barney', 'active': false },
49066 * { 'user': 'fred', 'active': false },
49067 * { 'user': 'pebbles', 'active': true }
49068 * ];
49069 *
49070 * _.findIndex(users, function(o) { return o.user == 'barney'; });
49071 * // => 0
49072 *
49073 * // The `_.matches` iteratee shorthand.
49074 * _.findIndex(users, { 'user': 'fred', 'active': false });
49075 * // => 1
49076 *
49077 * // The `_.matchesProperty` iteratee shorthand.
49078 * _.findIndex(users, ['active', false]);
49079 * // => 0
49080 *
49081 * // The `_.property` iteratee shorthand.
49082 * _.findIndex(users, 'active');
49083 * // => 2
49084 */
49085 function findIndex(array, predicate, fromIndex) {
49086 var length = array == null ? 0 : array.length;
49087 if (!length) {
49088 return -1;
49089 }
49090 var index = fromIndex == null ? 0 : toInteger(fromIndex);
49091 if (index < 0) {
49092 index = nativeMax(length + index, 0);
49093 }
49094 return baseFindIndex(array, getIteratee(predicate, 3), index);
49095 }
49096
49097 /**
49098 * This method is like `_.findIndex` except that it iterates over elements
49099 * of `collection` from right to left.
49100 *
49101 * @static
49102 * @memberOf _
49103 * @since 2.0.0
49104 * @category Array
49105 * @param {Array} array The array to inspect.
49106 * @param {Function} [predicate=_.identity] The function invoked per iteration.
49107 * @param {number} [fromIndex=array.length-1] The index to search from.
49108 * @returns {number} Returns the index of the found element, else `-1`.
49109 * @example
49110 *
49111 * var users = [
49112 * { 'user': 'barney', 'active': true },
49113 * { 'user': 'fred', 'active': false },
49114 * { 'user': 'pebbles', 'active': false }
49115 * ];
49116 *
49117 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
49118 * // => 2
49119 *
49120 * // The `_.matches` iteratee shorthand.
49121 * _.findLastIndex(users, { 'user': 'barney', 'active': true });
49122 * // => 0
49123 *
49124 * // The `_.matchesProperty` iteratee shorthand.
49125 * _.findLastIndex(users, ['active', false]);
49126 * // => 2
49127 *
49128 * // The `_.property` iteratee shorthand.
49129 * _.findLastIndex(users, 'active');
49130 * // => 0
49131 */
49132 function findLastIndex(array, predicate, fromIndex) {
49133 var length = array == null ? 0 : array.length;
49134 if (!length) {
49135 return -1;
49136 }
49137 var index = length - 1;
49138 if (fromIndex !== undefined) {
49139 index = toInteger(fromIndex);
49140 index = fromIndex < 0
49141 ? nativeMax(length + index, 0)
49142 : nativeMin(index, length - 1);
49143 }
49144 return baseFindIndex(array, getIteratee(predicate, 3), index, true);
49145 }
49146
49147 /**
49148 * Flattens `array` a single level deep.
49149 *
49150 * @static
49151 * @memberOf _
49152 * @since 0.1.0
49153 * @category Array
49154 * @param {Array} array The array to flatten.
49155 * @returns {Array} Returns the new flattened array.
49156 * @example
49157 *
49158 * _.flatten([1, [2, [3, [4]], 5]]);
49159 * // => [1, 2, [3, [4]], 5]
49160 */
49161 function flatten(array) {
49162 var length = array == null ? 0 : array.length;
49163 return length ? baseFlatten(array, 1) : [];
49164 }
49165
49166 /**
49167 * Recursively flattens `array`.
49168 *
49169 * @static
49170 * @memberOf _
49171 * @since 3.0.0
49172 * @category Array
49173 * @param {Array} array The array to flatten.
49174 * @returns {Array} Returns the new flattened array.
49175 * @example
49176 *
49177 * _.flattenDeep([1, [2, [3, [4]], 5]]);
49178 * // => [1, 2, 3, 4, 5]
49179 */
49180 function flattenDeep(array) {
49181 var length = array == null ? 0 : array.length;
49182 return length ? baseFlatten(array, INFINITY) : [];
49183 }
49184
49185 /**
49186 * Recursively flatten `array` up to `depth` times.
49187 *
49188 * @static
49189 * @memberOf _
49190 * @since 4.4.0
49191 * @category Array
49192 * @param {Array} array The array to flatten.
49193 * @param {number} [depth=1] The maximum recursion depth.
49194 * @returns {Array} Returns the new flattened array.
49195 * @example
49196 *
49197 * var array = [1, [2, [3, [4]], 5]];
49198 *
49199 * _.flattenDepth(array, 1);
49200 * // => [1, 2, [3, [4]], 5]
49201 *
49202 * _.flattenDepth(array, 2);
49203 * // => [1, 2, 3, [4], 5]
49204 */
49205 function flattenDepth(array, depth) {
49206 var length = array == null ? 0 : array.length;
49207 if (!length) {
49208 return [];
49209 }
49210 depth = depth === undefined ? 1 : toInteger(depth);
49211 return baseFlatten(array, depth);
49212 }
49213
49214 /**
49215 * The inverse of `_.toPairs`; this method returns an object composed
49216 * from key-value `pairs`.
49217 *
49218 * @static
49219 * @memberOf _
49220 * @since 4.0.0
49221 * @category Array
49222 * @param {Array} pairs The key-value pairs.
49223 * @returns {Object} Returns the new object.
49224 * @example
49225 *
49226 * _.fromPairs([['a', 1], ['b', 2]]);
49227 * // => { 'a': 1, 'b': 2 }
49228 */
49229 function fromPairs(pairs) {
49230 var index = -1,
49231 length = pairs == null ? 0 : pairs.length,
49232 result = {};
49233
49234 while (++index < length) {
49235 var pair = pairs[index];
49236 result[pair[0]] = pair[1];
49237 }
49238 return result;
49239 }
49240
49241 /**
49242 * Gets the first element of `array`.
49243 *
49244 * @static
49245 * @memberOf _
49246 * @since 0.1.0
49247 * @alias first
49248 * @category Array
49249 * @param {Array} array The array to query.
49250 * @returns {*} Returns the first element of `array`.
49251 * @example
49252 *
49253 * _.head([1, 2, 3]);
49254 * // => 1
49255 *
49256 * _.head([]);
49257 * // => undefined
49258 */
49259 function head(array) {
49260 return (array && array.length) ? array[0] : undefined;
49261 }
49262
49263 /**
49264 * Gets the index at which the first occurrence of `value` is found in `array`
49265 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
49266 * for equality comparisons. If `fromIndex` is negative, it's used as the
49267 * offset from the end of `array`.
49268 *
49269 * @static
49270 * @memberOf _
49271 * @since 0.1.0
49272 * @category Array
49273 * @param {Array} array The array to inspect.
49274 * @param {*} value The value to search for.
49275 * @param {number} [fromIndex=0] The index to search from.
49276 * @returns {number} Returns the index of the matched value, else `-1`.
49277 * @example
49278 *
49279 * _.indexOf([1, 2, 1, 2], 2);
49280 * // => 1
49281 *
49282 * // Search from the `fromIndex`.
49283 * _.indexOf([1, 2, 1, 2], 2, 2);
49284 * // => 3
49285 */
49286 function indexOf(array, value, fromIndex) {
49287 var length = array == null ? 0 : array.length;
49288 if (!length) {
49289 return -1;
49290 }
49291 var index = fromIndex == null ? 0 : toInteger(fromIndex);
49292 if (index < 0) {
49293 index = nativeMax(length + index, 0);
49294 }
49295 return baseIndexOf(array, value, index);
49296 }
49297
49298 /**
49299 * Gets all but the last element of `array`.
49300 *
49301 * @static
49302 * @memberOf _
49303 * @since 0.1.0
49304 * @category Array
49305 * @param {Array} array The array to query.
49306 * @returns {Array} Returns the slice of `array`.
49307 * @example
49308 *
49309 * _.initial([1, 2, 3]);
49310 * // => [1, 2]
49311 */
49312 function initial(array) {
49313 var length = array == null ? 0 : array.length;
49314 return length ? baseSlice(array, 0, -1) : [];
49315 }
49316
49317 /**
49318 * Creates an array of unique values that are included in all given arrays
49319 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
49320 * for equality comparisons. The order and references of result values are
49321 * determined by the first array.
49322 *
49323 * @static
49324 * @memberOf _
49325 * @since 0.1.0
49326 * @category Array
49327 * @param {...Array} [arrays] The arrays to inspect.
49328 * @returns {Array} Returns the new array of intersecting values.
49329 * @example
49330 *
49331 * _.intersection([2, 1], [2, 3]);
49332 * // => [2]
49333 */
49334 var intersection = baseRest(function(arrays) {
49335 var mapped = arrayMap(arrays, castArrayLikeObject);
49336 return (mapped.length && mapped[0] === arrays[0])
49337 ? baseIntersection(mapped)
49338 : [];
49339 });
49340
49341 /**
49342 * This method is like `_.intersection` except that it accepts `iteratee`
49343 * which is invoked for each element of each `arrays` to generate the criterion
49344 * by which they're compared. The order and references of result values are
49345 * determined by the first array. The iteratee is invoked with one argument:
49346 * (value).
49347 *
49348 * @static
49349 * @memberOf _
49350 * @since 4.0.0
49351 * @category Array
49352 * @param {...Array} [arrays] The arrays to inspect.
49353 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
49354 * @returns {Array} Returns the new array of intersecting values.
49355 * @example
49356 *
49357 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
49358 * // => [2.1]
49359 *
49360 * // The `_.property` iteratee shorthand.
49361 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
49362 * // => [{ 'x': 1 }]
49363 */
49364 var intersectionBy = baseRest(function(arrays) {
49365 var iteratee = last(arrays),
49366 mapped = arrayMap(arrays, castArrayLikeObject);
49367
49368 if (iteratee === last(mapped)) {
49369 iteratee = undefined;
49370 } else {
49371 mapped.pop();
49372 }
49373 return (mapped.length && mapped[0] === arrays[0])
49374 ? baseIntersection(mapped, getIteratee(iteratee, 2))
49375 : [];
49376 });
49377
49378 /**
49379 * This method is like `_.intersection` except that it accepts `comparator`
49380 * which is invoked to compare elements of `arrays`. The order and references
49381 * of result values are determined by the first array. The comparator is
49382 * invoked with two arguments: (arrVal, othVal).
49383 *
49384 * @static
49385 * @memberOf _
49386 * @since 4.0.0
49387 * @category Array
49388 * @param {...Array} [arrays] The arrays to inspect.
49389 * @param {Function} [comparator] The comparator invoked per element.
49390 * @returns {Array} Returns the new array of intersecting values.
49391 * @example
49392 *
49393 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
49394 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
49395 *
49396 * _.intersectionWith(objects, others, _.isEqual);
49397 * // => [{ 'x': 1, 'y': 2 }]
49398 */
49399 var intersectionWith = baseRest(function(arrays) {
49400 var comparator = last(arrays),
49401 mapped = arrayMap(arrays, castArrayLikeObject);
49402
49403 comparator = typeof comparator == 'function' ? comparator : undefined;
49404 if (comparator) {
49405 mapped.pop();
49406 }
49407 return (mapped.length && mapped[0] === arrays[0])
49408 ? baseIntersection(mapped, undefined, comparator)
49409 : [];
49410 });
49411
49412 /**
49413 * Converts all elements in `array` into a string separated by `separator`.
49414 *
49415 * @static
49416 * @memberOf _
49417 * @since 4.0.0
49418 * @category Array
49419 * @param {Array} array The array to convert.
49420 * @param {string} [separator=','] The element separator.
49421 * @returns {string} Returns the joined string.
49422 * @example
49423 *
49424 * _.join(['a', 'b', 'c'], '~');
49425 * // => 'a~b~c'
49426 */
49427 function join(array, separator) {
49428 return array == null ? '' : nativeJoin.call(array, separator);
49429 }
49430
49431 /**
49432 * Gets the last element of `array`.
49433 *
49434 * @static
49435 * @memberOf _
49436 * @since 0.1.0
49437 * @category Array
49438 * @param {Array} array The array to query.
49439 * @returns {*} Returns the last element of `array`.
49440 * @example
49441 *
49442 * _.last([1, 2, 3]);
49443 * // => 3
49444 */
49445 function last(array) {
49446 var length = array == null ? 0 : array.length;
49447 return length ? array[length - 1] : undefined;
49448 }
49449
49450 /**
49451 * This method is like `_.indexOf` except that it iterates over elements of
49452 * `array` from right to left.
49453 *
49454 * @static
49455 * @memberOf _
49456 * @since 0.1.0
49457 * @category Array
49458 * @param {Array} array The array to inspect.
49459 * @param {*} value The value to search for.
49460 * @param {number} [fromIndex=array.length-1] The index to search from.
49461 * @returns {number} Returns the index of the matched value, else `-1`.
49462 * @example
49463 *
49464 * _.lastIndexOf([1, 2, 1, 2], 2);
49465 * // => 3
49466 *
49467 * // Search from the `fromIndex`.
49468 * _.lastIndexOf([1, 2, 1, 2], 2, 2);
49469 * // => 1
49470 */
49471 function lastIndexOf(array, value, fromIndex) {
49472 var length = array == null ? 0 : array.length;
49473 if (!length) {
49474 return -1;
49475 }
49476 var index = length;
49477 if (fromIndex !== undefined) {
49478 index = toInteger(fromIndex);
49479 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
49480 }
49481 return value === value
49482 ? strictLastIndexOf(array, value, index)
49483 : baseFindIndex(array, baseIsNaN, index, true);
49484 }
49485
49486 /**
49487 * Gets the element at index `n` of `array`. If `n` is negative, the nth
49488 * element from the end is returned.
49489 *
49490 * @static
49491 * @memberOf _
49492 * @since 4.11.0
49493 * @category Array
49494 * @param {Array} array The array to query.
49495 * @param {number} [n=0] The index of the element to return.
49496 * @returns {*} Returns the nth element of `array`.
49497 * @example
49498 *
49499 * var array = ['a', 'b', 'c', 'd'];
49500 *
49501 * _.nth(array, 1);
49502 * // => 'b'
49503 *
49504 * _.nth(array, -2);
49505 * // => 'c';
49506 */
49507 function nth(array, n) {
49508 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
49509 }
49510
49511 /**
49512 * Removes all given values from `array` using
49513 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
49514 * for equality comparisons.
49515 *
49516 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
49517 * to remove elements from an array by predicate.
49518 *
49519 * @static
49520 * @memberOf _
49521 * @since 2.0.0
49522 * @category Array
49523 * @param {Array} array The array to modify.
49524 * @param {...*} [values] The values to remove.
49525 * @returns {Array} Returns `array`.
49526 * @example
49527 *
49528 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
49529 *
49530 * _.pull(array, 'a', 'c');
49531 * console.log(array);
49532 * // => ['b', 'b']
49533 */
49534 var pull = baseRest(pullAll);
49535
49536 /**
49537 * This method is like `_.pull` except that it accepts an array of values to remove.
49538 *
49539 * **Note:** Unlike `_.difference`, this method mutates `array`.
49540 *
49541 * @static
49542 * @memberOf _
49543 * @since 4.0.0
49544 * @category Array
49545 * @param {Array} array The array to modify.
49546 * @param {Array} values The values to remove.
49547 * @returns {Array} Returns `array`.
49548 * @example
49549 *
49550 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
49551 *
49552 * _.pullAll(array, ['a', 'c']);
49553 * console.log(array);
49554 * // => ['b', 'b']
49555 */
49556 function pullAll(array, values) {
49557 return (array && array.length && values && values.length)
49558 ? basePullAll(array, values)
49559 : array;
49560 }
49561
49562 /**
49563 * This method is like `_.pullAll` except that it accepts `iteratee` which is
49564 * invoked for each element of `array` and `values` to generate the criterion
49565 * by which they're compared. The iteratee is invoked with one argument: (value).
49566 *
49567 * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
49568 *
49569 * @static
49570 * @memberOf _
49571 * @since 4.0.0
49572 * @category Array
49573 * @param {Array} array The array to modify.
49574 * @param {Array} values The values to remove.
49575 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
49576 * @returns {Array} Returns `array`.
49577 * @example
49578 *
49579 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
49580 *
49581 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
49582 * console.log(array);
49583 * // => [{ 'x': 2 }]
49584 */
49585 function pullAllBy(array, values, iteratee) {
49586 return (array && array.length && values && values.length)
49587 ? basePullAll(array, values, getIteratee(iteratee, 2))
49588 : array;
49589 }
49590
49591 /**
49592 * This method is like `_.pullAll` except that it accepts `comparator` which
49593 * is invoked to compare elements of `array` to `values`. The comparator is
49594 * invoked with two arguments: (arrVal, othVal).
49595 *
49596 * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
49597 *
49598 * @static
49599 * @memberOf _
49600 * @since 4.6.0
49601 * @category Array
49602 * @param {Array} array The array to modify.
49603 * @param {Array} values The values to remove.
49604 * @param {Function} [comparator] The comparator invoked per element.
49605 * @returns {Array} Returns `array`.
49606 * @example
49607 *
49608 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
49609 *
49610 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
49611 * console.log(array);
49612 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
49613 */
49614 function pullAllWith(array, values, comparator) {
49615 return (array && array.length && values && values.length)
49616 ? basePullAll(array, values, undefined, comparator)
49617 : array;
49618 }
49619
49620 /**
49621 * Removes elements from `array` corresponding to `indexes` and returns an
49622 * array of removed elements.
49623 *
49624 * **Note:** Unlike `_.at`, this method mutates `array`.
49625 *
49626 * @static
49627 * @memberOf _
49628 * @since 3.0.0
49629 * @category Array
49630 * @param {Array} array The array to modify.
49631 * @param {...(number|number[])} [indexes] The indexes of elements to remove.
49632 * @returns {Array} Returns the new array of removed elements.
49633 * @example
49634 *
49635 * var array = ['a', 'b', 'c', 'd'];
49636 * var pulled = _.pullAt(array, [1, 3]);
49637 *
49638 * console.log(array);
49639 * // => ['a', 'c']
49640 *
49641 * console.log(pulled);
49642 * // => ['b', 'd']
49643 */
49644 var pullAt = flatRest(function(array, indexes) {
49645 var length = array == null ? 0 : array.length,
49646 result = baseAt(array, indexes);
49647
49648 basePullAt(array, arrayMap(indexes, function(index) {
49649 return isIndex(index, length) ? +index : index;
49650 }).sort(compareAscending));
49651
49652 return result;
49653 });
49654
49655 /**
49656 * Removes all elements from `array` that `predicate` returns truthy for
49657 * and returns an array of the removed elements. The predicate is invoked
49658 * with three arguments: (value, index, array).
49659 *
49660 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
49661 * to pull elements from an array by value.
49662 *
49663 * @static
49664 * @memberOf _
49665 * @since 2.0.0
49666 * @category Array
49667 * @param {Array} array The array to modify.
49668 * @param {Function} [predicate=_.identity] The function invoked per iteration.
49669 * @returns {Array} Returns the new array of removed elements.
49670 * @example
49671 *
49672 * var array = [1, 2, 3, 4];
49673 * var evens = _.remove(array, function(n) {
49674 * return n % 2 == 0;
49675 * });
49676 *
49677 * console.log(array);
49678 * // => [1, 3]
49679 *
49680 * console.log(evens);
49681 * // => [2, 4]
49682 */
49683 function remove(array, predicate) {
49684 var result = [];
49685 if (!(array && array.length)) {
49686 return result;
49687 }
49688 var index = -1,
49689 indexes = [],
49690 length = array.length;
49691
49692 predicate = getIteratee(predicate, 3);
49693 while (++index < length) {
49694 var value = array[index];
49695 if (predicate(value, index, array)) {
49696 result.push(value);
49697 indexes.push(index);
49698 }
49699 }
49700 basePullAt(array, indexes);
49701 return result;
49702 }
49703
49704 /**
49705 * Reverses `array` so that the first element becomes the last, the second
49706 * element becomes the second to last, and so on.
49707 *
49708 * **Note:** This method mutates `array` and is based on
49709 * [`Array#reverse`](https://mdn.io/Array/reverse).
49710 *
49711 * @static
49712 * @memberOf _
49713 * @since 4.0.0
49714 * @category Array
49715 * @param {Array} array The array to modify.
49716 * @returns {Array} Returns `array`.
49717 * @example
49718 *
49719 * var array = [1, 2, 3];
49720 *
49721 * _.reverse(array);
49722 * // => [3, 2, 1]
49723 *
49724 * console.log(array);
49725 * // => [3, 2, 1]
49726 */
49727 function reverse(array) {
49728 return array == null ? array : nativeReverse.call(array);
49729 }
49730
49731 /**
49732 * Creates a slice of `array` from `start` up to, but not including, `end`.
49733 *
49734 * **Note:** This method is used instead of
49735 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
49736 * returned.
49737 *
49738 * @static
49739 * @memberOf _
49740 * @since 3.0.0
49741 * @category Array
49742 * @param {Array} array The array to slice.
49743 * @param {number} [start=0] The start position.
49744 * @param {number} [end=array.length] The end position.
49745 * @returns {Array} Returns the slice of `array`.
49746 */
49747 function slice(array, start, end) {
49748 var length = array == null ? 0 : array.length;
49749 if (!length) {
49750 return [];
49751 }
49752 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
49753 start = 0;
49754 end = length;
49755 }
49756 else {
49757 start = start == null ? 0 : toInteger(start);
49758 end = end === undefined ? length : toInteger(end);
49759 }
49760 return baseSlice(array, start, end);
49761 }
49762
49763 /**
49764 * Uses a binary search to determine the lowest index at which `value`
49765 * should be inserted into `array` in order to maintain its sort order.
49766 *
49767 * @static
49768 * @memberOf _
49769 * @since 0.1.0
49770 * @category Array
49771 * @param {Array} array The sorted array to inspect.
49772 * @param {*} value The value to evaluate.
49773 * @returns {number} Returns the index at which `value` should be inserted
49774 * into `array`.
49775 * @example
49776 *
49777 * _.sortedIndex([30, 50], 40);
49778 * // => 1
49779 */
49780 function sortedIndex(array, value) {
49781 return baseSortedIndex(array, value);
49782 }
49783
49784 /**
49785 * This method is like `_.sortedIndex` except that it accepts `iteratee`
49786 * which is invoked for `value` and each element of `array` to compute their
49787 * sort ranking. The iteratee is invoked with one argument: (value).
49788 *
49789 * @static
49790 * @memberOf _
49791 * @since 4.0.0
49792 * @category Array
49793 * @param {Array} array The sorted array to inspect.
49794 * @param {*} value The value to evaluate.
49795 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
49796 * @returns {number} Returns the index at which `value` should be inserted
49797 * into `array`.
49798 * @example
49799 *
49800 * var objects = [{ 'x': 4 }, { 'x': 5 }];
49801 *
49802 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
49803 * // => 0
49804 *
49805 * // The `_.property` iteratee shorthand.
49806 * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
49807 * // => 0
49808 */
49809 function sortedIndexBy(array, value, iteratee) {
49810 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
49811 }
49812
49813 /**
49814 * This method is like `_.indexOf` except that it performs a binary
49815 * search on a sorted `array`.
49816 *
49817 * @static
49818 * @memberOf _
49819 * @since 4.0.0
49820 * @category Array
49821 * @param {Array} array The array to inspect.
49822 * @param {*} value The value to search for.
49823 * @returns {number} Returns the index of the matched value, else `-1`.
49824 * @example
49825 *
49826 * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
49827 * // => 1
49828 */
49829 function sortedIndexOf(array, value) {
49830 var length = array == null ? 0 : array.length;
49831 if (length) {
49832 var index = baseSortedIndex(array, value);
49833 if (index < length && eq(array[index], value)) {
49834 return index;
49835 }
49836 }
49837 return -1;
49838 }
49839
49840 /**
49841 * This method is like `_.sortedIndex` except that it returns the highest
49842 * index at which `value` should be inserted into `array` in order to
49843 * maintain its sort order.
49844 *
49845 * @static
49846 * @memberOf _
49847 * @since 3.0.0
49848 * @category Array
49849 * @param {Array} array The sorted array to inspect.
49850 * @param {*} value The value to evaluate.
49851 * @returns {number} Returns the index at which `value` should be inserted
49852 * into `array`.
49853 * @example
49854 *
49855 * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
49856 * // => 4
49857 */
49858 function sortedLastIndex(array, value) {
49859 return baseSortedIndex(array, value, true);
49860 }
49861
49862 /**
49863 * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
49864 * which is invoked for `value` and each element of `array` to compute their
49865 * sort ranking. The iteratee is invoked with one argument: (value).
49866 *
49867 * @static
49868 * @memberOf _
49869 * @since 4.0.0
49870 * @category Array
49871 * @param {Array} array The sorted array to inspect.
49872 * @param {*} value The value to evaluate.
49873 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
49874 * @returns {number} Returns the index at which `value` should be inserted
49875 * into `array`.
49876 * @example
49877 *
49878 * var objects = [{ 'x': 4 }, { 'x': 5 }];
49879 *
49880 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
49881 * // => 1
49882 *
49883 * // The `_.property` iteratee shorthand.
49884 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
49885 * // => 1
49886 */
49887 function sortedLastIndexBy(array, value, iteratee) {
49888 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
49889 }
49890
49891 /**
49892 * This method is like `_.lastIndexOf` except that it performs a binary
49893 * search on a sorted `array`.
49894 *
49895 * @static
49896 * @memberOf _
49897 * @since 4.0.0
49898 * @category Array
49899 * @param {Array} array The array to inspect.
49900 * @param {*} value The value to search for.
49901 * @returns {number} Returns the index of the matched value, else `-1`.
49902 * @example
49903 *
49904 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
49905 * // => 3
49906 */
49907 function sortedLastIndexOf(array, value) {
49908 var length = array == null ? 0 : array.length;
49909 if (length) {
49910 var index = baseSortedIndex(array, value, true) - 1;
49911 if (eq(array[index], value)) {
49912 return index;
49913 }
49914 }
49915 return -1;
49916 }
49917
49918 /**
49919 * This method is like `_.uniq` except that it's designed and optimized
49920 * for sorted arrays.
49921 *
49922 * @static
49923 * @memberOf _
49924 * @since 4.0.0
49925 * @category Array
49926 * @param {Array} array The array to inspect.
49927 * @returns {Array} Returns the new duplicate free array.
49928 * @example
49929 *
49930 * _.sortedUniq([1, 1, 2]);
49931 * // => [1, 2]
49932 */
49933 function sortedUniq(array) {
49934 return (array && array.length)
49935 ? baseSortedUniq(array)
49936 : [];
49937 }
49938
49939 /**
49940 * This method is like `_.uniqBy` except that it's designed and optimized
49941 * for sorted arrays.
49942 *
49943 * @static
49944 * @memberOf _
49945 * @since 4.0.0
49946 * @category Array
49947 * @param {Array} array The array to inspect.
49948 * @param {Function} [iteratee] The iteratee invoked per element.
49949 * @returns {Array} Returns the new duplicate free array.
49950 * @example
49951 *
49952 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
49953 * // => [1.1, 2.3]
49954 */
49955 function sortedUniqBy(array, iteratee) {
49956 return (array && array.length)
49957 ? baseSortedUniq(array, getIteratee(iteratee, 2))
49958 : [];
49959 }
49960
49961 /**
49962 * Gets all but the first element of `array`.
49963 *
49964 * @static
49965 * @memberOf _
49966 * @since 4.0.0
49967 * @category Array
49968 * @param {Array} array The array to query.
49969 * @returns {Array} Returns the slice of `array`.
49970 * @example
49971 *
49972 * _.tail([1, 2, 3]);
49973 * // => [2, 3]
49974 */
49975 function tail(array) {
49976 var length = array == null ? 0 : array.length;
49977 return length ? baseSlice(array, 1, length) : [];
49978 }
49979
49980 /**
49981 * Creates a slice of `array` with `n` elements taken from the beginning.
49982 *
49983 * @static
49984 * @memberOf _
49985 * @since 0.1.0
49986 * @category Array
49987 * @param {Array} array The array to query.
49988 * @param {number} [n=1] The number of elements to take.
49989 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
49990 * @returns {Array} Returns the slice of `array`.
49991 * @example
49992 *
49993 * _.take([1, 2, 3]);
49994 * // => [1]
49995 *
49996 * _.take([1, 2, 3], 2);
49997 * // => [1, 2]
49998 *
49999 * _.take([1, 2, 3], 5);
50000 * // => [1, 2, 3]
50001 *
50002 * _.take([1, 2, 3], 0);
50003 * // => []
50004 */
50005 function take(array, n, guard) {
50006 if (!(array && array.length)) {
50007 return [];
50008 }
50009 n = (guard || n === undefined) ? 1 : toInteger(n);
50010 return baseSlice(array, 0, n < 0 ? 0 : n);
50011 }
50012
50013 /**
50014 * Creates a slice of `array` with `n` elements taken from the end.
50015 *
50016 * @static
50017 * @memberOf _
50018 * @since 3.0.0
50019 * @category Array
50020 * @param {Array} array The array to query.
50021 * @param {number} [n=1] The number of elements to take.
50022 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
50023 * @returns {Array} Returns the slice of `array`.
50024 * @example
50025 *
50026 * _.takeRight([1, 2, 3]);
50027 * // => [3]
50028 *
50029 * _.takeRight([1, 2, 3], 2);
50030 * // => [2, 3]
50031 *
50032 * _.takeRight([1, 2, 3], 5);
50033 * // => [1, 2, 3]
50034 *
50035 * _.takeRight([1, 2, 3], 0);
50036 * // => []
50037 */
50038 function takeRight(array, n, guard) {
50039 var length = array == null ? 0 : array.length;
50040 if (!length) {
50041 return [];
50042 }
50043 n = (guard || n === undefined) ? 1 : toInteger(n);
50044 n = length - n;
50045 return baseSlice(array, n < 0 ? 0 : n, length);
50046 }
50047
50048 /**
50049 * Creates a slice of `array` with elements taken from the end. Elements are
50050 * taken until `predicate` returns falsey. The predicate is invoked with
50051 * three arguments: (value, index, array).
50052 *
50053 * @static
50054 * @memberOf _
50055 * @since 3.0.0
50056 * @category Array
50057 * @param {Array} array The array to query.
50058 * @param {Function} [predicate=_.identity] The function invoked per iteration.
50059 * @returns {Array} Returns the slice of `array`.
50060 * @example
50061 *
50062 * var users = [
50063 * { 'user': 'barney', 'active': true },
50064 * { 'user': 'fred', 'active': false },
50065 * { 'user': 'pebbles', 'active': false }
50066 * ];
50067 *
50068 * _.takeRightWhile(users, function(o) { return !o.active; });
50069 * // => objects for ['fred', 'pebbles']
50070 *
50071 * // The `_.matches` iteratee shorthand.
50072 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
50073 * // => objects for ['pebbles']
50074 *
50075 * // The `_.matchesProperty` iteratee shorthand.
50076 * _.takeRightWhile(users, ['active', false]);
50077 * // => objects for ['fred', 'pebbles']
50078 *
50079 * // The `_.property` iteratee shorthand.
50080 * _.takeRightWhile(users, 'active');
50081 * // => []
50082 */
50083 function takeRightWhile(array, predicate) {
50084 return (array && array.length)
50085 ? baseWhile(array, getIteratee(predicate, 3), false, true)
50086 : [];
50087 }
50088
50089 /**
50090 * Creates a slice of `array` with elements taken from the beginning. Elements
50091 * are taken until `predicate` returns falsey. The predicate is invoked with
50092 * three arguments: (value, index, array).
50093 *
50094 * @static
50095 * @memberOf _
50096 * @since 3.0.0
50097 * @category Array
50098 * @param {Array} array The array to query.
50099 * @param {Function} [predicate=_.identity] The function invoked per iteration.
50100 * @returns {Array} Returns the slice of `array`.
50101 * @example
50102 *
50103 * var users = [
50104 * { 'user': 'barney', 'active': false },
50105 * { 'user': 'fred', 'active': false },
50106 * { 'user': 'pebbles', 'active': true }
50107 * ];
50108 *
50109 * _.takeWhile(users, function(o) { return !o.active; });
50110 * // => objects for ['barney', 'fred']
50111 *
50112 * // The `_.matches` iteratee shorthand.
50113 * _.takeWhile(users, { 'user': 'barney', 'active': false });
50114 * // => objects for ['barney']
50115 *
50116 * // The `_.matchesProperty` iteratee shorthand.
50117 * _.takeWhile(users, ['active', false]);
50118 * // => objects for ['barney', 'fred']
50119 *
50120 * // The `_.property` iteratee shorthand.
50121 * _.takeWhile(users, 'active');
50122 * // => []
50123 */
50124 function takeWhile(array, predicate) {
50125 return (array && array.length)
50126 ? baseWhile(array, getIteratee(predicate, 3))
50127 : [];
50128 }
50129
50130 /**
50131 * Creates an array of unique values, in order, from all given arrays using
50132 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
50133 * for equality comparisons.
50134 *
50135 * @static
50136 * @memberOf _
50137 * @since 0.1.0
50138 * @category Array
50139 * @param {...Array} [arrays] The arrays to inspect.
50140 * @returns {Array} Returns the new array of combined values.
50141 * @example
50142 *
50143 * _.union([2], [1, 2]);
50144 * // => [2, 1]
50145 */
50146 var union = baseRest(function(arrays) {
50147 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
50148 });
50149
50150 /**
50151 * This method is like `_.union` except that it accepts `iteratee` which is
50152 * invoked for each element of each `arrays` to generate the criterion by
50153 * which uniqueness is computed. Result values are chosen from the first
50154 * array in which the value occurs. The iteratee is invoked with one argument:
50155 * (value).
50156 *
50157 * @static
50158 * @memberOf _
50159 * @since 4.0.0
50160 * @category Array
50161 * @param {...Array} [arrays] The arrays to inspect.
50162 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
50163 * @returns {Array} Returns the new array of combined values.
50164 * @example
50165 *
50166 * _.unionBy([2.1], [1.2, 2.3], Math.floor);
50167 * // => [2.1, 1.2]
50168 *
50169 * // The `_.property` iteratee shorthand.
50170 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
50171 * // => [{ 'x': 1 }, { 'x': 2 }]
50172 */
50173 var unionBy = baseRest(function(arrays) {
50174 var iteratee = last(arrays);
50175 if (isArrayLikeObject(iteratee)) {
50176 iteratee = undefined;
50177 }
50178 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
50179 });
50180
50181 /**
50182 * This method is like `_.union` except that it accepts `comparator` which
50183 * is invoked to compare elements of `arrays`. Result values are chosen from
50184 * the first array in which the value occurs. The comparator is invoked
50185 * with two arguments: (arrVal, othVal).
50186 *
50187 * @static
50188 * @memberOf _
50189 * @since 4.0.0
50190 * @category Array
50191 * @param {...Array} [arrays] The arrays to inspect.
50192 * @param {Function} [comparator] The comparator invoked per element.
50193 * @returns {Array} Returns the new array of combined values.
50194 * @example
50195 *
50196 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
50197 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
50198 *
50199 * _.unionWith(objects, others, _.isEqual);
50200 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
50201 */
50202 var unionWith = baseRest(function(arrays) {
50203 var comparator = last(arrays);
50204 comparator = typeof comparator == 'function' ? comparator : undefined;
50205 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
50206 });
50207
50208 /**
50209 * Creates a duplicate-free version of an array, using
50210 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
50211 * for equality comparisons, in which only the first occurrence of each element
50212 * is kept. The order of result values is determined by the order they occur
50213 * in the array.
50214 *
50215 * @static
50216 * @memberOf _
50217 * @since 0.1.0
50218 * @category Array
50219 * @param {Array} array The array to inspect.
50220 * @returns {Array} Returns the new duplicate free array.
50221 * @example
50222 *
50223 * _.uniq([2, 1, 2]);
50224 * // => [2, 1]
50225 */
50226 function uniq(array) {
50227 return (array && array.length) ? baseUniq(array) : [];
50228 }
50229
50230 /**
50231 * This method is like `_.uniq` except that it accepts `iteratee` which is
50232 * invoked for each element in `array` to generate the criterion by which
50233 * uniqueness is computed. The order of result values is determined by the
50234 * order they occur in the array. The iteratee is invoked with one argument:
50235 * (value).
50236 *
50237 * @static
50238 * @memberOf _
50239 * @since 4.0.0
50240 * @category Array
50241 * @param {Array} array The array to inspect.
50242 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
50243 * @returns {Array} Returns the new duplicate free array.
50244 * @example
50245 *
50246 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
50247 * // => [2.1, 1.2]
50248 *
50249 * // The `_.property` iteratee shorthand.
50250 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
50251 * // => [{ 'x': 1 }, { 'x': 2 }]
50252 */
50253 function uniqBy(array, iteratee) {
50254 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
50255 }
50256
50257 /**
50258 * This method is like `_.uniq` except that it accepts `comparator` which
50259 * is invoked to compare elements of `array`. The order of result values is
50260 * determined by the order they occur in the array.The comparator is invoked
50261 * with two arguments: (arrVal, othVal).
50262 *
50263 * @static
50264 * @memberOf _
50265 * @since 4.0.0
50266 * @category Array
50267 * @param {Array} array The array to inspect.
50268 * @param {Function} [comparator] The comparator invoked per element.
50269 * @returns {Array} Returns the new duplicate free array.
50270 * @example
50271 *
50272 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
50273 *
50274 * _.uniqWith(objects, _.isEqual);
50275 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
50276 */
50277 function uniqWith(array, comparator) {
50278 comparator = typeof comparator == 'function' ? comparator : undefined;
50279 return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
50280 }
50281
50282 /**
50283 * This method is like `_.zip` except that it accepts an array of grouped
50284 * elements and creates an array regrouping the elements to their pre-zip
50285 * configuration.
50286 *
50287 * @static
50288 * @memberOf _
50289 * @since 1.2.0
50290 * @category Array
50291 * @param {Array} array The array of grouped elements to process.
50292 * @returns {Array} Returns the new array of regrouped elements.
50293 * @example
50294 *
50295 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
50296 * // => [['a', 1, true], ['b', 2, false]]
50297 *
50298 * _.unzip(zipped);
50299 * // => [['a', 'b'], [1, 2], [true, false]]
50300 */
50301 function unzip(array) {
50302 if (!(array && array.length)) {
50303 return [];
50304 }
50305 var length = 0;
50306 array = arrayFilter(array, function(group) {
50307 if (isArrayLikeObject(group)) {
50308 length = nativeMax(group.length, length);
50309 return true;
50310 }
50311 });
50312 return baseTimes(length, function(index) {
50313 return arrayMap(array, baseProperty(index));
50314 });
50315 }
50316
50317 /**
50318 * This method is like `_.unzip` except that it accepts `iteratee` to specify
50319 * how regrouped values should be combined. The iteratee is invoked with the
50320 * elements of each group: (...group).
50321 *
50322 * @static
50323 * @memberOf _
50324 * @since 3.8.0
50325 * @category Array
50326 * @param {Array} array The array of grouped elements to process.
50327 * @param {Function} [iteratee=_.identity] The function to combine
50328 * regrouped values.
50329 * @returns {Array} Returns the new array of regrouped elements.
50330 * @example
50331 *
50332 * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
50333 * // => [[1, 10, 100], [2, 20, 200]]
50334 *
50335 * _.unzipWith(zipped, _.add);
50336 * // => [3, 30, 300]
50337 */
50338 function unzipWith(array, iteratee) {
50339 if (!(array && array.length)) {
50340 return [];
50341 }
50342 var result = unzip(array);
50343 if (iteratee == null) {
50344 return result;
50345 }
50346 return arrayMap(result, function(group) {
50347 return apply(iteratee, undefined, group);
50348 });
50349 }
50350
50351 /**
50352 * Creates an array excluding all given values using
50353 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
50354 * for equality comparisons.
50355 *
50356 * **Note:** Unlike `_.pull`, this method returns a new array.
50357 *
50358 * @static
50359 * @memberOf _
50360 * @since 0.1.0
50361 * @category Array
50362 * @param {Array} array The array to inspect.
50363 * @param {...*} [values] The values to exclude.
50364 * @returns {Array} Returns the new array of filtered values.
50365 * @see _.difference, _.xor
50366 * @example
50367 *
50368 * _.without([2, 1, 2, 3], 1, 2);
50369 * // => [3]
50370 */
50371 var without = baseRest(function(array, values) {
50372 return isArrayLikeObject(array)
50373 ? baseDifference(array, values)
50374 : [];
50375 });
50376
50377 /**
50378 * Creates an array of unique values that is the
50379 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
50380 * of the given arrays. The order of result values is determined by the order
50381 * they occur in the arrays.
50382 *
50383 * @static
50384 * @memberOf _
50385 * @since 2.4.0
50386 * @category Array
50387 * @param {...Array} [arrays] The arrays to inspect.
50388 * @returns {Array} Returns the new array of filtered values.
50389 * @see _.difference, _.without
50390 * @example
50391 *
50392 * _.xor([2, 1], [2, 3]);
50393 * // => [1, 3]
50394 */
50395 var xor = baseRest(function(arrays) {
50396 return baseXor(arrayFilter(arrays, isArrayLikeObject));
50397 });
50398
50399 /**
50400 * This method is like `_.xor` except that it accepts `iteratee` which is
50401 * invoked for each element of each `arrays` to generate the criterion by
50402 * which by which they're compared. The order of result values is determined
50403 * by the order they occur in the arrays. The iteratee is invoked with one
50404 * argument: (value).
50405 *
50406 * @static
50407 * @memberOf _
50408 * @since 4.0.0
50409 * @category Array
50410 * @param {...Array} [arrays] The arrays to inspect.
50411 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
50412 * @returns {Array} Returns the new array of filtered values.
50413 * @example
50414 *
50415 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
50416 * // => [1.2, 3.4]
50417 *
50418 * // The `_.property` iteratee shorthand.
50419 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
50420 * // => [{ 'x': 2 }]
50421 */
50422 var xorBy = baseRest(function(arrays) {
50423 var iteratee = last(arrays);
50424 if (isArrayLikeObject(iteratee)) {
50425 iteratee = undefined;
50426 }
50427 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
50428 });
50429
50430 /**
50431 * This method is like `_.xor` except that it accepts `comparator` which is
50432 * invoked to compare elements of `arrays`. The order of result values is
50433 * determined by the order they occur in the arrays. The comparator is invoked
50434 * with two arguments: (arrVal, othVal).
50435 *
50436 * @static
50437 * @memberOf _
50438 * @since 4.0.0
50439 * @category Array
50440 * @param {...Array} [arrays] The arrays to inspect.
50441 * @param {Function} [comparator] The comparator invoked per element.
50442 * @returns {Array} Returns the new array of filtered values.
50443 * @example
50444 *
50445 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
50446 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
50447 *
50448 * _.xorWith(objects, others, _.isEqual);
50449 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
50450 */
50451 var xorWith = baseRest(function(arrays) {
50452 var comparator = last(arrays);
50453 comparator = typeof comparator == 'function' ? comparator : undefined;
50454 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
50455 });
50456
50457 /**
50458 * Creates an array of grouped elements, the first of which contains the
50459 * first elements of the given arrays, the second of which contains the
50460 * second elements of the given arrays, and so on.
50461 *
50462 * @static
50463 * @memberOf _
50464 * @since 0.1.0
50465 * @category Array
50466 * @param {...Array} [arrays] The arrays to process.
50467 * @returns {Array} Returns the new array of grouped elements.
50468 * @example
50469 *
50470 * _.zip(['a', 'b'], [1, 2], [true, false]);
50471 * // => [['a', 1, true], ['b', 2, false]]
50472 */
50473 var zip = baseRest(unzip);
50474
50475 /**
50476 * This method is like `_.fromPairs` except that it accepts two arrays,
50477 * one of property identifiers and one of corresponding values.
50478 *
50479 * @static
50480 * @memberOf _
50481 * @since 0.4.0
50482 * @category Array
50483 * @param {Array} [props=[]] The property identifiers.
50484 * @param {Array} [values=[]] The property values.
50485 * @returns {Object} Returns the new object.
50486 * @example
50487 *
50488 * _.zipObject(['a', 'b'], [1, 2]);
50489 * // => { 'a': 1, 'b': 2 }
50490 */
50491 function zipObject(props, values) {
50492 return baseZipObject(props || [], values || [], assignValue);
50493 }
50494
50495 /**
50496 * This method is like `_.zipObject` except that it supports property paths.
50497 *
50498 * @static
50499 * @memberOf _
50500 * @since 4.1.0
50501 * @category Array
50502 * @param {Array} [props=[]] The property identifiers.
50503 * @param {Array} [values=[]] The property values.
50504 * @returns {Object} Returns the new object.
50505 * @example
50506 *
50507 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
50508 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
50509 */
50510 function zipObjectDeep(props, values) {
50511 return baseZipObject(props || [], values || [], baseSet);
50512 }
50513
50514 /**
50515 * This method is like `_.zip` except that it accepts `iteratee` to specify
50516 * how grouped values should be combined. The iteratee is invoked with the
50517 * elements of each group: (...group).
50518 *
50519 * @static
50520 * @memberOf _
50521 * @since 3.8.0
50522 * @category Array
50523 * @param {...Array} [arrays] The arrays to process.
50524 * @param {Function} [iteratee=_.identity] The function to combine
50525 * grouped values.
50526 * @returns {Array} Returns the new array of grouped elements.
50527 * @example
50528 *
50529 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
50530 * return a + b + c;
50531 * });
50532 * // => [111, 222]
50533 */
50534 var zipWith = baseRest(function(arrays) {
50535 var length = arrays.length,
50536 iteratee = length > 1 ? arrays[length - 1] : undefined;
50537
50538 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
50539 return unzipWith(arrays, iteratee);
50540 });
50541
50542 /*------------------------------------------------------------------------*/
50543
50544 /**
50545 * Creates a `lodash` wrapper instance that wraps `value` with explicit method
50546 * chain sequences enabled. The result of such sequences must be unwrapped
50547 * with `_#value`.
50548 *
50549 * @static
50550 * @memberOf _
50551 * @since 1.3.0
50552 * @category Seq
50553 * @param {*} value The value to wrap.
50554 * @returns {Object} Returns the new `lodash` wrapper instance.
50555 * @example
50556 *
50557 * var users = [
50558 * { 'user': 'barney', 'age': 36 },
50559 * { 'user': 'fred', 'age': 40 },
50560 * { 'user': 'pebbles', 'age': 1 }
50561 * ];
50562 *
50563 * var youngest = _
50564 * .chain(users)
50565 * .sortBy('age')
50566 * .map(function(o) {
50567 * return o.user + ' is ' + o.age;
50568 * })
50569 * .head()
50570 * .value();
50571 * // => 'pebbles is 1'
50572 */
50573 function chain(value) {
50574 var result = lodash(value);
50575 result.__chain__ = true;
50576 return result;
50577 }
50578
50579 /**
50580 * This method invokes `interceptor` and returns `value`. The interceptor
50581 * is invoked with one argument; (value). The purpose of this method is to
50582 * "tap into" a method chain sequence in order to modify intermediate results.
50583 *
50584 * @static
50585 * @memberOf _
50586 * @since 0.1.0
50587 * @category Seq
50588 * @param {*} value The value to provide to `interceptor`.
50589 * @param {Function} interceptor The function to invoke.
50590 * @returns {*} Returns `value`.
50591 * @example
50592 *
50593 * _([1, 2, 3])
50594 * .tap(function(array) {
50595 * // Mutate input array.
50596 * array.pop();
50597 * })
50598 * .reverse()
50599 * .value();
50600 * // => [2, 1]
50601 */
50602 function tap(value, interceptor) {
50603 interceptor(value);
50604 return value;
50605 }
50606
50607 /**
50608 * This method is like `_.tap` except that it returns the result of `interceptor`.
50609 * The purpose of this method is to "pass thru" values replacing intermediate
50610 * results in a method chain sequence.
50611 *
50612 * @static
50613 * @memberOf _
50614 * @since 3.0.0
50615 * @category Seq
50616 * @param {*} value The value to provide to `interceptor`.
50617 * @param {Function} interceptor The function to invoke.
50618 * @returns {*} Returns the result of `interceptor`.
50619 * @example
50620 *
50621 * _(' abc ')
50622 * .chain()
50623 * .trim()
50624 * .thru(function(value) {
50625 * return [value];
50626 * })
50627 * .value();
50628 * // => ['abc']
50629 */
50630 function thru(value, interceptor) {
50631 return interceptor(value);
50632 }
50633
50634 /**
50635 * This method is the wrapper version of `_.at`.
50636 *
50637 * @name at
50638 * @memberOf _
50639 * @since 1.0.0
50640 * @category Seq
50641 * @param {...(string|string[])} [paths] The property paths to pick.
50642 * @returns {Object} Returns the new `lodash` wrapper instance.
50643 * @example
50644 *
50645 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
50646 *
50647 * _(object).at(['a[0].b.c', 'a[1]']).value();
50648 * // => [3, 4]
50649 */
50650 var wrapperAt = flatRest(function(paths) {
50651 var length = paths.length,
50652 start = length ? paths[0] : 0,
50653 value = this.__wrapped__,
50654 interceptor = function(object) { return baseAt(object, paths); };
50655
50656 if (length > 1 || this.__actions__.length ||
50657 !(value instanceof LazyWrapper) || !isIndex(start)) {
50658 return this.thru(interceptor);
50659 }
50660 value = value.slice(start, +start + (length ? 1 : 0));
50661 value.__actions__.push({
50662 'func': thru,
50663 'args': [interceptor],
50664 'thisArg': undefined
50665 });
50666 return new LodashWrapper(value, this.__chain__).thru(function(array) {
50667 if (length && !array.length) {
50668 array.push(undefined);
50669 }
50670 return array;
50671 });
50672 });
50673
50674 /**
50675 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
50676 *
50677 * @name chain
50678 * @memberOf _
50679 * @since 0.1.0
50680 * @category Seq
50681 * @returns {Object} Returns the new `lodash` wrapper instance.
50682 * @example
50683 *
50684 * var users = [
50685 * { 'user': 'barney', 'age': 36 },
50686 * { 'user': 'fred', 'age': 40 }
50687 * ];
50688 *
50689 * // A sequence without explicit chaining.
50690 * _(users).head();
50691 * // => { 'user': 'barney', 'age': 36 }
50692 *
50693 * // A sequence with explicit chaining.
50694 * _(users)
50695 * .chain()
50696 * .head()
50697 * .pick('user')
50698 * .value();
50699 * // => { 'user': 'barney' }
50700 */
50701 function wrapperChain() {
50702 return chain(this);
50703 }
50704
50705 /**
50706 * Executes the chain sequence and returns the wrapped result.
50707 *
50708 * @name commit
50709 * @memberOf _
50710 * @since 3.2.0
50711 * @category Seq
50712 * @returns {Object} Returns the new `lodash` wrapper instance.
50713 * @example
50714 *
50715 * var array = [1, 2];
50716 * var wrapped = _(array).push(3);
50717 *
50718 * console.log(array);
50719 * // => [1, 2]
50720 *
50721 * wrapped = wrapped.commit();
50722 * console.log(array);
50723 * // => [1, 2, 3]
50724 *
50725 * wrapped.last();
50726 * // => 3
50727 *
50728 * console.log(array);
50729 * // => [1, 2, 3]
50730 */
50731 function wrapperCommit() {
50732 return new LodashWrapper(this.value(), this.__chain__);
50733 }
50734
50735 /**
50736 * Gets the next value on a wrapped object following the
50737 * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
50738 *
50739 * @name next
50740 * @memberOf _
50741 * @since 4.0.0
50742 * @category Seq
50743 * @returns {Object} Returns the next iterator value.
50744 * @example
50745 *
50746 * var wrapped = _([1, 2]);
50747 *
50748 * wrapped.next();
50749 * // => { 'done': false, 'value': 1 }
50750 *
50751 * wrapped.next();
50752 * // => { 'done': false, 'value': 2 }
50753 *
50754 * wrapped.next();
50755 * // => { 'done': true, 'value': undefined }
50756 */
50757 function wrapperNext() {
50758 if (this.__values__ === undefined) {
50759 this.__values__ = toArray(this.value());
50760 }
50761 var done = this.__index__ >= this.__values__.length,
50762 value = done ? undefined : this.__values__[this.__index__++];
50763
50764 return { 'done': done, 'value': value };
50765 }
50766
50767 /**
50768 * Enables the wrapper to be iterable.
50769 *
50770 * @name Symbol.iterator
50771 * @memberOf _
50772 * @since 4.0.0
50773 * @category Seq
50774 * @returns {Object} Returns the wrapper object.
50775 * @example
50776 *
50777 * var wrapped = _([1, 2]);
50778 *
50779 * wrapped[Symbol.iterator]() === wrapped;
50780 * // => true
50781 *
50782 * Array.from(wrapped);
50783 * // => [1, 2]
50784 */
50785 function wrapperToIterator() {
50786 return this;
50787 }
50788
50789 /**
50790 * Creates a clone of the chain sequence planting `value` as the wrapped value.
50791 *
50792 * @name plant
50793 * @memberOf _
50794 * @since 3.2.0
50795 * @category Seq
50796 * @param {*} value The value to plant.
50797 * @returns {Object} Returns the new `lodash` wrapper instance.
50798 * @example
50799 *
50800 * function square(n) {
50801 * return n * n;
50802 * }
50803 *
50804 * var wrapped = _([1, 2]).map(square);
50805 * var other = wrapped.plant([3, 4]);
50806 *
50807 * other.value();
50808 * // => [9, 16]
50809 *
50810 * wrapped.value();
50811 * // => [1, 4]
50812 */
50813 function wrapperPlant(value) {
50814 var result,
50815 parent = this;
50816
50817 while (parent instanceof baseLodash) {
50818 var clone = wrapperClone(parent);
50819 clone.__index__ = 0;
50820 clone.__values__ = undefined;
50821 if (result) {
50822 previous.__wrapped__ = clone;
50823 } else {
50824 result = clone;
50825 }
50826 var previous = clone;
50827 parent = parent.__wrapped__;
50828 }
50829 previous.__wrapped__ = value;
50830 return result;
50831 }
50832
50833 /**
50834 * This method is the wrapper version of `_.reverse`.
50835 *
50836 * **Note:** This method mutates the wrapped array.
50837 *
50838 * @name reverse
50839 * @memberOf _
50840 * @since 0.1.0
50841 * @category Seq
50842 * @returns {Object} Returns the new `lodash` wrapper instance.
50843 * @example
50844 *
50845 * var array = [1, 2, 3];
50846 *
50847 * _(array).reverse().value()
50848 * // => [3, 2, 1]
50849 *
50850 * console.log(array);
50851 * // => [3, 2, 1]
50852 */
50853 function wrapperReverse() {
50854 var value = this.__wrapped__;
50855 if (value instanceof LazyWrapper) {
50856 var wrapped = value;
50857 if (this.__actions__.length) {
50858 wrapped = new LazyWrapper(this);
50859 }
50860 wrapped = wrapped.reverse();
50861 wrapped.__actions__.push({
50862 'func': thru,
50863 'args': [reverse],
50864 'thisArg': undefined
50865 });
50866 return new LodashWrapper(wrapped, this.__chain__);
50867 }
50868 return this.thru(reverse);
50869 }
50870
50871 /**
50872 * Executes the chain sequence to resolve the unwrapped value.
50873 *
50874 * @name value
50875 * @memberOf _
50876 * @since 0.1.0
50877 * @alias toJSON, valueOf
50878 * @category Seq
50879 * @returns {*} Returns the resolved unwrapped value.
50880 * @example
50881 *
50882 * _([1, 2, 3]).value();
50883 * // => [1, 2, 3]
50884 */
50885 function wrapperValue() {
50886 return baseWrapperValue(this.__wrapped__, this.__actions__);
50887 }
50888
50889 /*------------------------------------------------------------------------*/
50890
50891 /**
50892 * Creates an object composed of keys generated from the results of running
50893 * each element of `collection` thru `iteratee`. The corresponding value of
50894 * each key is the number of times the key was returned by `iteratee`. The
50895 * iteratee is invoked with one argument: (value).
50896 *
50897 * @static
50898 * @memberOf _
50899 * @since 0.5.0
50900 * @category Collection
50901 * @param {Array|Object} collection The collection to iterate over.
50902 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
50903 * @returns {Object} Returns the composed aggregate object.
50904 * @example
50905 *
50906 * _.countBy([6.1, 4.2, 6.3], Math.floor);
50907 * // => { '4': 1, '6': 2 }
50908 *
50909 * // The `_.property` iteratee shorthand.
50910 * _.countBy(['one', 'two', 'three'], 'length');
50911 * // => { '3': 2, '5': 1 }
50912 */
50913 var countBy = createAggregator(function(result, value, key) {
50914 if (hasOwnProperty.call(result, key)) {
50915 ++result[key];
50916 } else {
50917 baseAssignValue(result, key, 1);
50918 }
50919 });
50920
50921 /**
50922 * Checks if `predicate` returns truthy for **all** elements of `collection`.
50923 * Iteration is stopped once `predicate` returns falsey. The predicate is
50924 * invoked with three arguments: (value, index|key, collection).
50925 *
50926 * **Note:** This method returns `true` for
50927 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
50928 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
50929 * elements of empty collections.
50930 *
50931 * @static
50932 * @memberOf _
50933 * @since 0.1.0
50934 * @category Collection
50935 * @param {Array|Object} collection The collection to iterate over.
50936 * @param {Function} [predicate=_.identity] The function invoked per iteration.
50937 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
50938 * @returns {boolean} Returns `true` if all elements pass the predicate check,
50939 * else `false`.
50940 * @example
50941 *
50942 * _.every([true, 1, null, 'yes'], Boolean);
50943 * // => false
50944 *
50945 * var users = [
50946 * { 'user': 'barney', 'age': 36, 'active': false },
50947 * { 'user': 'fred', 'age': 40, 'active': false }
50948 * ];
50949 *
50950 * // The `_.matches` iteratee shorthand.
50951 * _.every(users, { 'user': 'barney', 'active': false });
50952 * // => false
50953 *
50954 * // The `_.matchesProperty` iteratee shorthand.
50955 * _.every(users, ['active', false]);
50956 * // => true
50957 *
50958 * // The `_.property` iteratee shorthand.
50959 * _.every(users, 'active');
50960 * // => false
50961 */
50962 function every(collection, predicate, guard) {
50963 var func = isArray(collection) ? arrayEvery : baseEvery;
50964 if (guard && isIterateeCall(collection, predicate, guard)) {
50965 predicate = undefined;
50966 }
50967 return func(collection, getIteratee(predicate, 3));
50968 }
50969
50970 /**
50971 * Iterates over elements of `collection`, returning an array of all elements
50972 * `predicate` returns truthy for. The predicate is invoked with three
50973 * arguments: (value, index|key, collection).
50974 *
50975 * **Note:** Unlike `_.remove`, this method returns a new array.
50976 *
50977 * @static
50978 * @memberOf _
50979 * @since 0.1.0
50980 * @category Collection
50981 * @param {Array|Object} collection The collection to iterate over.
50982 * @param {Function} [predicate=_.identity] The function invoked per iteration.
50983 * @returns {Array} Returns the new filtered array.
50984 * @see _.reject
50985 * @example
50986 *
50987 * var users = [
50988 * { 'user': 'barney', 'age': 36, 'active': true },
50989 * { 'user': 'fred', 'age': 40, 'active': false }
50990 * ];
50991 *
50992 * _.filter(users, function(o) { return !o.active; });
50993 * // => objects for ['fred']
50994 *
50995 * // The `_.matches` iteratee shorthand.
50996 * _.filter(users, { 'age': 36, 'active': true });
50997 * // => objects for ['barney']
50998 *
50999 * // The `_.matchesProperty` iteratee shorthand.
51000 * _.filter(users, ['active', false]);
51001 * // => objects for ['fred']
51002 *
51003 * // The `_.property` iteratee shorthand.
51004 * _.filter(users, 'active');
51005 * // => objects for ['barney']
51006 */
51007 function filter(collection, predicate) {
51008 var func = isArray(collection) ? arrayFilter : baseFilter;
51009 return func(collection, getIteratee(predicate, 3));
51010 }
51011
51012 /**
51013 * Iterates over elements of `collection`, returning the first element
51014 * `predicate` returns truthy for. The predicate is invoked with three
51015 * arguments: (value, index|key, collection).
51016 *
51017 * @static
51018 * @memberOf _
51019 * @since 0.1.0
51020 * @category Collection
51021 * @param {Array|Object} collection The collection to inspect.
51022 * @param {Function} [predicate=_.identity] The function invoked per iteration.
51023 * @param {number} [fromIndex=0] The index to search from.
51024 * @returns {*} Returns the matched element, else `undefined`.
51025 * @example
51026 *
51027 * var users = [
51028 * { 'user': 'barney', 'age': 36, 'active': true },
51029 * { 'user': 'fred', 'age': 40, 'active': false },
51030 * { 'user': 'pebbles', 'age': 1, 'active': true }
51031 * ];
51032 *
51033 * _.find(users, function(o) { return o.age < 40; });
51034 * // => object for 'barney'
51035 *
51036 * // The `_.matches` iteratee shorthand.
51037 * _.find(users, { 'age': 1, 'active': true });
51038 * // => object for 'pebbles'
51039 *
51040 * // The `_.matchesProperty` iteratee shorthand.
51041 * _.find(users, ['active', false]);
51042 * // => object for 'fred'
51043 *
51044 * // The `_.property` iteratee shorthand.
51045 * _.find(users, 'active');
51046 * // => object for 'barney'
51047 */
51048 var find = createFind(findIndex);
51049
51050 /**
51051 * This method is like `_.find` except that it iterates over elements of
51052 * `collection` from right to left.
51053 *
51054 * @static
51055 * @memberOf _
51056 * @since 2.0.0
51057 * @category Collection
51058 * @param {Array|Object} collection The collection to inspect.
51059 * @param {Function} [predicate=_.identity] The function invoked per iteration.
51060 * @param {number} [fromIndex=collection.length-1] The index to search from.
51061 * @returns {*} Returns the matched element, else `undefined`.
51062 * @example
51063 *
51064 * _.findLast([1, 2, 3, 4], function(n) {
51065 * return n % 2 == 1;
51066 * });
51067 * // => 3
51068 */
51069 var findLast = createFind(findLastIndex);
51070
51071 /**
51072 * Creates a flattened array of values by running each element in `collection`
51073 * thru `iteratee` and flattening the mapped results. The iteratee is invoked
51074 * with three arguments: (value, index|key, collection).
51075 *
51076 * @static
51077 * @memberOf _
51078 * @since 4.0.0
51079 * @category Collection
51080 * @param {Array|Object} collection The collection to iterate over.
51081 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51082 * @returns {Array} Returns the new flattened array.
51083 * @example
51084 *
51085 * function duplicate(n) {
51086 * return [n, n];
51087 * }
51088 *
51089 * _.flatMap([1, 2], duplicate);
51090 * // => [1, 1, 2, 2]
51091 */
51092 function flatMap(collection, iteratee) {
51093 return baseFlatten(map(collection, iteratee), 1);
51094 }
51095
51096 /**
51097 * This method is like `_.flatMap` except that it recursively flattens the
51098 * mapped results.
51099 *
51100 * @static
51101 * @memberOf _
51102 * @since 4.7.0
51103 * @category Collection
51104 * @param {Array|Object} collection The collection to iterate over.
51105 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51106 * @returns {Array} Returns the new flattened array.
51107 * @example
51108 *
51109 * function duplicate(n) {
51110 * return [[[n, n]]];
51111 * }
51112 *
51113 * _.flatMapDeep([1, 2], duplicate);
51114 * // => [1, 1, 2, 2]
51115 */
51116 function flatMapDeep(collection, iteratee) {
51117 return baseFlatten(map(collection, iteratee), INFINITY);
51118 }
51119
51120 /**
51121 * This method is like `_.flatMap` except that it recursively flattens the
51122 * mapped results up to `depth` times.
51123 *
51124 * @static
51125 * @memberOf _
51126 * @since 4.7.0
51127 * @category Collection
51128 * @param {Array|Object} collection The collection to iterate over.
51129 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51130 * @param {number} [depth=1] The maximum recursion depth.
51131 * @returns {Array} Returns the new flattened array.
51132 * @example
51133 *
51134 * function duplicate(n) {
51135 * return [[[n, n]]];
51136 * }
51137 *
51138 * _.flatMapDepth([1, 2], duplicate, 2);
51139 * // => [[1, 1], [2, 2]]
51140 */
51141 function flatMapDepth(collection, iteratee, depth) {
51142 depth = depth === undefined ? 1 : toInteger(depth);
51143 return baseFlatten(map(collection, iteratee), depth);
51144 }
51145
51146 /**
51147 * Iterates over elements of `collection` and invokes `iteratee` for each element.
51148 * The iteratee is invoked with three arguments: (value, index|key, collection).
51149 * Iteratee functions may exit iteration early by explicitly returning `false`.
51150 *
51151 * **Note:** As with other "Collections" methods, objects with a "length"
51152 * property are iterated like arrays. To avoid this behavior use `_.forIn`
51153 * or `_.forOwn` for object iteration.
51154 *
51155 * @static
51156 * @memberOf _
51157 * @since 0.1.0
51158 * @alias each
51159 * @category Collection
51160 * @param {Array|Object} collection The collection to iterate over.
51161 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51162 * @returns {Array|Object} Returns `collection`.
51163 * @see _.forEachRight
51164 * @example
51165 *
51166 * _.forEach([1, 2], function(value) {
51167 * console.log(value);
51168 * });
51169 * // => Logs `1` then `2`.
51170 *
51171 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
51172 * console.log(key);
51173 * });
51174 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
51175 */
51176 function forEach(collection, iteratee) {
51177 var func = isArray(collection) ? arrayEach : baseEach;
51178 return func(collection, getIteratee(iteratee, 3));
51179 }
51180
51181 /**
51182 * This method is like `_.forEach` except that it iterates over elements of
51183 * `collection` from right to left.
51184 *
51185 * @static
51186 * @memberOf _
51187 * @since 2.0.0
51188 * @alias eachRight
51189 * @category Collection
51190 * @param {Array|Object} collection The collection to iterate over.
51191 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51192 * @returns {Array|Object} Returns `collection`.
51193 * @see _.forEach
51194 * @example
51195 *
51196 * _.forEachRight([1, 2], function(value) {
51197 * console.log(value);
51198 * });
51199 * // => Logs `2` then `1`.
51200 */
51201 function forEachRight(collection, iteratee) {
51202 var func = isArray(collection) ? arrayEachRight : baseEachRight;
51203 return func(collection, getIteratee(iteratee, 3));
51204 }
51205
51206 /**
51207 * Creates an object composed of keys generated from the results of running
51208 * each element of `collection` thru `iteratee`. The order of grouped values
51209 * is determined by the order they occur in `collection`. The corresponding
51210 * value of each key is an array of elements responsible for generating the
51211 * key. The iteratee is invoked with one argument: (value).
51212 *
51213 * @static
51214 * @memberOf _
51215 * @since 0.1.0
51216 * @category Collection
51217 * @param {Array|Object} collection The collection to iterate over.
51218 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
51219 * @returns {Object} Returns the composed aggregate object.
51220 * @example
51221 *
51222 * _.groupBy([6.1, 4.2, 6.3], Math.floor);
51223 * // => { '4': [4.2], '6': [6.1, 6.3] }
51224 *
51225 * // The `_.property` iteratee shorthand.
51226 * _.groupBy(['one', 'two', 'three'], 'length');
51227 * // => { '3': ['one', 'two'], '5': ['three'] }
51228 */
51229 var groupBy = createAggregator(function(result, value, key) {
51230 if (hasOwnProperty.call(result, key)) {
51231 result[key].push(value);
51232 } else {
51233 baseAssignValue(result, key, [value]);
51234 }
51235 });
51236
51237 /**
51238 * Checks if `value` is in `collection`. If `collection` is a string, it's
51239 * checked for a substring of `value`, otherwise
51240 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
51241 * is used for equality comparisons. If `fromIndex` is negative, it's used as
51242 * the offset from the end of `collection`.
51243 *
51244 * @static
51245 * @memberOf _
51246 * @since 0.1.0
51247 * @category Collection
51248 * @param {Array|Object|string} collection The collection to inspect.
51249 * @param {*} value The value to search for.
51250 * @param {number} [fromIndex=0] The index to search from.
51251 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
51252 * @returns {boolean} Returns `true` if `value` is found, else `false`.
51253 * @example
51254 *
51255 * _.includes([1, 2, 3], 1);
51256 * // => true
51257 *
51258 * _.includes([1, 2, 3], 1, 2);
51259 * // => false
51260 *
51261 * _.includes({ 'a': 1, 'b': 2 }, 1);
51262 * // => true
51263 *
51264 * _.includes('abcd', 'bc');
51265 * // => true
51266 */
51267 function includes(collection, value, fromIndex, guard) {
51268 collection = isArrayLike(collection) ? collection : values(collection);
51269 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
51270
51271 var length = collection.length;
51272 if (fromIndex < 0) {
51273 fromIndex = nativeMax(length + fromIndex, 0);
51274 }
51275 return isString(collection)
51276 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
51277 : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
51278 }
51279
51280 /**
51281 * Invokes the method at `path` of each element in `collection`, returning
51282 * an array of the results of each invoked method. Any additional arguments
51283 * are provided to each invoked method. If `path` is a function, it's invoked
51284 * for, and `this` bound to, each element in `collection`.
51285 *
51286 * @static
51287 * @memberOf _
51288 * @since 4.0.0
51289 * @category Collection
51290 * @param {Array|Object} collection The collection to iterate over.
51291 * @param {Array|Function|string} path The path of the method to invoke or
51292 * the function invoked per iteration.
51293 * @param {...*} [args] The arguments to invoke each method with.
51294 * @returns {Array} Returns the array of results.
51295 * @example
51296 *
51297 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
51298 * // => [[1, 5, 7], [1, 2, 3]]
51299 *
51300 * _.invokeMap([123, 456], String.prototype.split, '');
51301 * // => [['1', '2', '3'], ['4', '5', '6']]
51302 */
51303 var invokeMap = baseRest(function(collection, path, args) {
51304 var index = -1,
51305 isFunc = typeof path == 'function',
51306 result = isArrayLike(collection) ? Array(collection.length) : [];
51307
51308 baseEach(collection, function(value) {
51309 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
51310 });
51311 return result;
51312 });
51313
51314 /**
51315 * Creates an object composed of keys generated from the results of running
51316 * each element of `collection` thru `iteratee`. The corresponding value of
51317 * each key is the last element responsible for generating the key. The
51318 * iteratee is invoked with one argument: (value).
51319 *
51320 * @static
51321 * @memberOf _
51322 * @since 4.0.0
51323 * @category Collection
51324 * @param {Array|Object} collection The collection to iterate over.
51325 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
51326 * @returns {Object} Returns the composed aggregate object.
51327 * @example
51328 *
51329 * var array = [
51330 * { 'dir': 'left', 'code': 97 },
51331 * { 'dir': 'right', 'code': 100 }
51332 * ];
51333 *
51334 * _.keyBy(array, function(o) {
51335 * return String.fromCharCode(o.code);
51336 * });
51337 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
51338 *
51339 * _.keyBy(array, 'dir');
51340 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
51341 */
51342 var keyBy = createAggregator(function(result, value, key) {
51343 baseAssignValue(result, key, value);
51344 });
51345
51346 /**
51347 * Creates an array of values by running each element in `collection` thru
51348 * `iteratee`. The iteratee is invoked with three arguments:
51349 * (value, index|key, collection).
51350 *
51351 * Many lodash methods are guarded to work as iteratees for methods like
51352 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
51353 *
51354 * The guarded methods are:
51355 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
51356 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
51357 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
51358 * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
51359 *
51360 * @static
51361 * @memberOf _
51362 * @since 0.1.0
51363 * @category Collection
51364 * @param {Array|Object} collection The collection to iterate over.
51365 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51366 * @returns {Array} Returns the new mapped array.
51367 * @example
51368 *
51369 * function square(n) {
51370 * return n * n;
51371 * }
51372 *
51373 * _.map([4, 8], square);
51374 * // => [16, 64]
51375 *
51376 * _.map({ 'a': 4, 'b': 8 }, square);
51377 * // => [16, 64] (iteration order is not guaranteed)
51378 *
51379 * var users = [
51380 * { 'user': 'barney' },
51381 * { 'user': 'fred' }
51382 * ];
51383 *
51384 * // The `_.property` iteratee shorthand.
51385 * _.map(users, 'user');
51386 * // => ['barney', 'fred']
51387 */
51388 function map(collection, iteratee) {
51389 var func = isArray(collection) ? arrayMap : baseMap;
51390 return func(collection, getIteratee(iteratee, 3));
51391 }
51392
51393 /**
51394 * This method is like `_.sortBy` except that it allows specifying the sort
51395 * orders of the iteratees to sort by. If `orders` is unspecified, all values
51396 * are sorted in ascending order. Otherwise, specify an order of "desc" for
51397 * descending or "asc" for ascending sort order of corresponding values.
51398 *
51399 * @static
51400 * @memberOf _
51401 * @since 4.0.0
51402 * @category Collection
51403 * @param {Array|Object} collection The collection to iterate over.
51404 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
51405 * The iteratees to sort by.
51406 * @param {string[]} [orders] The sort orders of `iteratees`.
51407 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
51408 * @returns {Array} Returns the new sorted array.
51409 * @example
51410 *
51411 * var users = [
51412 * { 'user': 'fred', 'age': 48 },
51413 * { 'user': 'barney', 'age': 34 },
51414 * { 'user': 'fred', 'age': 40 },
51415 * { 'user': 'barney', 'age': 36 }
51416 * ];
51417 *
51418 * // Sort by `user` in ascending order and by `age` in descending order.
51419 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
51420 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
51421 */
51422 function orderBy(collection, iteratees, orders, guard) {
51423 if (collection == null) {
51424 return [];
51425 }
51426 if (!isArray(iteratees)) {
51427 iteratees = iteratees == null ? [] : [iteratees];
51428 }
51429 orders = guard ? undefined : orders;
51430 if (!isArray(orders)) {
51431 orders = orders == null ? [] : [orders];
51432 }
51433 return baseOrderBy(collection, iteratees, orders);
51434 }
51435
51436 /**
51437 * Creates an array of elements split into two groups, the first of which
51438 * contains elements `predicate` returns truthy for, the second of which
51439 * contains elements `predicate` returns falsey for. The predicate is
51440 * invoked with one argument: (value).
51441 *
51442 * @static
51443 * @memberOf _
51444 * @since 3.0.0
51445 * @category Collection
51446 * @param {Array|Object} collection The collection to iterate over.
51447 * @param {Function} [predicate=_.identity] The function invoked per iteration.
51448 * @returns {Array} Returns the array of grouped elements.
51449 * @example
51450 *
51451 * var users = [
51452 * { 'user': 'barney', 'age': 36, 'active': false },
51453 * { 'user': 'fred', 'age': 40, 'active': true },
51454 * { 'user': 'pebbles', 'age': 1, 'active': false }
51455 * ];
51456 *
51457 * _.partition(users, function(o) { return o.active; });
51458 * // => objects for [['fred'], ['barney', 'pebbles']]
51459 *
51460 * // The `_.matches` iteratee shorthand.
51461 * _.partition(users, { 'age': 1, 'active': false });
51462 * // => objects for [['pebbles'], ['barney', 'fred']]
51463 *
51464 * // The `_.matchesProperty` iteratee shorthand.
51465 * _.partition(users, ['active', false]);
51466 * // => objects for [['barney', 'pebbles'], ['fred']]
51467 *
51468 * // The `_.property` iteratee shorthand.
51469 * _.partition(users, 'active');
51470 * // => objects for [['fred'], ['barney', 'pebbles']]
51471 */
51472 var partition = createAggregator(function(result, value, key) {
51473 result[key ? 0 : 1].push(value);
51474 }, function() { return [[], []]; });
51475
51476 /**
51477 * Reduces `collection` to a value which is the accumulated result of running
51478 * each element in `collection` thru `iteratee`, where each successive
51479 * invocation is supplied the return value of the previous. If `accumulator`
51480 * is not given, the first element of `collection` is used as the initial
51481 * value. The iteratee is invoked with four arguments:
51482 * (accumulator, value, index|key, collection).
51483 *
51484 * Many lodash methods are guarded to work as iteratees for methods like
51485 * `_.reduce`, `_.reduceRight`, and `_.transform`.
51486 *
51487 * The guarded methods are:
51488 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
51489 * and `sortBy`
51490 *
51491 * @static
51492 * @memberOf _
51493 * @since 0.1.0
51494 * @category Collection
51495 * @param {Array|Object} collection The collection to iterate over.
51496 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51497 * @param {*} [accumulator] The initial value.
51498 * @returns {*} Returns the accumulated value.
51499 * @see _.reduceRight
51500 * @example
51501 *
51502 * _.reduce([1, 2], function(sum, n) {
51503 * return sum + n;
51504 * }, 0);
51505 * // => 3
51506 *
51507 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
51508 * (result[value] || (result[value] = [])).push(key);
51509 * return result;
51510 * }, {});
51511 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
51512 */
51513 function reduce(collection, iteratee, accumulator) {
51514 var func = isArray(collection) ? arrayReduce : baseReduce,
51515 initAccum = arguments.length < 3;
51516
51517 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
51518 }
51519
51520 /**
51521 * This method is like `_.reduce` except that it iterates over elements of
51522 * `collection` from right to left.
51523 *
51524 * @static
51525 * @memberOf _
51526 * @since 0.1.0
51527 * @category Collection
51528 * @param {Array|Object} collection The collection to iterate over.
51529 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
51530 * @param {*} [accumulator] The initial value.
51531 * @returns {*} Returns the accumulated value.
51532 * @see _.reduce
51533 * @example
51534 *
51535 * var array = [[0, 1], [2, 3], [4, 5]];
51536 *
51537 * _.reduceRight(array, function(flattened, other) {
51538 * return flattened.concat(other);
51539 * }, []);
51540 * // => [4, 5, 2, 3, 0, 1]
51541 */
51542 function reduceRight(collection, iteratee, accumulator) {
51543 var func = isArray(collection) ? arrayReduceRight : baseReduce,
51544 initAccum = arguments.length < 3;
51545
51546 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
51547 }
51548
51549 /**
51550 * The opposite of `_.filter`; this method returns the elements of `collection`
51551 * that `predicate` does **not** return truthy for.
51552 *
51553 * @static
51554 * @memberOf _
51555 * @since 0.1.0
51556 * @category Collection
51557 * @param {Array|Object} collection The collection to iterate over.
51558 * @param {Function} [predicate=_.identity] The function invoked per iteration.
51559 * @returns {Array} Returns the new filtered array.
51560 * @see _.filter
51561 * @example
51562 *
51563 * var users = [
51564 * { 'user': 'barney', 'age': 36, 'active': false },
51565 * { 'user': 'fred', 'age': 40, 'active': true }
51566 * ];
51567 *
51568 * _.reject(users, function(o) { return !o.active; });
51569 * // => objects for ['fred']
51570 *
51571 * // The `_.matches` iteratee shorthand.
51572 * _.reject(users, { 'age': 40, 'active': true });
51573 * // => objects for ['barney']
51574 *
51575 * // The `_.matchesProperty` iteratee shorthand.
51576 * _.reject(users, ['active', false]);
51577 * // => objects for ['fred']
51578 *
51579 * // The `_.property` iteratee shorthand.
51580 * _.reject(users, 'active');
51581 * // => objects for ['barney']
51582 */
51583 function reject(collection, predicate) {
51584 var func = isArray(collection) ? arrayFilter : baseFilter;
51585 return func(collection, negate(getIteratee(predicate, 3)));
51586 }
51587
51588 /**
51589 * Gets a random element from `collection`.
51590 *
51591 * @static
51592 * @memberOf _
51593 * @since 2.0.0
51594 * @category Collection
51595 * @param {Array|Object} collection The collection to sample.
51596 * @returns {*} Returns the random element.
51597 * @example
51598 *
51599 * _.sample([1, 2, 3, 4]);
51600 * // => 2
51601 */
51602 function sample(collection) {
51603 var func = isArray(collection) ? arraySample : baseSample;
51604 return func(collection);
51605 }
51606
51607 /**
51608 * Gets `n` random elements at unique keys from `collection` up to the
51609 * size of `collection`.
51610 *
51611 * @static
51612 * @memberOf _
51613 * @since 4.0.0
51614 * @category Collection
51615 * @param {Array|Object} collection The collection to sample.
51616 * @param {number} [n=1] The number of elements to sample.
51617 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
51618 * @returns {Array} Returns the random elements.
51619 * @example
51620 *
51621 * _.sampleSize([1, 2, 3], 2);
51622 * // => [3, 1]
51623 *
51624 * _.sampleSize([1, 2, 3], 4);
51625 * // => [2, 3, 1]
51626 */
51627 function sampleSize(collection, n, guard) {
51628 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
51629 n = 1;
51630 } else {
51631 n = toInteger(n);
51632 }
51633 var func = isArray(collection) ? arraySampleSize : baseSampleSize;
51634 return func(collection, n);
51635 }
51636
51637 /**
51638 * Creates an array of shuffled values, using a version of the
51639 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
51640 *
51641 * @static
51642 * @memberOf _
51643 * @since 0.1.0
51644 * @category Collection
51645 * @param {Array|Object} collection The collection to shuffle.
51646 * @returns {Array} Returns the new shuffled array.
51647 * @example
51648 *
51649 * _.shuffle([1, 2, 3, 4]);
51650 * // => [4, 1, 3, 2]
51651 */
51652 function shuffle(collection) {
51653 var func = isArray(collection) ? arrayShuffle : baseShuffle;
51654 return func(collection);
51655 }
51656
51657 /**
51658 * Gets the size of `collection` by returning its length for array-like
51659 * values or the number of own enumerable string keyed properties for objects.
51660 *
51661 * @static
51662 * @memberOf _
51663 * @since 0.1.0
51664 * @category Collection
51665 * @param {Array|Object|string} collection The collection to inspect.
51666 * @returns {number} Returns the collection size.
51667 * @example
51668 *
51669 * _.size([1, 2, 3]);
51670 * // => 3
51671 *
51672 * _.size({ 'a': 1, 'b': 2 });
51673 * // => 2
51674 *
51675 * _.size('pebbles');
51676 * // => 7
51677 */
51678 function size(collection) {
51679 if (collection == null) {
51680 return 0;
51681 }
51682 if (isArrayLike(collection)) {
51683 return isString(collection) ? stringSize(collection) : collection.length;
51684 }
51685 var tag = getTag(collection);
51686 if (tag == mapTag || tag == setTag) {
51687 return collection.size;
51688 }
51689 return baseKeys(collection).length;
51690 }
51691
51692 /**
51693 * Checks if `predicate` returns truthy for **any** element of `collection`.
51694 * Iteration is stopped once `predicate` returns truthy. The predicate is
51695 * invoked with three arguments: (value, index|key, collection).
51696 *
51697 * @static
51698 * @memberOf _
51699 * @since 0.1.0
51700 * @category Collection
51701 * @param {Array|Object} collection The collection to iterate over.
51702 * @param {Function} [predicate=_.identity] The function invoked per iteration.
51703 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
51704 * @returns {boolean} Returns `true` if any element passes the predicate check,
51705 * else `false`.
51706 * @example
51707 *
51708 * _.some([null, 0, 'yes', false], Boolean);
51709 * // => true
51710 *
51711 * var users = [
51712 * { 'user': 'barney', 'active': true },
51713 * { 'user': 'fred', 'active': false }
51714 * ];
51715 *
51716 * // The `_.matches` iteratee shorthand.
51717 * _.some(users, { 'user': 'barney', 'active': false });
51718 * // => false
51719 *
51720 * // The `_.matchesProperty` iteratee shorthand.
51721 * _.some(users, ['active', false]);
51722 * // => true
51723 *
51724 * // The `_.property` iteratee shorthand.
51725 * _.some(users, 'active');
51726 * // => true
51727 */
51728 function some(collection, predicate, guard) {
51729 var func = isArray(collection) ? arraySome : baseSome;
51730 if (guard && isIterateeCall(collection, predicate, guard)) {
51731 predicate = undefined;
51732 }
51733 return func(collection, getIteratee(predicate, 3));
51734 }
51735
51736 /**
51737 * Creates an array of elements, sorted in ascending order by the results of
51738 * running each element in a collection thru each iteratee. This method
51739 * performs a stable sort, that is, it preserves the original sort order of
51740 * equal elements. The iteratees are invoked with one argument: (value).
51741 *
51742 * @static
51743 * @memberOf _
51744 * @since 0.1.0
51745 * @category Collection
51746 * @param {Array|Object} collection The collection to iterate over.
51747 * @param {...(Function|Function[])} [iteratees=[_.identity]]
51748 * The iteratees to sort by.
51749 * @returns {Array} Returns the new sorted array.
51750 * @example
51751 *
51752 * var users = [
51753 * { 'user': 'fred', 'age': 48 },
51754 * { 'user': 'barney', 'age': 36 },
51755 * { 'user': 'fred', 'age': 40 },
51756 * { 'user': 'barney', 'age': 34 }
51757 * ];
51758 *
51759 * _.sortBy(users, [function(o) { return o.user; }]);
51760 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
51761 *
51762 * _.sortBy(users, ['user', 'age']);
51763 * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
51764 */
51765 var sortBy = baseRest(function(collection, iteratees) {
51766 if (collection == null) {
51767 return [];
51768 }
51769 var length = iteratees.length;
51770 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
51771 iteratees = [];
51772 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
51773 iteratees = [iteratees[0]];
51774 }
51775 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
51776 });
51777
51778 /*------------------------------------------------------------------------*/
51779
51780 /**
51781 * Gets the timestamp of the number of milliseconds that have elapsed since
51782 * the Unix epoch (1 January 1970 00:00:00 UTC).
51783 *
51784 * @static
51785 * @memberOf _
51786 * @since 2.4.0
51787 * @category Date
51788 * @returns {number} Returns the timestamp.
51789 * @example
51790 *
51791 * _.defer(function(stamp) {
51792 * console.log(_.now() - stamp);
51793 * }, _.now());
51794 * // => Logs the number of milliseconds it took for the deferred invocation.
51795 */
51796 var now = ctxNow || function() {
51797 return root.Date.now();
51798 };
51799
51800 /*------------------------------------------------------------------------*/
51801
51802 /**
51803 * The opposite of `_.before`; this method creates a function that invokes
51804 * `func` once it's called `n` or more times.
51805 *
51806 * @static
51807 * @memberOf _
51808 * @since 0.1.0
51809 * @category Function
51810 * @param {number} n The number of calls before `func` is invoked.
51811 * @param {Function} func The function to restrict.
51812 * @returns {Function} Returns the new restricted function.
51813 * @example
51814 *
51815 * var saves = ['profile', 'settings'];
51816 *
51817 * var done = _.after(saves.length, function() {
51818 * console.log('done saving!');
51819 * });
51820 *
51821 * _.forEach(saves, function(type) {
51822 * asyncSave({ 'type': type, 'complete': done });
51823 * });
51824 * // => Logs 'done saving!' after the two async saves have completed.
51825 */
51826 function after(n, func) {
51827 if (typeof func != 'function') {
51828 throw new TypeError(FUNC_ERROR_TEXT);
51829 }
51830 n = toInteger(n);
51831 return function() {
51832 if (--n < 1) {
51833 return func.apply(this, arguments);
51834 }
51835 };
51836 }
51837
51838 /**
51839 * Creates a function that invokes `func`, with up to `n` arguments,
51840 * ignoring any additional arguments.
51841 *
51842 * @static
51843 * @memberOf _
51844 * @since 3.0.0
51845 * @category Function
51846 * @param {Function} func The function to cap arguments for.
51847 * @param {number} [n=func.length] The arity cap.
51848 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
51849 * @returns {Function} Returns the new capped function.
51850 * @example
51851 *
51852 * _.map(['6', '8', '10'], _.ary(parseInt, 1));
51853 * // => [6, 8, 10]
51854 */
51855 function ary(func, n, guard) {
51856 n = guard ? undefined : n;
51857 n = (func && n == null) ? func.length : n;
51858 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
51859 }
51860
51861 /**
51862 * Creates a function that invokes `func`, with the `this` binding and arguments
51863 * of the created function, while it's called less than `n` times. Subsequent
51864 * calls to the created function return the result of the last `func` invocation.
51865 *
51866 * @static
51867 * @memberOf _
51868 * @since 3.0.0
51869 * @category Function
51870 * @param {number} n The number of calls at which `func` is no longer invoked.
51871 * @param {Function} func The function to restrict.
51872 * @returns {Function} Returns the new restricted function.
51873 * @example
51874 *
51875 * jQuery(element).on('click', _.before(5, addContactToList));
51876 * // => Allows adding up to 4 contacts to the list.
51877 */
51878 function before(n, func) {
51879 var result;
51880 if (typeof func != 'function') {
51881 throw new TypeError(FUNC_ERROR_TEXT);
51882 }
51883 n = toInteger(n);
51884 return function() {
51885 if (--n > 0) {
51886 result = func.apply(this, arguments);
51887 }
51888 if (n <= 1) {
51889 func = undefined;
51890 }
51891 return result;
51892 };
51893 }
51894
51895 /**
51896 * Creates a function that invokes `func` with the `this` binding of `thisArg`
51897 * and `partials` prepended to the arguments it receives.
51898 *
51899 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
51900 * may be used as a placeholder for partially applied arguments.
51901 *
51902 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
51903 * property of bound functions.
51904 *
51905 * @static
51906 * @memberOf _
51907 * @since 0.1.0
51908 * @category Function
51909 * @param {Function} func The function to bind.
51910 * @param {*} thisArg The `this` binding of `func`.
51911 * @param {...*} [partials] The arguments to be partially applied.
51912 * @returns {Function} Returns the new bound function.
51913 * @example
51914 *
51915 * function greet(greeting, punctuation) {
51916 * return greeting + ' ' + this.user + punctuation;
51917 * }
51918 *
51919 * var object = { 'user': 'fred' };
51920 *
51921 * var bound = _.bind(greet, object, 'hi');
51922 * bound('!');
51923 * // => 'hi fred!'
51924 *
51925 * // Bound with placeholders.
51926 * var bound = _.bind(greet, object, _, '!');
51927 * bound('hi');
51928 * // => 'hi fred!'
51929 */
51930 var bind = baseRest(function(func, thisArg, partials) {
51931 var bitmask = WRAP_BIND_FLAG;
51932 if (partials.length) {
51933 var holders = replaceHolders(partials, getHolder(bind));
51934 bitmask |= WRAP_PARTIAL_FLAG;
51935 }
51936 return createWrap(func, bitmask, thisArg, partials, holders);
51937 });
51938
51939 /**
51940 * Creates a function that invokes the method at `object[key]` with `partials`
51941 * prepended to the arguments it receives.
51942 *
51943 * This method differs from `_.bind` by allowing bound functions to reference
51944 * methods that may be redefined or don't yet exist. See
51945 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
51946 * for more details.
51947 *
51948 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
51949 * builds, may be used as a placeholder for partially applied arguments.
51950 *
51951 * @static
51952 * @memberOf _
51953 * @since 0.10.0
51954 * @category Function
51955 * @param {Object} object The object to invoke the method on.
51956 * @param {string} key The key of the method.
51957 * @param {...*} [partials] The arguments to be partially applied.
51958 * @returns {Function} Returns the new bound function.
51959 * @example
51960 *
51961 * var object = {
51962 * 'user': 'fred',
51963 * 'greet': function(greeting, punctuation) {
51964 * return greeting + ' ' + this.user + punctuation;
51965 * }
51966 * };
51967 *
51968 * var bound = _.bindKey(object, 'greet', 'hi');
51969 * bound('!');
51970 * // => 'hi fred!'
51971 *
51972 * object.greet = function(greeting, punctuation) {
51973 * return greeting + 'ya ' + this.user + punctuation;
51974 * };
51975 *
51976 * bound('!');
51977 * // => 'hiya fred!'
51978 *
51979 * // Bound with placeholders.
51980 * var bound = _.bindKey(object, 'greet', _, '!');
51981 * bound('hi');
51982 * // => 'hiya fred!'
51983 */
51984 var bindKey = baseRest(function(object, key, partials) {
51985 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
51986 if (partials.length) {
51987 var holders = replaceHolders(partials, getHolder(bindKey));
51988 bitmask |= WRAP_PARTIAL_FLAG;
51989 }
51990 return createWrap(key, bitmask, object, partials, holders);
51991 });
51992
51993 /**
51994 * Creates a function that accepts arguments of `func` and either invokes
51995 * `func` returning its result, if at least `arity` number of arguments have
51996 * been provided, or returns a function that accepts the remaining `func`
51997 * arguments, and so on. The arity of `func` may be specified if `func.length`
51998 * is not sufficient.
51999 *
52000 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
52001 * may be used as a placeholder for provided arguments.
52002 *
52003 * **Note:** This method doesn't set the "length" property of curried functions.
52004 *
52005 * @static
52006 * @memberOf _
52007 * @since 2.0.0
52008 * @category Function
52009 * @param {Function} func The function to curry.
52010 * @param {number} [arity=func.length] The arity of `func`.
52011 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
52012 * @returns {Function} Returns the new curried function.
52013 * @example
52014 *
52015 * var abc = function(a, b, c) {
52016 * return [a, b, c];
52017 * };
52018 *
52019 * var curried = _.curry(abc);
52020 *
52021 * curried(1)(2)(3);
52022 * // => [1, 2, 3]
52023 *
52024 * curried(1, 2)(3);
52025 * // => [1, 2, 3]
52026 *
52027 * curried(1, 2, 3);
52028 * // => [1, 2, 3]
52029 *
52030 * // Curried with placeholders.
52031 * curried(1)(_, 3)(2);
52032 * // => [1, 2, 3]
52033 */
52034 function curry(func, arity, guard) {
52035 arity = guard ? undefined : arity;
52036 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
52037 result.placeholder = curry.placeholder;
52038 return result;
52039 }
52040
52041 /**
52042 * This method is like `_.curry` except that arguments are applied to `func`
52043 * in the manner of `_.partialRight` instead of `_.partial`.
52044 *
52045 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
52046 * builds, may be used as a placeholder for provided arguments.
52047 *
52048 * **Note:** This method doesn't set the "length" property of curried functions.
52049 *
52050 * @static
52051 * @memberOf _
52052 * @since 3.0.0
52053 * @category Function
52054 * @param {Function} func The function to curry.
52055 * @param {number} [arity=func.length] The arity of `func`.
52056 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
52057 * @returns {Function} Returns the new curried function.
52058 * @example
52059 *
52060 * var abc = function(a, b, c) {
52061 * return [a, b, c];
52062 * };
52063 *
52064 * var curried = _.curryRight(abc);
52065 *
52066 * curried(3)(2)(1);
52067 * // => [1, 2, 3]
52068 *
52069 * curried(2, 3)(1);
52070 * // => [1, 2, 3]
52071 *
52072 * curried(1, 2, 3);
52073 * // => [1, 2, 3]
52074 *
52075 * // Curried with placeholders.
52076 * curried(3)(1, _)(2);
52077 * // => [1, 2, 3]
52078 */
52079 function curryRight(func, arity, guard) {
52080 arity = guard ? undefined : arity;
52081 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
52082 result.placeholder = curryRight.placeholder;
52083 return result;
52084 }
52085
52086 /**
52087 * Creates a debounced function that delays invoking `func` until after `wait`
52088 * milliseconds have elapsed since the last time the debounced function was
52089 * invoked. The debounced function comes with a `cancel` method to cancel
52090 * delayed `func` invocations and a `flush` method to immediately invoke them.
52091 * Provide `options` to indicate whether `func` should be invoked on the
52092 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
52093 * with the last arguments provided to the debounced function. Subsequent
52094 * calls to the debounced function return the result of the last `func`
52095 * invocation.
52096 *
52097 * **Note:** If `leading` and `trailing` options are `true`, `func` is
52098 * invoked on the trailing edge of the timeout only if the debounced function
52099 * is invoked more than once during the `wait` timeout.
52100 *
52101 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
52102 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
52103 *
52104 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
52105 * for details over the differences between `_.debounce` and `_.throttle`.
52106 *
52107 * @static
52108 * @memberOf _
52109 * @since 0.1.0
52110 * @category Function
52111 * @param {Function} func The function to debounce.
52112 * @param {number} [wait=0] The number of milliseconds to delay.
52113 * @param {Object} [options={}] The options object.
52114 * @param {boolean} [options.leading=false]
52115 * Specify invoking on the leading edge of the timeout.
52116 * @param {number} [options.maxWait]
52117 * The maximum time `func` is allowed to be delayed before it's invoked.
52118 * @param {boolean} [options.trailing=true]
52119 * Specify invoking on the trailing edge of the timeout.
52120 * @returns {Function} Returns the new debounced function.
52121 * @example
52122 *
52123 * // Avoid costly calculations while the window size is in flux.
52124 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
52125 *
52126 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
52127 * jQuery(element).on('click', _.debounce(sendMail, 300, {
52128 * 'leading': true,
52129 * 'trailing': false
52130 * }));
52131 *
52132 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
52133 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
52134 * var source = new EventSource('/stream');
52135 * jQuery(source).on('message', debounced);
52136 *
52137 * // Cancel the trailing debounced invocation.
52138 * jQuery(window).on('popstate', debounced.cancel);
52139 */
52140 function debounce(func, wait, options) {
52141 var lastArgs,
52142 lastThis,
52143 maxWait,
52144 result,
52145 timerId,
52146 lastCallTime,
52147 lastInvokeTime = 0,
52148 leading = false,
52149 maxing = false,
52150 trailing = true;
52151
52152 if (typeof func != 'function') {
52153 throw new TypeError(FUNC_ERROR_TEXT);
52154 }
52155 wait = toNumber(wait) || 0;
52156 if (isObject(options)) {
52157 leading = !!options.leading;
52158 maxing = 'maxWait' in options;
52159 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
52160 trailing = 'trailing' in options ? !!options.trailing : trailing;
52161 }
52162
52163 function invokeFunc(time) {
52164 var args = lastArgs,
52165 thisArg = lastThis;
52166
52167 lastArgs = lastThis = undefined;
52168 lastInvokeTime = time;
52169 result = func.apply(thisArg, args);
52170 return result;
52171 }
52172
52173 function leadingEdge(time) {
52174 // Reset any `maxWait` timer.
52175 lastInvokeTime = time;
52176 // Start the timer for the trailing edge.
52177 timerId = setTimeout(timerExpired, wait);
52178 // Invoke the leading edge.
52179 return leading ? invokeFunc(time) : result;
52180 }
52181
52182 function remainingWait(time) {
52183 var timeSinceLastCall = time - lastCallTime,
52184 timeSinceLastInvoke = time - lastInvokeTime,
52185 timeWaiting = wait - timeSinceLastCall;
52186
52187 return maxing
52188 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
52189 : timeWaiting;
52190 }
52191
52192 function shouldInvoke(time) {
52193 var timeSinceLastCall = time - lastCallTime,
52194 timeSinceLastInvoke = time - lastInvokeTime;
52195
52196 // Either this is the first call, activity has stopped and we're at the
52197 // trailing edge, the system time has gone backwards and we're treating
52198 // it as the trailing edge, or we've hit the `maxWait` limit.
52199 return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
52200 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
52201 }
52202
52203 function timerExpired() {
52204 var time = now();
52205 if (shouldInvoke(time)) {
52206 return trailingEdge(time);
52207 }
52208 // Restart the timer.
52209 timerId = setTimeout(timerExpired, remainingWait(time));
52210 }
52211
52212 function trailingEdge(time) {
52213 timerId = undefined;
52214
52215 // Only invoke if we have `lastArgs` which means `func` has been
52216 // debounced at least once.
52217 if (trailing && lastArgs) {
52218 return invokeFunc(time);
52219 }
52220 lastArgs = lastThis = undefined;
52221 return result;
52222 }
52223
52224 function cancel() {
52225 if (timerId !== undefined) {
52226 clearTimeout(timerId);
52227 }
52228 lastInvokeTime = 0;
52229 lastArgs = lastCallTime = lastThis = timerId = undefined;
52230 }
52231
52232 function flush() {
52233 return timerId === undefined ? result : trailingEdge(now());
52234 }
52235
52236 function debounced() {
52237 var time = now(),
52238 isInvoking = shouldInvoke(time);
52239
52240 lastArgs = arguments;
52241 lastThis = this;
52242 lastCallTime = time;
52243
52244 if (isInvoking) {
52245 if (timerId === undefined) {
52246 return leadingEdge(lastCallTime);
52247 }
52248 if (maxing) {
52249 // Handle invocations in a tight loop.
52250 clearTimeout(timerId);
52251 timerId = setTimeout(timerExpired, wait);
52252 return invokeFunc(lastCallTime);
52253 }
52254 }
52255 if (timerId === undefined) {
52256 timerId = setTimeout(timerExpired, wait);
52257 }
52258 return result;
52259 }
52260 debounced.cancel = cancel;
52261 debounced.flush = flush;
52262 return debounced;
52263 }
52264
52265 /**
52266 * Defers invoking the `func` until the current call stack has cleared. Any
52267 * additional arguments are provided to `func` when it's invoked.
52268 *
52269 * @static
52270 * @memberOf _
52271 * @since 0.1.0
52272 * @category Function
52273 * @param {Function} func The function to defer.
52274 * @param {...*} [args] The arguments to invoke `func` with.
52275 * @returns {number} Returns the timer id.
52276 * @example
52277 *
52278 * _.defer(function(text) {
52279 * console.log(text);
52280 * }, 'deferred');
52281 * // => Logs 'deferred' after one millisecond.
52282 */
52283 var defer = baseRest(function(func, args) {
52284 return baseDelay(func, 1, args);
52285 });
52286
52287 /**
52288 * Invokes `func` after `wait` milliseconds. Any additional arguments are
52289 * provided to `func` when it's invoked.
52290 *
52291 * @static
52292 * @memberOf _
52293 * @since 0.1.0
52294 * @category Function
52295 * @param {Function} func The function to delay.
52296 * @param {number} wait The number of milliseconds to delay invocation.
52297 * @param {...*} [args] The arguments to invoke `func` with.
52298 * @returns {number} Returns the timer id.
52299 * @example
52300 *
52301 * _.delay(function(text) {
52302 * console.log(text);
52303 * }, 1000, 'later');
52304 * // => Logs 'later' after one second.
52305 */
52306 var delay = baseRest(function(func, wait, args) {
52307 return baseDelay(func, toNumber(wait) || 0, args);
52308 });
52309
52310 /**
52311 * Creates a function that invokes `func` with arguments reversed.
52312 *
52313 * @static
52314 * @memberOf _
52315 * @since 4.0.0
52316 * @category Function
52317 * @param {Function} func The function to flip arguments for.
52318 * @returns {Function} Returns the new flipped function.
52319 * @example
52320 *
52321 * var flipped = _.flip(function() {
52322 * return _.toArray(arguments);
52323 * });
52324 *
52325 * flipped('a', 'b', 'c', 'd');
52326 * // => ['d', 'c', 'b', 'a']
52327 */
52328 function flip(func) {
52329 return createWrap(func, WRAP_FLIP_FLAG);
52330 }
52331
52332 /**
52333 * Creates a function that memoizes the result of `func`. If `resolver` is
52334 * provided, it determines the cache key for storing the result based on the
52335 * arguments provided to the memoized function. By default, the first argument
52336 * provided to the memoized function is used as the map cache key. The `func`
52337 * is invoked with the `this` binding of the memoized function.
52338 *
52339 * **Note:** The cache is exposed as the `cache` property on the memoized
52340 * function. Its creation may be customized by replacing the `_.memoize.Cache`
52341 * constructor with one whose instances implement the
52342 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
52343 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
52344 *
52345 * @static
52346 * @memberOf _
52347 * @since 0.1.0
52348 * @category Function
52349 * @param {Function} func The function to have its output memoized.
52350 * @param {Function} [resolver] The function to resolve the cache key.
52351 * @returns {Function} Returns the new memoized function.
52352 * @example
52353 *
52354 * var object = { 'a': 1, 'b': 2 };
52355 * var other = { 'c': 3, 'd': 4 };
52356 *
52357 * var values = _.memoize(_.values);
52358 * values(object);
52359 * // => [1, 2]
52360 *
52361 * values(other);
52362 * // => [3, 4]
52363 *
52364 * object.a = 2;
52365 * values(object);
52366 * // => [1, 2]
52367 *
52368 * // Modify the result cache.
52369 * values.cache.set(object, ['a', 'b']);
52370 * values(object);
52371 * // => ['a', 'b']
52372 *
52373 * // Replace `_.memoize.Cache`.
52374 * _.memoize.Cache = WeakMap;
52375 */
52376 function memoize(func, resolver) {
52377 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
52378 throw new TypeError(FUNC_ERROR_TEXT);
52379 }
52380 var memoized = function() {
52381 var args = arguments,
52382 key = resolver ? resolver.apply(this, args) : args[0],
52383 cache = memoized.cache;
52384
52385 if (cache.has(key)) {
52386 return cache.get(key);
52387 }
52388 var result = func.apply(this, args);
52389 memoized.cache = cache.set(key, result) || cache;
52390 return result;
52391 };
52392 memoized.cache = new (memoize.Cache || MapCache);
52393 return memoized;
52394 }
52395
52396 // Expose `MapCache`.
52397 memoize.Cache = MapCache;
52398
52399 /**
52400 * Creates a function that negates the result of the predicate `func`. The
52401 * `func` predicate is invoked with the `this` binding and arguments of the
52402 * created function.
52403 *
52404 * @static
52405 * @memberOf _
52406 * @since 3.0.0
52407 * @category Function
52408 * @param {Function} predicate The predicate to negate.
52409 * @returns {Function} Returns the new negated function.
52410 * @example
52411 *
52412 * function isEven(n) {
52413 * return n % 2 == 0;
52414 * }
52415 *
52416 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
52417 * // => [1, 3, 5]
52418 */
52419 function negate(predicate) {
52420 if (typeof predicate != 'function') {
52421 throw new TypeError(FUNC_ERROR_TEXT);
52422 }
52423 return function() {
52424 var args = arguments;
52425 switch (args.length) {
52426 case 0: return !predicate.call(this);
52427 case 1: return !predicate.call(this, args[0]);
52428 case 2: return !predicate.call(this, args[0], args[1]);
52429 case 3: return !predicate.call(this, args[0], args[1], args[2]);
52430 }
52431 return !predicate.apply(this, args);
52432 };
52433 }
52434
52435 /**
52436 * Creates a function that is restricted to invoking `func` once. Repeat calls
52437 * to the function return the value of the first invocation. The `func` is
52438 * invoked with the `this` binding and arguments of the created function.
52439 *
52440 * @static
52441 * @memberOf _
52442 * @since 0.1.0
52443 * @category Function
52444 * @param {Function} func The function to restrict.
52445 * @returns {Function} Returns the new restricted function.
52446 * @example
52447 *
52448 * var initialize = _.once(createApplication);
52449 * initialize();
52450 * initialize();
52451 * // => `createApplication` is invoked once
52452 */
52453 function once(func) {
52454 return before(2, func);
52455 }
52456
52457 /**
52458 * Creates a function that invokes `func` with its arguments transformed.
52459 *
52460 * @static
52461 * @since 4.0.0
52462 * @memberOf _
52463 * @category Function
52464 * @param {Function} func The function to wrap.
52465 * @param {...(Function|Function[])} [transforms=[_.identity]]
52466 * The argument transforms.
52467 * @returns {Function} Returns the new function.
52468 * @example
52469 *
52470 * function doubled(n) {
52471 * return n * 2;
52472 * }
52473 *
52474 * function square(n) {
52475 * return n * n;
52476 * }
52477 *
52478 * var func = _.overArgs(function(x, y) {
52479 * return [x, y];
52480 * }, [square, doubled]);
52481 *
52482 * func(9, 3);
52483 * // => [81, 6]
52484 *
52485 * func(10, 5);
52486 * // => [100, 10]
52487 */
52488 var overArgs = castRest(function(func, transforms) {
52489 transforms = (transforms.length == 1 && isArray(transforms[0]))
52490 ? arrayMap(transforms[0], baseUnary(getIteratee()))
52491 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
52492
52493 var funcsLength = transforms.length;
52494 return baseRest(function(args) {
52495 var index = -1,
52496 length = nativeMin(args.length, funcsLength);
52497
52498 while (++index < length) {
52499 args[index] = transforms[index].call(this, args[index]);
52500 }
52501 return apply(func, this, args);
52502 });
52503 });
52504
52505 /**
52506 * Creates a function that invokes `func` with `partials` prepended to the
52507 * arguments it receives. This method is like `_.bind` except it does **not**
52508 * alter the `this` binding.
52509 *
52510 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
52511 * builds, may be used as a placeholder for partially applied arguments.
52512 *
52513 * **Note:** This method doesn't set the "length" property of partially
52514 * applied functions.
52515 *
52516 * @static
52517 * @memberOf _
52518 * @since 0.2.0
52519 * @category Function
52520 * @param {Function} func The function to partially apply arguments to.
52521 * @param {...*} [partials] The arguments to be partially applied.
52522 * @returns {Function} Returns the new partially applied function.
52523 * @example
52524 *
52525 * function greet(greeting, name) {
52526 * return greeting + ' ' + name;
52527 * }
52528 *
52529 * var sayHelloTo = _.partial(greet, 'hello');
52530 * sayHelloTo('fred');
52531 * // => 'hello fred'
52532 *
52533 * // Partially applied with placeholders.
52534 * var greetFred = _.partial(greet, _, 'fred');
52535 * greetFred('hi');
52536 * // => 'hi fred'
52537 */
52538 var partial = baseRest(function(func, partials) {
52539 var holders = replaceHolders(partials, getHolder(partial));
52540 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
52541 });
52542
52543 /**
52544 * This method is like `_.partial` except that partially applied arguments
52545 * are appended to the arguments it receives.
52546 *
52547 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
52548 * builds, may be used as a placeholder for partially applied arguments.
52549 *
52550 * **Note:** This method doesn't set the "length" property of partially
52551 * applied functions.
52552 *
52553 * @static
52554 * @memberOf _
52555 * @since 1.0.0
52556 * @category Function
52557 * @param {Function} func The function to partially apply arguments to.
52558 * @param {...*} [partials] The arguments to be partially applied.
52559 * @returns {Function} Returns the new partially applied function.
52560 * @example
52561 *
52562 * function greet(greeting, name) {
52563 * return greeting + ' ' + name;
52564 * }
52565 *
52566 * var greetFred = _.partialRight(greet, 'fred');
52567 * greetFred('hi');
52568 * // => 'hi fred'
52569 *
52570 * // Partially applied with placeholders.
52571 * var sayHelloTo = _.partialRight(greet, 'hello', _);
52572 * sayHelloTo('fred');
52573 * // => 'hello fred'
52574 */
52575 var partialRight = baseRest(function(func, partials) {
52576 var holders = replaceHolders(partials, getHolder(partialRight));
52577 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
52578 });
52579
52580 /**
52581 * Creates a function that invokes `func` with arguments arranged according
52582 * to the specified `indexes` where the argument value at the first index is
52583 * provided as the first argument, the argument value at the second index is
52584 * provided as the second argument, and so on.
52585 *
52586 * @static
52587 * @memberOf _
52588 * @since 3.0.0
52589 * @category Function
52590 * @param {Function} func The function to rearrange arguments for.
52591 * @param {...(number|number[])} indexes The arranged argument indexes.
52592 * @returns {Function} Returns the new function.
52593 * @example
52594 *
52595 * var rearged = _.rearg(function(a, b, c) {
52596 * return [a, b, c];
52597 * }, [2, 0, 1]);
52598 *
52599 * rearged('b', 'c', 'a')
52600 * // => ['a', 'b', 'c']
52601 */
52602 var rearg = flatRest(function(func, indexes) {
52603 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
52604 });
52605
52606 /**
52607 * Creates a function that invokes `func` with the `this` binding of the
52608 * created function and arguments from `start` and beyond provided as
52609 * an array.
52610 *
52611 * **Note:** This method is based on the
52612 * [rest parameter](https://mdn.io/rest_parameters).
52613 *
52614 * @static
52615 * @memberOf _
52616 * @since 4.0.0
52617 * @category Function
52618 * @param {Function} func The function to apply a rest parameter to.
52619 * @param {number} [start=func.length-1] The start position of the rest parameter.
52620 * @returns {Function} Returns the new function.
52621 * @example
52622 *
52623 * var say = _.rest(function(what, names) {
52624 * return what + ' ' + _.initial(names).join(', ') +
52625 * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
52626 * });
52627 *
52628 * say('hello', 'fred', 'barney', 'pebbles');
52629 * // => 'hello fred, barney, & pebbles'
52630 */
52631 function rest(func, start) {
52632 if (typeof func != 'function') {
52633 throw new TypeError(FUNC_ERROR_TEXT);
52634 }
52635 start = start === undefined ? start : toInteger(start);
52636 return baseRest(func, start);
52637 }
52638
52639 /**
52640 * Creates a function that invokes `func` with the `this` binding of the
52641 * create function and an array of arguments much like
52642 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
52643 *
52644 * **Note:** This method is based on the
52645 * [spread operator](https://mdn.io/spread_operator).
52646 *
52647 * @static
52648 * @memberOf _
52649 * @since 3.2.0
52650 * @category Function
52651 * @param {Function} func The function to spread arguments over.
52652 * @param {number} [start=0] The start position of the spread.
52653 * @returns {Function} Returns the new function.
52654 * @example
52655 *
52656 * var say = _.spread(function(who, what) {
52657 * return who + ' says ' + what;
52658 * });
52659 *
52660 * say(['fred', 'hello']);
52661 * // => 'fred says hello'
52662 *
52663 * var numbers = Promise.all([
52664 * Promise.resolve(40),
52665 * Promise.resolve(36)
52666 * ]);
52667 *
52668 * numbers.then(_.spread(function(x, y) {
52669 * return x + y;
52670 * }));
52671 * // => a Promise of 76
52672 */
52673 function spread(func, start) {
52674 if (typeof func != 'function') {
52675 throw new TypeError(FUNC_ERROR_TEXT);
52676 }
52677 start = start == null ? 0 : nativeMax(toInteger(start), 0);
52678 return baseRest(function(args) {
52679 var array = args[start],
52680 otherArgs = castSlice(args, 0, start);
52681
52682 if (array) {
52683 arrayPush(otherArgs, array);
52684 }
52685 return apply(func, this, otherArgs);
52686 });
52687 }
52688
52689 /**
52690 * Creates a throttled function that only invokes `func` at most once per
52691 * every `wait` milliseconds. The throttled function comes with a `cancel`
52692 * method to cancel delayed `func` invocations and a `flush` method to
52693 * immediately invoke them. Provide `options` to indicate whether `func`
52694 * should be invoked on the leading and/or trailing edge of the `wait`
52695 * timeout. The `func` is invoked with the last arguments provided to the
52696 * throttled function. Subsequent calls to the throttled function return the
52697 * result of the last `func` invocation.
52698 *
52699 * **Note:** If `leading` and `trailing` options are `true`, `func` is
52700 * invoked on the trailing edge of the timeout only if the throttled function
52701 * is invoked more than once during the `wait` timeout.
52702 *
52703 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
52704 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
52705 *
52706 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
52707 * for details over the differences between `_.throttle` and `_.debounce`.
52708 *
52709 * @static
52710 * @memberOf _
52711 * @since 0.1.0
52712 * @category Function
52713 * @param {Function} func The function to throttle.
52714 * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
52715 * @param {Object} [options={}] The options object.
52716 * @param {boolean} [options.leading=true]
52717 * Specify invoking on the leading edge of the timeout.
52718 * @param {boolean} [options.trailing=true]
52719 * Specify invoking on the trailing edge of the timeout.
52720 * @returns {Function} Returns the new throttled function.
52721 * @example
52722 *
52723 * // Avoid excessively updating the position while scrolling.
52724 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
52725 *
52726 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
52727 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
52728 * jQuery(element).on('click', throttled);
52729 *
52730 * // Cancel the trailing throttled invocation.
52731 * jQuery(window).on('popstate', throttled.cancel);
52732 */
52733 function throttle(func, wait, options) {
52734 var leading = true,
52735 trailing = true;
52736
52737 if (typeof func != 'function') {
52738 throw new TypeError(FUNC_ERROR_TEXT);
52739 }
52740 if (isObject(options)) {
52741 leading = 'leading' in options ? !!options.leading : leading;
52742 trailing = 'trailing' in options ? !!options.trailing : trailing;
52743 }
52744 return debounce(func, wait, {
52745 'leading': leading,
52746 'maxWait': wait,
52747 'trailing': trailing
52748 });
52749 }
52750
52751 /**
52752 * Creates a function that accepts up to one argument, ignoring any
52753 * additional arguments.
52754 *
52755 * @static
52756 * @memberOf _
52757 * @since 4.0.0
52758 * @category Function
52759 * @param {Function} func The function to cap arguments for.
52760 * @returns {Function} Returns the new capped function.
52761 * @example
52762 *
52763 * _.map(['6', '8', '10'], _.unary(parseInt));
52764 * // => [6, 8, 10]
52765 */
52766 function unary(func) {
52767 return ary(func, 1);
52768 }
52769
52770 /**
52771 * Creates a function that provides `value` to `wrapper` as its first
52772 * argument. Any additional arguments provided to the function are appended
52773 * to those provided to the `wrapper`. The wrapper is invoked with the `this`
52774 * binding of the created function.
52775 *
52776 * @static
52777 * @memberOf _
52778 * @since 0.1.0
52779 * @category Function
52780 * @param {*} value The value to wrap.
52781 * @param {Function} [wrapper=identity] The wrapper function.
52782 * @returns {Function} Returns the new function.
52783 * @example
52784 *
52785 * var p = _.wrap(_.escape, function(func, text) {
52786 * return '<p>' + func(text) + '</p>';
52787 * });
52788 *
52789 * p('fred, barney, & pebbles');
52790 * // => '<p>fred, barney, &amp; pebbles</p>'
52791 */
52792 function wrap(value, wrapper) {
52793 return partial(castFunction(wrapper), value);
52794 }
52795
52796 /*------------------------------------------------------------------------*/
52797
52798 /**
52799 * Casts `value` as an array if it's not one.
52800 *
52801 * @static
52802 * @memberOf _
52803 * @since 4.4.0
52804 * @category Lang
52805 * @param {*} value The value to inspect.
52806 * @returns {Array} Returns the cast array.
52807 * @example
52808 *
52809 * _.castArray(1);
52810 * // => [1]
52811 *
52812 * _.castArray({ 'a': 1 });
52813 * // => [{ 'a': 1 }]
52814 *
52815 * _.castArray('abc');
52816 * // => ['abc']
52817 *
52818 * _.castArray(null);
52819 * // => [null]
52820 *
52821 * _.castArray(undefined);
52822 * // => [undefined]
52823 *
52824 * _.castArray();
52825 * // => []
52826 *
52827 * var array = [1, 2, 3];
52828 * console.log(_.castArray(array) === array);
52829 * // => true
52830 */
52831 function castArray() {
52832 if (!arguments.length) {
52833 return [];
52834 }
52835 var value = arguments[0];
52836 return isArray(value) ? value : [value];
52837 }
52838
52839 /**
52840 * Creates a shallow clone of `value`.
52841 *
52842 * **Note:** This method is loosely based on the
52843 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
52844 * and supports cloning arrays, array buffers, booleans, date objects, maps,
52845 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
52846 * arrays. The own enumerable properties of `arguments` objects are cloned
52847 * as plain objects. An empty object is returned for uncloneable values such
52848 * as error objects, functions, DOM nodes, and WeakMaps.
52849 *
52850 * @static
52851 * @memberOf _
52852 * @since 0.1.0
52853 * @category Lang
52854 * @param {*} value The value to clone.
52855 * @returns {*} Returns the cloned value.
52856 * @see _.cloneDeep
52857 * @example
52858 *
52859 * var objects = [{ 'a': 1 }, { 'b': 2 }];
52860 *
52861 * var shallow = _.clone(objects);
52862 * console.log(shallow[0] === objects[0]);
52863 * // => true
52864 */
52865 function clone(value) {
52866 return baseClone(value, CLONE_SYMBOLS_FLAG);
52867 }
52868
52869 /**
52870 * This method is like `_.clone` except that it accepts `customizer` which
52871 * is invoked to produce the cloned value. If `customizer` returns `undefined`,
52872 * cloning is handled by the method instead. The `customizer` is invoked with
52873 * up to four arguments; (value [, index|key, object, stack]).
52874 *
52875 * @static
52876 * @memberOf _
52877 * @since 4.0.0
52878 * @category Lang
52879 * @param {*} value The value to clone.
52880 * @param {Function} [customizer] The function to customize cloning.
52881 * @returns {*} Returns the cloned value.
52882 * @see _.cloneDeepWith
52883 * @example
52884 *
52885 * function customizer(value) {
52886 * if (_.isElement(value)) {
52887 * return value.cloneNode(false);
52888 * }
52889 * }
52890 *
52891 * var el = _.cloneWith(document.body, customizer);
52892 *
52893 * console.log(el === document.body);
52894 * // => false
52895 * console.log(el.nodeName);
52896 * // => 'BODY'
52897 * console.log(el.childNodes.length);
52898 * // => 0
52899 */
52900 function cloneWith(value, customizer) {
52901 customizer = typeof customizer == 'function' ? customizer : undefined;
52902 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
52903 }
52904
52905 /**
52906 * This method is like `_.clone` except that it recursively clones `value`.
52907 *
52908 * @static
52909 * @memberOf _
52910 * @since 1.0.0
52911 * @category Lang
52912 * @param {*} value The value to recursively clone.
52913 * @returns {*} Returns the deep cloned value.
52914 * @see _.clone
52915 * @example
52916 *
52917 * var objects = [{ 'a': 1 }, { 'b': 2 }];
52918 *
52919 * var deep = _.cloneDeep(objects);
52920 * console.log(deep[0] === objects[0]);
52921 * // => false
52922 */
52923 function cloneDeep(value) {
52924 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
52925 }
52926
52927 /**
52928 * This method is like `_.cloneWith` except that it recursively clones `value`.
52929 *
52930 * @static
52931 * @memberOf _
52932 * @since 4.0.0
52933 * @category Lang
52934 * @param {*} value The value to recursively clone.
52935 * @param {Function} [customizer] The function to customize cloning.
52936 * @returns {*} Returns the deep cloned value.
52937 * @see _.cloneWith
52938 * @example
52939 *
52940 * function customizer(value) {
52941 * if (_.isElement(value)) {
52942 * return value.cloneNode(true);
52943 * }
52944 * }
52945 *
52946 * var el = _.cloneDeepWith(document.body, customizer);
52947 *
52948 * console.log(el === document.body);
52949 * // => false
52950 * console.log(el.nodeName);
52951 * // => 'BODY'
52952 * console.log(el.childNodes.length);
52953 * // => 20
52954 */
52955 function cloneDeepWith(value, customizer) {
52956 customizer = typeof customizer == 'function' ? customizer : undefined;
52957 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
52958 }
52959
52960 /**
52961 * Checks if `object` conforms to `source` by invoking the predicate
52962 * properties of `source` with the corresponding property values of `object`.
52963 *
52964 * **Note:** This method is equivalent to `_.conforms` when `source` is
52965 * partially applied.
52966 *
52967 * @static
52968 * @memberOf _
52969 * @since 4.14.0
52970 * @category Lang
52971 * @param {Object} object The object to inspect.
52972 * @param {Object} source The object of property predicates to conform to.
52973 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
52974 * @example
52975 *
52976 * var object = { 'a': 1, 'b': 2 };
52977 *
52978 * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
52979 * // => true
52980 *
52981 * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
52982 * // => false
52983 */
52984 function conformsTo(object, source) {
52985 return source == null || baseConformsTo(object, source, keys(source));
52986 }
52987
52988 /**
52989 * Performs a
52990 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
52991 * comparison between two values to determine if they are equivalent.
52992 *
52993 * @static
52994 * @memberOf _
52995 * @since 4.0.0
52996 * @category Lang
52997 * @param {*} value The value to compare.
52998 * @param {*} other The other value to compare.
52999 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
53000 * @example
53001 *
53002 * var object = { 'a': 1 };
53003 * var other = { 'a': 1 };
53004 *
53005 * _.eq(object, object);
53006 * // => true
53007 *
53008 * _.eq(object, other);
53009 * // => false
53010 *
53011 * _.eq('a', 'a');
53012 * // => true
53013 *
53014 * _.eq('a', Object('a'));
53015 * // => false
53016 *
53017 * _.eq(NaN, NaN);
53018 * // => true
53019 */
53020 function eq(value, other) {
53021 return value === other || (value !== value && other !== other);
53022 }
53023
53024 /**
53025 * Checks if `value` is greater than `other`.
53026 *
53027 * @static
53028 * @memberOf _
53029 * @since 3.9.0
53030 * @category Lang
53031 * @param {*} value The value to compare.
53032 * @param {*} other The other value to compare.
53033 * @returns {boolean} Returns `true` if `value` is greater than `other`,
53034 * else `false`.
53035 * @see _.lt
53036 * @example
53037 *
53038 * _.gt(3, 1);
53039 * // => true
53040 *
53041 * _.gt(3, 3);
53042 * // => false
53043 *
53044 * _.gt(1, 3);
53045 * // => false
53046 */
53047 var gt = createRelationalOperation(baseGt);
53048
53049 /**
53050 * Checks if `value` is greater than or equal to `other`.
53051 *
53052 * @static
53053 * @memberOf _
53054 * @since 3.9.0
53055 * @category Lang
53056 * @param {*} value The value to compare.
53057 * @param {*} other The other value to compare.
53058 * @returns {boolean} Returns `true` if `value` is greater than or equal to
53059 * `other`, else `false`.
53060 * @see _.lte
53061 * @example
53062 *
53063 * _.gte(3, 1);
53064 * // => true
53065 *
53066 * _.gte(3, 3);
53067 * // => true
53068 *
53069 * _.gte(1, 3);
53070 * // => false
53071 */
53072 var gte = createRelationalOperation(function(value, other) {
53073 return value >= other;
53074 });
53075
53076 /**
53077 * Checks if `value` is likely an `arguments` object.
53078 *
53079 * @static
53080 * @memberOf _
53081 * @since 0.1.0
53082 * @category Lang
53083 * @param {*} value The value to check.
53084 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
53085 * else `false`.
53086 * @example
53087 *
53088 * _.isArguments(function() { return arguments; }());
53089 * // => true
53090 *
53091 * _.isArguments([1, 2, 3]);
53092 * // => false
53093 */
53094 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
53095 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
53096 !propertyIsEnumerable.call(value, 'callee');
53097 };
53098
53099 /**
53100 * Checks if `value` is classified as an `Array` object.
53101 *
53102 * @static
53103 * @memberOf _
53104 * @since 0.1.0
53105 * @category Lang
53106 * @param {*} value The value to check.
53107 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
53108 * @example
53109 *
53110 * _.isArray([1, 2, 3]);
53111 * // => true
53112 *
53113 * _.isArray(document.body.children);
53114 * // => false
53115 *
53116 * _.isArray('abc');
53117 * // => false
53118 *
53119 * _.isArray(_.noop);
53120 * // => false
53121 */
53122 var isArray = Array.isArray;
53123
53124 /**
53125 * Checks if `value` is classified as an `ArrayBuffer` object.
53126 *
53127 * @static
53128 * @memberOf _
53129 * @since 4.3.0
53130 * @category Lang
53131 * @param {*} value The value to check.
53132 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
53133 * @example
53134 *
53135 * _.isArrayBuffer(new ArrayBuffer(2));
53136 * // => true
53137 *
53138 * _.isArrayBuffer(new Array(2));
53139 * // => false
53140 */
53141 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
53142
53143 /**
53144 * Checks if `value` is array-like. A value is considered array-like if it's
53145 * not a function and has a `value.length` that's an integer greater than or
53146 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
53147 *
53148 * @static
53149 * @memberOf _
53150 * @since 4.0.0
53151 * @category Lang
53152 * @param {*} value The value to check.
53153 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
53154 * @example
53155 *
53156 * _.isArrayLike([1, 2, 3]);
53157 * // => true
53158 *
53159 * _.isArrayLike(document.body.children);
53160 * // => true
53161 *
53162 * _.isArrayLike('abc');
53163 * // => true
53164 *
53165 * _.isArrayLike(_.noop);
53166 * // => false
53167 */
53168 function isArrayLike(value) {
53169 return value != null && isLength(value.length) && !isFunction(value);
53170 }
53171
53172 /**
53173 * This method is like `_.isArrayLike` except that it also checks if `value`
53174 * is an object.
53175 *
53176 * @static
53177 * @memberOf _
53178 * @since 4.0.0
53179 * @category Lang
53180 * @param {*} value The value to check.
53181 * @returns {boolean} Returns `true` if `value` is an array-like object,
53182 * else `false`.
53183 * @example
53184 *
53185 * _.isArrayLikeObject([1, 2, 3]);
53186 * // => true
53187 *
53188 * _.isArrayLikeObject(document.body.children);
53189 * // => true
53190 *
53191 * _.isArrayLikeObject('abc');
53192 * // => false
53193 *
53194 * _.isArrayLikeObject(_.noop);
53195 * // => false
53196 */
53197 function isArrayLikeObject(value) {
53198 return isObjectLike(value) && isArrayLike(value);
53199 }
53200
53201 /**
53202 * Checks if `value` is classified as a boolean primitive or object.
53203 *
53204 * @static
53205 * @memberOf _
53206 * @since 0.1.0
53207 * @category Lang
53208 * @param {*} value The value to check.
53209 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
53210 * @example
53211 *
53212 * _.isBoolean(false);
53213 * // => true
53214 *
53215 * _.isBoolean(null);
53216 * // => false
53217 */
53218 function isBoolean(value) {
53219 return value === true || value === false ||
53220 (isObjectLike(value) && baseGetTag(value) == boolTag);
53221 }
53222
53223 /**
53224 * Checks if `value` is a buffer.
53225 *
53226 * @static
53227 * @memberOf _
53228 * @since 4.3.0
53229 * @category Lang
53230 * @param {*} value The value to check.
53231 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
53232 * @example
53233 *
53234 * _.isBuffer(new Buffer(2));
53235 * // => true
53236 *
53237 * _.isBuffer(new Uint8Array(2));
53238 * // => false
53239 */
53240 var isBuffer = nativeIsBuffer || stubFalse;
53241
53242 /**
53243 * Checks if `value` is classified as a `Date` object.
53244 *
53245 * @static
53246 * @memberOf _
53247 * @since 0.1.0
53248 * @category Lang
53249 * @param {*} value The value to check.
53250 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
53251 * @example
53252 *
53253 * _.isDate(new Date);
53254 * // => true
53255 *
53256 * _.isDate('Mon April 23 2012');
53257 * // => false
53258 */
53259 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
53260
53261 /**
53262 * Checks if `value` is likely a DOM element.
53263 *
53264 * @static
53265 * @memberOf _
53266 * @since 0.1.0
53267 * @category Lang
53268 * @param {*} value The value to check.
53269 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
53270 * @example
53271 *
53272 * _.isElement(document.body);
53273 * // => true
53274 *
53275 * _.isElement('<body>');
53276 * // => false
53277 */
53278 function isElement(value) {
53279 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
53280 }
53281
53282 /**
53283 * Checks if `value` is an empty object, collection, map, or set.
53284 *
53285 * Objects are considered empty if they have no own enumerable string keyed
53286 * properties.
53287 *
53288 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
53289 * jQuery-like collections are considered empty if they have a `length` of `0`.
53290 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
53291 *
53292 * @static
53293 * @memberOf _
53294 * @since 0.1.0
53295 * @category Lang
53296 * @param {*} value The value to check.
53297 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
53298 * @example
53299 *
53300 * _.isEmpty(null);
53301 * // => true
53302 *
53303 * _.isEmpty(true);
53304 * // => true
53305 *
53306 * _.isEmpty(1);
53307 * // => true
53308 *
53309 * _.isEmpty([1, 2, 3]);
53310 * // => false
53311 *
53312 * _.isEmpty({ 'a': 1 });
53313 * // => false
53314 */
53315 function isEmpty(value) {
53316 if (value == null) {
53317 return true;
53318 }
53319 if (isArrayLike(value) &&
53320 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
53321 isBuffer(value) || isTypedArray(value) || isArguments(value))) {
53322 return !value.length;
53323 }
53324 var tag = getTag(value);
53325 if (tag == mapTag || tag == setTag) {
53326 return !value.size;
53327 }
53328 if (isPrototype(value)) {
53329 return !baseKeys(value).length;
53330 }
53331 for (var key in value) {
53332 if (hasOwnProperty.call(value, key)) {
53333 return false;
53334 }
53335 }
53336 return true;
53337 }
53338
53339 /**
53340 * Performs a deep comparison between two values to determine if they are
53341 * equivalent.
53342 *
53343 * **Note:** This method supports comparing arrays, array buffers, booleans,
53344 * date objects, error objects, maps, numbers, `Object` objects, regexes,
53345 * sets, strings, symbols, and typed arrays. `Object` objects are compared
53346 * by their own, not inherited, enumerable properties. Functions and DOM
53347 * nodes are compared by strict equality, i.e. `===`.
53348 *
53349 * @static
53350 * @memberOf _
53351 * @since 0.1.0
53352 * @category Lang
53353 * @param {*} value The value to compare.
53354 * @param {*} other The other value to compare.
53355 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
53356 * @example
53357 *
53358 * var object = { 'a': 1 };
53359 * var other = { 'a': 1 };
53360 *
53361 * _.isEqual(object, other);
53362 * // => true
53363 *
53364 * object === other;
53365 * // => false
53366 */
53367 function isEqual(value, other) {
53368 return baseIsEqual(value, other);
53369 }
53370
53371 /**
53372 * This method is like `_.isEqual` except that it accepts `customizer` which
53373 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
53374 * are handled by the method instead. The `customizer` is invoked with up to
53375 * six arguments: (objValue, othValue [, index|key, object, other, stack]).
53376 *
53377 * @static
53378 * @memberOf _
53379 * @since 4.0.0
53380 * @category Lang
53381 * @param {*} value The value to compare.
53382 * @param {*} other The other value to compare.
53383 * @param {Function} [customizer] The function to customize comparisons.
53384 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
53385 * @example
53386 *
53387 * function isGreeting(value) {
53388 * return /^h(?:i|ello)$/.test(value);
53389 * }
53390 *
53391 * function customizer(objValue, othValue) {
53392 * if (isGreeting(objValue) && isGreeting(othValue)) {
53393 * return true;
53394 * }
53395 * }
53396 *
53397 * var array = ['hello', 'goodbye'];
53398 * var other = ['hi', 'goodbye'];
53399 *
53400 * _.isEqualWith(array, other, customizer);
53401 * // => true
53402 */
53403 function isEqualWith(value, other, customizer) {
53404 customizer = typeof customizer == 'function' ? customizer : undefined;
53405 var result = customizer ? customizer(value, other) : undefined;
53406 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
53407 }
53408
53409 /**
53410 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
53411 * `SyntaxError`, `TypeError`, or `URIError` object.
53412 *
53413 * @static
53414 * @memberOf _
53415 * @since 3.0.0
53416 * @category Lang
53417 * @param {*} value The value to check.
53418 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
53419 * @example
53420 *
53421 * _.isError(new Error);
53422 * // => true
53423 *
53424 * _.isError(Error);
53425 * // => false
53426 */
53427 function isError(value) {
53428 if (!isObjectLike(value)) {
53429 return false;
53430 }
53431 var tag = baseGetTag(value);
53432 return tag == errorTag || tag == domExcTag ||
53433 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
53434 }
53435
53436 /**
53437 * Checks if `value` is a finite primitive number.
53438 *
53439 * **Note:** This method is based on
53440 * [`Number.isFinite`](https://mdn.io/Number/isFinite).
53441 *
53442 * @static
53443 * @memberOf _
53444 * @since 0.1.0
53445 * @category Lang
53446 * @param {*} value The value to check.
53447 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
53448 * @example
53449 *
53450 * _.isFinite(3);
53451 * // => true
53452 *
53453 * _.isFinite(Number.MIN_VALUE);
53454 * // => true
53455 *
53456 * _.isFinite(Infinity);
53457 * // => false
53458 *
53459 * _.isFinite('3');
53460 * // => false
53461 */
53462 function isFinite(value) {
53463 return typeof value == 'number' && nativeIsFinite(value);
53464 }
53465
53466 /**
53467 * Checks if `value` is classified as a `Function` object.
53468 *
53469 * @static
53470 * @memberOf _
53471 * @since 0.1.0
53472 * @category Lang
53473 * @param {*} value The value to check.
53474 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
53475 * @example
53476 *
53477 * _.isFunction(_);
53478 * // => true
53479 *
53480 * _.isFunction(/abc/);
53481 * // => false
53482 */
53483 function isFunction(value) {
53484 if (!isObject(value)) {
53485 return false;
53486 }
53487 // The use of `Object#toString` avoids issues with the `typeof` operator
53488 // in Safari 9 which returns 'object' for typed arrays and other constructors.
53489 var tag = baseGetTag(value);
53490 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
53491 }
53492
53493 /**
53494 * Checks if `value` is an integer.
53495 *
53496 * **Note:** This method is based on
53497 * [`Number.isInteger`](https://mdn.io/Number/isInteger).
53498 *
53499 * @static
53500 * @memberOf _
53501 * @since 4.0.0
53502 * @category Lang
53503 * @param {*} value The value to check.
53504 * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
53505 * @example
53506 *
53507 * _.isInteger(3);
53508 * // => true
53509 *
53510 * _.isInteger(Number.MIN_VALUE);
53511 * // => false
53512 *
53513 * _.isInteger(Infinity);
53514 * // => false
53515 *
53516 * _.isInteger('3');
53517 * // => false
53518 */
53519 function isInteger(value) {
53520 return typeof value == 'number' && value == toInteger(value);
53521 }
53522
53523 /**
53524 * Checks if `value` is a valid array-like length.
53525 *
53526 * **Note:** This method is loosely based on
53527 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
53528 *
53529 * @static
53530 * @memberOf _
53531 * @since 4.0.0
53532 * @category Lang
53533 * @param {*} value The value to check.
53534 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
53535 * @example
53536 *
53537 * _.isLength(3);
53538 * // => true
53539 *
53540 * _.isLength(Number.MIN_VALUE);
53541 * // => false
53542 *
53543 * _.isLength(Infinity);
53544 * // => false
53545 *
53546 * _.isLength('3');
53547 * // => false
53548 */
53549 function isLength(value) {
53550 return typeof value == 'number' &&
53551 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
53552 }
53553
53554 /**
53555 * Checks if `value` is the
53556 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
53557 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
53558 *
53559 * @static
53560 * @memberOf _
53561 * @since 0.1.0
53562 * @category Lang
53563 * @param {*} value The value to check.
53564 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
53565 * @example
53566 *
53567 * _.isObject({});
53568 * // => true
53569 *
53570 * _.isObject([1, 2, 3]);
53571 * // => true
53572 *
53573 * _.isObject(_.noop);
53574 * // => true
53575 *
53576 * _.isObject(null);
53577 * // => false
53578 */
53579 function isObject(value) {
53580 var type = typeof value;
53581 return value != null && (type == 'object' || type == 'function');
53582 }
53583
53584 /**
53585 * Checks if `value` is object-like. A value is object-like if it's not `null`
53586 * and has a `typeof` result of "object".
53587 *
53588 * @static
53589 * @memberOf _
53590 * @since 4.0.0
53591 * @category Lang
53592 * @param {*} value The value to check.
53593 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
53594 * @example
53595 *
53596 * _.isObjectLike({});
53597 * // => true
53598 *
53599 * _.isObjectLike([1, 2, 3]);
53600 * // => true
53601 *
53602 * _.isObjectLike(_.noop);
53603 * // => false
53604 *
53605 * _.isObjectLike(null);
53606 * // => false
53607 */
53608 function isObjectLike(value) {
53609 return value != null && typeof value == 'object';
53610 }
53611
53612 /**
53613 * Checks if `value` is classified as a `Map` object.
53614 *
53615 * @static
53616 * @memberOf _
53617 * @since 4.3.0
53618 * @category Lang
53619 * @param {*} value The value to check.
53620 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
53621 * @example
53622 *
53623 * _.isMap(new Map);
53624 * // => true
53625 *
53626 * _.isMap(new WeakMap);
53627 * // => false
53628 */
53629 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
53630
53631 /**
53632 * Performs a partial deep comparison between `object` and `source` to
53633 * determine if `object` contains equivalent property values.
53634 *
53635 * **Note:** This method is equivalent to `_.matches` when `source` is
53636 * partially applied.
53637 *
53638 * Partial comparisons will match empty array and empty object `source`
53639 * values against any array or object value, respectively. See `_.isEqual`
53640 * for a list of supported value comparisons.
53641 *
53642 * @static
53643 * @memberOf _
53644 * @since 3.0.0
53645 * @category Lang
53646 * @param {Object} object The object to inspect.
53647 * @param {Object} source The object of property values to match.
53648 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
53649 * @example
53650 *
53651 * var object = { 'a': 1, 'b': 2 };
53652 *
53653 * _.isMatch(object, { 'b': 2 });
53654 * // => true
53655 *
53656 * _.isMatch(object, { 'b': 1 });
53657 * // => false
53658 */
53659 function isMatch(object, source) {
53660 return object === source || baseIsMatch(object, source, getMatchData(source));
53661 }
53662
53663 /**
53664 * This method is like `_.isMatch` except that it accepts `customizer` which
53665 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
53666 * are handled by the method instead. The `customizer` is invoked with five
53667 * arguments: (objValue, srcValue, index|key, object, source).
53668 *
53669 * @static
53670 * @memberOf _
53671 * @since 4.0.0
53672 * @category Lang
53673 * @param {Object} object The object to inspect.
53674 * @param {Object} source The object of property values to match.
53675 * @param {Function} [customizer] The function to customize comparisons.
53676 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
53677 * @example
53678 *
53679 * function isGreeting(value) {
53680 * return /^h(?:i|ello)$/.test(value);
53681 * }
53682 *
53683 * function customizer(objValue, srcValue) {
53684 * if (isGreeting(objValue) && isGreeting(srcValue)) {
53685 * return true;
53686 * }
53687 * }
53688 *
53689 * var object = { 'greeting': 'hello' };
53690 * var source = { 'greeting': 'hi' };
53691 *
53692 * _.isMatchWith(object, source, customizer);
53693 * // => true
53694 */
53695 function isMatchWith(object, source, customizer) {
53696 customizer = typeof customizer == 'function' ? customizer : undefined;
53697 return baseIsMatch(object, source, getMatchData(source), customizer);
53698 }
53699
53700 /**
53701 * Checks if `value` is `NaN`.
53702 *
53703 * **Note:** This method is based on
53704 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
53705 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
53706 * `undefined` and other non-number values.
53707 *
53708 * @static
53709 * @memberOf _
53710 * @since 0.1.0
53711 * @category Lang
53712 * @param {*} value The value to check.
53713 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
53714 * @example
53715 *
53716 * _.isNaN(NaN);
53717 * // => true
53718 *
53719 * _.isNaN(new Number(NaN));
53720 * // => true
53721 *
53722 * isNaN(undefined);
53723 * // => true
53724 *
53725 * _.isNaN(undefined);
53726 * // => false
53727 */
53728 function isNaN(value) {
53729 // An `NaN` primitive is the only value that is not equal to itself.
53730 // Perform the `toStringTag` check first to avoid errors with some
53731 // ActiveX objects in IE.
53732 return isNumber(value) && value != +value;
53733 }
53734
53735 /**
53736 * Checks if `value` is a pristine native function.
53737 *
53738 * **Note:** This method can't reliably detect native functions in the presence
53739 * of the core-js package because core-js circumvents this kind of detection.
53740 * Despite multiple requests, the core-js maintainer has made it clear: any
53741 * attempt to fix the detection will be obstructed. As a result, we're left
53742 * with little choice but to throw an error. Unfortunately, this also affects
53743 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
53744 * which rely on core-js.
53745 *
53746 * @static
53747 * @memberOf _
53748 * @since 3.0.0
53749 * @category Lang
53750 * @param {*} value The value to check.
53751 * @returns {boolean} Returns `true` if `value` is a native function,
53752 * else `false`.
53753 * @example
53754 *
53755 * _.isNative(Array.prototype.push);
53756 * // => true
53757 *
53758 * _.isNative(_);
53759 * // => false
53760 */
53761 function isNative(value) {
53762 if (isMaskable(value)) {
53763 throw new Error(CORE_ERROR_TEXT);
53764 }
53765 return baseIsNative(value);
53766 }
53767
53768 /**
53769 * Checks if `value` is `null`.
53770 *
53771 * @static
53772 * @memberOf _
53773 * @since 0.1.0
53774 * @category Lang
53775 * @param {*} value The value to check.
53776 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
53777 * @example
53778 *
53779 * _.isNull(null);
53780 * // => true
53781 *
53782 * _.isNull(void 0);
53783 * // => false
53784 */
53785 function isNull(value) {
53786 return value === null;
53787 }
53788
53789 /**
53790 * Checks if `value` is `null` or `undefined`.
53791 *
53792 * @static
53793 * @memberOf _
53794 * @since 4.0.0
53795 * @category Lang
53796 * @param {*} value The value to check.
53797 * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
53798 * @example
53799 *
53800 * _.isNil(null);
53801 * // => true
53802 *
53803 * _.isNil(void 0);
53804 * // => true
53805 *
53806 * _.isNil(NaN);
53807 * // => false
53808 */
53809 function isNil(value) {
53810 return value == null;
53811 }
53812
53813 /**
53814 * Checks if `value` is classified as a `Number` primitive or object.
53815 *
53816 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
53817 * classified as numbers, use the `_.isFinite` method.
53818 *
53819 * @static
53820 * @memberOf _
53821 * @since 0.1.0
53822 * @category Lang
53823 * @param {*} value The value to check.
53824 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
53825 * @example
53826 *
53827 * _.isNumber(3);
53828 * // => true
53829 *
53830 * _.isNumber(Number.MIN_VALUE);
53831 * // => true
53832 *
53833 * _.isNumber(Infinity);
53834 * // => true
53835 *
53836 * _.isNumber('3');
53837 * // => false
53838 */
53839 function isNumber(value) {
53840 return typeof value == 'number' ||
53841 (isObjectLike(value) && baseGetTag(value) == numberTag);
53842 }
53843
53844 /**
53845 * Checks if `value` is a plain object, that is, an object created by the
53846 * `Object` constructor or one with a `[[Prototype]]` of `null`.
53847 *
53848 * @static
53849 * @memberOf _
53850 * @since 0.8.0
53851 * @category Lang
53852 * @param {*} value The value to check.
53853 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
53854 * @example
53855 *
53856 * function Foo() {
53857 * this.a = 1;
53858 * }
53859 *
53860 * _.isPlainObject(new Foo);
53861 * // => false
53862 *
53863 * _.isPlainObject([1, 2, 3]);
53864 * // => false
53865 *
53866 * _.isPlainObject({ 'x': 0, 'y': 0 });
53867 * // => true
53868 *
53869 * _.isPlainObject(Object.create(null));
53870 * // => true
53871 */
53872 function isPlainObject(value) {
53873 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
53874 return false;
53875 }
53876 var proto = getPrototype(value);
53877 if (proto === null) {
53878 return true;
53879 }
53880 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
53881 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
53882 funcToString.call(Ctor) == objectCtorString;
53883 }
53884
53885 /**
53886 * Checks if `value` is classified as a `RegExp` object.
53887 *
53888 * @static
53889 * @memberOf _
53890 * @since 0.1.0
53891 * @category Lang
53892 * @param {*} value The value to check.
53893 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
53894 * @example
53895 *
53896 * _.isRegExp(/abc/);
53897 * // => true
53898 *
53899 * _.isRegExp('/abc/');
53900 * // => false
53901 */
53902 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
53903
53904 /**
53905 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
53906 * double precision number which isn't the result of a rounded unsafe integer.
53907 *
53908 * **Note:** This method is based on
53909 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
53910 *
53911 * @static
53912 * @memberOf _
53913 * @since 4.0.0
53914 * @category Lang
53915 * @param {*} value The value to check.
53916 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
53917 * @example
53918 *
53919 * _.isSafeInteger(3);
53920 * // => true
53921 *
53922 * _.isSafeInteger(Number.MIN_VALUE);
53923 * // => false
53924 *
53925 * _.isSafeInteger(Infinity);
53926 * // => false
53927 *
53928 * _.isSafeInteger('3');
53929 * // => false
53930 */
53931 function isSafeInteger(value) {
53932 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
53933 }
53934
53935 /**
53936 * Checks if `value` is classified as a `Set` object.
53937 *
53938 * @static
53939 * @memberOf _
53940 * @since 4.3.0
53941 * @category Lang
53942 * @param {*} value The value to check.
53943 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
53944 * @example
53945 *
53946 * _.isSet(new Set);
53947 * // => true
53948 *
53949 * _.isSet(new WeakSet);
53950 * // => false
53951 */
53952 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
53953
53954 /**
53955 * Checks if `value` is classified as a `String` primitive or object.
53956 *
53957 * @static
53958 * @since 0.1.0
53959 * @memberOf _
53960 * @category Lang
53961 * @param {*} value The value to check.
53962 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
53963 * @example
53964 *
53965 * _.isString('abc');
53966 * // => true
53967 *
53968 * _.isString(1);
53969 * // => false
53970 */
53971 function isString(value) {
53972 return typeof value == 'string' ||
53973 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
53974 }
53975
53976 /**
53977 * Checks if `value` is classified as a `Symbol` primitive or object.
53978 *
53979 * @static
53980 * @memberOf _
53981 * @since 4.0.0
53982 * @category Lang
53983 * @param {*} value The value to check.
53984 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
53985 * @example
53986 *
53987 * _.isSymbol(Symbol.iterator);
53988 * // => true
53989 *
53990 * _.isSymbol('abc');
53991 * // => false
53992 */
53993 function isSymbol(value) {
53994 return typeof value == 'symbol' ||
53995 (isObjectLike(value) && baseGetTag(value) == symbolTag);
53996 }
53997
53998 /**
53999 * Checks if `value` is classified as a typed array.
54000 *
54001 * @static
54002 * @memberOf _
54003 * @since 3.0.0
54004 * @category Lang
54005 * @param {*} value The value to check.
54006 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
54007 * @example
54008 *
54009 * _.isTypedArray(new Uint8Array);
54010 * // => true
54011 *
54012 * _.isTypedArray([]);
54013 * // => false
54014 */
54015 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
54016
54017 /**
54018 * Checks if `value` is `undefined`.
54019 *
54020 * @static
54021 * @since 0.1.0
54022 * @memberOf _
54023 * @category Lang
54024 * @param {*} value The value to check.
54025 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
54026 * @example
54027 *
54028 * _.isUndefined(void 0);
54029 * // => true
54030 *
54031 * _.isUndefined(null);
54032 * // => false
54033 */
54034 function isUndefined(value) {
54035 return value === undefined;
54036 }
54037
54038 /**
54039 * Checks if `value` is classified as a `WeakMap` object.
54040 *
54041 * @static
54042 * @memberOf _
54043 * @since 4.3.0
54044 * @category Lang
54045 * @param {*} value The value to check.
54046 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
54047 * @example
54048 *
54049 * _.isWeakMap(new WeakMap);
54050 * // => true
54051 *
54052 * _.isWeakMap(new Map);
54053 * // => false
54054 */
54055 function isWeakMap(value) {
54056 return isObjectLike(value) && getTag(value) == weakMapTag;
54057 }
54058
54059 /**
54060 * Checks if `value` is classified as a `WeakSet` object.
54061 *
54062 * @static
54063 * @memberOf _
54064 * @since 4.3.0
54065 * @category Lang
54066 * @param {*} value The value to check.
54067 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
54068 * @example
54069 *
54070 * _.isWeakSet(new WeakSet);
54071 * // => true
54072 *
54073 * _.isWeakSet(new Set);
54074 * // => false
54075 */
54076 function isWeakSet(value) {
54077 return isObjectLike(value) && baseGetTag(value) == weakSetTag;
54078 }
54079
54080 /**
54081 * Checks if `value` is less than `other`.
54082 *
54083 * @static
54084 * @memberOf _
54085 * @since 3.9.0
54086 * @category Lang
54087 * @param {*} value The value to compare.
54088 * @param {*} other The other value to compare.
54089 * @returns {boolean} Returns `true` if `value` is less than `other`,
54090 * else `false`.
54091 * @see _.gt
54092 * @example
54093 *
54094 * _.lt(1, 3);
54095 * // => true
54096 *
54097 * _.lt(3, 3);
54098 * // => false
54099 *
54100 * _.lt(3, 1);
54101 * // => false
54102 */
54103 var lt = createRelationalOperation(baseLt);
54104
54105 /**
54106 * Checks if `value` is less than or equal to `other`.
54107 *
54108 * @static
54109 * @memberOf _
54110 * @since 3.9.0
54111 * @category Lang
54112 * @param {*} value The value to compare.
54113 * @param {*} other The other value to compare.
54114 * @returns {boolean} Returns `true` if `value` is less than or equal to
54115 * `other`, else `false`.
54116 * @see _.gte
54117 * @example
54118 *
54119 * _.lte(1, 3);
54120 * // => true
54121 *
54122 * _.lte(3, 3);
54123 * // => true
54124 *
54125 * _.lte(3, 1);
54126 * // => false
54127 */
54128 var lte = createRelationalOperation(function(value, other) {
54129 return value <= other;
54130 });
54131
54132 /**
54133 * Converts `value` to an array.
54134 *
54135 * @static
54136 * @since 0.1.0
54137 * @memberOf _
54138 * @category Lang
54139 * @param {*} value The value to convert.
54140 * @returns {Array} Returns the converted array.
54141 * @example
54142 *
54143 * _.toArray({ 'a': 1, 'b': 2 });
54144 * // => [1, 2]
54145 *
54146 * _.toArray('abc');
54147 * // => ['a', 'b', 'c']
54148 *
54149 * _.toArray(1);
54150 * // => []
54151 *
54152 * _.toArray(null);
54153 * // => []
54154 */
54155 function toArray(value) {
54156 if (!value) {
54157 return [];
54158 }
54159 if (isArrayLike(value)) {
54160 return isString(value) ? stringToArray(value) : copyArray(value);
54161 }
54162 if (symIterator && value[symIterator]) {
54163 return iteratorToArray(value[symIterator]());
54164 }
54165 var tag = getTag(value),
54166 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
54167
54168 return func(value);
54169 }
54170
54171 /**
54172 * Converts `value` to a finite number.
54173 *
54174 * @static
54175 * @memberOf _
54176 * @since 4.12.0
54177 * @category Lang
54178 * @param {*} value The value to convert.
54179 * @returns {number} Returns the converted number.
54180 * @example
54181 *
54182 * _.toFinite(3.2);
54183 * // => 3.2
54184 *
54185 * _.toFinite(Number.MIN_VALUE);
54186 * // => 5e-324
54187 *
54188 * _.toFinite(Infinity);
54189 * // => 1.7976931348623157e+308
54190 *
54191 * _.toFinite('3.2');
54192 * // => 3.2
54193 */
54194 function toFinite(value) {
54195 if (!value) {
54196 return value === 0 ? value : 0;
54197 }
54198 value = toNumber(value);
54199 if (value === INFINITY || value === -INFINITY) {
54200 var sign = (value < 0 ? -1 : 1);
54201 return sign * MAX_INTEGER;
54202 }
54203 return value === value ? value : 0;
54204 }
54205
54206 /**
54207 * Converts `value` to an integer.
54208 *
54209 * **Note:** This method is loosely based on
54210 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
54211 *
54212 * @static
54213 * @memberOf _
54214 * @since 4.0.0
54215 * @category Lang
54216 * @param {*} value The value to convert.
54217 * @returns {number} Returns the converted integer.
54218 * @example
54219 *
54220 * _.toInteger(3.2);
54221 * // => 3
54222 *
54223 * _.toInteger(Number.MIN_VALUE);
54224 * // => 0
54225 *
54226 * _.toInteger(Infinity);
54227 * // => 1.7976931348623157e+308
54228 *
54229 * _.toInteger('3.2');
54230 * // => 3
54231 */
54232 function toInteger(value) {
54233 var result = toFinite(value),
54234 remainder = result % 1;
54235
54236 return result === result ? (remainder ? result - remainder : result) : 0;
54237 }
54238
54239 /**
54240 * Converts `value` to an integer suitable for use as the length of an
54241 * array-like object.
54242 *
54243 * **Note:** This method is based on
54244 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
54245 *
54246 * @static
54247 * @memberOf _
54248 * @since 4.0.0
54249 * @category Lang
54250 * @param {*} value The value to convert.
54251 * @returns {number} Returns the converted integer.
54252 * @example
54253 *
54254 * _.toLength(3.2);
54255 * // => 3
54256 *
54257 * _.toLength(Number.MIN_VALUE);
54258 * // => 0
54259 *
54260 * _.toLength(Infinity);
54261 * // => 4294967295
54262 *
54263 * _.toLength('3.2');
54264 * // => 3
54265 */
54266 function toLength(value) {
54267 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
54268 }
54269
54270 /**
54271 * Converts `value` to a number.
54272 *
54273 * @static
54274 * @memberOf _
54275 * @since 4.0.0
54276 * @category Lang
54277 * @param {*} value The value to process.
54278 * @returns {number} Returns the number.
54279 * @example
54280 *
54281 * _.toNumber(3.2);
54282 * // => 3.2
54283 *
54284 * _.toNumber(Number.MIN_VALUE);
54285 * // => 5e-324
54286 *
54287 * _.toNumber(Infinity);
54288 * // => Infinity
54289 *
54290 * _.toNumber('3.2');
54291 * // => 3.2
54292 */
54293 function toNumber(value) {
54294 if (typeof value == 'number') {
54295 return value;
54296 }
54297 if (isSymbol(value)) {
54298 return NAN;
54299 }
54300 if (isObject(value)) {
54301 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
54302 value = isObject(other) ? (other + '') : other;
54303 }
54304 if (typeof value != 'string') {
54305 return value === 0 ? value : +value;
54306 }
54307 value = value.replace(reTrim, '');
54308 var isBinary = reIsBinary.test(value);
54309 return (isBinary || reIsOctal.test(value))
54310 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
54311 : (reIsBadHex.test(value) ? NAN : +value);
54312 }
54313
54314 /**
54315 * Converts `value` to a plain object flattening inherited enumerable string
54316 * keyed properties of `value` to own properties of the plain object.
54317 *
54318 * @static
54319 * @memberOf _
54320 * @since 3.0.0
54321 * @category Lang
54322 * @param {*} value The value to convert.
54323 * @returns {Object} Returns the converted plain object.
54324 * @example
54325 *
54326 * function Foo() {
54327 * this.b = 2;
54328 * }
54329 *
54330 * Foo.prototype.c = 3;
54331 *
54332 * _.assign({ 'a': 1 }, new Foo);
54333 * // => { 'a': 1, 'b': 2 }
54334 *
54335 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
54336 * // => { 'a': 1, 'b': 2, 'c': 3 }
54337 */
54338 function toPlainObject(value) {
54339 return copyObject(value, keysIn(value));
54340 }
54341
54342 /**
54343 * Converts `value` to a safe integer. A safe integer can be compared and
54344 * represented correctly.
54345 *
54346 * @static
54347 * @memberOf _
54348 * @since 4.0.0
54349 * @category Lang
54350 * @param {*} value The value to convert.
54351 * @returns {number} Returns the converted integer.
54352 * @example
54353 *
54354 * _.toSafeInteger(3.2);
54355 * // => 3
54356 *
54357 * _.toSafeInteger(Number.MIN_VALUE);
54358 * // => 0
54359 *
54360 * _.toSafeInteger(Infinity);
54361 * // => 9007199254740991
54362 *
54363 * _.toSafeInteger('3.2');
54364 * // => 3
54365 */
54366 function toSafeInteger(value) {
54367 return value
54368 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
54369 : (value === 0 ? value : 0);
54370 }
54371
54372 /**
54373 * Converts `value` to a string. An empty string is returned for `null`
54374 * and `undefined` values. The sign of `-0` is preserved.
54375 *
54376 * @static
54377 * @memberOf _
54378 * @since 4.0.0
54379 * @category Lang
54380 * @param {*} value The value to convert.
54381 * @returns {string} Returns the converted string.
54382 * @example
54383 *
54384 * _.toString(null);
54385 * // => ''
54386 *
54387 * _.toString(-0);
54388 * // => '-0'
54389 *
54390 * _.toString([1, 2, 3]);
54391 * // => '1,2,3'
54392 */
54393 function toString(value) {
54394 return value == null ? '' : baseToString(value);
54395 }
54396
54397 /*------------------------------------------------------------------------*/
54398
54399 /**
54400 * Assigns own enumerable string keyed properties of source objects to the
54401 * destination object. Source objects are applied from left to right.
54402 * Subsequent sources overwrite property assignments of previous sources.
54403 *
54404 * **Note:** This method mutates `object` and is loosely based on
54405 * [`Object.assign`](https://mdn.io/Object/assign).
54406 *
54407 * @static
54408 * @memberOf _
54409 * @since 0.10.0
54410 * @category Object
54411 * @param {Object} object The destination object.
54412 * @param {...Object} [sources] The source objects.
54413 * @returns {Object} Returns `object`.
54414 * @see _.assignIn
54415 * @example
54416 *
54417 * function Foo() {
54418 * this.a = 1;
54419 * }
54420 *
54421 * function Bar() {
54422 * this.c = 3;
54423 * }
54424 *
54425 * Foo.prototype.b = 2;
54426 * Bar.prototype.d = 4;
54427 *
54428 * _.assign({ 'a': 0 }, new Foo, new Bar);
54429 * // => { 'a': 1, 'c': 3 }
54430 */
54431 var assign = createAssigner(function(object, source) {
54432 if (isPrototype(source) || isArrayLike(source)) {
54433 copyObject(source, keys(source), object);
54434 return;
54435 }
54436 for (var key in source) {
54437 if (hasOwnProperty.call(source, key)) {
54438 assignValue(object, key, source[key]);
54439 }
54440 }
54441 });
54442
54443 /**
54444 * This method is like `_.assign` except that it iterates over own and
54445 * inherited source properties.
54446 *
54447 * **Note:** This method mutates `object`.
54448 *
54449 * @static
54450 * @memberOf _
54451 * @since 4.0.0
54452 * @alias extend
54453 * @category Object
54454 * @param {Object} object The destination object.
54455 * @param {...Object} [sources] The source objects.
54456 * @returns {Object} Returns `object`.
54457 * @see _.assign
54458 * @example
54459 *
54460 * function Foo() {
54461 * this.a = 1;
54462 * }
54463 *
54464 * function Bar() {
54465 * this.c = 3;
54466 * }
54467 *
54468 * Foo.prototype.b = 2;
54469 * Bar.prototype.d = 4;
54470 *
54471 * _.assignIn({ 'a': 0 }, new Foo, new Bar);
54472 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
54473 */
54474 var assignIn = createAssigner(function(object, source) {
54475 copyObject(source, keysIn(source), object);
54476 });
54477
54478 /**
54479 * This method is like `_.assignIn` except that it accepts `customizer`
54480 * which is invoked to produce the assigned values. If `customizer` returns
54481 * `undefined`, assignment is handled by the method instead. The `customizer`
54482 * is invoked with five arguments: (objValue, srcValue, key, object, source).
54483 *
54484 * **Note:** This method mutates `object`.
54485 *
54486 * @static
54487 * @memberOf _
54488 * @since 4.0.0
54489 * @alias extendWith
54490 * @category Object
54491 * @param {Object} object The destination object.
54492 * @param {...Object} sources The source objects.
54493 * @param {Function} [customizer] The function to customize assigned values.
54494 * @returns {Object} Returns `object`.
54495 * @see _.assignWith
54496 * @example
54497 *
54498 * function customizer(objValue, srcValue) {
54499 * return _.isUndefined(objValue) ? srcValue : objValue;
54500 * }
54501 *
54502 * var defaults = _.partialRight(_.assignInWith, customizer);
54503 *
54504 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
54505 * // => { 'a': 1, 'b': 2 }
54506 */
54507 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
54508 copyObject(source, keysIn(source), object, customizer);
54509 });
54510
54511 /**
54512 * This method is like `_.assign` except that it accepts `customizer`
54513 * which is invoked to produce the assigned values. If `customizer` returns
54514 * `undefined`, assignment is handled by the method instead. The `customizer`
54515 * is invoked with five arguments: (objValue, srcValue, key, object, source).
54516 *
54517 * **Note:** This method mutates `object`.
54518 *
54519 * @static
54520 * @memberOf _
54521 * @since 4.0.0
54522 * @category Object
54523 * @param {Object} object The destination object.
54524 * @param {...Object} sources The source objects.
54525 * @param {Function} [customizer] The function to customize assigned values.
54526 * @returns {Object} Returns `object`.
54527 * @see _.assignInWith
54528 * @example
54529 *
54530 * function customizer(objValue, srcValue) {
54531 * return _.isUndefined(objValue) ? srcValue : objValue;
54532 * }
54533 *
54534 * var defaults = _.partialRight(_.assignWith, customizer);
54535 *
54536 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
54537 * // => { 'a': 1, 'b': 2 }
54538 */
54539 var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
54540 copyObject(source, keys(source), object, customizer);
54541 });
54542
54543 /**
54544 * Creates an array of values corresponding to `paths` of `object`.
54545 *
54546 * @static
54547 * @memberOf _
54548 * @since 1.0.0
54549 * @category Object
54550 * @param {Object} object The object to iterate over.
54551 * @param {...(string|string[])} [paths] The property paths to pick.
54552 * @returns {Array} Returns the picked values.
54553 * @example
54554 *
54555 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
54556 *
54557 * _.at(object, ['a[0].b.c', 'a[1]']);
54558 * // => [3, 4]
54559 */
54560 var at = flatRest(baseAt);
54561
54562 /**
54563 * Creates an object that inherits from the `prototype` object. If a
54564 * `properties` object is given, its own enumerable string keyed properties
54565 * are assigned to the created object.
54566 *
54567 * @static
54568 * @memberOf _
54569 * @since 2.3.0
54570 * @category Object
54571 * @param {Object} prototype The object to inherit from.
54572 * @param {Object} [properties] The properties to assign to the object.
54573 * @returns {Object} Returns the new object.
54574 * @example
54575 *
54576 * function Shape() {
54577 * this.x = 0;
54578 * this.y = 0;
54579 * }
54580 *
54581 * function Circle() {
54582 * Shape.call(this);
54583 * }
54584 *
54585 * Circle.prototype = _.create(Shape.prototype, {
54586 * 'constructor': Circle
54587 * });
54588 *
54589 * var circle = new Circle;
54590 * circle instanceof Circle;
54591 * // => true
54592 *
54593 * circle instanceof Shape;
54594 * // => true
54595 */
54596 function create(prototype, properties) {
54597 var result = baseCreate(prototype);
54598 return properties == null ? result : baseAssign(result, properties);
54599 }
54600
54601 /**
54602 * Assigns own and inherited enumerable string keyed properties of source
54603 * objects to the destination object for all destination properties that
54604 * resolve to `undefined`. Source objects are applied from left to right.
54605 * Once a property is set, additional values of the same property are ignored.
54606 *
54607 * **Note:** This method mutates `object`.
54608 *
54609 * @static
54610 * @since 0.1.0
54611 * @memberOf _
54612 * @category Object
54613 * @param {Object} object The destination object.
54614 * @param {...Object} [sources] The source objects.
54615 * @returns {Object} Returns `object`.
54616 * @see _.defaultsDeep
54617 * @example
54618 *
54619 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
54620 * // => { 'a': 1, 'b': 2 }
54621 */
54622 var defaults = baseRest(function(object, sources) {
54623 object = Object(object);
54624
54625 var index = -1;
54626 var length = sources.length;
54627 var guard = length > 2 ? sources[2] : undefined;
54628
54629 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
54630 length = 1;
54631 }
54632
54633 while (++index < length) {
54634 var source = sources[index];
54635 var props = keysIn(source);
54636 var propsIndex = -1;
54637 var propsLength = props.length;
54638
54639 while (++propsIndex < propsLength) {
54640 var key = props[propsIndex];
54641 var value = object[key];
54642
54643 if (value === undefined ||
54644 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
54645 object[key] = source[key];
54646 }
54647 }
54648 }
54649
54650 return object;
54651 });
54652
54653 /**
54654 * This method is like `_.defaults` except that it recursively assigns
54655 * default properties.
54656 *
54657 * **Note:** This method mutates `object`.
54658 *
54659 * @static
54660 * @memberOf _
54661 * @since 3.10.0
54662 * @category Object
54663 * @param {Object} object The destination object.
54664 * @param {...Object} [sources] The source objects.
54665 * @returns {Object} Returns `object`.
54666 * @see _.defaults
54667 * @example
54668 *
54669 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
54670 * // => { 'a': { 'b': 2, 'c': 3 } }
54671 */
54672 var defaultsDeep = baseRest(function(args) {
54673 args.push(undefined, customDefaultsMerge);
54674 return apply(mergeWith, undefined, args);
54675 });
54676
54677 /**
54678 * This method is like `_.find` except that it returns the key of the first
54679 * element `predicate` returns truthy for instead of the element itself.
54680 *
54681 * @static
54682 * @memberOf _
54683 * @since 1.1.0
54684 * @category Object
54685 * @param {Object} object The object to inspect.
54686 * @param {Function} [predicate=_.identity] The function invoked per iteration.
54687 * @returns {string|undefined} Returns the key of the matched element,
54688 * else `undefined`.
54689 * @example
54690 *
54691 * var users = {
54692 * 'barney': { 'age': 36, 'active': true },
54693 * 'fred': { 'age': 40, 'active': false },
54694 * 'pebbles': { 'age': 1, 'active': true }
54695 * };
54696 *
54697 * _.findKey(users, function(o) { return o.age < 40; });
54698 * // => 'barney' (iteration order is not guaranteed)
54699 *
54700 * // The `_.matches` iteratee shorthand.
54701 * _.findKey(users, { 'age': 1, 'active': true });
54702 * // => 'pebbles'
54703 *
54704 * // The `_.matchesProperty` iteratee shorthand.
54705 * _.findKey(users, ['active', false]);
54706 * // => 'fred'
54707 *
54708 * // The `_.property` iteratee shorthand.
54709 * _.findKey(users, 'active');
54710 * // => 'barney'
54711 */
54712 function findKey(object, predicate) {
54713 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
54714 }
54715
54716 /**
54717 * This method is like `_.findKey` except that it iterates over elements of
54718 * a collection in the opposite order.
54719 *
54720 * @static
54721 * @memberOf _
54722 * @since 2.0.0
54723 * @category Object
54724 * @param {Object} object The object to inspect.
54725 * @param {Function} [predicate=_.identity] The function invoked per iteration.
54726 * @returns {string|undefined} Returns the key of the matched element,
54727 * else `undefined`.
54728 * @example
54729 *
54730 * var users = {
54731 * 'barney': { 'age': 36, 'active': true },
54732 * 'fred': { 'age': 40, 'active': false },
54733 * 'pebbles': { 'age': 1, 'active': true }
54734 * };
54735 *
54736 * _.findLastKey(users, function(o) { return o.age < 40; });
54737 * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
54738 *
54739 * // The `_.matches` iteratee shorthand.
54740 * _.findLastKey(users, { 'age': 36, 'active': true });
54741 * // => 'barney'
54742 *
54743 * // The `_.matchesProperty` iteratee shorthand.
54744 * _.findLastKey(users, ['active', false]);
54745 * // => 'fred'
54746 *
54747 * // The `_.property` iteratee shorthand.
54748 * _.findLastKey(users, 'active');
54749 * // => 'pebbles'
54750 */
54751 function findLastKey(object, predicate) {
54752 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
54753 }
54754
54755 /**
54756 * Iterates over own and inherited enumerable string keyed properties of an
54757 * object and invokes `iteratee` for each property. The iteratee is invoked
54758 * with three arguments: (value, key, object). Iteratee functions may exit
54759 * iteration early by explicitly returning `false`.
54760 *
54761 * @static
54762 * @memberOf _
54763 * @since 0.3.0
54764 * @category Object
54765 * @param {Object} object The object to iterate over.
54766 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
54767 * @returns {Object} Returns `object`.
54768 * @see _.forInRight
54769 * @example
54770 *
54771 * function Foo() {
54772 * this.a = 1;
54773 * this.b = 2;
54774 * }
54775 *
54776 * Foo.prototype.c = 3;
54777 *
54778 * _.forIn(new Foo, function(value, key) {
54779 * console.log(key);
54780 * });
54781 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
54782 */
54783 function forIn(object, iteratee) {
54784 return object == null
54785 ? object
54786 : baseFor(object, getIteratee(iteratee, 3), keysIn);
54787 }
54788
54789 /**
54790 * This method is like `_.forIn` except that it iterates over properties of
54791 * `object` in the opposite order.
54792 *
54793 * @static
54794 * @memberOf _
54795 * @since 2.0.0
54796 * @category Object
54797 * @param {Object} object The object to iterate over.
54798 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
54799 * @returns {Object} Returns `object`.
54800 * @see _.forIn
54801 * @example
54802 *
54803 * function Foo() {
54804 * this.a = 1;
54805 * this.b = 2;
54806 * }
54807 *
54808 * Foo.prototype.c = 3;
54809 *
54810 * _.forInRight(new Foo, function(value, key) {
54811 * console.log(key);
54812 * });
54813 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
54814 */
54815 function forInRight(object, iteratee) {
54816 return object == null
54817 ? object
54818 : baseForRight(object, getIteratee(iteratee, 3), keysIn);
54819 }
54820
54821 /**
54822 * Iterates over own enumerable string keyed properties of an object and
54823 * invokes `iteratee` for each property. The iteratee is invoked with three
54824 * arguments: (value, key, object). Iteratee functions may exit iteration
54825 * early by explicitly returning `false`.
54826 *
54827 * @static
54828 * @memberOf _
54829 * @since 0.3.0
54830 * @category Object
54831 * @param {Object} object The object to iterate over.
54832 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
54833 * @returns {Object} Returns `object`.
54834 * @see _.forOwnRight
54835 * @example
54836 *
54837 * function Foo() {
54838 * this.a = 1;
54839 * this.b = 2;
54840 * }
54841 *
54842 * Foo.prototype.c = 3;
54843 *
54844 * _.forOwn(new Foo, function(value, key) {
54845 * console.log(key);
54846 * });
54847 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
54848 */
54849 function forOwn(object, iteratee) {
54850 return object && baseForOwn(object, getIteratee(iteratee, 3));
54851 }
54852
54853 /**
54854 * This method is like `_.forOwn` except that it iterates over properties of
54855 * `object` in the opposite order.
54856 *
54857 * @static
54858 * @memberOf _
54859 * @since 2.0.0
54860 * @category Object
54861 * @param {Object} object The object to iterate over.
54862 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
54863 * @returns {Object} Returns `object`.
54864 * @see _.forOwn
54865 * @example
54866 *
54867 * function Foo() {
54868 * this.a = 1;
54869 * this.b = 2;
54870 * }
54871 *
54872 * Foo.prototype.c = 3;
54873 *
54874 * _.forOwnRight(new Foo, function(value, key) {
54875 * console.log(key);
54876 * });
54877 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
54878 */
54879 function forOwnRight(object, iteratee) {
54880 return object && baseForOwnRight(object, getIteratee(iteratee, 3));
54881 }
54882
54883 /**
54884 * Creates an array of function property names from own enumerable properties
54885 * of `object`.
54886 *
54887 * @static
54888 * @since 0.1.0
54889 * @memberOf _
54890 * @category Object
54891 * @param {Object} object The object to inspect.
54892 * @returns {Array} Returns the function names.
54893 * @see _.functionsIn
54894 * @example
54895 *
54896 * function Foo() {
54897 * this.a = _.constant('a');
54898 * this.b = _.constant('b');
54899 * }
54900 *
54901 * Foo.prototype.c = _.constant('c');
54902 *
54903 * _.functions(new Foo);
54904 * // => ['a', 'b']
54905 */
54906 function functions(object) {
54907 return object == null ? [] : baseFunctions(object, keys(object));
54908 }
54909
54910 /**
54911 * Creates an array of function property names from own and inherited
54912 * enumerable properties of `object`.
54913 *
54914 * @static
54915 * @memberOf _
54916 * @since 4.0.0
54917 * @category Object
54918 * @param {Object} object The object to inspect.
54919 * @returns {Array} Returns the function names.
54920 * @see _.functions
54921 * @example
54922 *
54923 * function Foo() {
54924 * this.a = _.constant('a');
54925 * this.b = _.constant('b');
54926 * }
54927 *
54928 * Foo.prototype.c = _.constant('c');
54929 *
54930 * _.functionsIn(new Foo);
54931 * // => ['a', 'b', 'c']
54932 */
54933 function functionsIn(object) {
54934 return object == null ? [] : baseFunctions(object, keysIn(object));
54935 }
54936
54937 /**
54938 * Gets the value at `path` of `object`. If the resolved value is
54939 * `undefined`, the `defaultValue` is returned in its place.
54940 *
54941 * @static
54942 * @memberOf _
54943 * @since 3.7.0
54944 * @category Object
54945 * @param {Object} object The object to query.
54946 * @param {Array|string} path The path of the property to get.
54947 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
54948 * @returns {*} Returns the resolved value.
54949 * @example
54950 *
54951 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
54952 *
54953 * _.get(object, 'a[0].b.c');
54954 * // => 3
54955 *
54956 * _.get(object, ['a', '0', 'b', 'c']);
54957 * // => 3
54958 *
54959 * _.get(object, 'a.b.c', 'default');
54960 * // => 'default'
54961 */
54962 function get(object, path, defaultValue) {
54963 var result = object == null ? undefined : baseGet(object, path);
54964 return result === undefined ? defaultValue : result;
54965 }
54966
54967 /**
54968 * Checks if `path` is a direct property of `object`.
54969 *
54970 * @static
54971 * @since 0.1.0
54972 * @memberOf _
54973 * @category Object
54974 * @param {Object} object The object to query.
54975 * @param {Array|string} path The path to check.
54976 * @returns {boolean} Returns `true` if `path` exists, else `false`.
54977 * @example
54978 *
54979 * var object = { 'a': { 'b': 2 } };
54980 * var other = _.create({ 'a': _.create({ 'b': 2 }) });
54981 *
54982 * _.has(object, 'a');
54983 * // => true
54984 *
54985 * _.has(object, 'a.b');
54986 * // => true
54987 *
54988 * _.has(object, ['a', 'b']);
54989 * // => true
54990 *
54991 * _.has(other, 'a');
54992 * // => false
54993 */
54994 function has(object, path) {
54995 return object != null && hasPath(object, path, baseHas);
54996 }
54997
54998 /**
54999 * Checks if `path` is a direct or inherited property of `object`.
55000 *
55001 * @static
55002 * @memberOf _
55003 * @since 4.0.0
55004 * @category Object
55005 * @param {Object} object The object to query.
55006 * @param {Array|string} path The path to check.
55007 * @returns {boolean} Returns `true` if `path` exists, else `false`.
55008 * @example
55009 *
55010 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
55011 *
55012 * _.hasIn(object, 'a');
55013 * // => true
55014 *
55015 * _.hasIn(object, 'a.b');
55016 * // => true
55017 *
55018 * _.hasIn(object, ['a', 'b']);
55019 * // => true
55020 *
55021 * _.hasIn(object, 'b');
55022 * // => false
55023 */
55024 function hasIn(object, path) {
55025 return object != null && hasPath(object, path, baseHasIn);
55026 }
55027
55028 /**
55029 * Creates an object composed of the inverted keys and values of `object`.
55030 * If `object` contains duplicate values, subsequent values overwrite
55031 * property assignments of previous values.
55032 *
55033 * @static
55034 * @memberOf _
55035 * @since 0.7.0
55036 * @category Object
55037 * @param {Object} object The object to invert.
55038 * @returns {Object} Returns the new inverted object.
55039 * @example
55040 *
55041 * var object = { 'a': 1, 'b': 2, 'c': 1 };
55042 *
55043 * _.invert(object);
55044 * // => { '1': 'c', '2': 'b' }
55045 */
55046 var invert = createInverter(function(result, value, key) {
55047 if (value != null &&
55048 typeof value.toString != 'function') {
55049 value = nativeObjectToString.call(value);
55050 }
55051
55052 result[value] = key;
55053 }, constant(identity));
55054
55055 /**
55056 * This method is like `_.invert` except that the inverted object is generated
55057 * from the results of running each element of `object` thru `iteratee`. The
55058 * corresponding inverted value of each inverted key is an array of keys
55059 * responsible for generating the inverted value. The iteratee is invoked
55060 * with one argument: (value).
55061 *
55062 * @static
55063 * @memberOf _
55064 * @since 4.1.0
55065 * @category Object
55066 * @param {Object} object The object to invert.
55067 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
55068 * @returns {Object} Returns the new inverted object.
55069 * @example
55070 *
55071 * var object = { 'a': 1, 'b': 2, 'c': 1 };
55072 *
55073 * _.invertBy(object);
55074 * // => { '1': ['a', 'c'], '2': ['b'] }
55075 *
55076 * _.invertBy(object, function(value) {
55077 * return 'group' + value;
55078 * });
55079 * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
55080 */
55081 var invertBy = createInverter(function(result, value, key) {
55082 if (value != null &&
55083 typeof value.toString != 'function') {
55084 value = nativeObjectToString.call(value);
55085 }
55086
55087 if (hasOwnProperty.call(result, value)) {
55088 result[value].push(key);
55089 } else {
55090 result[value] = [key];
55091 }
55092 }, getIteratee);
55093
55094 /**
55095 * Invokes the method at `path` of `object`.
55096 *
55097 * @static
55098 * @memberOf _
55099 * @since 4.0.0
55100 * @category Object
55101 * @param {Object} object The object to query.
55102 * @param {Array|string} path The path of the method to invoke.
55103 * @param {...*} [args] The arguments to invoke the method with.
55104 * @returns {*} Returns the result of the invoked method.
55105 * @example
55106 *
55107 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
55108 *
55109 * _.invoke(object, 'a[0].b.c.slice', 1, 3);
55110 * // => [2, 3]
55111 */
55112 var invoke = baseRest(baseInvoke);
55113
55114 /**
55115 * Creates an array of the own enumerable property names of `object`.
55116 *
55117 * **Note:** Non-object values are coerced to objects. See the
55118 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
55119 * for more details.
55120 *
55121 * @static
55122 * @since 0.1.0
55123 * @memberOf _
55124 * @category Object
55125 * @param {Object} object The object to query.
55126 * @returns {Array} Returns the array of property names.
55127 * @example
55128 *
55129 * function Foo() {
55130 * this.a = 1;
55131 * this.b = 2;
55132 * }
55133 *
55134 * Foo.prototype.c = 3;
55135 *
55136 * _.keys(new Foo);
55137 * // => ['a', 'b'] (iteration order is not guaranteed)
55138 *
55139 * _.keys('hi');
55140 * // => ['0', '1']
55141 */
55142 function keys(object) {
55143 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
55144 }
55145
55146 /**
55147 * Creates an array of the own and inherited enumerable property names of `object`.
55148 *
55149 * **Note:** Non-object values are coerced to objects.
55150 *
55151 * @static
55152 * @memberOf _
55153 * @since 3.0.0
55154 * @category Object
55155 * @param {Object} object The object to query.
55156 * @returns {Array} Returns the array of property names.
55157 * @example
55158 *
55159 * function Foo() {
55160 * this.a = 1;
55161 * this.b = 2;
55162 * }
55163 *
55164 * Foo.prototype.c = 3;
55165 *
55166 * _.keysIn(new Foo);
55167 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
55168 */
55169 function keysIn(object) {
55170 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
55171 }
55172
55173 /**
55174 * The opposite of `_.mapValues`; this method creates an object with the
55175 * same values as `object` and keys generated by running each own enumerable
55176 * string keyed property of `object` thru `iteratee`. The iteratee is invoked
55177 * with three arguments: (value, key, object).
55178 *
55179 * @static
55180 * @memberOf _
55181 * @since 3.8.0
55182 * @category Object
55183 * @param {Object} object The object to iterate over.
55184 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
55185 * @returns {Object} Returns the new mapped object.
55186 * @see _.mapValues
55187 * @example
55188 *
55189 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
55190 * return key + value;
55191 * });
55192 * // => { 'a1': 1, 'b2': 2 }
55193 */
55194 function mapKeys(object, iteratee) {
55195 var result = {};
55196 iteratee = getIteratee(iteratee, 3);
55197
55198 baseForOwn(object, function(value, key, object) {
55199 baseAssignValue(result, iteratee(value, key, object), value);
55200 });
55201 return result;
55202 }
55203
55204 /**
55205 * Creates an object with the same keys as `object` and values generated
55206 * by running each own enumerable string keyed property of `object` thru
55207 * `iteratee`. The iteratee is invoked with three arguments:
55208 * (value, key, object).
55209 *
55210 * @static
55211 * @memberOf _
55212 * @since 2.4.0
55213 * @category Object
55214 * @param {Object} object The object to iterate over.
55215 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
55216 * @returns {Object} Returns the new mapped object.
55217 * @see _.mapKeys
55218 * @example
55219 *
55220 * var users = {
55221 * 'fred': { 'user': 'fred', 'age': 40 },
55222 * 'pebbles': { 'user': 'pebbles', 'age': 1 }
55223 * };
55224 *
55225 * _.mapValues(users, function(o) { return o.age; });
55226 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
55227 *
55228 * // The `_.property` iteratee shorthand.
55229 * _.mapValues(users, 'age');
55230 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
55231 */
55232 function mapValues(object, iteratee) {
55233 var result = {};
55234 iteratee = getIteratee(iteratee, 3);
55235
55236 baseForOwn(object, function(value, key, object) {
55237 baseAssignValue(result, key, iteratee(value, key, object));
55238 });
55239 return result;
55240 }
55241
55242 /**
55243 * This method is like `_.assign` except that it recursively merges own and
55244 * inherited enumerable string keyed properties of source objects into the
55245 * destination object. Source properties that resolve to `undefined` are
55246 * skipped if a destination value exists. Array and plain object properties
55247 * are merged recursively. Other objects and value types are overridden by
55248 * assignment. Source objects are applied from left to right. Subsequent
55249 * sources overwrite property assignments of previous sources.
55250 *
55251 * **Note:** This method mutates `object`.
55252 *
55253 * @static
55254 * @memberOf _
55255 * @since 0.5.0
55256 * @category Object
55257 * @param {Object} object The destination object.
55258 * @param {...Object} [sources] The source objects.
55259 * @returns {Object} Returns `object`.
55260 * @example
55261 *
55262 * var object = {
55263 * 'a': [{ 'b': 2 }, { 'd': 4 }]
55264 * };
55265 *
55266 * var other = {
55267 * 'a': [{ 'c': 3 }, { 'e': 5 }]
55268 * };
55269 *
55270 * _.merge(object, other);
55271 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
55272 */
55273 var merge = createAssigner(function(object, source, srcIndex) {
55274 baseMerge(object, source, srcIndex);
55275 });
55276
55277 /**
55278 * This method is like `_.merge` except that it accepts `customizer` which
55279 * is invoked to produce the merged values of the destination and source
55280 * properties. If `customizer` returns `undefined`, merging is handled by the
55281 * method instead. The `customizer` is invoked with six arguments:
55282 * (objValue, srcValue, key, object, source, stack).
55283 *
55284 * **Note:** This method mutates `object`.
55285 *
55286 * @static
55287 * @memberOf _
55288 * @since 4.0.0
55289 * @category Object
55290 * @param {Object} object The destination object.
55291 * @param {...Object} sources The source objects.
55292 * @param {Function} customizer The function to customize assigned values.
55293 * @returns {Object} Returns `object`.
55294 * @example
55295 *
55296 * function customizer(objValue, srcValue) {
55297 * if (_.isArray(objValue)) {
55298 * return objValue.concat(srcValue);
55299 * }
55300 * }
55301 *
55302 * var object = { 'a': [1], 'b': [2] };
55303 * var other = { 'a': [3], 'b': [4] };
55304 *
55305 * _.mergeWith(object, other, customizer);
55306 * // => { 'a': [1, 3], 'b': [2, 4] }
55307 */
55308 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
55309 baseMerge(object, source, srcIndex, customizer);
55310 });
55311
55312 /**
55313 * The opposite of `_.pick`; this method creates an object composed of the
55314 * own and inherited enumerable property paths of `object` that are not omitted.
55315 *
55316 * **Note:** This method is considerably slower than `_.pick`.
55317 *
55318 * @static
55319 * @since 0.1.0
55320 * @memberOf _
55321 * @category Object
55322 * @param {Object} object The source object.
55323 * @param {...(string|string[])} [paths] The property paths to omit.
55324 * @returns {Object} Returns the new object.
55325 * @example
55326 *
55327 * var object = { 'a': 1, 'b': '2', 'c': 3 };
55328 *
55329 * _.omit(object, ['a', 'c']);
55330 * // => { 'b': '2' }
55331 */
55332 var omit = flatRest(function(object, paths) {
55333 var result = {};
55334 if (object == null) {
55335 return result;
55336 }
55337 var isDeep = false;
55338 paths = arrayMap(paths, function(path) {
55339 path = castPath(path, object);
55340 isDeep || (isDeep = path.length > 1);
55341 return path;
55342 });
55343 copyObject(object, getAllKeysIn(object), result);
55344 if (isDeep) {
55345 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
55346 }
55347 var length = paths.length;
55348 while (length--) {
55349 baseUnset(result, paths[length]);
55350 }
55351 return result;
55352 });
55353
55354 /**
55355 * The opposite of `_.pickBy`; this method creates an object composed of
55356 * the own and inherited enumerable string keyed properties of `object` that
55357 * `predicate` doesn't return truthy for. The predicate is invoked with two
55358 * arguments: (value, key).
55359 *
55360 * @static
55361 * @memberOf _
55362 * @since 4.0.0
55363 * @category Object
55364 * @param {Object} object The source object.
55365 * @param {Function} [predicate=_.identity] The function invoked per property.
55366 * @returns {Object} Returns the new object.
55367 * @example
55368 *
55369 * var object = { 'a': 1, 'b': '2', 'c': 3 };
55370 *
55371 * _.omitBy(object, _.isNumber);
55372 * // => { 'b': '2' }
55373 */
55374 function omitBy(object, predicate) {
55375 return pickBy(object, negate(getIteratee(predicate)));
55376 }
55377
55378 /**
55379 * Creates an object composed of the picked `object` properties.
55380 *
55381 * @static
55382 * @since 0.1.0
55383 * @memberOf _
55384 * @category Object
55385 * @param {Object} object The source object.
55386 * @param {...(string|string[])} [paths] The property paths to pick.
55387 * @returns {Object} Returns the new object.
55388 * @example
55389 *
55390 * var object = { 'a': 1, 'b': '2', 'c': 3 };
55391 *
55392 * _.pick(object, ['a', 'c']);
55393 * // => { 'a': 1, 'c': 3 }
55394 */
55395 var pick = flatRest(function(object, paths) {
55396 return object == null ? {} : basePick(object, paths);
55397 });
55398
55399 /**
55400 * Creates an object composed of the `object` properties `predicate` returns
55401 * truthy for. The predicate is invoked with two arguments: (value, key).
55402 *
55403 * @static
55404 * @memberOf _
55405 * @since 4.0.0
55406 * @category Object
55407 * @param {Object} object The source object.
55408 * @param {Function} [predicate=_.identity] The function invoked per property.
55409 * @returns {Object} Returns the new object.
55410 * @example
55411 *
55412 * var object = { 'a': 1, 'b': '2', 'c': 3 };
55413 *
55414 * _.pickBy(object, _.isNumber);
55415 * // => { 'a': 1, 'c': 3 }
55416 */
55417 function pickBy(object, predicate) {
55418 if (object == null) {
55419 return {};
55420 }
55421 var props = arrayMap(getAllKeysIn(object), function(prop) {
55422 return [prop];
55423 });
55424 predicate = getIteratee(predicate);
55425 return basePickBy(object, props, function(value, path) {
55426 return predicate(value, path[0]);
55427 });
55428 }
55429
55430 /**
55431 * This method is like `_.get` except that if the resolved value is a
55432 * function it's invoked with the `this` binding of its parent object and
55433 * its result is returned.
55434 *
55435 * @static
55436 * @since 0.1.0
55437 * @memberOf _
55438 * @category Object
55439 * @param {Object} object The object to query.
55440 * @param {Array|string} path The path of the property to resolve.
55441 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
55442 * @returns {*} Returns the resolved value.
55443 * @example
55444 *
55445 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
55446 *
55447 * _.result(object, 'a[0].b.c1');
55448 * // => 3
55449 *
55450 * _.result(object, 'a[0].b.c2');
55451 * // => 4
55452 *
55453 * _.result(object, 'a[0].b.c3', 'default');
55454 * // => 'default'
55455 *
55456 * _.result(object, 'a[0].b.c3', _.constant('default'));
55457 * // => 'default'
55458 */
55459 function result(object, path, defaultValue) {
55460 path = castPath(path, object);
55461
55462 var index = -1,
55463 length = path.length;
55464
55465 // Ensure the loop is entered when path is empty.
55466 if (!length) {
55467 length = 1;
55468 object = undefined;
55469 }
55470 while (++index < length) {
55471 var value = object == null ? undefined : object[toKey(path[index])];
55472 if (value === undefined) {
55473 index = length;
55474 value = defaultValue;
55475 }
55476 object = isFunction(value) ? value.call(object) : value;
55477 }
55478 return object;
55479 }
55480
55481 /**
55482 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
55483 * it's created. Arrays are created for missing index properties while objects
55484 * are created for all other missing properties. Use `_.setWith` to customize
55485 * `path` creation.
55486 *
55487 * **Note:** This method mutates `object`.
55488 *
55489 * @static
55490 * @memberOf _
55491 * @since 3.7.0
55492 * @category Object
55493 * @param {Object} object The object to modify.
55494 * @param {Array|string} path The path of the property to set.
55495 * @param {*} value The value to set.
55496 * @returns {Object} Returns `object`.
55497 * @example
55498 *
55499 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
55500 *
55501 * _.set(object, 'a[0].b.c', 4);
55502 * console.log(object.a[0].b.c);
55503 * // => 4
55504 *
55505 * _.set(object, ['x', '0', 'y', 'z'], 5);
55506 * console.log(object.x[0].y.z);
55507 * // => 5
55508 */
55509 function set(object, path, value) {
55510 return object == null ? object : baseSet(object, path, value);
55511 }
55512
55513 /**
55514 * This method is like `_.set` except that it accepts `customizer` which is
55515 * invoked to produce the objects of `path`. If `customizer` returns `undefined`
55516 * path creation is handled by the method instead. The `customizer` is invoked
55517 * with three arguments: (nsValue, key, nsObject).
55518 *
55519 * **Note:** This method mutates `object`.
55520 *
55521 * @static
55522 * @memberOf _
55523 * @since 4.0.0
55524 * @category Object
55525 * @param {Object} object The object to modify.
55526 * @param {Array|string} path The path of the property to set.
55527 * @param {*} value The value to set.
55528 * @param {Function} [customizer] The function to customize assigned values.
55529 * @returns {Object} Returns `object`.
55530 * @example
55531 *
55532 * var object = {};
55533 *
55534 * _.setWith(object, '[0][1]', 'a', Object);
55535 * // => { '0': { '1': 'a' } }
55536 */
55537 function setWith(object, path, value, customizer) {
55538 customizer = typeof customizer == 'function' ? customizer : undefined;
55539 return object == null ? object : baseSet(object, path, value, customizer);
55540 }
55541
55542 /**
55543 * Creates an array of own enumerable string keyed-value pairs for `object`
55544 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
55545 * entries are returned.
55546 *
55547 * @static
55548 * @memberOf _
55549 * @since 4.0.0
55550 * @alias entries
55551 * @category Object
55552 * @param {Object} object The object to query.
55553 * @returns {Array} Returns the key-value pairs.
55554 * @example
55555 *
55556 * function Foo() {
55557 * this.a = 1;
55558 * this.b = 2;
55559 * }
55560 *
55561 * Foo.prototype.c = 3;
55562 *
55563 * _.toPairs(new Foo);
55564 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
55565 */
55566 var toPairs = createToPairs(keys);
55567
55568 /**
55569 * Creates an array of own and inherited enumerable string keyed-value pairs
55570 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
55571 * or set, its entries are returned.
55572 *
55573 * @static
55574 * @memberOf _
55575 * @since 4.0.0
55576 * @alias entriesIn
55577 * @category Object
55578 * @param {Object} object The object to query.
55579 * @returns {Array} Returns the key-value pairs.
55580 * @example
55581 *
55582 * function Foo() {
55583 * this.a = 1;
55584 * this.b = 2;
55585 * }
55586 *
55587 * Foo.prototype.c = 3;
55588 *
55589 * _.toPairsIn(new Foo);
55590 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
55591 */
55592 var toPairsIn = createToPairs(keysIn);
55593
55594 /**
55595 * An alternative to `_.reduce`; this method transforms `object` to a new
55596 * `accumulator` object which is the result of running each of its own
55597 * enumerable string keyed properties thru `iteratee`, with each invocation
55598 * potentially mutating the `accumulator` object. If `accumulator` is not
55599 * provided, a new object with the same `[[Prototype]]` will be used. The
55600 * iteratee is invoked with four arguments: (accumulator, value, key, object).
55601 * Iteratee functions may exit iteration early by explicitly returning `false`.
55602 *
55603 * @static
55604 * @memberOf _
55605 * @since 1.3.0
55606 * @category Object
55607 * @param {Object} object The object to iterate over.
55608 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
55609 * @param {*} [accumulator] The custom accumulator value.
55610 * @returns {*} Returns the accumulated value.
55611 * @example
55612 *
55613 * _.transform([2, 3, 4], function(result, n) {
55614 * result.push(n *= n);
55615 * return n % 2 == 0;
55616 * }, []);
55617 * // => [4, 9]
55618 *
55619 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
55620 * (result[value] || (result[value] = [])).push(key);
55621 * }, {});
55622 * // => { '1': ['a', 'c'], '2': ['b'] }
55623 */
55624 function transform(object, iteratee, accumulator) {
55625 var isArr = isArray(object),
55626 isArrLike = isArr || isBuffer(object) || isTypedArray(object);
55627
55628 iteratee = getIteratee(iteratee, 4);
55629 if (accumulator == null) {
55630 var Ctor = object && object.constructor;
55631 if (isArrLike) {
55632 accumulator = isArr ? new Ctor : [];
55633 }
55634 else if (isObject(object)) {
55635 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
55636 }
55637 else {
55638 accumulator = {};
55639 }
55640 }
55641 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
55642 return iteratee(accumulator, value, index, object);
55643 });
55644 return accumulator;
55645 }
55646
55647 /**
55648 * Removes the property at `path` of `object`.
55649 *
55650 * **Note:** This method mutates `object`.
55651 *
55652 * @static
55653 * @memberOf _
55654 * @since 4.0.0
55655 * @category Object
55656 * @param {Object} object The object to modify.
55657 * @param {Array|string} path The path of the property to unset.
55658 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
55659 * @example
55660 *
55661 * var object = { 'a': [{ 'b': { 'c': 7 } }] };
55662 * _.unset(object, 'a[0].b.c');
55663 * // => true
55664 *
55665 * console.log(object);
55666 * // => { 'a': [{ 'b': {} }] };
55667 *
55668 * _.unset(object, ['a', '0', 'b', 'c']);
55669 * // => true
55670 *
55671 * console.log(object);
55672 * // => { 'a': [{ 'b': {} }] };
55673 */
55674 function unset(object, path) {
55675 return object == null ? true : baseUnset(object, path);
55676 }
55677
55678 /**
55679 * This method is like `_.set` except that accepts `updater` to produce the
55680 * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
55681 * is invoked with one argument: (value).
55682 *
55683 * **Note:** This method mutates `object`.
55684 *
55685 * @static
55686 * @memberOf _
55687 * @since 4.6.0
55688 * @category Object
55689 * @param {Object} object The object to modify.
55690 * @param {Array|string} path The path of the property to set.
55691 * @param {Function} updater The function to produce the updated value.
55692 * @returns {Object} Returns `object`.
55693 * @example
55694 *
55695 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
55696 *
55697 * _.update(object, 'a[0].b.c', function(n) { return n * n; });
55698 * console.log(object.a[0].b.c);
55699 * // => 9
55700 *
55701 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
55702 * console.log(object.x[0].y.z);
55703 * // => 0
55704 */
55705 function update(object, path, updater) {
55706 return object == null ? object : baseUpdate(object, path, castFunction(updater));
55707 }
55708
55709 /**
55710 * This method is like `_.update` except that it accepts `customizer` which is
55711 * invoked to produce the objects of `path`. If `customizer` returns `undefined`
55712 * path creation is handled by the method instead. The `customizer` is invoked
55713 * with three arguments: (nsValue, key, nsObject).
55714 *
55715 * **Note:** This method mutates `object`.
55716 *
55717 * @static
55718 * @memberOf _
55719 * @since 4.6.0
55720 * @category Object
55721 * @param {Object} object The object to modify.
55722 * @param {Array|string} path The path of the property to set.
55723 * @param {Function} updater The function to produce the updated value.
55724 * @param {Function} [customizer] The function to customize assigned values.
55725 * @returns {Object} Returns `object`.
55726 * @example
55727 *
55728 * var object = {};
55729 *
55730 * _.updateWith(object, '[0][1]', _.constant('a'), Object);
55731 * // => { '0': { '1': 'a' } }
55732 */
55733 function updateWith(object, path, updater, customizer) {
55734 customizer = typeof customizer == 'function' ? customizer : undefined;
55735 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
55736 }
55737
55738 /**
55739 * Creates an array of the own enumerable string keyed property values of `object`.
55740 *
55741 * **Note:** Non-object values are coerced to objects.
55742 *
55743 * @static
55744 * @since 0.1.0
55745 * @memberOf _
55746 * @category Object
55747 * @param {Object} object The object to query.
55748 * @returns {Array} Returns the array of property values.
55749 * @example
55750 *
55751 * function Foo() {
55752 * this.a = 1;
55753 * this.b = 2;
55754 * }
55755 *
55756 * Foo.prototype.c = 3;
55757 *
55758 * _.values(new Foo);
55759 * // => [1, 2] (iteration order is not guaranteed)
55760 *
55761 * _.values('hi');
55762 * // => ['h', 'i']
55763 */
55764 function values(object) {
55765 return object == null ? [] : baseValues(object, keys(object));
55766 }
55767
55768 /**
55769 * Creates an array of the own and inherited enumerable string keyed property
55770 * values of `object`.
55771 *
55772 * **Note:** Non-object values are coerced to objects.
55773 *
55774 * @static
55775 * @memberOf _
55776 * @since 3.0.0
55777 * @category Object
55778 * @param {Object} object The object to query.
55779 * @returns {Array} Returns the array of property values.
55780 * @example
55781 *
55782 * function Foo() {
55783 * this.a = 1;
55784 * this.b = 2;
55785 * }
55786 *
55787 * Foo.prototype.c = 3;
55788 *
55789 * _.valuesIn(new Foo);
55790 * // => [1, 2, 3] (iteration order is not guaranteed)
55791 */
55792 function valuesIn(object) {
55793 return object == null ? [] : baseValues(object, keysIn(object));
55794 }
55795
55796 /*------------------------------------------------------------------------*/
55797
55798 /**
55799 * Clamps `number` within the inclusive `lower` and `upper` bounds.
55800 *
55801 * @static
55802 * @memberOf _
55803 * @since 4.0.0
55804 * @category Number
55805 * @param {number} number The number to clamp.
55806 * @param {number} [lower] The lower bound.
55807 * @param {number} upper The upper bound.
55808 * @returns {number} Returns the clamped number.
55809 * @example
55810 *
55811 * _.clamp(-10, -5, 5);
55812 * // => -5
55813 *
55814 * _.clamp(10, -5, 5);
55815 * // => 5
55816 */
55817 function clamp(number, lower, upper) {
55818 if (upper === undefined) {
55819 upper = lower;
55820 lower = undefined;
55821 }
55822 if (upper !== undefined) {
55823 upper = toNumber(upper);
55824 upper = upper === upper ? upper : 0;
55825 }
55826 if (lower !== undefined) {
55827 lower = toNumber(lower);
55828 lower = lower === lower ? lower : 0;
55829 }
55830 return baseClamp(toNumber(number), lower, upper);
55831 }
55832
55833 /**
55834 * Checks if `n` is between `start` and up to, but not including, `end`. If
55835 * `end` is not specified, it's set to `start` with `start` then set to `0`.
55836 * If `start` is greater than `end` the params are swapped to support
55837 * negative ranges.
55838 *
55839 * @static
55840 * @memberOf _
55841 * @since 3.3.0
55842 * @category Number
55843 * @param {number} number The number to check.
55844 * @param {number} [start=0] The start of the range.
55845 * @param {number} end The end of the range.
55846 * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
55847 * @see _.range, _.rangeRight
55848 * @example
55849 *
55850 * _.inRange(3, 2, 4);
55851 * // => true
55852 *
55853 * _.inRange(4, 8);
55854 * // => true
55855 *
55856 * _.inRange(4, 2);
55857 * // => false
55858 *
55859 * _.inRange(2, 2);
55860 * // => false
55861 *
55862 * _.inRange(1.2, 2);
55863 * // => true
55864 *
55865 * _.inRange(5.2, 4);
55866 * // => false
55867 *
55868 * _.inRange(-3, -2, -6);
55869 * // => true
55870 */
55871 function inRange(number, start, end) {
55872 start = toFinite(start);
55873 if (end === undefined) {
55874 end = start;
55875 start = 0;
55876 } else {
55877 end = toFinite(end);
55878 }
55879 number = toNumber(number);
55880 return baseInRange(number, start, end);
55881 }
55882
55883 /**
55884 * Produces a random number between the inclusive `lower` and `upper` bounds.
55885 * If only one argument is provided a number between `0` and the given number
55886 * is returned. If `floating` is `true`, or either `lower` or `upper` are
55887 * floats, a floating-point number is returned instead of an integer.
55888 *
55889 * **Note:** JavaScript follows the IEEE-754 standard for resolving
55890 * floating-point values which can produce unexpected results.
55891 *
55892 * @static
55893 * @memberOf _
55894 * @since 0.7.0
55895 * @category Number
55896 * @param {number} [lower=0] The lower bound.
55897 * @param {number} [upper=1] The upper bound.
55898 * @param {boolean} [floating] Specify returning a floating-point number.
55899 * @returns {number} Returns the random number.
55900 * @example
55901 *
55902 * _.random(0, 5);
55903 * // => an integer between 0 and 5
55904 *
55905 * _.random(5);
55906 * // => also an integer between 0 and 5
55907 *
55908 * _.random(5, true);
55909 * // => a floating-point number between 0 and 5
55910 *
55911 * _.random(1.2, 5.2);
55912 * // => a floating-point number between 1.2 and 5.2
55913 */
55914 function random(lower, upper, floating) {
55915 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
55916 upper = floating = undefined;
55917 }
55918 if (floating === undefined) {
55919 if (typeof upper == 'boolean') {
55920 floating = upper;
55921 upper = undefined;
55922 }
55923 else if (typeof lower == 'boolean') {
55924 floating = lower;
55925 lower = undefined;
55926 }
55927 }
55928 if (lower === undefined && upper === undefined) {
55929 lower = 0;
55930 upper = 1;
55931 }
55932 else {
55933 lower = toFinite(lower);
55934 if (upper === undefined) {
55935 upper = lower;
55936 lower = 0;
55937 } else {
55938 upper = toFinite(upper);
55939 }
55940 }
55941 if (lower > upper) {
55942 var temp = lower;
55943 lower = upper;
55944 upper = temp;
55945 }
55946 if (floating || lower % 1 || upper % 1) {
55947 var rand = nativeRandom();
55948 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
55949 }
55950 return baseRandom(lower, upper);
55951 }
55952
55953 /*------------------------------------------------------------------------*/
55954
55955 /**
55956 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
55957 *
55958 * @static
55959 * @memberOf _
55960 * @since 3.0.0
55961 * @category String
55962 * @param {string} [string=''] The string to convert.
55963 * @returns {string} Returns the camel cased string.
55964 * @example
55965 *
55966 * _.camelCase('Foo Bar');
55967 * // => 'fooBar'
55968 *
55969 * _.camelCase('--foo-bar--');
55970 * // => 'fooBar'
55971 *
55972 * _.camelCase('__FOO_BAR__');
55973 * // => 'fooBar'
55974 */
55975 var camelCase = createCompounder(function(result, word, index) {
55976 word = word.toLowerCase();
55977 return result + (index ? capitalize(word) : word);
55978 });
55979
55980 /**
55981 * Converts the first character of `string` to upper case and the remaining
55982 * to lower case.
55983 *
55984 * @static
55985 * @memberOf _
55986 * @since 3.0.0
55987 * @category String
55988 * @param {string} [string=''] The string to capitalize.
55989 * @returns {string} Returns the capitalized string.
55990 * @example
55991 *
55992 * _.capitalize('FRED');
55993 * // => 'Fred'
55994 */
55995 function capitalize(string) {
55996 return upperFirst(toString(string).toLowerCase());
55997 }
55998
55999 /**
56000 * Deburrs `string` by converting
56001 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
56002 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
56003 * letters to basic Latin letters and removing
56004 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
56005 *
56006 * @static
56007 * @memberOf _
56008 * @since 3.0.0
56009 * @category String
56010 * @param {string} [string=''] The string to deburr.
56011 * @returns {string} Returns the deburred string.
56012 * @example
56013 *
56014 * _.deburr('déjà vu');
56015 * // => 'deja vu'
56016 */
56017 function deburr(string) {
56018 string = toString(string);
56019 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
56020 }
56021
56022 /**
56023 * Checks if `string` ends with the given target string.
56024 *
56025 * @static
56026 * @memberOf _
56027 * @since 3.0.0
56028 * @category String
56029 * @param {string} [string=''] The string to inspect.
56030 * @param {string} [target] The string to search for.
56031 * @param {number} [position=string.length] The position to search up to.
56032 * @returns {boolean} Returns `true` if `string` ends with `target`,
56033 * else `false`.
56034 * @example
56035 *
56036 * _.endsWith('abc', 'c');
56037 * // => true
56038 *
56039 * _.endsWith('abc', 'b');
56040 * // => false
56041 *
56042 * _.endsWith('abc', 'b', 2);
56043 * // => true
56044 */
56045 function endsWith(string, target, position) {
56046 string = toString(string);
56047 target = baseToString(target);
56048
56049 var length = string.length;
56050 position = position === undefined
56051 ? length
56052 : baseClamp(toInteger(position), 0, length);
56053
56054 var end = position;
56055 position -= target.length;
56056 return position >= 0 && string.slice(position, end) == target;
56057 }
56058
56059 /**
56060 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
56061 * corresponding HTML entities.
56062 *
56063 * **Note:** No other characters are escaped. To escape additional
56064 * characters use a third-party library like [_he_](https://mths.be/he).
56065 *
56066 * Though the ">" character is escaped for symmetry, characters like
56067 * ">" and "/" don't need escaping in HTML and have no special meaning
56068 * unless they're part of a tag or unquoted attribute value. See
56069 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
56070 * (under "semi-related fun fact") for more details.
56071 *
56072 * When working with HTML you should always
56073 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
56074 * XSS vectors.
56075 *
56076 * @static
56077 * @since 0.1.0
56078 * @memberOf _
56079 * @category String
56080 * @param {string} [string=''] The string to escape.
56081 * @returns {string} Returns the escaped string.
56082 * @example
56083 *
56084 * _.escape('fred, barney, & pebbles');
56085 * // => 'fred, barney, &amp; pebbles'
56086 */
56087 function escape(string) {
56088 string = toString(string);
56089 return (string && reHasUnescapedHtml.test(string))
56090 ? string.replace(reUnescapedHtml, escapeHtmlChar)
56091 : string;
56092 }
56093
56094 /**
56095 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
56096 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
56097 *
56098 * @static
56099 * @memberOf _
56100 * @since 3.0.0
56101 * @category String
56102 * @param {string} [string=''] The string to escape.
56103 * @returns {string} Returns the escaped string.
56104 * @example
56105 *
56106 * _.escapeRegExp('[lodash](https://lodash.com/)');
56107 * // => '\[lodash\]\(https://lodash\.com/\)'
56108 */
56109 function escapeRegExp(string) {
56110 string = toString(string);
56111 return (string && reHasRegExpChar.test(string))
56112 ? string.replace(reRegExpChar, '\\$&')
56113 : string;
56114 }
56115
56116 /**
56117 * Converts `string` to
56118 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
56119 *
56120 * @static
56121 * @memberOf _
56122 * @since 3.0.0
56123 * @category String
56124 * @param {string} [string=''] The string to convert.
56125 * @returns {string} Returns the kebab cased string.
56126 * @example
56127 *
56128 * _.kebabCase('Foo Bar');
56129 * // => 'foo-bar'
56130 *
56131 * _.kebabCase('fooBar');
56132 * // => 'foo-bar'
56133 *
56134 * _.kebabCase('__FOO_BAR__');
56135 * // => 'foo-bar'
56136 */
56137 var kebabCase = createCompounder(function(result, word, index) {
56138 return result + (index ? '-' : '') + word.toLowerCase();
56139 });
56140
56141 /**
56142 * Converts `string`, as space separated words, to lower case.
56143 *
56144 * @static
56145 * @memberOf _
56146 * @since 4.0.0
56147 * @category String
56148 * @param {string} [string=''] The string to convert.
56149 * @returns {string} Returns the lower cased string.
56150 * @example
56151 *
56152 * _.lowerCase('--Foo-Bar--');
56153 * // => 'foo bar'
56154 *
56155 * _.lowerCase('fooBar');
56156 * // => 'foo bar'
56157 *
56158 * _.lowerCase('__FOO_BAR__');
56159 * // => 'foo bar'
56160 */
56161 var lowerCase = createCompounder(function(result, word, index) {
56162 return result + (index ? ' ' : '') + word.toLowerCase();
56163 });
56164
56165 /**
56166 * Converts the first character of `string` to lower case.
56167 *
56168 * @static
56169 * @memberOf _
56170 * @since 4.0.0
56171 * @category String
56172 * @param {string} [string=''] The string to convert.
56173 * @returns {string} Returns the converted string.
56174 * @example
56175 *
56176 * _.lowerFirst('Fred');
56177 * // => 'fred'
56178 *
56179 * _.lowerFirst('FRED');
56180 * // => 'fRED'
56181 */
56182 var lowerFirst = createCaseFirst('toLowerCase');
56183
56184 /**
56185 * Pads `string` on the left and right sides if it's shorter than `length`.
56186 * Padding characters are truncated if they can't be evenly divided by `length`.
56187 *
56188 * @static
56189 * @memberOf _
56190 * @since 3.0.0
56191 * @category String
56192 * @param {string} [string=''] The string to pad.
56193 * @param {number} [length=0] The padding length.
56194 * @param {string} [chars=' '] The string used as padding.
56195 * @returns {string} Returns the padded string.
56196 * @example
56197 *
56198 * _.pad('abc', 8);
56199 * // => ' abc '
56200 *
56201 * _.pad('abc', 8, '_-');
56202 * // => '_-abc_-_'
56203 *
56204 * _.pad('abc', 3);
56205 * // => 'abc'
56206 */
56207 function pad(string, length, chars) {
56208 string = toString(string);
56209 length = toInteger(length);
56210
56211 var strLength = length ? stringSize(string) : 0;
56212 if (!length || strLength >= length) {
56213 return string;
56214 }
56215 var mid = (length - strLength) / 2;
56216 return (
56217 createPadding(nativeFloor(mid), chars) +
56218 string +
56219 createPadding(nativeCeil(mid), chars)
56220 );
56221 }
56222
56223 /**
56224 * Pads `string` on the right side if it's shorter than `length`. Padding
56225 * characters are truncated if they exceed `length`.
56226 *
56227 * @static
56228 * @memberOf _
56229 * @since 4.0.0
56230 * @category String
56231 * @param {string} [string=''] The string to pad.
56232 * @param {number} [length=0] The padding length.
56233 * @param {string} [chars=' '] The string used as padding.
56234 * @returns {string} Returns the padded string.
56235 * @example
56236 *
56237 * _.padEnd('abc', 6);
56238 * // => 'abc '
56239 *
56240 * _.padEnd('abc', 6, '_-');
56241 * // => 'abc_-_'
56242 *
56243 * _.padEnd('abc', 3);
56244 * // => 'abc'
56245 */
56246 function padEnd(string, length, chars) {
56247 string = toString(string);
56248 length = toInteger(length);
56249
56250 var strLength = length ? stringSize(string) : 0;
56251 return (length && strLength < length)
56252 ? (string + createPadding(length - strLength, chars))
56253 : string;
56254 }
56255
56256 /**
56257 * Pads `string` on the left side if it's shorter than `length`. Padding
56258 * characters are truncated if they exceed `length`.
56259 *
56260 * @static
56261 * @memberOf _
56262 * @since 4.0.0
56263 * @category String
56264 * @param {string} [string=''] The string to pad.
56265 * @param {number} [length=0] The padding length.
56266 * @param {string} [chars=' '] The string used as padding.
56267 * @returns {string} Returns the padded string.
56268 * @example
56269 *
56270 * _.padStart('abc', 6);
56271 * // => ' abc'
56272 *
56273 * _.padStart('abc', 6, '_-');
56274 * // => '_-_abc'
56275 *
56276 * _.padStart('abc', 3);
56277 * // => 'abc'
56278 */
56279 function padStart(string, length, chars) {
56280 string = toString(string);
56281 length = toInteger(length);
56282
56283 var strLength = length ? stringSize(string) : 0;
56284 return (length && strLength < length)
56285 ? (createPadding(length - strLength, chars) + string)
56286 : string;
56287 }
56288
56289 /**
56290 * Converts `string` to an integer of the specified radix. If `radix` is
56291 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
56292 * hexadecimal, in which case a `radix` of `16` is used.
56293 *
56294 * **Note:** This method aligns with the
56295 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
56296 *
56297 * @static
56298 * @memberOf _
56299 * @since 1.1.0
56300 * @category String
56301 * @param {string} string The string to convert.
56302 * @param {number} [radix=10] The radix to interpret `value` by.
56303 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
56304 * @returns {number} Returns the converted integer.
56305 * @example
56306 *
56307 * _.parseInt('08');
56308 * // => 8
56309 *
56310 * _.map(['6', '08', '10'], _.parseInt);
56311 * // => [6, 8, 10]
56312 */
56313 function parseInt(string, radix, guard) {
56314 if (guard || radix == null) {
56315 radix = 0;
56316 } else if (radix) {
56317 radix = +radix;
56318 }
56319 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
56320 }
56321
56322 /**
56323 * Repeats the given string `n` times.
56324 *
56325 * @static
56326 * @memberOf _
56327 * @since 3.0.0
56328 * @category String
56329 * @param {string} [string=''] The string to repeat.
56330 * @param {number} [n=1] The number of times to repeat the string.
56331 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
56332 * @returns {string} Returns the repeated string.
56333 * @example
56334 *
56335 * _.repeat('*', 3);
56336 * // => '***'
56337 *
56338 * _.repeat('abc', 2);
56339 * // => 'abcabc'
56340 *
56341 * _.repeat('abc', 0);
56342 * // => ''
56343 */
56344 function repeat(string, n, guard) {
56345 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
56346 n = 1;
56347 } else {
56348 n = toInteger(n);
56349 }
56350 return baseRepeat(toString(string), n);
56351 }
56352
56353 /**
56354 * Replaces matches for `pattern` in `string` with `replacement`.
56355 *
56356 * **Note:** This method is based on
56357 * [`String#replace`](https://mdn.io/String/replace).
56358 *
56359 * @static
56360 * @memberOf _
56361 * @since 4.0.0
56362 * @category String
56363 * @param {string} [string=''] The string to modify.
56364 * @param {RegExp|string} pattern The pattern to replace.
56365 * @param {Function|string} replacement The match replacement.
56366 * @returns {string} Returns the modified string.
56367 * @example
56368 *
56369 * _.replace('Hi Fred', 'Fred', 'Barney');
56370 * // => 'Hi Barney'
56371 */
56372 function replace() {
56373 var args = arguments,
56374 string = toString(args[0]);
56375
56376 return args.length < 3 ? string : string.replace(args[1], args[2]);
56377 }
56378
56379 /**
56380 * Converts `string` to
56381 * [snake case](https://en.wikipedia.org/wiki/Snake_case).
56382 *
56383 * @static
56384 * @memberOf _
56385 * @since 3.0.0
56386 * @category String
56387 * @param {string} [string=''] The string to convert.
56388 * @returns {string} Returns the snake cased string.
56389 * @example
56390 *
56391 * _.snakeCase('Foo Bar');
56392 * // => 'foo_bar'
56393 *
56394 * _.snakeCase('fooBar');
56395 * // => 'foo_bar'
56396 *
56397 * _.snakeCase('--FOO-BAR--');
56398 * // => 'foo_bar'
56399 */
56400 var snakeCase = createCompounder(function(result, word, index) {
56401 return result + (index ? '_' : '') + word.toLowerCase();
56402 });
56403
56404 /**
56405 * Splits `string` by `separator`.
56406 *
56407 * **Note:** This method is based on
56408 * [`String#split`](https://mdn.io/String/split).
56409 *
56410 * @static
56411 * @memberOf _
56412 * @since 4.0.0
56413 * @category String
56414 * @param {string} [string=''] The string to split.
56415 * @param {RegExp|string} separator The separator pattern to split by.
56416 * @param {number} [limit] The length to truncate results to.
56417 * @returns {Array} Returns the string segments.
56418 * @example
56419 *
56420 * _.split('a-b-c', '-', 2);
56421 * // => ['a', 'b']
56422 */
56423 function split(string, separator, limit) {
56424 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
56425 separator = limit = undefined;
56426 }
56427 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
56428 if (!limit) {
56429 return [];
56430 }
56431 string = toString(string);
56432 if (string && (
56433 typeof separator == 'string' ||
56434 (separator != null && !isRegExp(separator))
56435 )) {
56436 separator = baseToString(separator);
56437 if (!separator && hasUnicode(string)) {
56438 return castSlice(stringToArray(string), 0, limit);
56439 }
56440 }
56441 return string.split(separator, limit);
56442 }
56443
56444 /**
56445 * Converts `string` to
56446 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
56447 *
56448 * @static
56449 * @memberOf _
56450 * @since 3.1.0
56451 * @category String
56452 * @param {string} [string=''] The string to convert.
56453 * @returns {string} Returns the start cased string.
56454 * @example
56455 *
56456 * _.startCase('--foo-bar--');
56457 * // => 'Foo Bar'
56458 *
56459 * _.startCase('fooBar');
56460 * // => 'Foo Bar'
56461 *
56462 * _.startCase('__FOO_BAR__');
56463 * // => 'FOO BAR'
56464 */
56465 var startCase = createCompounder(function(result, word, index) {
56466 return result + (index ? ' ' : '') + upperFirst(word);
56467 });
56468
56469 /**
56470 * Checks if `string` starts with the given target string.
56471 *
56472 * @static
56473 * @memberOf _
56474 * @since 3.0.0
56475 * @category String
56476 * @param {string} [string=''] The string to inspect.
56477 * @param {string} [target] The string to search for.
56478 * @param {number} [position=0] The position to search from.
56479 * @returns {boolean} Returns `true` if `string` starts with `target`,
56480 * else `false`.
56481 * @example
56482 *
56483 * _.startsWith('abc', 'a');
56484 * // => true
56485 *
56486 * _.startsWith('abc', 'b');
56487 * // => false
56488 *
56489 * _.startsWith('abc', 'b', 1);
56490 * // => true
56491 */
56492 function startsWith(string, target, position) {
56493 string = toString(string);
56494 position = position == null
56495 ? 0
56496 : baseClamp(toInteger(position), 0, string.length);
56497
56498 target = baseToString(target);
56499 return string.slice(position, position + target.length) == target;
56500 }
56501
56502 /**
56503 * Creates a compiled template function that can interpolate data properties
56504 * in "interpolate" delimiters, HTML-escape interpolated data properties in
56505 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
56506 * properties may be accessed as free variables in the template. If a setting
56507 * object is given, it takes precedence over `_.templateSettings` values.
56508 *
56509 * **Note:** In the development build `_.template` utilizes
56510 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
56511 * for easier debugging.
56512 *
56513 * For more information on precompiling templates see
56514 * [lodash's custom builds documentation](https://lodash.com/custom-builds).
56515 *
56516 * For more information on Chrome extension sandboxes see
56517 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
56518 *
56519 * @static
56520 * @since 0.1.0
56521 * @memberOf _
56522 * @category String
56523 * @param {string} [string=''] The template string.
56524 * @param {Object} [options={}] The options object.
56525 * @param {RegExp} [options.escape=_.templateSettings.escape]
56526 * The HTML "escape" delimiter.
56527 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
56528 * The "evaluate" delimiter.
56529 * @param {Object} [options.imports=_.templateSettings.imports]
56530 * An object to import into the template as free variables.
56531 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
56532 * The "interpolate" delimiter.
56533 * @param {string} [options.sourceURL='lodash.templateSources[n]']
56534 * The sourceURL of the compiled template.
56535 * @param {string} [options.variable='obj']
56536 * The data object variable name.
56537 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
56538 * @returns {Function} Returns the compiled template function.
56539 * @example
56540 *
56541 * // Use the "interpolate" delimiter to create a compiled template.
56542 * var compiled = _.template('hello <%= user %>!');
56543 * compiled({ 'user': 'fred' });
56544 * // => 'hello fred!'
56545 *
56546 * // Use the HTML "escape" delimiter to escape data property values.
56547 * var compiled = _.template('<b><%- value %></b>');
56548 * compiled({ 'value': '<script>' });
56549 * // => '<b>&lt;script&gt;</b>'
56550 *
56551 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
56552 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
56553 * compiled({ 'users': ['fred', 'barney'] });
56554 * // => '<li>fred</li><li>barney</li>'
56555 *
56556 * // Use the internal `print` function in "evaluate" delimiters.
56557 * var compiled = _.template('<% print("hello " + user); %>!');
56558 * compiled({ 'user': 'barney' });
56559 * // => 'hello barney!'
56560 *
56561 * // Use the ES template literal delimiter as an "interpolate" delimiter.
56562 * // Disable support by replacing the "interpolate" delimiter.
56563 * var compiled = _.template('hello ${ user }!');
56564 * compiled({ 'user': 'pebbles' });
56565 * // => 'hello pebbles!'
56566 *
56567 * // Use backslashes to treat delimiters as plain text.
56568 * var compiled = _.template('<%= "\\<%- value %\\>" %>');
56569 * compiled({ 'value': 'ignored' });
56570 * // => '<%- value %>'
56571 *
56572 * // Use the `imports` option to import `jQuery` as `jq`.
56573 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
56574 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
56575 * compiled({ 'users': ['fred', 'barney'] });
56576 * // => '<li>fred</li><li>barney</li>'
56577 *
56578 * // Use the `sourceURL` option to specify a custom sourceURL for the template.
56579 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
56580 * compiled(data);
56581 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
56582 *
56583 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
56584 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
56585 * compiled.source;
56586 * // => function(data) {
56587 * // var __t, __p = '';
56588 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
56589 * // return __p;
56590 * // }
56591 *
56592 * // Use custom template delimiters.
56593 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
56594 * var compiled = _.template('hello {{ user }}!');
56595 * compiled({ 'user': 'mustache' });
56596 * // => 'hello mustache!'
56597 *
56598 * // Use the `source` property to inline compiled templates for meaningful
56599 * // line numbers in error messages and stack traces.
56600 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
56601 * var JST = {\
56602 * "main": ' + _.template(mainText).source + '\
56603 * };\
56604 * ');
56605 */
56606 function template(string, options, guard) {
56607 // Based on John Resig's `tmpl` implementation
56608 // (http://ejohn.org/blog/javascript-micro-templating/)
56609 // and Laura Doktorova's doT.js (https://github.com/olado/doT).
56610 var settings = lodash.templateSettings;
56611
56612 if (guard && isIterateeCall(string, options, guard)) {
56613 options = undefined;
56614 }
56615 string = toString(string);
56616 options = assignInWith({}, options, settings, customDefaultsAssignIn);
56617
56618 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
56619 importsKeys = keys(imports),
56620 importsValues = baseValues(imports, importsKeys);
56621
56622 var isEscaping,
56623 isEvaluating,
56624 index = 0,
56625 interpolate = options.interpolate || reNoMatch,
56626 source = "__p += '";
56627
56628 // Compile the regexp to match each delimiter.
56629 var reDelimiters = RegExp(
56630 (options.escape || reNoMatch).source + '|' +
56631 interpolate.source + '|' +
56632 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
56633 (options.evaluate || reNoMatch).source + '|$'
56634 , 'g');
56635
56636 // Use a sourceURL for easier debugging.
56637 // The sourceURL gets injected into the source that's eval-ed, so be careful
56638 // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
56639 // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
56640 var sourceURL = '//# sourceURL=' +
56641 (hasOwnProperty.call(options, 'sourceURL')
56642 ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
56643 : ('lodash.templateSources[' + (++templateCounter) + ']')
56644 ) + '\n';
56645
56646 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
56647 interpolateValue || (interpolateValue = esTemplateValue);
56648
56649 // Escape characters that can't be included in string literals.
56650 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
56651
56652 // Replace delimiters with snippets.
56653 if (escapeValue) {
56654 isEscaping = true;
56655 source += "' +\n__e(" + escapeValue + ") +\n'";
56656 }
56657 if (evaluateValue) {
56658 isEvaluating = true;
56659 source += "';\n" + evaluateValue + ";\n__p += '";
56660 }
56661 if (interpolateValue) {
56662 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
56663 }
56664 index = offset + match.length;
56665
56666 // The JS engine embedded in Adobe products needs `match` returned in
56667 // order to produce the correct `offset` value.
56668 return match;
56669 });
56670
56671 source += "';\n";
56672
56673 // If `variable` is not specified wrap a with-statement around the generated
56674 // code to add the data object to the top of the scope chain.
56675 // Like with sourceURL, we take care to not check the option's prototype,
56676 // as this configuration is a code injection vector.
56677 var variable = hasOwnProperty.call(options, 'variable') && options.variable;
56678 if (!variable) {
56679 source = 'with (obj) {\n' + source + '\n}\n';
56680 }
56681 // Cleanup code by stripping empty strings.
56682 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
56683 .replace(reEmptyStringMiddle, '$1')
56684 .replace(reEmptyStringTrailing, '$1;');
56685
56686 // Frame code as the function body.
56687 source = 'function(' + (variable || 'obj') + ') {\n' +
56688 (variable
56689 ? ''
56690 : 'obj || (obj = {});\n'
56691 ) +
56692 "var __t, __p = ''" +
56693 (isEscaping
56694 ? ', __e = _.escape'
56695 : ''
56696 ) +
56697 (isEvaluating
56698 ? ', __j = Array.prototype.join;\n' +
56699 "function print() { __p += __j.call(arguments, '') }\n"
56700 : ';\n'
56701 ) +
56702 source +
56703 'return __p\n}';
56704
56705 var result = attempt(function() {
56706 return Function(importsKeys, sourceURL + 'return ' + source)
56707 .apply(undefined, importsValues);
56708 });
56709
56710 // Provide the compiled function's source by its `toString` method or
56711 // the `source` property as a convenience for inlining compiled templates.
56712 result.source = source;
56713 if (isError(result)) {
56714 throw result;
56715 }
56716 return result;
56717 }
56718
56719 /**
56720 * Converts `string`, as a whole, to lower case just like
56721 * [String#toLowerCase](https://mdn.io/toLowerCase).
56722 *
56723 * @static
56724 * @memberOf _
56725 * @since 4.0.0
56726 * @category String
56727 * @param {string} [string=''] The string to convert.
56728 * @returns {string} Returns the lower cased string.
56729 * @example
56730 *
56731 * _.toLower('--Foo-Bar--');
56732 * // => '--foo-bar--'
56733 *
56734 * _.toLower('fooBar');
56735 * // => 'foobar'
56736 *
56737 * _.toLower('__FOO_BAR__');
56738 * // => '__foo_bar__'
56739 */
56740 function toLower(value) {
56741 return toString(value).toLowerCase();
56742 }
56743
56744 /**
56745 * Converts `string`, as a whole, to upper case just like
56746 * [String#toUpperCase](https://mdn.io/toUpperCase).
56747 *
56748 * @static
56749 * @memberOf _
56750 * @since 4.0.0
56751 * @category String
56752 * @param {string} [string=''] The string to convert.
56753 * @returns {string} Returns the upper cased string.
56754 * @example
56755 *
56756 * _.toUpper('--foo-bar--');
56757 * // => '--FOO-BAR--'
56758 *
56759 * _.toUpper('fooBar');
56760 * // => 'FOOBAR'
56761 *
56762 * _.toUpper('__foo_bar__');
56763 * // => '__FOO_BAR__'
56764 */
56765 function toUpper(value) {
56766 return toString(value).toUpperCase();
56767 }
56768
56769 /**
56770 * Removes leading and trailing whitespace or specified characters from `string`.
56771 *
56772 * @static
56773 * @memberOf _
56774 * @since 3.0.0
56775 * @category String
56776 * @param {string} [string=''] The string to trim.
56777 * @param {string} [chars=whitespace] The characters to trim.
56778 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
56779 * @returns {string} Returns the trimmed string.
56780 * @example
56781 *
56782 * _.trim(' abc ');
56783 * // => 'abc'
56784 *
56785 * _.trim('-_-abc-_-', '_-');
56786 * // => 'abc'
56787 *
56788 * _.map([' foo ', ' bar '], _.trim);
56789 * // => ['foo', 'bar']
56790 */
56791 function trim(string, chars, guard) {
56792 string = toString(string);
56793 if (string && (guard || chars === undefined)) {
56794 return string.replace(reTrim, '');
56795 }
56796 if (!string || !(chars = baseToString(chars))) {
56797 return string;
56798 }
56799 var strSymbols = stringToArray(string),
56800 chrSymbols = stringToArray(chars),
56801 start = charsStartIndex(strSymbols, chrSymbols),
56802 end = charsEndIndex(strSymbols, chrSymbols) + 1;
56803
56804 return castSlice(strSymbols, start, end).join('');
56805 }
56806
56807 /**
56808 * Removes trailing whitespace or specified characters from `string`.
56809 *
56810 * @static
56811 * @memberOf _
56812 * @since 4.0.0
56813 * @category String
56814 * @param {string} [string=''] The string to trim.
56815 * @param {string} [chars=whitespace] The characters to trim.
56816 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
56817 * @returns {string} Returns the trimmed string.
56818 * @example
56819 *
56820 * _.trimEnd(' abc ');
56821 * // => ' abc'
56822 *
56823 * _.trimEnd('-_-abc-_-', '_-');
56824 * // => '-_-abc'
56825 */
56826 function trimEnd(string, chars, guard) {
56827 string = toString(string);
56828 if (string && (guard || chars === undefined)) {
56829 return string.replace(reTrimEnd, '');
56830 }
56831 if (!string || !(chars = baseToString(chars))) {
56832 return string;
56833 }
56834 var strSymbols = stringToArray(string),
56835 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
56836
56837 return castSlice(strSymbols, 0, end).join('');
56838 }
56839
56840 /**
56841 * Removes leading whitespace or specified characters from `string`.
56842 *
56843 * @static
56844 * @memberOf _
56845 * @since 4.0.0
56846 * @category String
56847 * @param {string} [string=''] The string to trim.
56848 * @param {string} [chars=whitespace] The characters to trim.
56849 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
56850 * @returns {string} Returns the trimmed string.
56851 * @example
56852 *
56853 * _.trimStart(' abc ');
56854 * // => 'abc '
56855 *
56856 * _.trimStart('-_-abc-_-', '_-');
56857 * // => 'abc-_-'
56858 */
56859 function trimStart(string, chars, guard) {
56860 string = toString(string);
56861 if (string && (guard || chars === undefined)) {
56862 return string.replace(reTrimStart, '');
56863 }
56864 if (!string || !(chars = baseToString(chars))) {
56865 return string;
56866 }
56867 var strSymbols = stringToArray(string),
56868 start = charsStartIndex(strSymbols, stringToArray(chars));
56869
56870 return castSlice(strSymbols, start).join('');
56871 }
56872
56873 /**
56874 * Truncates `string` if it's longer than the given maximum string length.
56875 * The last characters of the truncated string are replaced with the omission
56876 * string which defaults to "...".
56877 *
56878 * @static
56879 * @memberOf _
56880 * @since 4.0.0
56881 * @category String
56882 * @param {string} [string=''] The string to truncate.
56883 * @param {Object} [options={}] The options object.
56884 * @param {number} [options.length=30] The maximum string length.
56885 * @param {string} [options.omission='...'] The string to indicate text is omitted.
56886 * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
56887 * @returns {string} Returns the truncated string.
56888 * @example
56889 *
56890 * _.truncate('hi-diddly-ho there, neighborino');
56891 * // => 'hi-diddly-ho there, neighbo...'
56892 *
56893 * _.truncate('hi-diddly-ho there, neighborino', {
56894 * 'length': 24,
56895 * 'separator': ' '
56896 * });
56897 * // => 'hi-diddly-ho there,...'
56898 *
56899 * _.truncate('hi-diddly-ho there, neighborino', {
56900 * 'length': 24,
56901 * 'separator': /,? +/
56902 * });
56903 * // => 'hi-diddly-ho there...'
56904 *
56905 * _.truncate('hi-diddly-ho there, neighborino', {
56906 * 'omission': ' [...]'
56907 * });
56908 * // => 'hi-diddly-ho there, neig [...]'
56909 */
56910 function truncate(string, options) {
56911 var length = DEFAULT_TRUNC_LENGTH,
56912 omission = DEFAULT_TRUNC_OMISSION;
56913
56914 if (isObject(options)) {
56915 var separator = 'separator' in options ? options.separator : separator;
56916 length = 'length' in options ? toInteger(options.length) : length;
56917 omission = 'omission' in options ? baseToString(options.omission) : omission;
56918 }
56919 string = toString(string);
56920
56921 var strLength = string.length;
56922 if (hasUnicode(string)) {
56923 var strSymbols = stringToArray(string);
56924 strLength = strSymbols.length;
56925 }
56926 if (length >= strLength) {
56927 return string;
56928 }
56929 var end = length - stringSize(omission);
56930 if (end < 1) {
56931 return omission;
56932 }
56933 var result = strSymbols
56934 ? castSlice(strSymbols, 0, end).join('')
56935 : string.slice(0, end);
56936
56937 if (separator === undefined) {
56938 return result + omission;
56939 }
56940 if (strSymbols) {
56941 end += (result.length - end);
56942 }
56943 if (isRegExp(separator)) {
56944 if (string.slice(end).search(separator)) {
56945 var match,
56946 substring = result;
56947
56948 if (!separator.global) {
56949 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
56950 }
56951 separator.lastIndex = 0;
56952 while ((match = separator.exec(substring))) {
56953 var newEnd = match.index;
56954 }
56955 result = result.slice(0, newEnd === undefined ? end : newEnd);
56956 }
56957 } else if (string.indexOf(baseToString(separator), end) != end) {
56958 var index = result.lastIndexOf(separator);
56959 if (index > -1) {
56960 result = result.slice(0, index);
56961 }
56962 }
56963 return result + omission;
56964 }
56965
56966 /**
56967 * The inverse of `_.escape`; this method converts the HTML entities
56968 * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
56969 * their corresponding characters.
56970 *
56971 * **Note:** No other HTML entities are unescaped. To unescape additional
56972 * HTML entities use a third-party library like [_he_](https://mths.be/he).
56973 *
56974 * @static
56975 * @memberOf _
56976 * @since 0.6.0
56977 * @category String
56978 * @param {string} [string=''] The string to unescape.
56979 * @returns {string} Returns the unescaped string.
56980 * @example
56981 *
56982 * _.unescape('fred, barney, &amp; pebbles');
56983 * // => 'fred, barney, & pebbles'
56984 */
56985 function unescape(string) {
56986 string = toString(string);
56987 return (string && reHasEscapedHtml.test(string))
56988 ? string.replace(reEscapedHtml, unescapeHtmlChar)
56989 : string;
56990 }
56991
56992 /**
56993 * Converts `string`, as space separated words, to upper case.
56994 *
56995 * @static
56996 * @memberOf _
56997 * @since 4.0.0
56998 * @category String
56999 * @param {string} [string=''] The string to convert.
57000 * @returns {string} Returns the upper cased string.
57001 * @example
57002 *
57003 * _.upperCase('--foo-bar');
57004 * // => 'FOO BAR'
57005 *
57006 * _.upperCase('fooBar');
57007 * // => 'FOO BAR'
57008 *
57009 * _.upperCase('__foo_bar__');
57010 * // => 'FOO BAR'
57011 */
57012 var upperCase = createCompounder(function(result, word, index) {
57013 return result + (index ? ' ' : '') + word.toUpperCase();
57014 });
57015
57016 /**
57017 * Converts the first character of `string` to upper case.
57018 *
57019 * @static
57020 * @memberOf _
57021 * @since 4.0.0
57022 * @category String
57023 * @param {string} [string=''] The string to convert.
57024 * @returns {string} Returns the converted string.
57025 * @example
57026 *
57027 * _.upperFirst('fred');
57028 * // => 'Fred'
57029 *
57030 * _.upperFirst('FRED');
57031 * // => 'FRED'
57032 */
57033 var upperFirst = createCaseFirst('toUpperCase');
57034
57035 /**
57036 * Splits `string` into an array of its words.
57037 *
57038 * @static
57039 * @memberOf _
57040 * @since 3.0.0
57041 * @category String
57042 * @param {string} [string=''] The string to inspect.
57043 * @param {RegExp|string} [pattern] The pattern to match words.
57044 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
57045 * @returns {Array} Returns the words of `string`.
57046 * @example
57047 *
57048 * _.words('fred, barney, & pebbles');
57049 * // => ['fred', 'barney', 'pebbles']
57050 *
57051 * _.words('fred, barney, & pebbles', /[^, ]+/g);
57052 * // => ['fred', 'barney', '&', 'pebbles']
57053 */
57054 function words(string, pattern, guard) {
57055 string = toString(string);
57056 pattern = guard ? undefined : pattern;
57057
57058 if (pattern === undefined) {
57059 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
57060 }
57061 return string.match(pattern) || [];
57062 }
57063
57064 /*------------------------------------------------------------------------*/
57065
57066 /**
57067 * Attempts to invoke `func`, returning either the result or the caught error
57068 * object. Any additional arguments are provided to `func` when it's invoked.
57069 *
57070 * @static
57071 * @memberOf _
57072 * @since 3.0.0
57073 * @category Util
57074 * @param {Function} func The function to attempt.
57075 * @param {...*} [args] The arguments to invoke `func` with.
57076 * @returns {*} Returns the `func` result or error object.
57077 * @example
57078 *
57079 * // Avoid throwing errors for invalid selectors.
57080 * var elements = _.attempt(function(selector) {
57081 * return document.querySelectorAll(selector);
57082 * }, '>_>');
57083 *
57084 * if (_.isError(elements)) {
57085 * elements = [];
57086 * }
57087 */
57088 var attempt = baseRest(function(func, args) {
57089 try {
57090 return apply(func, undefined, args);
57091 } catch (e) {
57092 return isError(e) ? e : new Error(e);
57093 }
57094 });
57095
57096 /**
57097 * Binds methods of an object to the object itself, overwriting the existing
57098 * method.
57099 *
57100 * **Note:** This method doesn't set the "length" property of bound functions.
57101 *
57102 * @static
57103 * @since 0.1.0
57104 * @memberOf _
57105 * @category Util
57106 * @param {Object} object The object to bind and assign the bound methods to.
57107 * @param {...(string|string[])} methodNames The object method names to bind.
57108 * @returns {Object} Returns `object`.
57109 * @example
57110 *
57111 * var view = {
57112 * 'label': 'docs',
57113 * 'click': function() {
57114 * console.log('clicked ' + this.label);
57115 * }
57116 * };
57117 *
57118 * _.bindAll(view, ['click']);
57119 * jQuery(element).on('click', view.click);
57120 * // => Logs 'clicked docs' when clicked.
57121 */
57122 var bindAll = flatRest(function(object, methodNames) {
57123 arrayEach(methodNames, function(key) {
57124 key = toKey(key);
57125 baseAssignValue(object, key, bind(object[key], object));
57126 });
57127 return object;
57128 });
57129
57130 /**
57131 * Creates a function that iterates over `pairs` and invokes the corresponding
57132 * function of the first predicate to return truthy. The predicate-function
57133 * pairs are invoked with the `this` binding and arguments of the created
57134 * function.
57135 *
57136 * @static
57137 * @memberOf _
57138 * @since 4.0.0
57139 * @category Util
57140 * @param {Array} pairs The predicate-function pairs.
57141 * @returns {Function} Returns the new composite function.
57142 * @example
57143 *
57144 * var func = _.cond([
57145 * [_.matches({ 'a': 1 }), _.constant('matches A')],
57146 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
57147 * [_.stubTrue, _.constant('no match')]
57148 * ]);
57149 *
57150 * func({ 'a': 1, 'b': 2 });
57151 * // => 'matches A'
57152 *
57153 * func({ 'a': 0, 'b': 1 });
57154 * // => 'matches B'
57155 *
57156 * func({ 'a': '1', 'b': '2' });
57157 * // => 'no match'
57158 */
57159 function cond(pairs) {
57160 var length = pairs == null ? 0 : pairs.length,
57161 toIteratee = getIteratee();
57162
57163 pairs = !length ? [] : arrayMap(pairs, function(pair) {
57164 if (typeof pair[1] != 'function') {
57165 throw new TypeError(FUNC_ERROR_TEXT);
57166 }
57167 return [toIteratee(pair[0]), pair[1]];
57168 });
57169
57170 return baseRest(function(args) {
57171 var index = -1;
57172 while (++index < length) {
57173 var pair = pairs[index];
57174 if (apply(pair[0], this, args)) {
57175 return apply(pair[1], this, args);
57176 }
57177 }
57178 });
57179 }
57180
57181 /**
57182 * Creates a function that invokes the predicate properties of `source` with
57183 * the corresponding property values of a given object, returning `true` if
57184 * all predicates return truthy, else `false`.
57185 *
57186 * **Note:** The created function is equivalent to `_.conformsTo` with
57187 * `source` partially applied.
57188 *
57189 * @static
57190 * @memberOf _
57191 * @since 4.0.0
57192 * @category Util
57193 * @param {Object} source The object of property predicates to conform to.
57194 * @returns {Function} Returns the new spec function.
57195 * @example
57196 *
57197 * var objects = [
57198 * { 'a': 2, 'b': 1 },
57199 * { 'a': 1, 'b': 2 }
57200 * ];
57201 *
57202 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
57203 * // => [{ 'a': 1, 'b': 2 }]
57204 */
57205 function conforms(source) {
57206 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
57207 }
57208
57209 /**
57210 * Creates a function that returns `value`.
57211 *
57212 * @static
57213 * @memberOf _
57214 * @since 2.4.0
57215 * @category Util
57216 * @param {*} value The value to return from the new function.
57217 * @returns {Function} Returns the new constant function.
57218 * @example
57219 *
57220 * var objects = _.times(2, _.constant({ 'a': 1 }));
57221 *
57222 * console.log(objects);
57223 * // => [{ 'a': 1 }, { 'a': 1 }]
57224 *
57225 * console.log(objects[0] === objects[1]);
57226 * // => true
57227 */
57228 function constant(value) {
57229 return function() {
57230 return value;
57231 };
57232 }
57233
57234 /**
57235 * Checks `value` to determine whether a default value should be returned in
57236 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
57237 * or `undefined`.
57238 *
57239 * @static
57240 * @memberOf _
57241 * @since 4.14.0
57242 * @category Util
57243 * @param {*} value The value to check.
57244 * @param {*} defaultValue The default value.
57245 * @returns {*} Returns the resolved value.
57246 * @example
57247 *
57248 * _.defaultTo(1, 10);
57249 * // => 1
57250 *
57251 * _.defaultTo(undefined, 10);
57252 * // => 10
57253 */
57254 function defaultTo(value, defaultValue) {
57255 return (value == null || value !== value) ? defaultValue : value;
57256 }
57257
57258 /**
57259 * Creates a function that returns the result of invoking the given functions
57260 * with the `this` binding of the created function, where each successive
57261 * invocation is supplied the return value of the previous.
57262 *
57263 * @static
57264 * @memberOf _
57265 * @since 3.0.0
57266 * @category Util
57267 * @param {...(Function|Function[])} [funcs] The functions to invoke.
57268 * @returns {Function} Returns the new composite function.
57269 * @see _.flowRight
57270 * @example
57271 *
57272 * function square(n) {
57273 * return n * n;
57274 * }
57275 *
57276 * var addSquare = _.flow([_.add, square]);
57277 * addSquare(1, 2);
57278 * // => 9
57279 */
57280 var flow = createFlow();
57281
57282 /**
57283 * This method is like `_.flow` except that it creates a function that
57284 * invokes the given functions from right to left.
57285 *
57286 * @static
57287 * @since 3.0.0
57288 * @memberOf _
57289 * @category Util
57290 * @param {...(Function|Function[])} [funcs] The functions to invoke.
57291 * @returns {Function} Returns the new composite function.
57292 * @see _.flow
57293 * @example
57294 *
57295 * function square(n) {
57296 * return n * n;
57297 * }
57298 *
57299 * var addSquare = _.flowRight([square, _.add]);
57300 * addSquare(1, 2);
57301 * // => 9
57302 */
57303 var flowRight = createFlow(true);
57304
57305 /**
57306 * This method returns the first argument it receives.
57307 *
57308 * @static
57309 * @since 0.1.0
57310 * @memberOf _
57311 * @category Util
57312 * @param {*} value Any value.
57313 * @returns {*} Returns `value`.
57314 * @example
57315 *
57316 * var object = { 'a': 1 };
57317 *
57318 * console.log(_.identity(object) === object);
57319 * // => true
57320 */
57321 function identity(value) {
57322 return value;
57323 }
57324
57325 /**
57326 * Creates a function that invokes `func` with the arguments of the created
57327 * function. If `func` is a property name, the created function returns the
57328 * property value for a given element. If `func` is an array or object, the
57329 * created function returns `true` for elements that contain the equivalent
57330 * source properties, otherwise it returns `false`.
57331 *
57332 * @static
57333 * @since 4.0.0
57334 * @memberOf _
57335 * @category Util
57336 * @param {*} [func=_.identity] The value to convert to a callback.
57337 * @returns {Function} Returns the callback.
57338 * @example
57339 *
57340 * var users = [
57341 * { 'user': 'barney', 'age': 36, 'active': true },
57342 * { 'user': 'fred', 'age': 40, 'active': false }
57343 * ];
57344 *
57345 * // The `_.matches` iteratee shorthand.
57346 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
57347 * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
57348 *
57349 * // The `_.matchesProperty` iteratee shorthand.
57350 * _.filter(users, _.iteratee(['user', 'fred']));
57351 * // => [{ 'user': 'fred', 'age': 40 }]
57352 *
57353 * // The `_.property` iteratee shorthand.
57354 * _.map(users, _.iteratee('user'));
57355 * // => ['barney', 'fred']
57356 *
57357 * // Create custom iteratee shorthands.
57358 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
57359 * return !_.isRegExp(func) ? iteratee(func) : function(string) {
57360 * return func.test(string);
57361 * };
57362 * });
57363 *
57364 * _.filter(['abc', 'def'], /ef/);
57365 * // => ['def']
57366 */
57367 function iteratee(func) {
57368 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
57369 }
57370
57371 /**
57372 * Creates a function that performs a partial deep comparison between a given
57373 * object and `source`, returning `true` if the given object has equivalent
57374 * property values, else `false`.
57375 *
57376 * **Note:** The created function is equivalent to `_.isMatch` with `source`
57377 * partially applied.
57378 *
57379 * Partial comparisons will match empty array and empty object `source`
57380 * values against any array or object value, respectively. See `_.isEqual`
57381 * for a list of supported value comparisons.
57382 *
57383 * @static
57384 * @memberOf _
57385 * @since 3.0.0
57386 * @category Util
57387 * @param {Object} source The object of property values to match.
57388 * @returns {Function} Returns the new spec function.
57389 * @example
57390 *
57391 * var objects = [
57392 * { 'a': 1, 'b': 2, 'c': 3 },
57393 * { 'a': 4, 'b': 5, 'c': 6 }
57394 * ];
57395 *
57396 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
57397 * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
57398 */
57399 function matches(source) {
57400 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
57401 }
57402
57403 /**
57404 * Creates a function that performs a partial deep comparison between the
57405 * value at `path` of a given object to `srcValue`, returning `true` if the
57406 * object value is equivalent, else `false`.
57407 *
57408 * **Note:** Partial comparisons will match empty array and empty object
57409 * `srcValue` values against any array or object value, respectively. See
57410 * `_.isEqual` for a list of supported value comparisons.
57411 *
57412 * @static
57413 * @memberOf _
57414 * @since 3.2.0
57415 * @category Util
57416 * @param {Array|string} path The path of the property to get.
57417 * @param {*} srcValue The value to match.
57418 * @returns {Function} Returns the new spec function.
57419 * @example
57420 *
57421 * var objects = [
57422 * { 'a': 1, 'b': 2, 'c': 3 },
57423 * { 'a': 4, 'b': 5, 'c': 6 }
57424 * ];
57425 *
57426 * _.find(objects, _.matchesProperty('a', 4));
57427 * // => { 'a': 4, 'b': 5, 'c': 6 }
57428 */
57429 function matchesProperty(path, srcValue) {
57430 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
57431 }
57432
57433 /**
57434 * Creates a function that invokes the method at `path` of a given object.
57435 * Any additional arguments are provided to the invoked method.
57436 *
57437 * @static
57438 * @memberOf _
57439 * @since 3.7.0
57440 * @category Util
57441 * @param {Array|string} path The path of the method to invoke.
57442 * @param {...*} [args] The arguments to invoke the method with.
57443 * @returns {Function} Returns the new invoker function.
57444 * @example
57445 *
57446 * var objects = [
57447 * { 'a': { 'b': _.constant(2) } },
57448 * { 'a': { 'b': _.constant(1) } }
57449 * ];
57450 *
57451 * _.map(objects, _.method('a.b'));
57452 * // => [2, 1]
57453 *
57454 * _.map(objects, _.method(['a', 'b']));
57455 * // => [2, 1]
57456 */
57457 var method = baseRest(function(path, args) {
57458 return function(object) {
57459 return baseInvoke(object, path, args);
57460 };
57461 });
57462
57463 /**
57464 * The opposite of `_.method`; this method creates a function that invokes
57465 * the method at a given path of `object`. Any additional arguments are
57466 * provided to the invoked method.
57467 *
57468 * @static
57469 * @memberOf _
57470 * @since 3.7.0
57471 * @category Util
57472 * @param {Object} object The object to query.
57473 * @param {...*} [args] The arguments to invoke the method with.
57474 * @returns {Function} Returns the new invoker function.
57475 * @example
57476 *
57477 * var array = _.times(3, _.constant),
57478 * object = { 'a': array, 'b': array, 'c': array };
57479 *
57480 * _.map(['a[2]', 'c[0]'], _.methodOf(object));
57481 * // => [2, 0]
57482 *
57483 * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
57484 * // => [2, 0]
57485 */
57486 var methodOf = baseRest(function(object, args) {
57487 return function(path) {
57488 return baseInvoke(object, path, args);
57489 };
57490 });
57491
57492 /**
57493 * Adds all own enumerable string keyed function properties of a source
57494 * object to the destination object. If `object` is a function, then methods
57495 * are added to its prototype as well.
57496 *
57497 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
57498 * avoid conflicts caused by modifying the original.
57499 *
57500 * @static
57501 * @since 0.1.0
57502 * @memberOf _
57503 * @category Util
57504 * @param {Function|Object} [object=lodash] The destination object.
57505 * @param {Object} source The object of functions to add.
57506 * @param {Object} [options={}] The options object.
57507 * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
57508 * @returns {Function|Object} Returns `object`.
57509 * @example
57510 *
57511 * function vowels(string) {
57512 * return _.filter(string, function(v) {
57513 * return /[aeiou]/i.test(v);
57514 * });
57515 * }
57516 *
57517 * _.mixin({ 'vowels': vowels });
57518 * _.vowels('fred');
57519 * // => ['e']
57520 *
57521 * _('fred').vowels().value();
57522 * // => ['e']
57523 *
57524 * _.mixin({ 'vowels': vowels }, { 'chain': false });
57525 * _('fred').vowels();
57526 * // => ['e']
57527 */
57528 function mixin(object, source, options) {
57529 var props = keys(source),
57530 methodNames = baseFunctions(source, props);
57531
57532 if (options == null &&
57533 !(isObject(source) && (methodNames.length || !props.length))) {
57534 options = source;
57535 source = object;
57536 object = this;
57537 methodNames = baseFunctions(source, keys(source));
57538 }
57539 var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
57540 isFunc = isFunction(object);
57541
57542 arrayEach(methodNames, function(methodName) {
57543 var func = source[methodName];
57544 object[methodName] = func;
57545 if (isFunc) {
57546 object.prototype[methodName] = function() {
57547 var chainAll = this.__chain__;
57548 if (chain || chainAll) {
57549 var result = object(this.__wrapped__),
57550 actions = result.__actions__ = copyArray(this.__actions__);
57551
57552 actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
57553 result.__chain__ = chainAll;
57554 return result;
57555 }
57556 return func.apply(object, arrayPush([this.value()], arguments));
57557 };
57558 }
57559 });
57560
57561 return object;
57562 }
57563
57564 /**
57565 * Reverts the `_` variable to its previous value and returns a reference to
57566 * the `lodash` function.
57567 *
57568 * @static
57569 * @since 0.1.0
57570 * @memberOf _
57571 * @category Util
57572 * @returns {Function} Returns the `lodash` function.
57573 * @example
57574 *
57575 * var lodash = _.noConflict();
57576 */
57577 function noConflict() {
57578 if (root._ === this) {
57579 root._ = oldDash;
57580 }
57581 return this;
57582 }
57583
57584 /**
57585 * This method returns `undefined`.
57586 *
57587 * @static
57588 * @memberOf _
57589 * @since 2.3.0
57590 * @category Util
57591 * @example
57592 *
57593 * _.times(2, _.noop);
57594 * // => [undefined, undefined]
57595 */
57596 function noop() {
57597 // No operation performed.
57598 }
57599
57600 /**
57601 * Creates a function that gets the argument at index `n`. If `n` is negative,
57602 * the nth argument from the end is returned.
57603 *
57604 * @static
57605 * @memberOf _
57606 * @since 4.0.0
57607 * @category Util
57608 * @param {number} [n=0] The index of the argument to return.
57609 * @returns {Function} Returns the new pass-thru function.
57610 * @example
57611 *
57612 * var func = _.nthArg(1);
57613 * func('a', 'b', 'c', 'd');
57614 * // => 'b'
57615 *
57616 * var func = _.nthArg(-2);
57617 * func('a', 'b', 'c', 'd');
57618 * // => 'c'
57619 */
57620 function nthArg(n) {
57621 n = toInteger(n);
57622 return baseRest(function(args) {
57623 return baseNth(args, n);
57624 });
57625 }
57626
57627 /**
57628 * Creates a function that invokes `iteratees` with the arguments it receives
57629 * and returns their results.
57630 *
57631 * @static
57632 * @memberOf _
57633 * @since 4.0.0
57634 * @category Util
57635 * @param {...(Function|Function[])} [iteratees=[_.identity]]
57636 * The iteratees to invoke.
57637 * @returns {Function} Returns the new function.
57638 * @example
57639 *
57640 * var func = _.over([Math.max, Math.min]);
57641 *
57642 * func(1, 2, 3, 4);
57643 * // => [4, 1]
57644 */
57645 var over = createOver(arrayMap);
57646
57647 /**
57648 * Creates a function that checks if **all** of the `predicates` return
57649 * truthy when invoked with the arguments it receives.
57650 *
57651 * @static
57652 * @memberOf _
57653 * @since 4.0.0
57654 * @category Util
57655 * @param {...(Function|Function[])} [predicates=[_.identity]]
57656 * The predicates to check.
57657 * @returns {Function} Returns the new function.
57658 * @example
57659 *
57660 * var func = _.overEvery([Boolean, isFinite]);
57661 *
57662 * func('1');
57663 * // => true
57664 *
57665 * func(null);
57666 * // => false
57667 *
57668 * func(NaN);
57669 * // => false
57670 */
57671 var overEvery = createOver(arrayEvery);
57672
57673 /**
57674 * Creates a function that checks if **any** of the `predicates` return
57675 * truthy when invoked with the arguments it receives.
57676 *
57677 * @static
57678 * @memberOf _
57679 * @since 4.0.0
57680 * @category Util
57681 * @param {...(Function|Function[])} [predicates=[_.identity]]
57682 * The predicates to check.
57683 * @returns {Function} Returns the new function.
57684 * @example
57685 *
57686 * var func = _.overSome([Boolean, isFinite]);
57687 *
57688 * func('1');
57689 * // => true
57690 *
57691 * func(null);
57692 * // => true
57693 *
57694 * func(NaN);
57695 * // => false
57696 */
57697 var overSome = createOver(arraySome);
57698
57699 /**
57700 * Creates a function that returns the value at `path` of a given object.
57701 *
57702 * @static
57703 * @memberOf _
57704 * @since 2.4.0
57705 * @category Util
57706 * @param {Array|string} path The path of the property to get.
57707 * @returns {Function} Returns the new accessor function.
57708 * @example
57709 *
57710 * var objects = [
57711 * { 'a': { 'b': 2 } },
57712 * { 'a': { 'b': 1 } }
57713 * ];
57714 *
57715 * _.map(objects, _.property('a.b'));
57716 * // => [2, 1]
57717 *
57718 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
57719 * // => [1, 2]
57720 */
57721 function property(path) {
57722 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
57723 }
57724
57725 /**
57726 * The opposite of `_.property`; this method creates a function that returns
57727 * the value at a given path of `object`.
57728 *
57729 * @static
57730 * @memberOf _
57731 * @since 3.0.0
57732 * @category Util
57733 * @param {Object} object The object to query.
57734 * @returns {Function} Returns the new accessor function.
57735 * @example
57736 *
57737 * var array = [0, 1, 2],
57738 * object = { 'a': array, 'b': array, 'c': array };
57739 *
57740 * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
57741 * // => [2, 0]
57742 *
57743 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
57744 * // => [2, 0]
57745 */
57746 function propertyOf(object) {
57747 return function(path) {
57748 return object == null ? undefined : baseGet(object, path);
57749 };
57750 }
57751
57752 /**
57753 * Creates an array of numbers (positive and/or negative) progressing from
57754 * `start` up to, but not including, `end`. A step of `-1` is used if a negative
57755 * `start` is specified without an `end` or `step`. If `end` is not specified,
57756 * it's set to `start` with `start` then set to `0`.
57757 *
57758 * **Note:** JavaScript follows the IEEE-754 standard for resolving
57759 * floating-point values which can produce unexpected results.
57760 *
57761 * @static
57762 * @since 0.1.0
57763 * @memberOf _
57764 * @category Util
57765 * @param {number} [start=0] The start of the range.
57766 * @param {number} end The end of the range.
57767 * @param {number} [step=1] The value to increment or decrement by.
57768 * @returns {Array} Returns the range of numbers.
57769 * @see _.inRange, _.rangeRight
57770 * @example
57771 *
57772 * _.range(4);
57773 * // => [0, 1, 2, 3]
57774 *
57775 * _.range(-4);
57776 * // => [0, -1, -2, -3]
57777 *
57778 * _.range(1, 5);
57779 * // => [1, 2, 3, 4]
57780 *
57781 * _.range(0, 20, 5);
57782 * // => [0, 5, 10, 15]
57783 *
57784 * _.range(0, -4, -1);
57785 * // => [0, -1, -2, -3]
57786 *
57787 * _.range(1, 4, 0);
57788 * // => [1, 1, 1]
57789 *
57790 * _.range(0);
57791 * // => []
57792 */
57793 var range = createRange();
57794
57795 /**
57796 * This method is like `_.range` except that it populates values in
57797 * descending order.
57798 *
57799 * @static
57800 * @memberOf _
57801 * @since 4.0.0
57802 * @category Util
57803 * @param {number} [start=0] The start of the range.
57804 * @param {number} end The end of the range.
57805 * @param {number} [step=1] The value to increment or decrement by.
57806 * @returns {Array} Returns the range of numbers.
57807 * @see _.inRange, _.range
57808 * @example
57809 *
57810 * _.rangeRight(4);
57811 * // => [3, 2, 1, 0]
57812 *
57813 * _.rangeRight(-4);
57814 * // => [-3, -2, -1, 0]
57815 *
57816 * _.rangeRight(1, 5);
57817 * // => [4, 3, 2, 1]
57818 *
57819 * _.rangeRight(0, 20, 5);
57820 * // => [15, 10, 5, 0]
57821 *
57822 * _.rangeRight(0, -4, -1);
57823 * // => [-3, -2, -1, 0]
57824 *
57825 * _.rangeRight(1, 4, 0);
57826 * // => [1, 1, 1]
57827 *
57828 * _.rangeRight(0);
57829 * // => []
57830 */
57831 var rangeRight = createRange(true);
57832
57833 /**
57834 * This method returns a new empty array.
57835 *
57836 * @static
57837 * @memberOf _
57838 * @since 4.13.0
57839 * @category Util
57840 * @returns {Array} Returns the new empty array.
57841 * @example
57842 *
57843 * var arrays = _.times(2, _.stubArray);
57844 *
57845 * console.log(arrays);
57846 * // => [[], []]
57847 *
57848 * console.log(arrays[0] === arrays[1]);
57849 * // => false
57850 */
57851 function stubArray() {
57852 return [];
57853 }
57854
57855 /**
57856 * This method returns `false`.
57857 *
57858 * @static
57859 * @memberOf _
57860 * @since 4.13.0
57861 * @category Util
57862 * @returns {boolean} Returns `false`.
57863 * @example
57864 *
57865 * _.times(2, _.stubFalse);
57866 * // => [false, false]
57867 */
57868 function stubFalse() {
57869 return false;
57870 }
57871
57872 /**
57873 * This method returns a new empty object.
57874 *
57875 * @static
57876 * @memberOf _
57877 * @since 4.13.0
57878 * @category Util
57879 * @returns {Object} Returns the new empty object.
57880 * @example
57881 *
57882 * var objects = _.times(2, _.stubObject);
57883 *
57884 * console.log(objects);
57885 * // => [{}, {}]
57886 *
57887 * console.log(objects[0] === objects[1]);
57888 * // => false
57889 */
57890 function stubObject() {
57891 return {};
57892 }
57893
57894 /**
57895 * This method returns an empty string.
57896 *
57897 * @static
57898 * @memberOf _
57899 * @since 4.13.0
57900 * @category Util
57901 * @returns {string} Returns the empty string.
57902 * @example
57903 *
57904 * _.times(2, _.stubString);
57905 * // => ['', '']
57906 */
57907 function stubString() {
57908 return '';
57909 }
57910
57911 /**
57912 * This method returns `true`.
57913 *
57914 * @static
57915 * @memberOf _
57916 * @since 4.13.0
57917 * @category Util
57918 * @returns {boolean} Returns `true`.
57919 * @example
57920 *
57921 * _.times(2, _.stubTrue);
57922 * // => [true, true]
57923 */
57924 function stubTrue() {
57925 return true;
57926 }
57927
57928 /**
57929 * Invokes the iteratee `n` times, returning an array of the results of
57930 * each invocation. The iteratee is invoked with one argument; (index).
57931 *
57932 * @static
57933 * @since 0.1.0
57934 * @memberOf _
57935 * @category Util
57936 * @param {number} n The number of times to invoke `iteratee`.
57937 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
57938 * @returns {Array} Returns the array of results.
57939 * @example
57940 *
57941 * _.times(3, String);
57942 * // => ['0', '1', '2']
57943 *
57944 * _.times(4, _.constant(0));
57945 * // => [0, 0, 0, 0]
57946 */
57947 function times(n, iteratee) {
57948 n = toInteger(n);
57949 if (n < 1 || n > MAX_SAFE_INTEGER) {
57950 return [];
57951 }
57952 var index = MAX_ARRAY_LENGTH,
57953 length = nativeMin(n, MAX_ARRAY_LENGTH);
57954
57955 iteratee = getIteratee(iteratee);
57956 n -= MAX_ARRAY_LENGTH;
57957
57958 var result = baseTimes(length, iteratee);
57959 while (++index < n) {
57960 iteratee(index);
57961 }
57962 return result;
57963 }
57964
57965 /**
57966 * Converts `value` to a property path array.
57967 *
57968 * @static
57969 * @memberOf _
57970 * @since 4.0.0
57971 * @category Util
57972 * @param {*} value The value to convert.
57973 * @returns {Array} Returns the new property path array.
57974 * @example
57975 *
57976 * _.toPath('a.b.c');
57977 * // => ['a', 'b', 'c']
57978 *
57979 * _.toPath('a[0].b.c');
57980 * // => ['a', '0', 'b', 'c']
57981 */
57982 function toPath(value) {
57983 if (isArray(value)) {
57984 return arrayMap(value, toKey);
57985 }
57986 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
57987 }
57988
57989 /**
57990 * Generates a unique ID. If `prefix` is given, the ID is appended to it.
57991 *
57992 * @static
57993 * @since 0.1.0
57994 * @memberOf _
57995 * @category Util
57996 * @param {string} [prefix=''] The value to prefix the ID with.
57997 * @returns {string} Returns the unique ID.
57998 * @example
57999 *
58000 * _.uniqueId('contact_');
58001 * // => 'contact_104'
58002 *
58003 * _.uniqueId();
58004 * // => '105'
58005 */
58006 function uniqueId(prefix) {
58007 var id = ++idCounter;
58008 return toString(prefix) + id;
58009 }
58010
58011 /*------------------------------------------------------------------------*/
58012
58013 /**
58014 * Adds two numbers.
58015 *
58016 * @static
58017 * @memberOf _
58018 * @since 3.4.0
58019 * @category Math
58020 * @param {number} augend The first number in an addition.
58021 * @param {number} addend The second number in an addition.
58022 * @returns {number} Returns the total.
58023 * @example
58024 *
58025 * _.add(6, 4);
58026 * // => 10
58027 */
58028 var add = createMathOperation(function(augend, addend) {
58029 return augend + addend;
58030 }, 0);
58031
58032 /**
58033 * Computes `number` rounded up to `precision`.
58034 *
58035 * @static
58036 * @memberOf _
58037 * @since 3.10.0
58038 * @category Math
58039 * @param {number} number The number to round up.
58040 * @param {number} [precision=0] The precision to round up to.
58041 * @returns {number} Returns the rounded up number.
58042 * @example
58043 *
58044 * _.ceil(4.006);
58045 * // => 5
58046 *
58047 * _.ceil(6.004, 2);
58048 * // => 6.01
58049 *
58050 * _.ceil(6040, -2);
58051 * // => 6100
58052 */
58053 var ceil = createRound('ceil');
58054
58055 /**
58056 * Divide two numbers.
58057 *
58058 * @static
58059 * @memberOf _
58060 * @since 4.7.0
58061 * @category Math
58062 * @param {number} dividend The first number in a division.
58063 * @param {number} divisor The second number in a division.
58064 * @returns {number} Returns the quotient.
58065 * @example
58066 *
58067 * _.divide(6, 4);
58068 * // => 1.5
58069 */
58070 var divide = createMathOperation(function(dividend, divisor) {
58071 return dividend / divisor;
58072 }, 1);
58073
58074 /**
58075 * Computes `number` rounded down to `precision`.
58076 *
58077 * @static
58078 * @memberOf _
58079 * @since 3.10.0
58080 * @category Math
58081 * @param {number} number The number to round down.
58082 * @param {number} [precision=0] The precision to round down to.
58083 * @returns {number} Returns the rounded down number.
58084 * @example
58085 *
58086 * _.floor(4.006);
58087 * // => 4
58088 *
58089 * _.floor(0.046, 2);
58090 * // => 0.04
58091 *
58092 * _.floor(4060, -2);
58093 * // => 4000
58094 */
58095 var floor = createRound('floor');
58096
58097 /**
58098 * Computes the maximum value of `array`. If `array` is empty or falsey,
58099 * `undefined` is returned.
58100 *
58101 * @static
58102 * @since 0.1.0
58103 * @memberOf _
58104 * @category Math
58105 * @param {Array} array The array to iterate over.
58106 * @returns {*} Returns the maximum value.
58107 * @example
58108 *
58109 * _.max([4, 2, 8, 6]);
58110 * // => 8
58111 *
58112 * _.max([]);
58113 * // => undefined
58114 */
58115 function max(array) {
58116 return (array && array.length)
58117 ? baseExtremum(array, identity, baseGt)
58118 : undefined;
58119 }
58120
58121 /**
58122 * This method is like `_.max` except that it accepts `iteratee` which is
58123 * invoked for each element in `array` to generate the criterion by which
58124 * the value is ranked. The iteratee is invoked with one argument: (value).
58125 *
58126 * @static
58127 * @memberOf _
58128 * @since 4.0.0
58129 * @category Math
58130 * @param {Array} array The array to iterate over.
58131 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
58132 * @returns {*} Returns the maximum value.
58133 * @example
58134 *
58135 * var objects = [{ 'n': 1 }, { 'n': 2 }];
58136 *
58137 * _.maxBy(objects, function(o) { return o.n; });
58138 * // => { 'n': 2 }
58139 *
58140 * // The `_.property` iteratee shorthand.
58141 * _.maxBy(objects, 'n');
58142 * // => { 'n': 2 }
58143 */
58144 function maxBy(array, iteratee) {
58145 return (array && array.length)
58146 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
58147 : undefined;
58148 }
58149
58150 /**
58151 * Computes the mean of the values in `array`.
58152 *
58153 * @static
58154 * @memberOf _
58155 * @since 4.0.0
58156 * @category Math
58157 * @param {Array} array The array to iterate over.
58158 * @returns {number} Returns the mean.
58159 * @example
58160 *
58161 * _.mean([4, 2, 8, 6]);
58162 * // => 5
58163 */
58164 function mean(array) {
58165 return baseMean(array, identity);
58166 }
58167
58168 /**
58169 * This method is like `_.mean` except that it accepts `iteratee` which is
58170 * invoked for each element in `array` to generate the value to be averaged.
58171 * The iteratee is invoked with one argument: (value).
58172 *
58173 * @static
58174 * @memberOf _
58175 * @since 4.7.0
58176 * @category Math
58177 * @param {Array} array The array to iterate over.
58178 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
58179 * @returns {number} Returns the mean.
58180 * @example
58181 *
58182 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
58183 *
58184 * _.meanBy(objects, function(o) { return o.n; });
58185 * // => 5
58186 *
58187 * // The `_.property` iteratee shorthand.
58188 * _.meanBy(objects, 'n');
58189 * // => 5
58190 */
58191 function meanBy(array, iteratee) {
58192 return baseMean(array, getIteratee(iteratee, 2));
58193 }
58194
58195 /**
58196 * Computes the minimum value of `array`. If `array` is empty or falsey,
58197 * `undefined` is returned.
58198 *
58199 * @static
58200 * @since 0.1.0
58201 * @memberOf _
58202 * @category Math
58203 * @param {Array} array The array to iterate over.
58204 * @returns {*} Returns the minimum value.
58205 * @example
58206 *
58207 * _.min([4, 2, 8, 6]);
58208 * // => 2
58209 *
58210 * _.min([]);
58211 * // => undefined
58212 */
58213 function min(array) {
58214 return (array && array.length)
58215 ? baseExtremum(array, identity, baseLt)
58216 : undefined;
58217 }
58218
58219 /**
58220 * This method is like `_.min` except that it accepts `iteratee` which is
58221 * invoked for each element in `array` to generate the criterion by which
58222 * the value is ranked. The iteratee is invoked with one argument: (value).
58223 *
58224 * @static
58225 * @memberOf _
58226 * @since 4.0.0
58227 * @category Math
58228 * @param {Array} array The array to iterate over.
58229 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
58230 * @returns {*} Returns the minimum value.
58231 * @example
58232 *
58233 * var objects = [{ 'n': 1 }, { 'n': 2 }];
58234 *
58235 * _.minBy(objects, function(o) { return o.n; });
58236 * // => { 'n': 1 }
58237 *
58238 * // The `_.property` iteratee shorthand.
58239 * _.minBy(objects, 'n');
58240 * // => { 'n': 1 }
58241 */
58242 function minBy(array, iteratee) {
58243 return (array && array.length)
58244 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
58245 : undefined;
58246 }
58247
58248 /**
58249 * Multiply two numbers.
58250 *
58251 * @static
58252 * @memberOf _
58253 * @since 4.7.0
58254 * @category Math
58255 * @param {number} multiplier The first number in a multiplication.
58256 * @param {number} multiplicand The second number in a multiplication.
58257 * @returns {number} Returns the product.
58258 * @example
58259 *
58260 * _.multiply(6, 4);
58261 * // => 24
58262 */
58263 var multiply = createMathOperation(function(multiplier, multiplicand) {
58264 return multiplier * multiplicand;
58265 }, 1);
58266
58267 /**
58268 * Computes `number` rounded to `precision`.
58269 *
58270 * @static
58271 * @memberOf _
58272 * @since 3.10.0
58273 * @category Math
58274 * @param {number} number The number to round.
58275 * @param {number} [precision=0] The precision to round to.
58276 * @returns {number} Returns the rounded number.
58277 * @example
58278 *
58279 * _.round(4.006);
58280 * // => 4
58281 *
58282 * _.round(4.006, 2);
58283 * // => 4.01
58284 *
58285 * _.round(4060, -2);
58286 * // => 4100
58287 */
58288 var round = createRound('round');
58289
58290 /**
58291 * Subtract two numbers.
58292 *
58293 * @static
58294 * @memberOf _
58295 * @since 4.0.0
58296 * @category Math
58297 * @param {number} minuend The first number in a subtraction.
58298 * @param {number} subtrahend The second number in a subtraction.
58299 * @returns {number} Returns the difference.
58300 * @example
58301 *
58302 * _.subtract(6, 4);
58303 * // => 2
58304 */
58305 var subtract = createMathOperation(function(minuend, subtrahend) {
58306 return minuend - subtrahend;
58307 }, 0);
58308
58309 /**
58310 * Computes the sum of the values in `array`.
58311 *
58312 * @static
58313 * @memberOf _
58314 * @since 3.4.0
58315 * @category Math
58316 * @param {Array} array The array to iterate over.
58317 * @returns {number} Returns the sum.
58318 * @example
58319 *
58320 * _.sum([4, 2, 8, 6]);
58321 * // => 20
58322 */
58323 function sum(array) {
58324 return (array && array.length)
58325 ? baseSum(array, identity)
58326 : 0;
58327 }
58328
58329 /**
58330 * This method is like `_.sum` except that it accepts `iteratee` which is
58331 * invoked for each element in `array` to generate the value to be summed.
58332 * The iteratee is invoked with one argument: (value).
58333 *
58334 * @static
58335 * @memberOf _
58336 * @since 4.0.0
58337 * @category Math
58338 * @param {Array} array The array to iterate over.
58339 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
58340 * @returns {number} Returns the sum.
58341 * @example
58342 *
58343 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
58344 *
58345 * _.sumBy(objects, function(o) { return o.n; });
58346 * // => 20
58347 *
58348 * // The `_.property` iteratee shorthand.
58349 * _.sumBy(objects, 'n');
58350 * // => 20
58351 */
58352 function sumBy(array, iteratee) {
58353 return (array && array.length)
58354 ? baseSum(array, getIteratee(iteratee, 2))
58355 : 0;
58356 }
58357
58358 /*------------------------------------------------------------------------*/
58359
58360 // Add methods that return wrapped values in chain sequences.
58361 lodash.after = after;
58362 lodash.ary = ary;
58363 lodash.assign = assign;
58364 lodash.assignIn = assignIn;
58365 lodash.assignInWith = assignInWith;
58366 lodash.assignWith = assignWith;
58367 lodash.at = at;
58368 lodash.before = before;
58369 lodash.bind = bind;
58370 lodash.bindAll = bindAll;
58371 lodash.bindKey = bindKey;
58372 lodash.castArray = castArray;
58373 lodash.chain = chain;
58374 lodash.chunk = chunk;
58375 lodash.compact = compact;
58376 lodash.concat = concat;
58377 lodash.cond = cond;
58378 lodash.conforms = conforms;
58379 lodash.constant = constant;
58380 lodash.countBy = countBy;
58381 lodash.create = create;
58382 lodash.curry = curry;
58383 lodash.curryRight = curryRight;
58384 lodash.debounce = debounce;
58385 lodash.defaults = defaults;
58386 lodash.defaultsDeep = defaultsDeep;
58387 lodash.defer = defer;
58388 lodash.delay = delay;
58389 lodash.difference = difference;
58390 lodash.differenceBy = differenceBy;
58391 lodash.differenceWith = differenceWith;
58392 lodash.drop = drop;
58393 lodash.dropRight = dropRight;
58394 lodash.dropRightWhile = dropRightWhile;
58395 lodash.dropWhile = dropWhile;
58396 lodash.fill = fill;
58397 lodash.filter = filter;
58398 lodash.flatMap = flatMap;
58399 lodash.flatMapDeep = flatMapDeep;
58400 lodash.flatMapDepth = flatMapDepth;
58401 lodash.flatten = flatten;
58402 lodash.flattenDeep = flattenDeep;
58403 lodash.flattenDepth = flattenDepth;
58404 lodash.flip = flip;
58405 lodash.flow = flow;
58406 lodash.flowRight = flowRight;
58407 lodash.fromPairs = fromPairs;
58408 lodash.functions = functions;
58409 lodash.functionsIn = functionsIn;
58410 lodash.groupBy = groupBy;
58411 lodash.initial = initial;
58412 lodash.intersection = intersection;
58413 lodash.intersectionBy = intersectionBy;
58414 lodash.intersectionWith = intersectionWith;
58415 lodash.invert = invert;
58416 lodash.invertBy = invertBy;
58417 lodash.invokeMap = invokeMap;
58418 lodash.iteratee = iteratee;
58419 lodash.keyBy = keyBy;
58420 lodash.keys = keys;
58421 lodash.keysIn = keysIn;
58422 lodash.map = map;
58423 lodash.mapKeys = mapKeys;
58424 lodash.mapValues = mapValues;
58425 lodash.matches = matches;
58426 lodash.matchesProperty = matchesProperty;
58427 lodash.memoize = memoize;
58428 lodash.merge = merge;
58429 lodash.mergeWith = mergeWith;
58430 lodash.method = method;
58431 lodash.methodOf = methodOf;
58432 lodash.mixin = mixin;
58433 lodash.negate = negate;
58434 lodash.nthArg = nthArg;
58435 lodash.omit = omit;
58436 lodash.omitBy = omitBy;
58437 lodash.once = once;
58438 lodash.orderBy = orderBy;
58439 lodash.over = over;
58440 lodash.overArgs = overArgs;
58441 lodash.overEvery = overEvery;
58442 lodash.overSome = overSome;
58443 lodash.partial = partial;
58444 lodash.partialRight = partialRight;
58445 lodash.partition = partition;
58446 lodash.pick = pick;
58447 lodash.pickBy = pickBy;
58448 lodash.property = property;
58449 lodash.propertyOf = propertyOf;
58450 lodash.pull = pull;
58451 lodash.pullAll = pullAll;
58452 lodash.pullAllBy = pullAllBy;
58453 lodash.pullAllWith = pullAllWith;
58454 lodash.pullAt = pullAt;
58455 lodash.range = range;
58456 lodash.rangeRight = rangeRight;
58457 lodash.rearg = rearg;
58458 lodash.reject = reject;
58459 lodash.remove = remove;
58460 lodash.rest = rest;
58461 lodash.reverse = reverse;
58462 lodash.sampleSize = sampleSize;
58463 lodash.set = set;
58464 lodash.setWith = setWith;
58465 lodash.shuffle = shuffle;
58466 lodash.slice = slice;
58467 lodash.sortBy = sortBy;
58468 lodash.sortedUniq = sortedUniq;
58469 lodash.sortedUniqBy = sortedUniqBy;
58470 lodash.split = split;
58471 lodash.spread = spread;
58472 lodash.tail = tail;
58473 lodash.take = take;
58474 lodash.takeRight = takeRight;
58475 lodash.takeRightWhile = takeRightWhile;
58476 lodash.takeWhile = takeWhile;
58477 lodash.tap = tap;
58478 lodash.throttle = throttle;
58479 lodash.thru = thru;
58480 lodash.toArray = toArray;
58481 lodash.toPairs = toPairs;
58482 lodash.toPairsIn = toPairsIn;
58483 lodash.toPath = toPath;
58484 lodash.toPlainObject = toPlainObject;
58485 lodash.transform = transform;
58486 lodash.unary = unary;
58487 lodash.union = union;
58488 lodash.unionBy = unionBy;
58489 lodash.unionWith = unionWith;
58490 lodash.uniq = uniq;
58491 lodash.uniqBy = uniqBy;
58492 lodash.uniqWith = uniqWith;
58493 lodash.unset = unset;
58494 lodash.unzip = unzip;
58495 lodash.unzipWith = unzipWith;
58496 lodash.update = update;
58497 lodash.updateWith = updateWith;
58498 lodash.values = values;
58499 lodash.valuesIn = valuesIn;
58500 lodash.without = without;
58501 lodash.words = words;
58502 lodash.wrap = wrap;
58503 lodash.xor = xor;
58504 lodash.xorBy = xorBy;
58505 lodash.xorWith = xorWith;
58506 lodash.zip = zip;
58507 lodash.zipObject = zipObject;
58508 lodash.zipObjectDeep = zipObjectDeep;
58509 lodash.zipWith = zipWith;
58510
58511 // Add aliases.
58512 lodash.entries = toPairs;
58513 lodash.entriesIn = toPairsIn;
58514 lodash.extend = assignIn;
58515 lodash.extendWith = assignInWith;
58516
58517 // Add methods to `lodash.prototype`.
58518 mixin(lodash, lodash);
58519
58520 /*------------------------------------------------------------------------*/
58521
58522 // Add methods that return unwrapped values in chain sequences.
58523 lodash.add = add;
58524 lodash.attempt = attempt;
58525 lodash.camelCase = camelCase;
58526 lodash.capitalize = capitalize;
58527 lodash.ceil = ceil;
58528 lodash.clamp = clamp;
58529 lodash.clone = clone;
58530 lodash.cloneDeep = cloneDeep;
58531 lodash.cloneDeepWith = cloneDeepWith;
58532 lodash.cloneWith = cloneWith;
58533 lodash.conformsTo = conformsTo;
58534 lodash.deburr = deburr;
58535 lodash.defaultTo = defaultTo;
58536 lodash.divide = divide;
58537 lodash.endsWith = endsWith;
58538 lodash.eq = eq;
58539 lodash.escape = escape;
58540 lodash.escapeRegExp = escapeRegExp;
58541 lodash.every = every;
58542 lodash.find = find;
58543 lodash.findIndex = findIndex;
58544 lodash.findKey = findKey;
58545 lodash.findLast = findLast;
58546 lodash.findLastIndex = findLastIndex;
58547 lodash.findLastKey = findLastKey;
58548 lodash.floor = floor;
58549 lodash.forEach = forEach;
58550 lodash.forEachRight = forEachRight;
58551 lodash.forIn = forIn;
58552 lodash.forInRight = forInRight;
58553 lodash.forOwn = forOwn;
58554 lodash.forOwnRight = forOwnRight;
58555 lodash.get = get;
58556 lodash.gt = gt;
58557 lodash.gte = gte;
58558 lodash.has = has;
58559 lodash.hasIn = hasIn;
58560 lodash.head = head;
58561 lodash.identity = identity;
58562 lodash.includes = includes;
58563 lodash.indexOf = indexOf;
58564 lodash.inRange = inRange;
58565 lodash.invoke = invoke;
58566 lodash.isArguments = isArguments;
58567 lodash.isArray = isArray;
58568 lodash.isArrayBuffer = isArrayBuffer;
58569 lodash.isArrayLike = isArrayLike;
58570 lodash.isArrayLikeObject = isArrayLikeObject;
58571 lodash.isBoolean = isBoolean;
58572 lodash.isBuffer = isBuffer;
58573 lodash.isDate = isDate;
58574 lodash.isElement = isElement;
58575 lodash.isEmpty = isEmpty;
58576 lodash.isEqual = isEqual;
58577 lodash.isEqualWith = isEqualWith;
58578 lodash.isError = isError;
58579 lodash.isFinite = isFinite;
58580 lodash.isFunction = isFunction;
58581 lodash.isInteger = isInteger;
58582 lodash.isLength = isLength;
58583 lodash.isMap = isMap;
58584 lodash.isMatch = isMatch;
58585 lodash.isMatchWith = isMatchWith;
58586 lodash.isNaN = isNaN;
58587 lodash.isNative = isNative;
58588 lodash.isNil = isNil;
58589 lodash.isNull = isNull;
58590 lodash.isNumber = isNumber;
58591 lodash.isObject = isObject;
58592 lodash.isObjectLike = isObjectLike;
58593 lodash.isPlainObject = isPlainObject;
58594 lodash.isRegExp = isRegExp;
58595 lodash.isSafeInteger = isSafeInteger;
58596 lodash.isSet = isSet;
58597 lodash.isString = isString;
58598 lodash.isSymbol = isSymbol;
58599 lodash.isTypedArray = isTypedArray;
58600 lodash.isUndefined = isUndefined;
58601 lodash.isWeakMap = isWeakMap;
58602 lodash.isWeakSet = isWeakSet;
58603 lodash.join = join;
58604 lodash.kebabCase = kebabCase;
58605 lodash.last = last;
58606 lodash.lastIndexOf = lastIndexOf;
58607 lodash.lowerCase = lowerCase;
58608 lodash.lowerFirst = lowerFirst;
58609 lodash.lt = lt;
58610 lodash.lte = lte;
58611 lodash.max = max;
58612 lodash.maxBy = maxBy;
58613 lodash.mean = mean;
58614 lodash.meanBy = meanBy;
58615 lodash.min = min;
58616 lodash.minBy = minBy;
58617 lodash.stubArray = stubArray;
58618 lodash.stubFalse = stubFalse;
58619 lodash.stubObject = stubObject;
58620 lodash.stubString = stubString;
58621 lodash.stubTrue = stubTrue;
58622 lodash.multiply = multiply;
58623 lodash.nth = nth;
58624 lodash.noConflict = noConflict;
58625 lodash.noop = noop;
58626 lodash.now = now;
58627 lodash.pad = pad;
58628 lodash.padEnd = padEnd;
58629 lodash.padStart = padStart;
58630 lodash.parseInt = parseInt;
58631 lodash.random = random;
58632 lodash.reduce = reduce;
58633 lodash.reduceRight = reduceRight;
58634 lodash.repeat = repeat;
58635 lodash.replace = replace;
58636 lodash.result = result;
58637 lodash.round = round;
58638 lodash.runInContext = runInContext;
58639 lodash.sample = sample;
58640 lodash.size = size;
58641 lodash.snakeCase = snakeCase;
58642 lodash.some = some;
58643 lodash.sortedIndex = sortedIndex;
58644 lodash.sortedIndexBy = sortedIndexBy;
58645 lodash.sortedIndexOf = sortedIndexOf;
58646 lodash.sortedLastIndex = sortedLastIndex;
58647 lodash.sortedLastIndexBy = sortedLastIndexBy;
58648 lodash.sortedLastIndexOf = sortedLastIndexOf;
58649 lodash.startCase = startCase;
58650 lodash.startsWith = startsWith;
58651 lodash.subtract = subtract;
58652 lodash.sum = sum;
58653 lodash.sumBy = sumBy;
58654 lodash.template = template;
58655 lodash.times = times;
58656 lodash.toFinite = toFinite;
58657 lodash.toInteger = toInteger;
58658 lodash.toLength = toLength;
58659 lodash.toLower = toLower;
58660 lodash.toNumber = toNumber;
58661 lodash.toSafeInteger = toSafeInteger;
58662 lodash.toString = toString;
58663 lodash.toUpper = toUpper;
58664 lodash.trim = trim;
58665 lodash.trimEnd = trimEnd;
58666 lodash.trimStart = trimStart;
58667 lodash.truncate = truncate;
58668 lodash.unescape = unescape;
58669 lodash.uniqueId = uniqueId;
58670 lodash.upperCase = upperCase;
58671 lodash.upperFirst = upperFirst;
58672
58673 // Add aliases.
58674 lodash.each = forEach;
58675 lodash.eachRight = forEachRight;
58676 lodash.first = head;
58677
58678 mixin(lodash, (function() {
58679 var source = {};
58680 baseForOwn(lodash, function(func, methodName) {
58681 if (!hasOwnProperty.call(lodash.prototype, methodName)) {
58682 source[methodName] = func;
58683 }
58684 });
58685 return source;
58686 }()), { 'chain': false });
58687
58688 /*------------------------------------------------------------------------*/
58689
58690 /**
58691 * The semantic version number.
58692 *
58693 * @static
58694 * @memberOf _
58695 * @type {string}
58696 */
58697 lodash.VERSION = VERSION;
58698
58699 // Assign default placeholders.
58700 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
58701 lodash[methodName].placeholder = lodash;
58702 });
58703
58704 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
58705 arrayEach(['drop', 'take'], function(methodName, index) {
58706 LazyWrapper.prototype[methodName] = function(n) {
58707 n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
58708
58709 var result = (this.__filtered__ && !index)
58710 ? new LazyWrapper(this)
58711 : this.clone();
58712
58713 if (result.__filtered__) {
58714 result.__takeCount__ = nativeMin(n, result.__takeCount__);
58715 } else {
58716 result.__views__.push({
58717 'size': nativeMin(n, MAX_ARRAY_LENGTH),
58718 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
58719 });
58720 }
58721 return result;
58722 };
58723
58724 LazyWrapper.prototype[methodName + 'Right'] = function(n) {
58725 return this.reverse()[methodName](n).reverse();
58726 };
58727 });
58728
58729 // Add `LazyWrapper` methods that accept an `iteratee` value.
58730 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
58731 var type = index + 1,
58732 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
58733
58734 LazyWrapper.prototype[methodName] = function(iteratee) {
58735 var result = this.clone();
58736 result.__iteratees__.push({
58737 'iteratee': getIteratee(iteratee, 3),
58738 'type': type
58739 });
58740 result.__filtered__ = result.__filtered__ || isFilter;
58741 return result;
58742 };
58743 });
58744
58745 // Add `LazyWrapper` methods for `_.head` and `_.last`.
58746 arrayEach(['head', 'last'], function(methodName, index) {
58747 var takeName = 'take' + (index ? 'Right' : '');
58748
58749 LazyWrapper.prototype[methodName] = function() {
58750 return this[takeName](1).value()[0];
58751 };
58752 });
58753
58754 // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
58755 arrayEach(['initial', 'tail'], function(methodName, index) {
58756 var dropName = 'drop' + (index ? '' : 'Right');
58757
58758 LazyWrapper.prototype[methodName] = function() {
58759 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
58760 };
58761 });
58762
58763 LazyWrapper.prototype.compact = function() {
58764 return this.filter(identity);
58765 };
58766
58767 LazyWrapper.prototype.find = function(predicate) {
58768 return this.filter(predicate).head();
58769 };
58770
58771 LazyWrapper.prototype.findLast = function(predicate) {
58772 return this.reverse().find(predicate);
58773 };
58774
58775 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
58776 if (typeof path == 'function') {
58777 return new LazyWrapper(this);
58778 }
58779 return this.map(function(value) {
58780 return baseInvoke(value, path, args);
58781 });
58782 });
58783
58784 LazyWrapper.prototype.reject = function(predicate) {
58785 return this.filter(negate(getIteratee(predicate)));
58786 };
58787
58788 LazyWrapper.prototype.slice = function(start, end) {
58789 start = toInteger(start);
58790
58791 var result = this;
58792 if (result.__filtered__ && (start > 0 || end < 0)) {
58793 return new LazyWrapper(result);
58794 }
58795 if (start < 0) {
58796 result = result.takeRight(-start);
58797 } else if (start) {
58798 result = result.drop(start);
58799 }
58800 if (end !== undefined) {
58801 end = toInteger(end);
58802 result = end < 0 ? result.dropRight(-end) : result.take(end - start);
58803 }
58804 return result;
58805 };
58806
58807 LazyWrapper.prototype.takeRightWhile = function(predicate) {
58808 return this.reverse().takeWhile(predicate).reverse();
58809 };
58810
58811 LazyWrapper.prototype.toArray = function() {
58812 return this.take(MAX_ARRAY_LENGTH);
58813 };
58814
58815 // Add `LazyWrapper` methods to `lodash.prototype`.
58816 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
58817 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
58818 isTaker = /^(?:head|last)$/.test(methodName),
58819 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
58820 retUnwrapped = isTaker || /^find/.test(methodName);
58821
58822 if (!lodashFunc) {
58823 return;
58824 }
58825 lodash.prototype[methodName] = function() {
58826 var value = this.__wrapped__,
58827 args = isTaker ? [1] : arguments,
58828 isLazy = value instanceof LazyWrapper,
58829 iteratee = args[0],
58830 useLazy = isLazy || isArray(value);
58831
58832 var interceptor = function(value) {
58833 var result = lodashFunc.apply(lodash, arrayPush([value], args));
58834 return (isTaker && chainAll) ? result[0] : result;
58835 };
58836
58837 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
58838 // Avoid lazy use if the iteratee has a "length" value other than `1`.
58839 isLazy = useLazy = false;
58840 }
58841 var chainAll = this.__chain__,
58842 isHybrid = !!this.__actions__.length,
58843 isUnwrapped = retUnwrapped && !chainAll,
58844 onlyLazy = isLazy && !isHybrid;
58845
58846 if (!retUnwrapped && useLazy) {
58847 value = onlyLazy ? value : new LazyWrapper(this);
58848 var result = func.apply(value, args);
58849 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
58850 return new LodashWrapper(result, chainAll);
58851 }
58852 if (isUnwrapped && onlyLazy) {
58853 return func.apply(this, args);
58854 }
58855 result = this.thru(interceptor);
58856 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
58857 };
58858 });
58859
58860 // Add `Array` methods to `lodash.prototype`.
58861 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
58862 var func = arrayProto[methodName],
58863 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
58864 retUnwrapped = /^(?:pop|shift)$/.test(methodName);
58865
58866 lodash.prototype[methodName] = function() {
58867 var args = arguments;
58868 if (retUnwrapped && !this.__chain__) {
58869 var value = this.value();
58870 return func.apply(isArray(value) ? value : [], args);
58871 }
58872 return this[chainName](function(value) {
58873 return func.apply(isArray(value) ? value : [], args);
58874 });
58875 };
58876 });
58877
58878 // Map minified method names to their real names.
58879 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
58880 var lodashFunc = lodash[methodName];
58881 if (lodashFunc) {
58882 var key = lodashFunc.name + '';
58883 if (!hasOwnProperty.call(realNames, key)) {
58884 realNames[key] = [];
58885 }
58886 realNames[key].push({ 'name': methodName, 'func': lodashFunc });
58887 }
58888 });
58889
58890 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
58891 'name': 'wrapper',
58892 'func': undefined
58893 }];
58894
58895 // Add methods to `LazyWrapper`.
58896 LazyWrapper.prototype.clone = lazyClone;
58897 LazyWrapper.prototype.reverse = lazyReverse;
58898 LazyWrapper.prototype.value = lazyValue;
58899
58900 // Add chain sequence methods to the `lodash` wrapper.
58901 lodash.prototype.at = wrapperAt;
58902 lodash.prototype.chain = wrapperChain;
58903 lodash.prototype.commit = wrapperCommit;
58904 lodash.prototype.next = wrapperNext;
58905 lodash.prototype.plant = wrapperPlant;
58906 lodash.prototype.reverse = wrapperReverse;
58907 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
58908
58909 // Add lazy aliases.
58910 lodash.prototype.first = lodash.prototype.head;
58911
58912 if (symIterator) {
58913 lodash.prototype[symIterator] = wrapperToIterator;
58914 }
58915 return lodash;
58916 });
58917
58918 /*--------------------------------------------------------------------------*/
58919
58920 // Export lodash.
58921 var _ = runInContext();
58922
58923 // Some AMD build optimizers, like r.js, check for condition patterns like:
58924 if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
58925 // Expose Lodash on the global object to prevent errors when Lodash is
58926 // loaded by a script tag in the presence of an AMD loader.
58927 // See http://requirejs.org/docs/errors.html#mismatch for more details.
58928 // Use `_.noConflict` to remove Lodash from the global object.
58929 root._ = _;
58930
58931 // Define as an anonymous module so, through path mapping, it can be
58932 // referenced as the "underscore" module.
58933 define(function() {
58934 return _;
58935 });
58936 }
58937 // Check for `exports` after `define` in case a build optimizer adds it.
58938 else if (freeModule) {
58939 // Export for Node.js.
58940 (freeModule.exports = _)._ = _;
58941 // Export for CommonJS support.
58942 freeExports._ = _;
58943 }
58944 else {
58945 // Export to the global object.
58946 root._ = _;
58947 }
58948}.call(this));
58949
58950}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
58951},{}],312:[function(require,module,exports){
58952module.exports={
58953 "_from": "bitcore-lib-p256@0.16.0",
58954 "_id": "bitcore-lib-p256@0.16.0",
58955 "_inBundle": false,
58956 "_integrity": "sha512-zuWJXrdLCsj562kwvN4XFxTUa86QV9cQymAtDuGdY4OGEvDcKcvSsx5Kq1WH3DX41PbxDbfovAQ0vuVAqgfnnw==",
58957 "_location": "/elastos-wallet-js/bitcore-lib-p256",
58958 "_phantomChildren": {},
58959 "_requested": {
58960 "type": "version",
58961 "registry": true,
58962 "raw": "bitcore-lib-p256@0.16.0",
58963 "name": "bitcore-lib-p256",
58964 "escapedName": "bitcore-lib-p256",
58965 "rawSpec": "0.16.0",
58966 "saveSpec": null,
58967 "fetchSpec": "0.16.0"
58968 },
58969 "_requiredBy": [
58970 "/elastos-wallet-js"
58971 ],
58972 "_resolved": "https://registry.npmjs.org/bitcore-lib-p256/-/bitcore-lib-p256-0.16.0.tgz",
58973 "_shasum": "47f544d126cef71c31164446ca1bfd0102f35898",
58974 "_spec": "bitcore-lib-p256@0.16.0",
58975 "_where": "/home/ian/git/bitcoin/bip39/libs/combined",
58976 "author": {
58977 "name": "BitPay",
58978 "email": "dev@bitpay.com"
58979 },
58980 "browser": {
58981 "request": "browser-request"
58982 },
58983 "bugs": {
58984 "url": "https://github.com/bitpay/bitcore-lib/issues"
58985 },
58986 "bundleDependencies": false,
58987 "dependencies": {
58988 "bn.js": "=4.11.8",
58989 "bs58": "=4.0.1",
58990 "buffer-compare": "=1.1.1",
58991 "elliptic": "=6.4.0",
58992 "inherits": "=2.0.1",
58993 "lodash": "=4.17.11"
58994 },
58995 "deprecated": false,
58996 "description": "A pure and powerful JavaScript Bitcoin library.",
58997 "devDependencies": {
58998 "bitcore-build": "git+https://github.com/bitpay/bitcore-build.git#1023e8a99cd42b9241ccafe8e34c52f308c10284",
58999 "brfs": "^2.0.1",
59000 "chai": "^4.2.0",
59001 "gulp": "^4.0.0",
59002 "sinon": "^7.1.1"
59003 },
59004 "homepage": "https://github.com/bitpay/bitcore-lib#readme",
59005 "keywords": [
59006 "bitcoin",
59007 "transaction",
59008 "address",
59009 "p2p",
59010 "ecies",
59011 "cryptocurrency",
59012 "blockchain",
59013 "payment",
59014 "bip21",
59015 "bip32",
59016 "bip37",
59017 "bip69",
59018 "bip70",
59019 "multisig"
59020 ],
59021 "license": "MIT",
59022 "main": "index.js",
59023 "name": "bitcore-lib-p256",
59024 "repository": {
59025 "type": "git",
59026 "url": "git+https://github.com/bitpay/bitcore-lib.git"
59027 },
59028 "scripts": {
59029 "build": "gulp",
59030 "coverage": "gulp coverage",
59031 "lint": "gulp lint",
59032 "test": "gulp test"
59033 },
59034 "version": "0.16.0"
59035}
59036
59037},{}],313:[function(require,module,exports){
59038arguments[4][27][0].apply(exports,arguments)
59039},{"dup":27}],314:[function(require,module,exports){
59040const { crypto, encoding, PrivateKey } = require('bitcore-lib-p256')
59041const { getPublicKeyFromPrivateKey } = require('./Api')
59042const { Buffer } = require('buffer')
59043const { compress } = require('./Utils')
59044
59045const { BN, Hash } = crypto
59046const { Base58Check } = encoding
59047
59048const signTypeMap = {
59049 ELA_STANDARD: { type: 0xac, address: 0x21 },
59050 ELA_MULTISIG: { type: 0xae, address: 0x12 },
59051 ELA_CROSSCHAIN: { type: 0xaf, address: 0x48 },
59052 ELA_IDCHAIN: { type: 0xad, address: 0x67 },
59053 ELA_DESTROY: {
59054 type: 0xaa,
59055 address: 0x0,
59056 },
59057}
59058
59059// a, b => public key
59060const sortBigNumber = (a, b) => {
59061 const bBigInt = BN.fromBuffer(Buffer.from(a, 'hex').slice(1))
59062 const aBigInt = BN.fromBuffer(Buffer.from(b, 'hex').slice(1))
59063 return bBigInt.gt(aBigInt)
59064}
59065
59066const toCode = (pubKeyBuf, signType) => {
59067 return Buffer.concat([Buffer.from([0x21]), pubKeyBuf, Buffer.from([signType])])
59068}
59069
59070const getAddressBase = (pubKey, signType) => {
59071 const pubKeyBuf = new Buffer(pubKey, 'hex')
59072 const code = toCode(pubKeyBuf, signTypeMap[signType].type)
59073 const hashBuf = Hash.sha256ripemd160(code)
59074 const programHashBuf = Buffer.concat([Buffer.from([signTypeMap[signType].address]), hashBuf])
59075
59076 return Base58Check.encode(programHashBuf)
59077}
59078
59079const getAddress = pubKey => getAddressBase(pubKey, 'ELA_STANDARD')
59080
59081const getAddressFromPrivateKey = prvKey => {
59082 const prvKeyBuf = Buffer.from(prvKey, 'hex')
59083 const pubKeyObj = getPublicKeyFromPrivateKey(prvKeyBuf)
59084 return getAddress(compress(pubKeyObj))
59085}
59086
59087const getDid = pubKey => getAddressBase(pubKey, 'ELA_IDCHAIN')
59088
59089const getMultiSignAddress = (pubKeys, requiredCount) => {
59090 const keysCount = pubKeys.length
59091
59092 const sortedPubKeys = pubKeys.sort(sortBigNumber)
59093
59094 let buf = Buffer.from([0x51 + requiredCount - 1])
59095
59096 sortedPubKeys.forEach(pub => {
59097 const pubInHex = Buffer.from(pub, 'hex')
59098 buf = Buffer.concat([buf, Buffer.from([pubInHex.length]), pubInHex])
59099 })
59100
59101 buf = Buffer.concat([buf, Buffer.from([0x51 + keysCount - 1, 0xae])])
59102
59103 const hashBuf = Hash.sha256ripemd160(buf)
59104 const programHashBuf = Buffer.concat([Buffer.from([0x12]), hashBuf])
59105
59106 return Base58Check.encode(programHashBuf)
59107}
59108
59109module.exports = {
59110 toCode,
59111 getAddress,
59112 getAddressFromPrivateKey,
59113 getDid,
59114 getMultiSignAddress,
59115}
59116
59117},{"./Api":315,"./Utils":316,"bitcore-lib-p256":265,"buffer":146}],315:[function(require,module,exports){
59118const {HDPrivateKey, HDPublicKey, PublicKey, PrivateKey, crypto} = require('bitcore-lib-p256')
59119const {Buffer} = require('buffer')
59120const {ecdsa, hash} = crypto
59121//const {getSeedFromMnemonic} = require('./Mnemonic')
59122//const {getAddress} = require('./Address')
59123const rs = require('jsrsasign')
59124const {uncompress} = require('./Utils')
59125
59126const COIN_TYPE_ELA = 2305
59127const COIN_TYPE_IDCHAIN = 1
59128
59129const EXTERNAL_CHAIN = 0
59130const INTERNAL_CHAIN = 1
59131
59132const ELA_ASSERT_ID = 'a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0'
59133
59134const getRootPrivateKey = (seed, coinType = COIN_TYPE_ELA) => {
59135 const prvKey = HDPrivateKey.fromSeed(seed)
59136 return prvKey.xprivkey
59137}
59138
59139const getRootMultiWallet = (seed, coinType = COIN_TYPE_ELA) => {
59140 const prvKey = HDPrivateKey.fromSeed(seed)
59141 const parent = new HDPrivateKey(prvKey.xprivkey)
59142
59143 const multiWallet = parent
59144 .deriveChild(44, true)
59145 .deriveChild(coinType, true)
59146 .deriveChild(0, true)
59147
59148 return multiWallet
59149}
59150
59151const getMasterPrivateKey = (seed, coinType = COIN_TYPE_ELA) => {
59152 return getRootMultiWallet(seed, coinType).xprivkey
59153}
59154
59155const getMasterPublicKey = (seed, coinType = COIN_TYPE_ELA) => {
59156 return getRootMultiWallet(seed, coinType).xpubkey
59157}
59158
59159const getAccountExtendedPrivateKey = (seed, coinType = COIN_TYPE_ELA, account = 0) => {
59160 return getAccountExtendedMultiWallet(seed, coinType, account).xprivkey
59161}
59162
59163const getAccountExtendedPublicKey = (seed, coinType = COIN_TYPE_ELA, account = 0) => {
59164 return getAccountExtendedMultiWallet(seed, coinType, account).xpubkey
59165}
59166
59167const getAccountExtendedMultiWallet = (seed, coinType = COIN_TYPE_ELA, account = 0) => {
59168 const prvKey = HDPrivateKey.fromSeed(seed)
59169 const parent = new HDPrivateKey(prvKey.xprivkey)
59170
59171 const multiWallet = parent
59172 .deriveChild(44, true)
59173 .deriveChild(coinType, true)
59174 .deriveChild(account, true)
59175
59176 return multiWallet
59177}
59178
59179const getBip32RootMultiWallet = (seed, coinType = COIN_TYPE_ELA, account = 0, changeChain = 0) => {
59180 const prvKey = HDPrivateKey.fromSeed(seed)
59181 const parent = new HDPrivateKey(prvKey.xprivkey)
59182
59183 const multiWallet = parent
59184 .deriveChild(44, true)
59185 .deriveChild(coinType, true)
59186 .deriveChild(account, true)
59187 .deriveChild(changeChain, false)
59188
59189 return multiWallet
59190}
59191
59192const getBip32ExtendedPrivateKey = (seed, coinType = COIN_TYPE_ELA, account = 0, changeChain = 0) => {
59193 return getBip32RootMultiWallet(seed, coinType, account, changeChain).xprivkey
59194}
59195
59196const getBip32ExtendedPublicKey = (seed, coinType = COIN_TYPE_ELA, account = 0, changeChain = 0) => {
59197 return getBip32RootMultiWallet(seed, coinType, account, changeChain).xpubkey
59198}
59199
59200const getIdChainMasterPublicKey = seed => {
59201 const prvKey = HDPrivateKey.fromSeed(seed)
59202 const parent = new HDPrivateKey(prvKey.xprivkey)
59203 const idChain = parent.deriveChild(0, true)
59204
59205 return idChain.publicKey
59206}
59207
59208const getDidWallet = (seed, index) => {
59209 const prvKey = HDPrivateKey.fromSeed(seed)
59210 const parent = new HDPrivateKey(prvKey.xprivkey)
59211
59212 const didWallet = parent
59213 .deriveChild(0, true)
59214 .deriveChild(0, false)
59215 .deriveChild(index, false)
59216
59217 return didWallet
59218}
59219
59220const generateIdChainSubPrivateKey = (seed, index) => getDidWallet(seed, index).privateKey
59221const generateIdChainSubPublicKey = (masterPublicKey, index) => getDidWallet(seed, index).publicKey
59222
59223const getSingleWallet = seed => getMultiWallet(seed, COIN_TYPE_ELA, 0, EXTERNAL_CHAIN, 0)
59224
59225const getMultiWallet = (seed, coinType, account, changeChain, index) => {
59226 const prvKey = HDPrivateKey.fromSeed(seed)
59227 const parent = new HDPrivateKey(prvKey.xprivkey)
59228 return parent
59229 .deriveChild(44, true)
59230 .deriveChild(coinType ? coinType : COIN_TYPE_ELA, true)
59231 .deriveChild(account, true)
59232 .deriveChild(changeChain ? changeChain : EXTERNAL_CHAIN, false)
59233 .deriveChild(index ? index : 0, false)
59234}
59235
59236const getSinglePrivateKey = seed => getSingleWallet(seed).privateKey
59237const getSinglePublicKey = seed => getSingleWallet(seed).publicKey
59238const getPublicKeyFromPrivateKey = prvKey => PrivateKey.fromBuffer(prvKey).publicKey
59239const generateSubPrivateKey = (seed, coinType, changeChain, index) => {
59240 return getMultiWallet(seed, coinType, 0, changeChain, index).privateKey
59241}
59242const generateSubPublicKey = (masterPublicKey, changeChain, index) => {
59243 const parent = new HDPublicKey(masterPublicKey)
59244 return parent.deriveChild(changeChain ? changeChain : EXTERNAL_CHAIN).deriveChild(index).publicKey
59245}
59246
59247const getDerivedPrivateKey = (seed, coinType, account, changeChain, index) => {
59248 return getMultiWallet(seed, coinType, account, changeChain, index).privateKey
59249}
59250
59251const getDerivedPublicKey = (masterPublicKey, changeChain, index) => {
59252 const parent = new HDPublicKey(masterPublicKey)
59253 return parent.deriveChild(changeChain ? changeChain : EXTERNAL_CHAIN).deriveChild(index).publicKey
59254}
59255
59256const sign = (data, prvKey, hex = false) => {
59257 if (!hex) data = Buffer.from(data, 'utf8').toString('hex')
59258 var signer = new rs.KJUR.crypto.Signature({alg: 'SHA256withECDSA'})
59259 signer.init({d: prvKey, curve: 'secp256r1'})
59260 signer.updateHex(data)
59261 var signature = signer.sign()
59262 return rs.ECDSA.asn1SigToConcatSig(signature) // return a hex string
59263}
59264
59265const verify = (data, signature, pubKey, hex = false) => {
59266 if (!hex) data = Buffer.from(data, 'utf8').toString('hex')
59267 const pubKeyObj = PublicKey.fromString(pubKey)
59268
59269 const signer = new rs.KJUR.crypto.Signature({alg: 'SHA256withECDSA'})
59270 signer.init({xy: uncompress(pubKeyObj).toString('hex'), curve: 'secp256r1'})
59271 signer.updateHex(data)
59272
59273 return signer.verify(rs.ECDSA.concatSigToASN1Sig(signature))
59274}
59275
59276module.exports = {
59277 getMasterPrivateKey,
59278 getMasterPublicKey,
59279 getBip32ExtendedPrivateKey,
59280 getBip32ExtendedPublicKey,
59281 getAccountExtendedPrivateKey,
59282 getAccountExtendedPublicKey,
59283 getDerivedPrivateKey,
59284 getDerivedPublicKey,
59285 getRootPrivateKey,
59286 getSinglePrivateKey,
59287 getSinglePublicKey,
59288 getPublicKeyFromPrivateKey,
59289 generateSubPrivateKey,
59290 generateSubPublicKey,
59291 getIdChainMasterPublicKey,
59292 generateIdChainSubPrivateKey,
59293 generateIdChainSubPublicKey,
59294 sign,
59295 verify,
59296}
59297
59298},{"./Utils":316,"bitcore-lib-p256":265,"buffer":146,"jsrsasign":427}],316:[function(require,module,exports){
59299(function (Buffer){
59300const uncompress = key => {
59301 if (!key.compressed) {
59302 throw new Error('Publick key is not compressed.')
59303 }
59304
59305 const x = key.point.getX()
59306 const y = key.point.getY()
59307
59308 const xbuf = x.toBuffer({
59309 size: 32,
59310 })
59311
59312 const ybuf = y.toBuffer({
59313 size: 32,
59314 })
59315
59316 return Buffer.concat([Buffer.from([0x04]), xbuf, ybuf])
59317}
59318
59319const compress = key => {
59320 if (key.compressed) {
59321 throw new Error('Publick key is already compressed.')
59322 }
59323 const x = key.point.getX()
59324 const y = key.point.getY()
59325
59326 const xbuf = x.toBuffer({
59327 size: 32,
59328 })
59329 const ybuf = y.toBuffer({
59330 size: 32,
59331 })
59332
59333 let prefix
59334
59335 const odd = ybuf[ybuf.length - 1] % 2
59336 if (odd) {
59337 prefix = new Buffer([0x03])
59338 } else {
59339 prefix = new Buffer([0x02])
59340 }
59341 return Buffer.concat([prefix, xbuf])
59342}
59343
59344const reverseByteBuffer = buffer => {
59345 for (var i = 0, j = buffer.length - 1; i < j; ++i, --j) {
59346 var t = buffer[j]
59347 buffer[j] = buffer[i]
59348 buffer[i] = t
59349 }
59350 return buffer
59351}
59352
59353module.exports = {
59354 compress,
59355 uncompress,
59356 reverseByteBuffer
59357}
59358
59359}).call(this,require("buffer").Buffer)
59360},{"buffer":146}],317:[function(require,module,exports){
59361'use strict';
59362
59363var elliptic = exports;
59364
59365elliptic.version = require('../package.json').version;
59366elliptic.utils = require('./elliptic/utils');
59367elliptic.rand = require('brorand');
59368elliptic.curve = require('./elliptic/curve');
59369elliptic.curves = require('./elliptic/curves');
59370
59371// Protocols
59372elliptic.ec = require('./elliptic/ec');
59373elliptic.eddsa = require('./elliptic/eddsa');
59374
59375},{"../package.json":332,"./elliptic/curve":320,"./elliptic/curves":323,"./elliptic/ec":324,"./elliptic/eddsa":327,"./elliptic/utils":331,"brorand":109}],318:[function(require,module,exports){
59376'use strict';
59377
59378var BN = require('bn.js');
59379var elliptic = require('../../elliptic');
59380var utils = elliptic.utils;
59381var getNAF = utils.getNAF;
59382var getJSF = utils.getJSF;
59383var assert = utils.assert;
59384
59385function BaseCurve(type, conf) {
59386 this.type = type;
59387 this.p = new BN(conf.p, 16);
59388
59389 // Use Montgomery, when there is no fast reduction for the prime
59390 this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
59391
59392 // Useful for many curves
59393 this.zero = new BN(0).toRed(this.red);
59394 this.one = new BN(1).toRed(this.red);
59395 this.two = new BN(2).toRed(this.red);
59396
59397 // Curve configuration, optional
59398 this.n = conf.n && new BN(conf.n, 16);
59399 this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
59400
59401 // Temporary arrays
59402 this._wnafT1 = new Array(4);
59403 this._wnafT2 = new Array(4);
59404 this._wnafT3 = new Array(4);
59405 this._wnafT4 = new Array(4);
59406
59407 // Generalized Greg Maxwell's trick
59408 var adjustCount = this.n && this.p.div(this.n);
59409 if (!adjustCount || adjustCount.cmpn(100) > 0) {
59410 this.redN = null;
59411 } else {
59412 this._maxwellTrick = true;
59413 this.redN = this.n.toRed(this.red);
59414 }
59415}
59416module.exports = BaseCurve;
59417
59418BaseCurve.prototype.point = function point() {
59419 throw new Error('Not implemented');
59420};
59421
59422BaseCurve.prototype.validate = function validate() {
59423 throw new Error('Not implemented');
59424};
59425
59426BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
59427 assert(p.precomputed);
59428 var doubles = p._getDoubles();
59429
59430 var naf = getNAF(k, 1);
59431 var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
59432 I /= 3;
59433
59434 // Translate into more windowed form
59435 var repr = [];
59436 for (var j = 0; j < naf.length; j += doubles.step) {
59437 var nafW = 0;
59438 for (var k = j + doubles.step - 1; k >= j; k--)
59439 nafW = (nafW << 1) + naf[k];
59440 repr.push(nafW);
59441 }
59442
59443 var a = this.jpoint(null, null, null);
59444 var b = this.jpoint(null, null, null);
59445 for (var i = I; i > 0; i--) {
59446 for (var j = 0; j < repr.length; j++) {
59447 var nafW = repr[j];
59448 if (nafW === i)
59449 b = b.mixedAdd(doubles.points[j]);
59450 else if (nafW === -i)
59451 b = b.mixedAdd(doubles.points[j].neg());
59452 }
59453 a = a.add(b);
59454 }
59455 return a.toP();
59456};
59457
59458BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
59459 var w = 4;
59460
59461 // Precompute window
59462 var nafPoints = p._getNAFPoints(w);
59463 w = nafPoints.wnd;
59464 var wnd = nafPoints.points;
59465
59466 // Get NAF form
59467 var naf = getNAF(k, w);
59468
59469 // Add `this`*(N+1) for every w-NAF index
59470 var acc = this.jpoint(null, null, null);
59471 for (var i = naf.length - 1; i >= 0; i--) {
59472 // Count zeroes
59473 for (var k = 0; i >= 0 && naf[i] === 0; i--)
59474 k++;
59475 if (i >= 0)
59476 k++;
59477 acc = acc.dblp(k);
59478
59479 if (i < 0)
59480 break;
59481 var z = naf[i];
59482 assert(z !== 0);
59483 if (p.type === 'affine') {
59484 // J +- P
59485 if (z > 0)
59486 acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
59487 else
59488 acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
59489 } else {
59490 // J +- J
59491 if (z > 0)
59492 acc = acc.add(wnd[(z - 1) >> 1]);
59493 else
59494 acc = acc.add(wnd[(-z - 1) >> 1].neg());
59495 }
59496 }
59497 return p.type === 'affine' ? acc.toP() : acc;
59498};
59499
59500BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
59501 points,
59502 coeffs,
59503 len,
59504 jacobianResult) {
59505 var wndWidth = this._wnafT1;
59506 var wnd = this._wnafT2;
59507 var naf = this._wnafT3;
59508
59509 // Fill all arrays
59510 var max = 0;
59511 for (var i = 0; i < len; i++) {
59512 var p = points[i];
59513 var nafPoints = p._getNAFPoints(defW);
59514 wndWidth[i] = nafPoints.wnd;
59515 wnd[i] = nafPoints.points;
59516 }
59517
59518 // Comb small window NAFs
59519 for (var i = len - 1; i >= 1; i -= 2) {
59520 var a = i - 1;
59521 var b = i;
59522 if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
59523 naf[a] = getNAF(coeffs[a], wndWidth[a]);
59524 naf[b] = getNAF(coeffs[b], wndWidth[b]);
59525 max = Math.max(naf[a].length, max);
59526 max = Math.max(naf[b].length, max);
59527 continue;
59528 }
59529
59530 var comb = [
59531 points[a], /* 1 */
59532 null, /* 3 */
59533 null, /* 5 */
59534 points[b] /* 7 */
59535 ];
59536
59537 // Try to avoid Projective points, if possible
59538 if (points[a].y.cmp(points[b].y) === 0) {
59539 comb[1] = points[a].add(points[b]);
59540 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
59541 } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
59542 comb[1] = points[a].toJ().mixedAdd(points[b]);
59543 comb[2] = points[a].add(points[b].neg());
59544 } else {
59545 comb[1] = points[a].toJ().mixedAdd(points[b]);
59546 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
59547 }
59548
59549 var index = [
59550 -3, /* -1 -1 */
59551 -1, /* -1 0 */
59552 -5, /* -1 1 */
59553 -7, /* 0 -1 */
59554 0, /* 0 0 */
59555 7, /* 0 1 */
59556 5, /* 1 -1 */
59557 1, /* 1 0 */
59558 3 /* 1 1 */
59559 ];
59560
59561 var jsf = getJSF(coeffs[a], coeffs[b]);
59562 max = Math.max(jsf[0].length, max);
59563 naf[a] = new Array(max);
59564 naf[b] = new Array(max);
59565 for (var j = 0; j < max; j++) {
59566 var ja = jsf[0][j] | 0;
59567 var jb = jsf[1][j] | 0;
59568
59569 naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
59570 naf[b][j] = 0;
59571 wnd[a] = comb;
59572 }
59573 }
59574
59575 var acc = this.jpoint(null, null, null);
59576 var tmp = this._wnafT4;
59577 for (var i = max; i >= 0; i--) {
59578 var k = 0;
59579
59580 while (i >= 0) {
59581 var zero = true;
59582 for (var j = 0; j < len; j++) {
59583 tmp[j] = naf[j][i] | 0;
59584 if (tmp[j] !== 0)
59585 zero = false;
59586 }
59587 if (!zero)
59588 break;
59589 k++;
59590 i--;
59591 }
59592 if (i >= 0)
59593 k++;
59594 acc = acc.dblp(k);
59595 if (i < 0)
59596 break;
59597
59598 for (var j = 0; j < len; j++) {
59599 var z = tmp[j];
59600 var p;
59601 if (z === 0)
59602 continue;
59603 else if (z > 0)
59604 p = wnd[j][(z - 1) >> 1];
59605 else if (z < 0)
59606 p = wnd[j][(-z - 1) >> 1].neg();
59607
59608 if (p.type === 'affine')
59609 acc = acc.mixedAdd(p);
59610 else
59611 acc = acc.add(p);
59612 }
59613 }
59614 // Zeroify references
59615 for (var i = 0; i < len; i++)
59616 wnd[i] = null;
59617
59618 if (jacobianResult)
59619 return acc;
59620 else
59621 return acc.toP();
59622};
59623
59624function BasePoint(curve, type) {
59625 this.curve = curve;
59626 this.type = type;
59627 this.precomputed = null;
59628}
59629BaseCurve.BasePoint = BasePoint;
59630
59631BasePoint.prototype.eq = function eq(/*other*/) {
59632 throw new Error('Not implemented');
59633};
59634
59635BasePoint.prototype.validate = function validate() {
59636 return this.curve.validate(this);
59637};
59638
59639BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
59640 bytes = utils.toArray(bytes, enc);
59641
59642 var len = this.p.byteLength();
59643
59644 // uncompressed, hybrid-odd, hybrid-even
59645 if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
59646 bytes.length - 1 === 2 * len) {
59647 if (bytes[0] === 0x06)
59648 assert(bytes[bytes.length - 1] % 2 === 0);
59649 else if (bytes[0] === 0x07)
59650 assert(bytes[bytes.length - 1] % 2 === 1);
59651
59652 var res = this.point(bytes.slice(1, 1 + len),
59653 bytes.slice(1 + len, 1 + 2 * len));
59654
59655 return res;
59656 } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
59657 bytes.length - 1 === len) {
59658 return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
59659 }
59660 throw new Error('Unknown point format');
59661};
59662
59663BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
59664 return this.encode(enc, true);
59665};
59666
59667BasePoint.prototype._encode = function _encode(compact) {
59668 var len = this.curve.p.byteLength();
59669 var x = this.getX().toArray('be', len);
59670
59671 if (compact)
59672 return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
59673
59674 return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
59675};
59676
59677BasePoint.prototype.encode = function encode(enc, compact) {
59678 return utils.encode(this._encode(compact), enc);
59679};
59680
59681BasePoint.prototype.precompute = function precompute(power) {
59682 if (this.precomputed)
59683 return this;
59684
59685 var precomputed = {
59686 doubles: null,
59687 naf: null,
59688 beta: null
59689 };
59690 precomputed.naf = this._getNAFPoints(8);
59691 precomputed.doubles = this._getDoubles(4, power);
59692 precomputed.beta = this._getBeta();
59693 this.precomputed = precomputed;
59694
59695 return this;
59696};
59697
59698BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
59699 if (!this.precomputed)
59700 return false;
59701
59702 var doubles = this.precomputed.doubles;
59703 if (!doubles)
59704 return false;
59705
59706 return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
59707};
59708
59709BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
59710 if (this.precomputed && this.precomputed.doubles)
59711 return this.precomputed.doubles;
59712
59713 var doubles = [ this ];
59714 var acc = this;
59715 for (var i = 0; i < power; i += step) {
59716 for (var j = 0; j < step; j++)
59717 acc = acc.dbl();
59718 doubles.push(acc);
59719 }
59720 return {
59721 step: step,
59722 points: doubles
59723 };
59724};
59725
59726BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
59727 if (this.precomputed && this.precomputed.naf)
59728 return this.precomputed.naf;
59729
59730 var res = [ this ];
59731 var max = (1 << wnd) - 1;
59732 var dbl = max === 1 ? null : this.dbl();
59733 for (var i = 1; i < max; i++)
59734 res[i] = res[i - 1].add(dbl);
59735 return {
59736 wnd: wnd,
59737 points: res
59738 };
59739};
59740
59741BasePoint.prototype._getBeta = function _getBeta() {
59742 return null;
59743};
59744
59745BasePoint.prototype.dblp = function dblp(k) {
59746 var r = this;
59747 for (var i = 0; i < k; i++)
59748 r = r.dbl();
59749 return r;
59750};
59751
59752},{"../../elliptic":317,"bn.js":108}],319:[function(require,module,exports){
59753'use strict';
59754
59755var curve = require('../curve');
59756var elliptic = require('../../elliptic');
59757var BN = require('bn.js');
59758var inherits = require('inherits');
59759var Base = curve.base;
59760
59761var assert = elliptic.utils.assert;
59762
59763function EdwardsCurve(conf) {
59764 // NOTE: Important as we are creating point in Base.call()
59765 this.twisted = (conf.a | 0) !== 1;
59766 this.mOneA = this.twisted && (conf.a | 0) === -1;
59767 this.extended = this.mOneA;
59768
59769 Base.call(this, 'edwards', conf);
59770
59771 this.a = new BN(conf.a, 16).umod(this.red.m);
59772 this.a = this.a.toRed(this.red);
59773 this.c = new BN(conf.c, 16).toRed(this.red);
59774 this.c2 = this.c.redSqr();
59775 this.d = new BN(conf.d, 16).toRed(this.red);
59776 this.dd = this.d.redAdd(this.d);
59777
59778 assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
59779 this.oneC = (conf.c | 0) === 1;
59780}
59781inherits(EdwardsCurve, Base);
59782module.exports = EdwardsCurve;
59783
59784EdwardsCurve.prototype._mulA = function _mulA(num) {
59785 if (this.mOneA)
59786 return num.redNeg();
59787 else
59788 return this.a.redMul(num);
59789};
59790
59791EdwardsCurve.prototype._mulC = function _mulC(num) {
59792 if (this.oneC)
59793 return num;
59794 else
59795 return this.c.redMul(num);
59796};
59797
59798// Just for compatibility with Short curve
59799EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
59800 return this.point(x, y, z, t);
59801};
59802
59803EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
59804 x = new BN(x, 16);
59805 if (!x.red)
59806 x = x.toRed(this.red);
59807
59808 var x2 = x.redSqr();
59809 var rhs = this.c2.redSub(this.a.redMul(x2));
59810 var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
59811
59812 var y2 = rhs.redMul(lhs.redInvm());
59813 var y = y2.redSqrt();
59814 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
59815 throw new Error('invalid point');
59816
59817 var isOdd = y.fromRed().isOdd();
59818 if (odd && !isOdd || !odd && isOdd)
59819 y = y.redNeg();
59820
59821 return this.point(x, y);
59822};
59823
59824EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
59825 y = new BN(y, 16);
59826 if (!y.red)
59827 y = y.toRed(this.red);
59828
59829 // x^2 = (y^2 - 1) / (d y^2 + 1)
59830 var y2 = y.redSqr();
59831 var lhs = y2.redSub(this.one);
59832 var rhs = y2.redMul(this.d).redAdd(this.one);
59833 var x2 = lhs.redMul(rhs.redInvm());
59834
59835 if (x2.cmp(this.zero) === 0) {
59836 if (odd)
59837 throw new Error('invalid point');
59838 else
59839 return this.point(this.zero, y);
59840 }
59841
59842 var x = x2.redSqrt();
59843 if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
59844 throw new Error('invalid point');
59845
59846 if (x.isOdd() !== odd)
59847 x = x.redNeg();
59848
59849 return this.point(x, y);
59850};
59851
59852EdwardsCurve.prototype.validate = function validate(point) {
59853 if (point.isInfinity())
59854 return true;
59855
59856 // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
59857 point.normalize();
59858
59859 var x2 = point.x.redSqr();
59860 var y2 = point.y.redSqr();
59861 var lhs = x2.redMul(this.a).redAdd(y2);
59862 var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
59863
59864 return lhs.cmp(rhs) === 0;
59865};
59866
59867function Point(curve, x, y, z, t) {
59868 Base.BasePoint.call(this, curve, 'projective');
59869 if (x === null && y === null && z === null) {
59870 this.x = this.curve.zero;
59871 this.y = this.curve.one;
59872 this.z = this.curve.one;
59873 this.t = this.curve.zero;
59874 this.zOne = true;
59875 } else {
59876 this.x = new BN(x, 16);
59877 this.y = new BN(y, 16);
59878 this.z = z ? new BN(z, 16) : this.curve.one;
59879 this.t = t && new BN(t, 16);
59880 if (!this.x.red)
59881 this.x = this.x.toRed(this.curve.red);
59882 if (!this.y.red)
59883 this.y = this.y.toRed(this.curve.red);
59884 if (!this.z.red)
59885 this.z = this.z.toRed(this.curve.red);
59886 if (this.t && !this.t.red)
59887 this.t = this.t.toRed(this.curve.red);
59888 this.zOne = this.z === this.curve.one;
59889
59890 // Use extended coordinates
59891 if (this.curve.extended && !this.t) {
59892 this.t = this.x.redMul(this.y);
59893 if (!this.zOne)
59894 this.t = this.t.redMul(this.z.redInvm());
59895 }
59896 }
59897}
59898inherits(Point, Base.BasePoint);
59899
59900EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
59901 return Point.fromJSON(this, obj);
59902};
59903
59904EdwardsCurve.prototype.point = function point(x, y, z, t) {
59905 return new Point(this, x, y, z, t);
59906};
59907
59908Point.fromJSON = function fromJSON(curve, obj) {
59909 return new Point(curve, obj[0], obj[1], obj[2]);
59910};
59911
59912Point.prototype.inspect = function inspect() {
59913 if (this.isInfinity())
59914 return '<EC Point Infinity>';
59915 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
59916 ' y: ' + this.y.fromRed().toString(16, 2) +
59917 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
59918};
59919
59920Point.prototype.isInfinity = function isInfinity() {
59921 // XXX This code assumes that zero is always zero in red
59922 return this.x.cmpn(0) === 0 &&
59923 this.y.cmp(this.z) === 0;
59924};
59925
59926Point.prototype._extDbl = function _extDbl() {
59927 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
59928 // #doubling-dbl-2008-hwcd
59929 // 4M + 4S
59930
59931 // A = X1^2
59932 var a = this.x.redSqr();
59933 // B = Y1^2
59934 var b = this.y.redSqr();
59935 // C = 2 * Z1^2
59936 var c = this.z.redSqr();
59937 c = c.redIAdd(c);
59938 // D = a * A
59939 var d = this.curve._mulA(a);
59940 // E = (X1 + Y1)^2 - A - B
59941 var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
59942 // G = D + B
59943 var g = d.redAdd(b);
59944 // F = G - C
59945 var f = g.redSub(c);
59946 // H = D - B
59947 var h = d.redSub(b);
59948 // X3 = E * F
59949 var nx = e.redMul(f);
59950 // Y3 = G * H
59951 var ny = g.redMul(h);
59952 // T3 = E * H
59953 var nt = e.redMul(h);
59954 // Z3 = F * G
59955 var nz = f.redMul(g);
59956 return this.curve.point(nx, ny, nz, nt);
59957};
59958
59959Point.prototype._projDbl = function _projDbl() {
59960 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
59961 // #doubling-dbl-2008-bbjlp
59962 // #doubling-dbl-2007-bl
59963 // and others
59964 // Generally 3M + 4S or 2M + 4S
59965
59966 // B = (X1 + Y1)^2
59967 var b = this.x.redAdd(this.y).redSqr();
59968 // C = X1^2
59969 var c = this.x.redSqr();
59970 // D = Y1^2
59971 var d = this.y.redSqr();
59972
59973 var nx;
59974 var ny;
59975 var nz;
59976 if (this.curve.twisted) {
59977 // E = a * C
59978 var e = this.curve._mulA(c);
59979 // F = E + D
59980 var f = e.redAdd(d);
59981 if (this.zOne) {
59982 // X3 = (B - C - D) * (F - 2)
59983 nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
59984 // Y3 = F * (E - D)
59985 ny = f.redMul(e.redSub(d));
59986 // Z3 = F^2 - 2 * F
59987 nz = f.redSqr().redSub(f).redSub(f);
59988 } else {
59989 // H = Z1^2
59990 var h = this.z.redSqr();
59991 // J = F - 2 * H
59992 var j = f.redSub(h).redISub(h);
59993 // X3 = (B-C-D)*J
59994 nx = b.redSub(c).redISub(d).redMul(j);
59995 // Y3 = F * (E - D)
59996 ny = f.redMul(e.redSub(d));
59997 // Z3 = F * J
59998 nz = f.redMul(j);
59999 }
60000 } else {
60001 // E = C + D
60002 var e = c.redAdd(d);
60003 // H = (c * Z1)^2
60004 var h = this.curve._mulC(this.c.redMul(this.z)).redSqr();
60005 // J = E - 2 * H
60006 var j = e.redSub(h).redSub(h);
60007 // X3 = c * (B - E) * J
60008 nx = this.curve._mulC(b.redISub(e)).redMul(j);
60009 // Y3 = c * E * (C - D)
60010 ny = this.curve._mulC(e).redMul(c.redISub(d));
60011 // Z3 = E * J
60012 nz = e.redMul(j);
60013 }
60014 return this.curve.point(nx, ny, nz);
60015};
60016
60017Point.prototype.dbl = function dbl() {
60018 if (this.isInfinity())
60019 return this;
60020
60021 // Double in extended coordinates
60022 if (this.curve.extended)
60023 return this._extDbl();
60024 else
60025 return this._projDbl();
60026};
60027
60028Point.prototype._extAdd = function _extAdd(p) {
60029 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
60030 // #addition-add-2008-hwcd-3
60031 // 8M
60032
60033 // A = (Y1 - X1) * (Y2 - X2)
60034 var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
60035 // B = (Y1 + X1) * (Y2 + X2)
60036 var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
60037 // C = T1 * k * T2
60038 var c = this.t.redMul(this.curve.dd).redMul(p.t);
60039 // D = Z1 * 2 * Z2
60040 var d = this.z.redMul(p.z.redAdd(p.z));
60041 // E = B - A
60042 var e = b.redSub(a);
60043 // F = D - C
60044 var f = d.redSub(c);
60045 // G = D + C
60046 var g = d.redAdd(c);
60047 // H = B + A
60048 var h = b.redAdd(a);
60049 // X3 = E * F
60050 var nx = e.redMul(f);
60051 // Y3 = G * H
60052 var ny = g.redMul(h);
60053 // T3 = E * H
60054 var nt = e.redMul(h);
60055 // Z3 = F * G
60056 var nz = f.redMul(g);
60057 return this.curve.point(nx, ny, nz, nt);
60058};
60059
60060Point.prototype._projAdd = function _projAdd(p) {
60061 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
60062 // #addition-add-2008-bbjlp
60063 // #addition-add-2007-bl
60064 // 10M + 1S
60065
60066 // A = Z1 * Z2
60067 var a = this.z.redMul(p.z);
60068 // B = A^2
60069 var b = a.redSqr();
60070 // C = X1 * X2
60071 var c = this.x.redMul(p.x);
60072 // D = Y1 * Y2
60073 var d = this.y.redMul(p.y);
60074 // E = d * C * D
60075 var e = this.curve.d.redMul(c).redMul(d);
60076 // F = B - E
60077 var f = b.redSub(e);
60078 // G = B + E
60079 var g = b.redAdd(e);
60080 // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
60081 var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
60082 var nx = a.redMul(f).redMul(tmp);
60083 var ny;
60084 var nz;
60085 if (this.curve.twisted) {
60086 // Y3 = A * G * (D - a * C)
60087 ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
60088 // Z3 = F * G
60089 nz = f.redMul(g);
60090 } else {
60091 // Y3 = A * G * (D - C)
60092 ny = a.redMul(g).redMul(d.redSub(c));
60093 // Z3 = c * F * G
60094 nz = this.curve._mulC(f).redMul(g);
60095 }
60096 return this.curve.point(nx, ny, nz);
60097};
60098
60099Point.prototype.add = function add(p) {
60100 if (this.isInfinity())
60101 return p;
60102 if (p.isInfinity())
60103 return this;
60104
60105 if (this.curve.extended)
60106 return this._extAdd(p);
60107 else
60108 return this._projAdd(p);
60109};
60110
60111Point.prototype.mul = function mul(k) {
60112 if (this._hasDoubles(k))
60113 return this.curve._fixedNafMul(this, k);
60114 else
60115 return this.curve._wnafMul(this, k);
60116};
60117
60118Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
60119 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
60120};
60121
60122Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
60123 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
60124};
60125
60126Point.prototype.normalize = function normalize() {
60127 if (this.zOne)
60128 return this;
60129
60130 // Normalize coordinates
60131 var zi = this.z.redInvm();
60132 this.x = this.x.redMul(zi);
60133 this.y = this.y.redMul(zi);
60134 if (this.t)
60135 this.t = this.t.redMul(zi);
60136 this.z = this.curve.one;
60137 this.zOne = true;
60138 return this;
60139};
60140
60141Point.prototype.neg = function neg() {
60142 return this.curve.point(this.x.redNeg(),
60143 this.y,
60144 this.z,
60145 this.t && this.t.redNeg());
60146};
60147
60148Point.prototype.getX = function getX() {
60149 this.normalize();
60150 return this.x.fromRed();
60151};
60152
60153Point.prototype.getY = function getY() {
60154 this.normalize();
60155 return this.y.fromRed();
60156};
60157
60158Point.prototype.eq = function eq(other) {
60159 return this === other ||
60160 this.getX().cmp(other.getX()) === 0 &&
60161 this.getY().cmp(other.getY()) === 0;
60162};
60163
60164Point.prototype.eqXToP = function eqXToP(x) {
60165 var rx = x.toRed(this.curve.red).redMul(this.z);
60166 if (this.x.cmp(rx) === 0)
60167 return true;
60168
60169 var xc = x.clone();
60170 var t = this.curve.redN.redMul(this.z);
60171 for (;;) {
60172 xc.iadd(this.curve.n);
60173 if (xc.cmp(this.curve.p) >= 0)
60174 return false;
60175
60176 rx.redIAdd(t);
60177 if (this.x.cmp(rx) === 0)
60178 return true;
60179 }
60180 return false;
60181};
60182
60183// Compatibility with BaseCurve
60184Point.prototype.toP = Point.prototype.normalize;
60185Point.prototype.mixedAdd = Point.prototype.add;
60186
60187},{"../../elliptic":317,"../curve":320,"bn.js":108,"inherits":396}],320:[function(require,module,exports){
60188'use strict';
60189
60190var curve = exports;
60191
60192curve.base = require('./base');
60193curve.short = require('./short');
60194curve.mont = require('./mont');
60195curve.edwards = require('./edwards');
60196
60197},{"./base":318,"./edwards":319,"./mont":321,"./short":322}],321:[function(require,module,exports){
60198'use strict';
60199
60200var curve = require('../curve');
60201var BN = require('bn.js');
60202var inherits = require('inherits');
60203var Base = curve.base;
60204
60205var elliptic = require('../../elliptic');
60206var utils = elliptic.utils;
60207
60208function MontCurve(conf) {
60209 Base.call(this, 'mont', conf);
60210
60211 this.a = new BN(conf.a, 16).toRed(this.red);
60212 this.b = new BN(conf.b, 16).toRed(this.red);
60213 this.i4 = new BN(4).toRed(this.red).redInvm();
60214 this.two = new BN(2).toRed(this.red);
60215 this.a24 = this.i4.redMul(this.a.redAdd(this.two));
60216}
60217inherits(MontCurve, Base);
60218module.exports = MontCurve;
60219
60220MontCurve.prototype.validate = function validate(point) {
60221 var x = point.normalize().x;
60222 var x2 = x.redSqr();
60223 var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
60224 var y = rhs.redSqrt();
60225
60226 return y.redSqr().cmp(rhs) === 0;
60227};
60228
60229function Point(curve, x, z) {
60230 Base.BasePoint.call(this, curve, 'projective');
60231 if (x === null && z === null) {
60232 this.x = this.curve.one;
60233 this.z = this.curve.zero;
60234 } else {
60235 this.x = new BN(x, 16);
60236 this.z = new BN(z, 16);
60237 if (!this.x.red)
60238 this.x = this.x.toRed(this.curve.red);
60239 if (!this.z.red)
60240 this.z = this.z.toRed(this.curve.red);
60241 }
60242}
60243inherits(Point, Base.BasePoint);
60244
60245MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
60246 return this.point(utils.toArray(bytes, enc), 1);
60247};
60248
60249MontCurve.prototype.point = function point(x, z) {
60250 return new Point(this, x, z);
60251};
60252
60253MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
60254 return Point.fromJSON(this, obj);
60255};
60256
60257Point.prototype.precompute = function precompute() {
60258 // No-op
60259};
60260
60261Point.prototype._encode = function _encode() {
60262 return this.getX().toArray('be', this.curve.p.byteLength());
60263};
60264
60265Point.fromJSON = function fromJSON(curve, obj) {
60266 return new Point(curve, obj[0], obj[1] || curve.one);
60267};
60268
60269Point.prototype.inspect = function inspect() {
60270 if (this.isInfinity())
60271 return '<EC Point Infinity>';
60272 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
60273 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
60274};
60275
60276Point.prototype.isInfinity = function isInfinity() {
60277 // XXX This code assumes that zero is always zero in red
60278 return this.z.cmpn(0) === 0;
60279};
60280
60281Point.prototype.dbl = function dbl() {
60282 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
60283 // 2M + 2S + 4A
60284
60285 // A = X1 + Z1
60286 var a = this.x.redAdd(this.z);
60287 // AA = A^2
60288 var aa = a.redSqr();
60289 // B = X1 - Z1
60290 var b = this.x.redSub(this.z);
60291 // BB = B^2
60292 var bb = b.redSqr();
60293 // C = AA - BB
60294 var c = aa.redSub(bb);
60295 // X3 = AA * BB
60296 var nx = aa.redMul(bb);
60297 // Z3 = C * (BB + A24 * C)
60298 var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
60299 return this.curve.point(nx, nz);
60300};
60301
60302Point.prototype.add = function add() {
60303 throw new Error('Not supported on Montgomery curve');
60304};
60305
60306Point.prototype.diffAdd = function diffAdd(p, diff) {
60307 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
60308 // 4M + 2S + 6A
60309
60310 // A = X2 + Z2
60311 var a = this.x.redAdd(this.z);
60312 // B = X2 - Z2
60313 var b = this.x.redSub(this.z);
60314 // C = X3 + Z3
60315 var c = p.x.redAdd(p.z);
60316 // D = X3 - Z3
60317 var d = p.x.redSub(p.z);
60318 // DA = D * A
60319 var da = d.redMul(a);
60320 // CB = C * B
60321 var cb = c.redMul(b);
60322 // X5 = Z1 * (DA + CB)^2
60323 var nx = diff.z.redMul(da.redAdd(cb).redSqr());
60324 // Z5 = X1 * (DA - CB)^2
60325 var nz = diff.x.redMul(da.redISub(cb).redSqr());
60326 return this.curve.point(nx, nz);
60327};
60328
60329Point.prototype.mul = function mul(k) {
60330 var t = k.clone();
60331 var a = this; // (N / 2) * Q + Q
60332 var b = this.curve.point(null, null); // (N / 2) * Q
60333 var c = this; // Q
60334
60335 for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
60336 bits.push(t.andln(1));
60337
60338 for (var i = bits.length - 1; i >= 0; i--) {
60339 if (bits[i] === 0) {
60340 // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
60341 a = a.diffAdd(b, c);
60342 // N * Q = 2 * ((N / 2) * Q + Q))
60343 b = b.dbl();
60344 } else {
60345 // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
60346 b = a.diffAdd(b, c);
60347 // N * Q + Q = 2 * ((N / 2) * Q + Q)
60348 a = a.dbl();
60349 }
60350 }
60351 return b;
60352};
60353
60354Point.prototype.mulAdd = function mulAdd() {
60355 throw new Error('Not supported on Montgomery curve');
60356};
60357
60358Point.prototype.jumlAdd = function jumlAdd() {
60359 throw new Error('Not supported on Montgomery curve');
60360};
60361
60362Point.prototype.eq = function eq(other) {
60363 return this.getX().cmp(other.getX()) === 0;
60364};
60365
60366Point.prototype.normalize = function normalize() {
60367 this.x = this.x.redMul(this.z.redInvm());
60368 this.z = this.curve.one;
60369 return this;
60370};
60371
60372Point.prototype.getX = function getX() {
60373 // Normalize coordinates
60374 this.normalize();
60375
60376 return this.x.fromRed();
60377};
60378
60379},{"../../elliptic":317,"../curve":320,"bn.js":108,"inherits":396}],322:[function(require,module,exports){
60380'use strict';
60381
60382var curve = require('../curve');
60383var elliptic = require('../../elliptic');
60384var BN = require('bn.js');
60385var inherits = require('inherits');
60386var Base = curve.base;
60387
60388var assert = elliptic.utils.assert;
60389
60390function ShortCurve(conf) {
60391 Base.call(this, 'short', conf);
60392
60393 this.a = new BN(conf.a, 16).toRed(this.red);
60394 this.b = new BN(conf.b, 16).toRed(this.red);
60395 this.tinv = this.two.redInvm();
60396
60397 this.zeroA = this.a.fromRed().cmpn(0) === 0;
60398 this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
60399
60400 // If the curve is endomorphic, precalculate beta and lambda
60401 this.endo = this._getEndomorphism(conf);
60402 this._endoWnafT1 = new Array(4);
60403 this._endoWnafT2 = new Array(4);
60404}
60405inherits(ShortCurve, Base);
60406module.exports = ShortCurve;
60407
60408ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
60409 // No efficient endomorphism
60410 if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
60411 return;
60412
60413 // Compute beta and lambda, that lambda * P = (beta * Px; Py)
60414 var beta;
60415 var lambda;
60416 if (conf.beta) {
60417 beta = new BN(conf.beta, 16).toRed(this.red);
60418 } else {
60419 var betas = this._getEndoRoots(this.p);
60420 // Choose the smallest beta
60421 beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
60422 beta = beta.toRed(this.red);
60423 }
60424 if (conf.lambda) {
60425 lambda = new BN(conf.lambda, 16);
60426 } else {
60427 // Choose the lambda that is matching selected beta
60428 var lambdas = this._getEndoRoots(this.n);
60429 if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
60430 lambda = lambdas[0];
60431 } else {
60432 lambda = lambdas[1];
60433 assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
60434 }
60435 }
60436
60437 // Get basis vectors, used for balanced length-two representation
60438 var basis;
60439 if (conf.basis) {
60440 basis = conf.basis.map(function(vec) {
60441 return {
60442 a: new BN(vec.a, 16),
60443 b: new BN(vec.b, 16)
60444 };
60445 });
60446 } else {
60447 basis = this._getEndoBasis(lambda);
60448 }
60449
60450 return {
60451 beta: beta,
60452 lambda: lambda,
60453 basis: basis
60454 };
60455};
60456
60457ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
60458 // Find roots of for x^2 + x + 1 in F
60459 // Root = (-1 +- Sqrt(-3)) / 2
60460 //
60461 var red = num === this.p ? this.red : BN.mont(num);
60462 var tinv = new BN(2).toRed(red).redInvm();
60463 var ntinv = tinv.redNeg();
60464
60465 var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
60466
60467 var l1 = ntinv.redAdd(s).fromRed();
60468 var l2 = ntinv.redSub(s).fromRed();
60469 return [ l1, l2 ];
60470};
60471
60472ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
60473 // aprxSqrt >= sqrt(this.n)
60474 var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
60475
60476 // 3.74
60477 // Run EGCD, until r(L + 1) < aprxSqrt
60478 var u = lambda;
60479 var v = this.n.clone();
60480 var x1 = new BN(1);
60481 var y1 = new BN(0);
60482 var x2 = new BN(0);
60483 var y2 = new BN(1);
60484
60485 // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
60486 var a0;
60487 var b0;
60488 // First vector
60489 var a1;
60490 var b1;
60491 // Second vector
60492 var a2;
60493 var b2;
60494
60495 var prevR;
60496 var i = 0;
60497 var r;
60498 var x;
60499 while (u.cmpn(0) !== 0) {
60500 var q = v.div(u);
60501 r = v.sub(q.mul(u));
60502 x = x2.sub(q.mul(x1));
60503 var y = y2.sub(q.mul(y1));
60504
60505 if (!a1 && r.cmp(aprxSqrt) < 0) {
60506 a0 = prevR.neg();
60507 b0 = x1;
60508 a1 = r.neg();
60509 b1 = x;
60510 } else if (a1 && ++i === 2) {
60511 break;
60512 }
60513 prevR = r;
60514
60515 v = u;
60516 u = r;
60517 x2 = x1;
60518 x1 = x;
60519 y2 = y1;
60520 y1 = y;
60521 }
60522 a2 = r.neg();
60523 b2 = x;
60524
60525 var len1 = a1.sqr().add(b1.sqr());
60526 var len2 = a2.sqr().add(b2.sqr());
60527 if (len2.cmp(len1) >= 0) {
60528 a2 = a0;
60529 b2 = b0;
60530 }
60531
60532 // Normalize signs
60533 if (a1.negative) {
60534 a1 = a1.neg();
60535 b1 = b1.neg();
60536 }
60537 if (a2.negative) {
60538 a2 = a2.neg();
60539 b2 = b2.neg();
60540 }
60541
60542 return [
60543 { a: a1, b: b1 },
60544 { a: a2, b: b2 }
60545 ];
60546};
60547
60548ShortCurve.prototype._endoSplit = function _endoSplit(k) {
60549 var basis = this.endo.basis;
60550 var v1 = basis[0];
60551 var v2 = basis[1];
60552
60553 var c1 = v2.b.mul(k).divRound(this.n);
60554 var c2 = v1.b.neg().mul(k).divRound(this.n);
60555
60556 var p1 = c1.mul(v1.a);
60557 var p2 = c2.mul(v2.a);
60558 var q1 = c1.mul(v1.b);
60559 var q2 = c2.mul(v2.b);
60560
60561 // Calculate answer
60562 var k1 = k.sub(p1).sub(p2);
60563 var k2 = q1.add(q2).neg();
60564 return { k1: k1, k2: k2 };
60565};
60566
60567ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
60568 x = new BN(x, 16);
60569 if (!x.red)
60570 x = x.toRed(this.red);
60571
60572 var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
60573 var y = y2.redSqrt();
60574 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
60575 throw new Error('invalid point');
60576
60577 // XXX Is there any way to tell if the number is odd without converting it
60578 // to non-red form?
60579 var isOdd = y.fromRed().isOdd();
60580 if (odd && !isOdd || !odd && isOdd)
60581 y = y.redNeg();
60582
60583 return this.point(x, y);
60584};
60585
60586ShortCurve.prototype.validate = function validate(point) {
60587 if (point.inf)
60588 return true;
60589
60590 var x = point.x;
60591 var y = point.y;
60592
60593 var ax = this.a.redMul(x);
60594 var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
60595 return y.redSqr().redISub(rhs).cmpn(0) === 0;
60596};
60597
60598ShortCurve.prototype._endoWnafMulAdd =
60599 function _endoWnafMulAdd(points, coeffs, jacobianResult) {
60600 var npoints = this._endoWnafT1;
60601 var ncoeffs = this._endoWnafT2;
60602 for (var i = 0; i < points.length; i++) {
60603 var split = this._endoSplit(coeffs[i]);
60604 var p = points[i];
60605 var beta = p._getBeta();
60606
60607 if (split.k1.negative) {
60608 split.k1.ineg();
60609 p = p.neg(true);
60610 }
60611 if (split.k2.negative) {
60612 split.k2.ineg();
60613 beta = beta.neg(true);
60614 }
60615
60616 npoints[i * 2] = p;
60617 npoints[i * 2 + 1] = beta;
60618 ncoeffs[i * 2] = split.k1;
60619 ncoeffs[i * 2 + 1] = split.k2;
60620 }
60621 var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
60622
60623 // Clean-up references to points and coefficients
60624 for (var j = 0; j < i * 2; j++) {
60625 npoints[j] = null;
60626 ncoeffs[j] = null;
60627 }
60628 return res;
60629};
60630
60631function Point(curve, x, y, isRed) {
60632 Base.BasePoint.call(this, curve, 'affine');
60633 if (x === null && y === null) {
60634 this.x = null;
60635 this.y = null;
60636 this.inf = true;
60637 } else {
60638 this.x = new BN(x, 16);
60639 this.y = new BN(y, 16);
60640 // Force redgomery representation when loading from JSON
60641 if (isRed) {
60642 this.x.forceRed(this.curve.red);
60643 this.y.forceRed(this.curve.red);
60644 }
60645 if (!this.x.red)
60646 this.x = this.x.toRed(this.curve.red);
60647 if (!this.y.red)
60648 this.y = this.y.toRed(this.curve.red);
60649 this.inf = false;
60650 }
60651}
60652inherits(Point, Base.BasePoint);
60653
60654ShortCurve.prototype.point = function point(x, y, isRed) {
60655 return new Point(this, x, y, isRed);
60656};
60657
60658ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
60659 return Point.fromJSON(this, obj, red);
60660};
60661
60662Point.prototype._getBeta = function _getBeta() {
60663 if (!this.curve.endo)
60664 return;
60665
60666 var pre = this.precomputed;
60667 if (pre && pre.beta)
60668 return pre.beta;
60669
60670 var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
60671 if (pre) {
60672 var curve = this.curve;
60673 var endoMul = function(p) {
60674 return curve.point(p.x.redMul(curve.endo.beta), p.y);
60675 };
60676 pre.beta = beta;
60677 beta.precomputed = {
60678 beta: null,
60679 naf: pre.naf && {
60680 wnd: pre.naf.wnd,
60681 points: pre.naf.points.map(endoMul)
60682 },
60683 doubles: pre.doubles && {
60684 step: pre.doubles.step,
60685 points: pre.doubles.points.map(endoMul)
60686 }
60687 };
60688 }
60689 return beta;
60690};
60691
60692Point.prototype.toJSON = function toJSON() {
60693 if (!this.precomputed)
60694 return [ this.x, this.y ];
60695
60696 return [ this.x, this.y, this.precomputed && {
60697 doubles: this.precomputed.doubles && {
60698 step: this.precomputed.doubles.step,
60699 points: this.precomputed.doubles.points.slice(1)
60700 },
60701 naf: this.precomputed.naf && {
60702 wnd: this.precomputed.naf.wnd,
60703 points: this.precomputed.naf.points.slice(1)
60704 }
60705 } ];
60706};
60707
60708Point.fromJSON = function fromJSON(curve, obj, red) {
60709 if (typeof obj === 'string')
60710 obj = JSON.parse(obj);
60711 var res = curve.point(obj[0], obj[1], red);
60712 if (!obj[2])
60713 return res;
60714
60715 function obj2point(obj) {
60716 return curve.point(obj[0], obj[1], red);
60717 }
60718
60719 var pre = obj[2];
60720 res.precomputed = {
60721 beta: null,
60722 doubles: pre.doubles && {
60723 step: pre.doubles.step,
60724 points: [ res ].concat(pre.doubles.points.map(obj2point))
60725 },
60726 naf: pre.naf && {
60727 wnd: pre.naf.wnd,
60728 points: [ res ].concat(pre.naf.points.map(obj2point))
60729 }
60730 };
60731 return res;
60732};
60733
60734Point.prototype.inspect = function inspect() {
60735 if (this.isInfinity())
60736 return '<EC Point Infinity>';
60737 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
60738 ' y: ' + this.y.fromRed().toString(16, 2) + '>';
60739};
60740
60741Point.prototype.isInfinity = function isInfinity() {
60742 return this.inf;
60743};
60744
60745Point.prototype.add = function add(p) {
60746 // O + P = P
60747 if (this.inf)
60748 return p;
60749
60750 // P + O = P
60751 if (p.inf)
60752 return this;
60753
60754 // P + P = 2P
60755 if (this.eq(p))
60756 return this.dbl();
60757
60758 // P + (-P) = O
60759 if (this.neg().eq(p))
60760 return this.curve.point(null, null);
60761
60762 // P + Q = O
60763 if (this.x.cmp(p.x) === 0)
60764 return this.curve.point(null, null);
60765
60766 var c = this.y.redSub(p.y);
60767 if (c.cmpn(0) !== 0)
60768 c = c.redMul(this.x.redSub(p.x).redInvm());
60769 var nx = c.redSqr().redISub(this.x).redISub(p.x);
60770 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
60771 return this.curve.point(nx, ny);
60772};
60773
60774Point.prototype.dbl = function dbl() {
60775 if (this.inf)
60776 return this;
60777
60778 // 2P = O
60779 var ys1 = this.y.redAdd(this.y);
60780 if (ys1.cmpn(0) === 0)
60781 return this.curve.point(null, null);
60782
60783 var a = this.curve.a;
60784
60785 var x2 = this.x.redSqr();
60786 var dyinv = ys1.redInvm();
60787 var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
60788
60789 var nx = c.redSqr().redISub(this.x.redAdd(this.x));
60790 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
60791 return this.curve.point(nx, ny);
60792};
60793
60794Point.prototype.getX = function getX() {
60795 return this.x.fromRed();
60796};
60797
60798Point.prototype.getY = function getY() {
60799 return this.y.fromRed();
60800};
60801
60802Point.prototype.mul = function mul(k) {
60803 k = new BN(k, 16);
60804
60805 if (this._hasDoubles(k))
60806 return this.curve._fixedNafMul(this, k);
60807 else if (this.curve.endo)
60808 return this.curve._endoWnafMulAdd([ this ], [ k ]);
60809 else
60810 return this.curve._wnafMul(this, k);
60811};
60812
60813Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
60814 var points = [ this, p2 ];
60815 var coeffs = [ k1, k2 ];
60816 if (this.curve.endo)
60817 return this.curve._endoWnafMulAdd(points, coeffs);
60818 else
60819 return this.curve._wnafMulAdd(1, points, coeffs, 2);
60820};
60821
60822Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
60823 var points = [ this, p2 ];
60824 var coeffs = [ k1, k2 ];
60825 if (this.curve.endo)
60826 return this.curve._endoWnafMulAdd(points, coeffs, true);
60827 else
60828 return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
60829};
60830
60831Point.prototype.eq = function eq(p) {
60832 return this === p ||
60833 this.inf === p.inf &&
60834 (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
60835};
60836
60837Point.prototype.neg = function neg(_precompute) {
60838 if (this.inf)
60839 return this;
60840
60841 var res = this.curve.point(this.x, this.y.redNeg());
60842 if (_precompute && this.precomputed) {
60843 var pre = this.precomputed;
60844 var negate = function(p) {
60845 return p.neg();
60846 };
60847 res.precomputed = {
60848 naf: pre.naf && {
60849 wnd: pre.naf.wnd,
60850 points: pre.naf.points.map(negate)
60851 },
60852 doubles: pre.doubles && {
60853 step: pre.doubles.step,
60854 points: pre.doubles.points.map(negate)
60855 }
60856 };
60857 }
60858 return res;
60859};
60860
60861Point.prototype.toJ = function toJ() {
60862 if (this.inf)
60863 return this.curve.jpoint(null, null, null);
60864
60865 var res = this.curve.jpoint(this.x, this.y, this.curve.one);
60866 return res;
60867};
60868
60869function JPoint(curve, x, y, z) {
60870 Base.BasePoint.call(this, curve, 'jacobian');
60871 if (x === null && y === null && z === null) {
60872 this.x = this.curve.one;
60873 this.y = this.curve.one;
60874 this.z = new BN(0);
60875 } else {
60876 this.x = new BN(x, 16);
60877 this.y = new BN(y, 16);
60878 this.z = new BN(z, 16);
60879 }
60880 if (!this.x.red)
60881 this.x = this.x.toRed(this.curve.red);
60882 if (!this.y.red)
60883 this.y = this.y.toRed(this.curve.red);
60884 if (!this.z.red)
60885 this.z = this.z.toRed(this.curve.red);
60886
60887 this.zOne = this.z === this.curve.one;
60888}
60889inherits(JPoint, Base.BasePoint);
60890
60891ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
60892 return new JPoint(this, x, y, z);
60893};
60894
60895JPoint.prototype.toP = function toP() {
60896 if (this.isInfinity())
60897 return this.curve.point(null, null);
60898
60899 var zinv = this.z.redInvm();
60900 var zinv2 = zinv.redSqr();
60901 var ax = this.x.redMul(zinv2);
60902 var ay = this.y.redMul(zinv2).redMul(zinv);
60903
60904 return this.curve.point(ax, ay);
60905};
60906
60907JPoint.prototype.neg = function neg() {
60908 return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
60909};
60910
60911JPoint.prototype.add = function add(p) {
60912 // O + P = P
60913 if (this.isInfinity())
60914 return p;
60915
60916 // P + O = P
60917 if (p.isInfinity())
60918 return this;
60919
60920 // 12M + 4S + 7A
60921 var pz2 = p.z.redSqr();
60922 var z2 = this.z.redSqr();
60923 var u1 = this.x.redMul(pz2);
60924 var u2 = p.x.redMul(z2);
60925 var s1 = this.y.redMul(pz2.redMul(p.z));
60926 var s2 = p.y.redMul(z2.redMul(this.z));
60927
60928 var h = u1.redSub(u2);
60929 var r = s1.redSub(s2);
60930 if (h.cmpn(0) === 0) {
60931 if (r.cmpn(0) !== 0)
60932 return this.curve.jpoint(null, null, null);
60933 else
60934 return this.dbl();
60935 }
60936
60937 var h2 = h.redSqr();
60938 var h3 = h2.redMul(h);
60939 var v = u1.redMul(h2);
60940
60941 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
60942 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
60943 var nz = this.z.redMul(p.z).redMul(h);
60944
60945 return this.curve.jpoint(nx, ny, nz);
60946};
60947
60948JPoint.prototype.mixedAdd = function mixedAdd(p) {
60949 // O + P = P
60950 if (this.isInfinity())
60951 return p.toJ();
60952
60953 // P + O = P
60954 if (p.isInfinity())
60955 return this;
60956
60957 // 8M + 3S + 7A
60958 var z2 = this.z.redSqr();
60959 var u1 = this.x;
60960 var u2 = p.x.redMul(z2);
60961 var s1 = this.y;
60962 var s2 = p.y.redMul(z2).redMul(this.z);
60963
60964 var h = u1.redSub(u2);
60965 var r = s1.redSub(s2);
60966 if (h.cmpn(0) === 0) {
60967 if (r.cmpn(0) !== 0)
60968 return this.curve.jpoint(null, null, null);
60969 else
60970 return this.dbl();
60971 }
60972
60973 var h2 = h.redSqr();
60974 var h3 = h2.redMul(h);
60975 var v = u1.redMul(h2);
60976
60977 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
60978 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
60979 var nz = this.z.redMul(h);
60980
60981 return this.curve.jpoint(nx, ny, nz);
60982};
60983
60984JPoint.prototype.dblp = function dblp(pow) {
60985 if (pow === 0)
60986 return this;
60987 if (this.isInfinity())
60988 return this;
60989 if (!pow)
60990 return this.dbl();
60991
60992 if (this.curve.zeroA || this.curve.threeA) {
60993 var r = this;
60994 for (var i = 0; i < pow; i++)
60995 r = r.dbl();
60996 return r;
60997 }
60998
60999 // 1M + 2S + 1A + N * (4S + 5M + 8A)
61000 // N = 1 => 6M + 6S + 9A
61001 var a = this.curve.a;
61002 var tinv = this.curve.tinv;
61003
61004 var jx = this.x;
61005 var jy = this.y;
61006 var jz = this.z;
61007 var jz4 = jz.redSqr().redSqr();
61008
61009 // Reuse results
61010 var jyd = jy.redAdd(jy);
61011 for (var i = 0; i < pow; i++) {
61012 var jx2 = jx.redSqr();
61013 var jyd2 = jyd.redSqr();
61014 var jyd4 = jyd2.redSqr();
61015 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
61016
61017 var t1 = jx.redMul(jyd2);
61018 var nx = c.redSqr().redISub(t1.redAdd(t1));
61019 var t2 = t1.redISub(nx);
61020 var dny = c.redMul(t2);
61021 dny = dny.redIAdd(dny).redISub(jyd4);
61022 var nz = jyd.redMul(jz);
61023 if (i + 1 < pow)
61024 jz4 = jz4.redMul(jyd4);
61025
61026 jx = nx;
61027 jz = nz;
61028 jyd = dny;
61029 }
61030
61031 return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
61032};
61033
61034JPoint.prototype.dbl = function dbl() {
61035 if (this.isInfinity())
61036 return this;
61037
61038 if (this.curve.zeroA)
61039 return this._zeroDbl();
61040 else if (this.curve.threeA)
61041 return this._threeDbl();
61042 else
61043 return this._dbl();
61044};
61045
61046JPoint.prototype._zeroDbl = function _zeroDbl() {
61047 var nx;
61048 var ny;
61049 var nz;
61050 // Z = 1
61051 if (this.zOne) {
61052 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
61053 // #doubling-mdbl-2007-bl
61054 // 1M + 5S + 14A
61055
61056 // XX = X1^2
61057 var xx = this.x.redSqr();
61058 // YY = Y1^2
61059 var yy = this.y.redSqr();
61060 // YYYY = YY^2
61061 var yyyy = yy.redSqr();
61062 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
61063 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
61064 s = s.redIAdd(s);
61065 // M = 3 * XX + a; a = 0
61066 var m = xx.redAdd(xx).redIAdd(xx);
61067 // T = M ^ 2 - 2*S
61068 var t = m.redSqr().redISub(s).redISub(s);
61069
61070 // 8 * YYYY
61071 var yyyy8 = yyyy.redIAdd(yyyy);
61072 yyyy8 = yyyy8.redIAdd(yyyy8);
61073 yyyy8 = yyyy8.redIAdd(yyyy8);
61074
61075 // X3 = T
61076 nx = t;
61077 // Y3 = M * (S - T) - 8 * YYYY
61078 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
61079 // Z3 = 2*Y1
61080 nz = this.y.redAdd(this.y);
61081 } else {
61082 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
61083 // #doubling-dbl-2009-l
61084 // 2M + 5S + 13A
61085
61086 // A = X1^2
61087 var a = this.x.redSqr();
61088 // B = Y1^2
61089 var b = this.y.redSqr();
61090 // C = B^2
61091 var c = b.redSqr();
61092 // D = 2 * ((X1 + B)^2 - A - C)
61093 var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
61094 d = d.redIAdd(d);
61095 // E = 3 * A
61096 var e = a.redAdd(a).redIAdd(a);
61097 // F = E^2
61098 var f = e.redSqr();
61099
61100 // 8 * C
61101 var c8 = c.redIAdd(c);
61102 c8 = c8.redIAdd(c8);
61103 c8 = c8.redIAdd(c8);
61104
61105 // X3 = F - 2 * D
61106 nx = f.redISub(d).redISub(d);
61107 // Y3 = E * (D - X3) - 8 * C
61108 ny = e.redMul(d.redISub(nx)).redISub(c8);
61109 // Z3 = 2 * Y1 * Z1
61110 nz = this.y.redMul(this.z);
61111 nz = nz.redIAdd(nz);
61112 }
61113
61114 return this.curve.jpoint(nx, ny, nz);
61115};
61116
61117JPoint.prototype._threeDbl = function _threeDbl() {
61118 var nx;
61119 var ny;
61120 var nz;
61121 // Z = 1
61122 if (this.zOne) {
61123 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
61124 // #doubling-mdbl-2007-bl
61125 // 1M + 5S + 15A
61126
61127 // XX = X1^2
61128 var xx = this.x.redSqr();
61129 // YY = Y1^2
61130 var yy = this.y.redSqr();
61131 // YYYY = YY^2
61132 var yyyy = yy.redSqr();
61133 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
61134 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
61135 s = s.redIAdd(s);
61136 // M = 3 * XX + a
61137 var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
61138 // T = M^2 - 2 * S
61139 var t = m.redSqr().redISub(s).redISub(s);
61140 // X3 = T
61141 nx = t;
61142 // Y3 = M * (S - T) - 8 * YYYY
61143 var yyyy8 = yyyy.redIAdd(yyyy);
61144 yyyy8 = yyyy8.redIAdd(yyyy8);
61145 yyyy8 = yyyy8.redIAdd(yyyy8);
61146 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
61147 // Z3 = 2 * Y1
61148 nz = this.y.redAdd(this.y);
61149 } else {
61150 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
61151 // 3M + 5S
61152
61153 // delta = Z1^2
61154 var delta = this.z.redSqr();
61155 // gamma = Y1^2
61156 var gamma = this.y.redSqr();
61157 // beta = X1 * gamma
61158 var beta = this.x.redMul(gamma);
61159 // alpha = 3 * (X1 - delta) * (X1 + delta)
61160 var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
61161 alpha = alpha.redAdd(alpha).redIAdd(alpha);
61162 // X3 = alpha^2 - 8 * beta
61163 var beta4 = beta.redIAdd(beta);
61164 beta4 = beta4.redIAdd(beta4);
61165 var beta8 = beta4.redAdd(beta4);
61166 nx = alpha.redSqr().redISub(beta8);
61167 // Z3 = (Y1 + Z1)^2 - gamma - delta
61168 nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
61169 // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
61170 var ggamma8 = gamma.redSqr();
61171 ggamma8 = ggamma8.redIAdd(ggamma8);
61172 ggamma8 = ggamma8.redIAdd(ggamma8);
61173 ggamma8 = ggamma8.redIAdd(ggamma8);
61174 ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
61175 }
61176
61177 return this.curve.jpoint(nx, ny, nz);
61178};
61179
61180JPoint.prototype._dbl = function _dbl() {
61181 var a = this.curve.a;
61182
61183 // 4M + 6S + 10A
61184 var jx = this.x;
61185 var jy = this.y;
61186 var jz = this.z;
61187 var jz4 = jz.redSqr().redSqr();
61188
61189 var jx2 = jx.redSqr();
61190 var jy2 = jy.redSqr();
61191
61192 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
61193
61194 var jxd4 = jx.redAdd(jx);
61195 jxd4 = jxd4.redIAdd(jxd4);
61196 var t1 = jxd4.redMul(jy2);
61197 var nx = c.redSqr().redISub(t1.redAdd(t1));
61198 var t2 = t1.redISub(nx);
61199
61200 var jyd8 = jy2.redSqr();
61201 jyd8 = jyd8.redIAdd(jyd8);
61202 jyd8 = jyd8.redIAdd(jyd8);
61203 jyd8 = jyd8.redIAdd(jyd8);
61204 var ny = c.redMul(t2).redISub(jyd8);
61205 var nz = jy.redAdd(jy).redMul(jz);
61206
61207 return this.curve.jpoint(nx, ny, nz);
61208};
61209
61210JPoint.prototype.trpl = function trpl() {
61211 if (!this.curve.zeroA)
61212 return this.dbl().add(this);
61213
61214 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
61215 // 5M + 10S + ...
61216
61217 // XX = X1^2
61218 var xx = this.x.redSqr();
61219 // YY = Y1^2
61220 var yy = this.y.redSqr();
61221 // ZZ = Z1^2
61222 var zz = this.z.redSqr();
61223 // YYYY = YY^2
61224 var yyyy = yy.redSqr();
61225 // M = 3 * XX + a * ZZ2; a = 0
61226 var m = xx.redAdd(xx).redIAdd(xx);
61227 // MM = M^2
61228 var mm = m.redSqr();
61229 // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
61230 var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
61231 e = e.redIAdd(e);
61232 e = e.redAdd(e).redIAdd(e);
61233 e = e.redISub(mm);
61234 // EE = E^2
61235 var ee = e.redSqr();
61236 // T = 16*YYYY
61237 var t = yyyy.redIAdd(yyyy);
61238 t = t.redIAdd(t);
61239 t = t.redIAdd(t);
61240 t = t.redIAdd(t);
61241 // U = (M + E)^2 - MM - EE - T
61242 var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
61243 // X3 = 4 * (X1 * EE - 4 * YY * U)
61244 var yyu4 = yy.redMul(u);
61245 yyu4 = yyu4.redIAdd(yyu4);
61246 yyu4 = yyu4.redIAdd(yyu4);
61247 var nx = this.x.redMul(ee).redISub(yyu4);
61248 nx = nx.redIAdd(nx);
61249 nx = nx.redIAdd(nx);
61250 // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
61251 var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
61252 ny = ny.redIAdd(ny);
61253 ny = ny.redIAdd(ny);
61254 ny = ny.redIAdd(ny);
61255 // Z3 = (Z1 + E)^2 - ZZ - EE
61256 var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
61257
61258 return this.curve.jpoint(nx, ny, nz);
61259};
61260
61261JPoint.prototype.mul = function mul(k, kbase) {
61262 k = new BN(k, kbase);
61263
61264 return this.curve._wnafMul(this, k);
61265};
61266
61267JPoint.prototype.eq = function eq(p) {
61268 if (p.type === 'affine')
61269 return this.eq(p.toJ());
61270
61271 if (this === p)
61272 return true;
61273
61274 // x1 * z2^2 == x2 * z1^2
61275 var z2 = this.z.redSqr();
61276 var pz2 = p.z.redSqr();
61277 if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
61278 return false;
61279
61280 // y1 * z2^3 == y2 * z1^3
61281 var z3 = z2.redMul(this.z);
61282 var pz3 = pz2.redMul(p.z);
61283 return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
61284};
61285
61286JPoint.prototype.eqXToP = function eqXToP(x) {
61287 var zs = this.z.redSqr();
61288 var rx = x.toRed(this.curve.red).redMul(zs);
61289 if (this.x.cmp(rx) === 0)
61290 return true;
61291
61292 var xc = x.clone();
61293 var t = this.curve.redN.redMul(zs);
61294 for (;;) {
61295 xc.iadd(this.curve.n);
61296 if (xc.cmp(this.curve.p) >= 0)
61297 return false;
61298
61299 rx.redIAdd(t);
61300 if (this.x.cmp(rx) === 0)
61301 return true;
61302 }
61303 return false;
61304};
61305
61306JPoint.prototype.inspect = function inspect() {
61307 if (this.isInfinity())
61308 return '<EC JPoint Infinity>';
61309 return '<EC JPoint x: ' + this.x.toString(16, 2) +
61310 ' y: ' + this.y.toString(16, 2) +
61311 ' z: ' + this.z.toString(16, 2) + '>';
61312};
61313
61314JPoint.prototype.isInfinity = function isInfinity() {
61315 // XXX This code assumes that zero is always zero in red
61316 return this.z.cmpn(0) === 0;
61317};
61318
61319},{"../../elliptic":317,"../curve":320,"bn.js":108,"inherits":396}],323:[function(require,module,exports){
61320'use strict';
61321
61322var curves = exports;
61323
61324var hash = require('hash.js');
61325var elliptic = require('../elliptic');
61326
61327var assert = elliptic.utils.assert;
61328
61329function PresetCurve(options) {
61330 if (options.type === 'short')
61331 this.curve = new elliptic.curve.short(options);
61332 else if (options.type === 'edwards')
61333 this.curve = new elliptic.curve.edwards(options);
61334 else
61335 this.curve = new elliptic.curve.mont(options);
61336 this.g = this.curve.g;
61337 this.n = this.curve.n;
61338 this.hash = options.hash;
61339
61340 assert(this.g.validate(), 'Invalid curve');
61341 assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
61342}
61343curves.PresetCurve = PresetCurve;
61344
61345function defineCurve(name, options) {
61346 Object.defineProperty(curves, name, {
61347 configurable: true,
61348 enumerable: true,
61349 get: function() {
61350 var curve = new PresetCurve(options);
61351 Object.defineProperty(curves, name, {
61352 configurable: true,
61353 enumerable: true,
61354 value: curve
61355 });
61356 return curve;
61357 }
61358 });
61359}
61360
61361defineCurve('p192', {
61362 type: 'short',
61363 prime: 'p192',
61364 p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
61365 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
61366 b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
61367 n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
61368 hash: hash.sha256,
61369 gRed: false,
61370 g: [
61371 '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
61372 '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
61373 ]
61374});
61375
61376defineCurve('p224', {
61377 type: 'short',
61378 prime: 'p224',
61379 p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
61380 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
61381 b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
61382 n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
61383 hash: hash.sha256,
61384 gRed: false,
61385 g: [
61386 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
61387 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
61388 ]
61389});
61390
61391defineCurve('p256', {
61392 type: 'short',
61393 prime: null,
61394 p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
61395 a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
61396 b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
61397 n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
61398 hash: hash.sha256,
61399 gRed: false,
61400 g: [
61401 '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
61402 '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
61403 ]
61404});
61405
61406defineCurve('p384', {
61407 type: 'short',
61408 prime: null,
61409 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61410 'fffffffe ffffffff 00000000 00000000 ffffffff',
61411 a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61412 'fffffffe ffffffff 00000000 00000000 fffffffc',
61413 b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
61414 '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
61415 n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
61416 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
61417 hash: hash.sha384,
61418 gRed: false,
61419 g: [
61420 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
61421 '5502f25d bf55296c 3a545e38 72760ab7',
61422 '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
61423 '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
61424 ]
61425});
61426
61427defineCurve('p521', {
61428 type: 'short',
61429 prime: null,
61430 p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61431 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61432 'ffffffff ffffffff ffffffff ffffffff ffffffff',
61433 a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61434 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61435 'ffffffff ffffffff ffffffff ffffffff fffffffc',
61436 b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
61437 '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
61438 '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
61439 n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
61440 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
61441 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
61442 hash: hash.sha512,
61443 gRed: false,
61444 g: [
61445 '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
61446 '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
61447 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
61448 '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
61449 '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
61450 '3fad0761 353c7086 a272c240 88be9476 9fd16650'
61451 ]
61452});
61453
61454defineCurve('curve25519', {
61455 type: 'mont',
61456 prime: 'p25519',
61457 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
61458 a: '76d06',
61459 b: '1',
61460 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
61461 hash: hash.sha256,
61462 gRed: false,
61463 g: [
61464 '9'
61465 ]
61466});
61467
61468defineCurve('ed25519', {
61469 type: 'edwards',
61470 prime: 'p25519',
61471 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
61472 a: '-1',
61473 c: '1',
61474 // -121665 * (121666^(-1)) (mod P)
61475 d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
61476 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
61477 hash: hash.sha256,
61478 gRed: false,
61479 g: [
61480 '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
61481
61482 // 4/5
61483 '6666666666666666666666666666666666666666666666666666666666666658'
61484 ]
61485});
61486
61487var pre;
61488try {
61489 pre = require('./precomputed/secp256k1');
61490} catch (e) {
61491 pre = undefined;
61492}
61493
61494defineCurve('secp256k1', {
61495 type: 'short',
61496 prime: 'k256',
61497 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
61498 a: '0',
61499 b: '7',
61500 n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
61501 h: '1',
61502 hash: hash.sha256,
61503
61504 // Precomputed endomorphism
61505 beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
61506 lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
61507 basis: [
61508 {
61509 a: '3086d221a7d46bcde86c90e49284eb15',
61510 b: '-e4437ed6010e88286f547fa90abfe4c3'
61511 },
61512 {
61513 a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
61514 b: '3086d221a7d46bcde86c90e49284eb15'
61515 }
61516 ],
61517
61518 gRed: false,
61519 g: [
61520 '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
61521 '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
61522 pre
61523 ]
61524});
61525
61526},{"../elliptic":317,"./precomputed/secp256k1":330,"hash.js":381}],324:[function(require,module,exports){
61527'use strict';
61528
61529var BN = require('bn.js');
61530var HmacDRBG = require('hmac-drbg');
61531var elliptic = require('../../elliptic');
61532var utils = elliptic.utils;
61533var assert = utils.assert;
61534
61535var KeyPair = require('./key');
61536var Signature = require('./signature');
61537
61538function EC(options) {
61539 if (!(this instanceof EC))
61540 return new EC(options);
61541
61542 // Shortcut `elliptic.ec(curve-name)`
61543 if (typeof options === 'string') {
61544 assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);
61545
61546 options = elliptic.curves[options];
61547 }
61548
61549 // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
61550 if (options instanceof elliptic.curves.PresetCurve)
61551 options = { curve: options };
61552
61553 this.curve = options.curve.curve;
61554 this.n = this.curve.n;
61555 this.nh = this.n.ushrn(1);
61556 this.g = this.curve.g;
61557
61558 // Point on curve
61559 this.g = options.curve.g;
61560 this.g.precompute(options.curve.n.bitLength() + 1);
61561
61562 // Hash for function for DRBG
61563 this.hash = options.hash || options.curve.hash;
61564}
61565module.exports = EC;
61566
61567EC.prototype.keyPair = function keyPair(options) {
61568 return new KeyPair(this, options);
61569};
61570
61571EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
61572 return KeyPair.fromPrivate(this, priv, enc);
61573};
61574
61575EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
61576 return KeyPair.fromPublic(this, pub, enc);
61577};
61578
61579EC.prototype.genKeyPair = function genKeyPair(options) {
61580 if (!options)
61581 options = {};
61582
61583 // Instantiate Hmac_DRBG
61584 var drbg = new HmacDRBG({
61585 hash: this.hash,
61586 pers: options.pers,
61587 persEnc: options.persEnc || 'utf8',
61588 entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
61589 entropyEnc: options.entropy && options.entropyEnc || 'utf8',
61590 nonce: this.n.toArray()
61591 });
61592
61593 var bytes = this.n.byteLength();
61594 var ns2 = this.n.sub(new BN(2));
61595 do {
61596 var priv = new BN(drbg.generate(bytes));
61597 if (priv.cmp(ns2) > 0)
61598 continue;
61599
61600 priv.iaddn(1);
61601 return this.keyFromPrivate(priv);
61602 } while (true);
61603};
61604
61605EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
61606 var delta = msg.byteLength() * 8 - this.n.bitLength();
61607 if (delta > 0)
61608 msg = msg.ushrn(delta);
61609 if (!truncOnly && msg.cmp(this.n) >= 0)
61610 return msg.sub(this.n);
61611 else
61612 return msg;
61613};
61614
61615EC.prototype.sign = function sign(msg, key, enc, options) {
61616 if (typeof enc === 'object') {
61617 options = enc;
61618 enc = null;
61619 }
61620 if (!options)
61621 options = {};
61622
61623 key = this.keyFromPrivate(key, enc);
61624 msg = this._truncateToN(new BN(msg, 16));
61625
61626 // Zero-extend key to provide enough entropy
61627 var bytes = this.n.byteLength();
61628 var bkey = key.getPrivate().toArray('be', bytes);
61629
61630 // Zero-extend nonce to have the same byte size as N
61631 var nonce = msg.toArray('be', bytes);
61632
61633 // Instantiate Hmac_DRBG
61634 var drbg = new HmacDRBG({
61635 hash: this.hash,
61636 entropy: bkey,
61637 nonce: nonce,
61638 pers: options.pers,
61639 persEnc: options.persEnc || 'utf8'
61640 });
61641
61642 // Number of bytes to generate
61643 var ns1 = this.n.sub(new BN(1));
61644
61645 for (var iter = 0; true; iter++) {
61646 var k = options.k ?
61647 options.k(iter) :
61648 new BN(drbg.generate(this.n.byteLength()));
61649 k = this._truncateToN(k, true);
61650 if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
61651 continue;
61652
61653 var kp = this.g.mul(k);
61654 if (kp.isInfinity())
61655 continue;
61656
61657 var kpX = kp.getX();
61658 var r = kpX.umod(this.n);
61659 if (r.cmpn(0) === 0)
61660 continue;
61661
61662 var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
61663 s = s.umod(this.n);
61664 if (s.cmpn(0) === 0)
61665 continue;
61666
61667 var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
61668 (kpX.cmp(r) !== 0 ? 2 : 0);
61669
61670 // Use complement of `s`, if it is > `n / 2`
61671 if (options.canonical && s.cmp(this.nh) > 0) {
61672 s = this.n.sub(s);
61673 recoveryParam ^= 1;
61674 }
61675
61676 return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
61677 }
61678};
61679
61680EC.prototype.verify = function verify(msg, signature, key, enc) {
61681 msg = this._truncateToN(new BN(msg, 16));
61682 key = this.keyFromPublic(key, enc);
61683 signature = new Signature(signature, 'hex');
61684
61685 // Perform primitive values validation
61686 var r = signature.r;
61687 var s = signature.s;
61688 if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
61689 return false;
61690 if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
61691 return false;
61692
61693 // Validate signature
61694 var sinv = s.invm(this.n);
61695 var u1 = sinv.mul(msg).umod(this.n);
61696 var u2 = sinv.mul(r).umod(this.n);
61697
61698 if (!this.curve._maxwellTrick) {
61699 var p = this.g.mulAdd(u1, key.getPublic(), u2);
61700 if (p.isInfinity())
61701 return false;
61702
61703 return p.getX().umod(this.n).cmp(r) === 0;
61704 }
61705
61706 // NOTE: Greg Maxwell's trick, inspired by:
61707 // https://git.io/vad3K
61708
61709 var p = this.g.jmulAdd(u1, key.getPublic(), u2);
61710 if (p.isInfinity())
61711 return false;
61712
61713 // Compare `p.x` of Jacobian point with `r`,
61714 // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
61715 // inverse of `p.z^2`
61716 return p.eqXToP(r);
61717};
61718
61719EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
61720 assert((3 & j) === j, 'The recovery param is more than two bits');
61721 signature = new Signature(signature, enc);
61722
61723 var n = this.n;
61724 var e = new BN(msg);
61725 var r = signature.r;
61726 var s = signature.s;
61727
61728 // A set LSB signifies that the y-coordinate is odd
61729 var isYOdd = j & 1;
61730 var isSecondKey = j >> 1;
61731 if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
61732 throw new Error('Unable to find sencond key candinate');
61733
61734 // 1.1. Let x = r + jn.
61735 if (isSecondKey)
61736 r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
61737 else
61738 r = this.curve.pointFromX(r, isYOdd);
61739
61740 var rInv = signature.r.invm(n);
61741 var s1 = n.sub(e).mul(rInv).umod(n);
61742 var s2 = s.mul(rInv).umod(n);
61743
61744 // 1.6.1 Compute Q = r^-1 (sR - eG)
61745 // Q = r^-1 (sR + -eG)
61746 return this.g.mulAdd(s1, r, s2);
61747};
61748
61749EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
61750 signature = new Signature(signature, enc);
61751 if (signature.recoveryParam !== null)
61752 return signature.recoveryParam;
61753
61754 for (var i = 0; i < 4; i++) {
61755 var Qprime;
61756 try {
61757 Qprime = this.recoverPubKey(e, signature, i);
61758 } catch (e) {
61759 continue;
61760 }
61761
61762 if (Qprime.eq(Q))
61763 return i;
61764 }
61765 throw new Error('Unable to find valid recovery factor');
61766};
61767
61768},{"../../elliptic":317,"./key":325,"./signature":326,"bn.js":108,"hmac-drbg":393}],325:[function(require,module,exports){
61769'use strict';
61770
61771var BN = require('bn.js');
61772var elliptic = require('../../elliptic');
61773var utils = elliptic.utils;
61774var assert = utils.assert;
61775
61776function KeyPair(ec, options) {
61777 this.ec = ec;
61778 this.priv = null;
61779 this.pub = null;
61780
61781 // KeyPair(ec, { priv: ..., pub: ... })
61782 if (options.priv)
61783 this._importPrivate(options.priv, options.privEnc);
61784 if (options.pub)
61785 this._importPublic(options.pub, options.pubEnc);
61786}
61787module.exports = KeyPair;
61788
61789KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
61790 if (pub instanceof KeyPair)
61791 return pub;
61792
61793 return new KeyPair(ec, {
61794 pub: pub,
61795 pubEnc: enc
61796 });
61797};
61798
61799KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
61800 if (priv instanceof KeyPair)
61801 return priv;
61802
61803 return new KeyPair(ec, {
61804 priv: priv,
61805 privEnc: enc
61806 });
61807};
61808
61809KeyPair.prototype.validate = function validate() {
61810 var pub = this.getPublic();
61811
61812 if (pub.isInfinity())
61813 return { result: false, reason: 'Invalid public key' };
61814 if (!pub.validate())
61815 return { result: false, reason: 'Public key is not a point' };
61816 if (!pub.mul(this.ec.curve.n).isInfinity())
61817 return { result: false, reason: 'Public key * N != O' };
61818
61819 return { result: true, reason: null };
61820};
61821
61822KeyPair.prototype.getPublic = function getPublic(compact, enc) {
61823 // compact is optional argument
61824 if (typeof compact === 'string') {
61825 enc = compact;
61826 compact = null;
61827 }
61828
61829 if (!this.pub)
61830 this.pub = this.ec.g.mul(this.priv);
61831
61832 if (!enc)
61833 return this.pub;
61834
61835 return this.pub.encode(enc, compact);
61836};
61837
61838KeyPair.prototype.getPrivate = function getPrivate(enc) {
61839 if (enc === 'hex')
61840 return this.priv.toString(16, 2);
61841 else
61842 return this.priv;
61843};
61844
61845KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
61846 this.priv = new BN(key, enc || 16);
61847
61848 // Ensure that the priv won't be bigger than n, otherwise we may fail
61849 // in fixed multiplication method
61850 this.priv = this.priv.umod(this.ec.curve.n);
61851};
61852
61853KeyPair.prototype._importPublic = function _importPublic(key, enc) {
61854 if (key.x || key.y) {
61855 // Montgomery points only have an `x` coordinate.
61856 // Weierstrass/Edwards points on the other hand have both `x` and
61857 // `y` coordinates.
61858 if (this.ec.curve.type === 'mont') {
61859 assert(key.x, 'Need x coordinate');
61860 } else if (this.ec.curve.type === 'short' ||
61861 this.ec.curve.type === 'edwards') {
61862 assert(key.x && key.y, 'Need both x and y coordinate');
61863 }
61864 this.pub = this.ec.curve.point(key.x, key.y);
61865 return;
61866 }
61867 this.pub = this.ec.curve.decodePoint(key, enc);
61868};
61869
61870// ECDH
61871KeyPair.prototype.derive = function derive(pub) {
61872 return pub.mul(this.priv).getX();
61873};
61874
61875// ECDSA
61876KeyPair.prototype.sign = function sign(msg, enc, options) {
61877 return this.ec.sign(msg, this, enc, options);
61878};
61879
61880KeyPair.prototype.verify = function verify(msg, signature) {
61881 return this.ec.verify(msg, signature, this);
61882};
61883
61884KeyPair.prototype.inspect = function inspect() {
61885 return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
61886 ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
61887};
61888
61889},{"../../elliptic":317,"bn.js":108}],326:[function(require,module,exports){
61890'use strict';
61891
61892var BN = require('bn.js');
61893
61894var elliptic = require('../../elliptic');
61895var utils = elliptic.utils;
61896var assert = utils.assert;
61897
61898function Signature(options, enc) {
61899 if (options instanceof Signature)
61900 return options;
61901
61902 if (this._importDER(options, enc))
61903 return;
61904
61905 assert(options.r && options.s, 'Signature without r or s');
61906 this.r = new BN(options.r, 16);
61907 this.s = new BN(options.s, 16);
61908 if (options.recoveryParam === undefined)
61909 this.recoveryParam = null;
61910 else
61911 this.recoveryParam = options.recoveryParam;
61912}
61913module.exports = Signature;
61914
61915function Position() {
61916 this.place = 0;
61917}
61918
61919function getLength(buf, p) {
61920 var initial = buf[p.place++];
61921 if (!(initial & 0x80)) {
61922 return initial;
61923 }
61924 var octetLen = initial & 0xf;
61925 var val = 0;
61926 for (var i = 0, off = p.place; i < octetLen; i++, off++) {
61927 val <<= 8;
61928 val |= buf[off];
61929 }
61930 p.place = off;
61931 return val;
61932}
61933
61934function rmPadding(buf) {
61935 var i = 0;
61936 var len = buf.length - 1;
61937 while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
61938 i++;
61939 }
61940 if (i === 0) {
61941 return buf;
61942 }
61943 return buf.slice(i);
61944}
61945
61946Signature.prototype._importDER = function _importDER(data, enc) {
61947 data = utils.toArray(data, enc);
61948 var p = new Position();
61949 if (data[p.place++] !== 0x30) {
61950 return false;
61951 }
61952 var len = getLength(data, p);
61953 if ((len + p.place) !== data.length) {
61954 return false;
61955 }
61956 if (data[p.place++] !== 0x02) {
61957 return false;
61958 }
61959 var rlen = getLength(data, p);
61960 var r = data.slice(p.place, rlen + p.place);
61961 p.place += rlen;
61962 if (data[p.place++] !== 0x02) {
61963 return false;
61964 }
61965 var slen = getLength(data, p);
61966 if (data.length !== slen + p.place) {
61967 return false;
61968 }
61969 var s = data.slice(p.place, slen + p.place);
61970 if (r[0] === 0 && (r[1] & 0x80)) {
61971 r = r.slice(1);
61972 }
61973 if (s[0] === 0 && (s[1] & 0x80)) {
61974 s = s.slice(1);
61975 }
61976
61977 this.r = new BN(r);
61978 this.s = new BN(s);
61979 this.recoveryParam = null;
61980
61981 return true;
61982};
61983
61984function constructLength(arr, len) {
61985 if (len < 0x80) {
61986 arr.push(len);
61987 return;
61988 }
61989 var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
61990 arr.push(octets | 0x80);
61991 while (--octets) {
61992 arr.push((len >>> (octets << 3)) & 0xff);
61993 }
61994 arr.push(len);
61995}
61996
61997Signature.prototype.toDER = function toDER(enc) {
61998 var r = this.r.toArray();
61999 var s = this.s.toArray();
62000
62001 // Pad values
62002 if (r[0] & 0x80)
62003 r = [ 0 ].concat(r);
62004 // Pad values
62005 if (s[0] & 0x80)
62006 s = [ 0 ].concat(s);
62007
62008 r = rmPadding(r);
62009 s = rmPadding(s);
62010
62011 while (!s[0] && !(s[1] & 0x80)) {
62012 s = s.slice(1);
62013 }
62014 var arr = [ 0x02 ];
62015 constructLength(arr, r.length);
62016 arr = arr.concat(r);
62017 arr.push(0x02);
62018 constructLength(arr, s.length);
62019 var backHalf = arr.concat(s);
62020 var res = [ 0x30 ];
62021 constructLength(res, backHalf.length);
62022 res = res.concat(backHalf);
62023 return utils.encode(res, enc);
62024};
62025
62026},{"../../elliptic":317,"bn.js":108}],327:[function(require,module,exports){
62027'use strict';
62028
62029var hash = require('hash.js');
62030var elliptic = require('../../elliptic');
62031var utils = elliptic.utils;
62032var assert = utils.assert;
62033var parseBytes = utils.parseBytes;
62034var KeyPair = require('./key');
62035var Signature = require('./signature');
62036
62037function EDDSA(curve) {
62038 assert(curve === 'ed25519', 'only tested with ed25519 so far');
62039
62040 if (!(this instanceof EDDSA))
62041 return new EDDSA(curve);
62042
62043 var curve = elliptic.curves[curve].curve;
62044 this.curve = curve;
62045 this.g = curve.g;
62046 this.g.precompute(curve.n.bitLength() + 1);
62047
62048 this.pointClass = curve.point().constructor;
62049 this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
62050 this.hash = hash.sha512;
62051}
62052
62053module.exports = EDDSA;
62054
62055/**
62056* @param {Array|String} message - message bytes
62057* @param {Array|String|KeyPair} secret - secret bytes or a keypair
62058* @returns {Signature} - signature
62059*/
62060EDDSA.prototype.sign = function sign(message, secret) {
62061 message = parseBytes(message);
62062 var key = this.keyFromSecret(secret);
62063 var r = this.hashInt(key.messagePrefix(), message);
62064 var R = this.g.mul(r);
62065 var Rencoded = this.encodePoint(R);
62066 var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
62067 .mul(key.priv());
62068 var S = r.add(s_).umod(this.curve.n);
62069 return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
62070};
62071
62072/**
62073* @param {Array} message - message bytes
62074* @param {Array|String|Signature} sig - sig bytes
62075* @param {Array|String|Point|KeyPair} pub - public key
62076* @returns {Boolean} - true if public key matches sig of message
62077*/
62078EDDSA.prototype.verify = function verify(message, sig, pub) {
62079 message = parseBytes(message);
62080 sig = this.makeSignature(sig);
62081 var key = this.keyFromPublic(pub);
62082 var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
62083 var SG = this.g.mul(sig.S());
62084 var RplusAh = sig.R().add(key.pub().mul(h));
62085 return RplusAh.eq(SG);
62086};
62087
62088EDDSA.prototype.hashInt = function hashInt() {
62089 var hash = this.hash();
62090 for (var i = 0; i < arguments.length; i++)
62091 hash.update(arguments[i]);
62092 return utils.intFromLE(hash.digest()).umod(this.curve.n);
62093};
62094
62095EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
62096 return KeyPair.fromPublic(this, pub);
62097};
62098
62099EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
62100 return KeyPair.fromSecret(this, secret);
62101};
62102
62103EDDSA.prototype.makeSignature = function makeSignature(sig) {
62104 if (sig instanceof Signature)
62105 return sig;
62106 return new Signature(this, sig);
62107};
62108
62109/**
62110* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
62111*
62112* EDDSA defines methods for encoding and decoding points and integers. These are
62113* helper convenience methods, that pass along to utility functions implied
62114* parameters.
62115*
62116*/
62117EDDSA.prototype.encodePoint = function encodePoint(point) {
62118 var enc = point.getY().toArray('le', this.encodingLength);
62119 enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
62120 return enc;
62121};
62122
62123EDDSA.prototype.decodePoint = function decodePoint(bytes) {
62124 bytes = utils.parseBytes(bytes);
62125
62126 var lastIx = bytes.length - 1;
62127 var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
62128 var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
62129
62130 var y = utils.intFromLE(normed);
62131 return this.curve.pointFromY(y, xIsOdd);
62132};
62133
62134EDDSA.prototype.encodeInt = function encodeInt(num) {
62135 return num.toArray('le', this.encodingLength);
62136};
62137
62138EDDSA.prototype.decodeInt = function decodeInt(bytes) {
62139 return utils.intFromLE(bytes);
62140};
62141
62142EDDSA.prototype.isPoint = function isPoint(val) {
62143 return val instanceof this.pointClass;
62144};
62145
62146},{"../../elliptic":317,"./key":328,"./signature":329,"hash.js":381}],328:[function(require,module,exports){
62147'use strict';
62148
62149var elliptic = require('../../elliptic');
62150var utils = elliptic.utils;
62151var assert = utils.assert;
62152var parseBytes = utils.parseBytes;
62153var cachedProperty = utils.cachedProperty;
62154
62155/**
62156* @param {EDDSA} eddsa - instance
62157* @param {Object} params - public/private key parameters
62158*
62159* @param {Array<Byte>} [params.secret] - secret seed bytes
62160* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
62161* @param {Array<Byte>} [params.pub] - public key point encoded as bytes
62162*
62163*/
62164function KeyPair(eddsa, params) {
62165 this.eddsa = eddsa;
62166 this._secret = parseBytes(params.secret);
62167 if (eddsa.isPoint(params.pub))
62168 this._pub = params.pub;
62169 else
62170 this._pubBytes = parseBytes(params.pub);
62171}
62172
62173KeyPair.fromPublic = function fromPublic(eddsa, pub) {
62174 if (pub instanceof KeyPair)
62175 return pub;
62176 return new KeyPair(eddsa, { pub: pub });
62177};
62178
62179KeyPair.fromSecret = function fromSecret(eddsa, secret) {
62180 if (secret instanceof KeyPair)
62181 return secret;
62182 return new KeyPair(eddsa, { secret: secret });
62183};
62184
62185KeyPair.prototype.secret = function secret() {
62186 return this._secret;
62187};
62188
62189cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
62190 return this.eddsa.encodePoint(this.pub());
62191});
62192
62193cachedProperty(KeyPair, 'pub', function pub() {
62194 if (this._pubBytes)
62195 return this.eddsa.decodePoint(this._pubBytes);
62196 return this.eddsa.g.mul(this.priv());
62197});
62198
62199cachedProperty(KeyPair, 'privBytes', function privBytes() {
62200 var eddsa = this.eddsa;
62201 var hash = this.hash();
62202 var lastIx = eddsa.encodingLength - 1;
62203
62204 var a = hash.slice(0, eddsa.encodingLength);
62205 a[0] &= 248;
62206 a[lastIx] &= 127;
62207 a[lastIx] |= 64;
62208
62209 return a;
62210});
62211
62212cachedProperty(KeyPair, 'priv', function priv() {
62213 return this.eddsa.decodeInt(this.privBytes());
62214});
62215
62216cachedProperty(KeyPair, 'hash', function hash() {
62217 return this.eddsa.hash().update(this.secret()).digest();
62218});
62219
62220cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
62221 return this.hash().slice(this.eddsa.encodingLength);
62222});
62223
62224KeyPair.prototype.sign = function sign(message) {
62225 assert(this._secret, 'KeyPair can only verify');
62226 return this.eddsa.sign(message, this);
62227};
62228
62229KeyPair.prototype.verify = function verify(message, sig) {
62230 return this.eddsa.verify(message, sig, this);
62231};
62232
62233KeyPair.prototype.getSecret = function getSecret(enc) {
62234 assert(this._secret, 'KeyPair is public only');
62235 return utils.encode(this.secret(), enc);
62236};
62237
62238KeyPair.prototype.getPublic = function getPublic(enc) {
62239 return utils.encode(this.pubBytes(), enc);
62240};
62241
62242module.exports = KeyPair;
62243
62244},{"../../elliptic":317}],329:[function(require,module,exports){
62245'use strict';
62246
62247var BN = require('bn.js');
62248var elliptic = require('../../elliptic');
62249var utils = elliptic.utils;
62250var assert = utils.assert;
62251var cachedProperty = utils.cachedProperty;
62252var parseBytes = utils.parseBytes;
62253
62254/**
62255* @param {EDDSA} eddsa - eddsa instance
62256* @param {Array<Bytes>|Object} sig -
62257* @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
62258* @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
62259* @param {Array<Bytes>} [sig.Rencoded] - R point encoded
62260* @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
62261*/
62262function Signature(eddsa, sig) {
62263 this.eddsa = eddsa;
62264
62265 if (typeof sig !== 'object')
62266 sig = parseBytes(sig);
62267
62268 if (Array.isArray(sig)) {
62269 sig = {
62270 R: sig.slice(0, eddsa.encodingLength),
62271 S: sig.slice(eddsa.encodingLength)
62272 };
62273 }
62274
62275 assert(sig.R && sig.S, 'Signature without R or S');
62276
62277 if (eddsa.isPoint(sig.R))
62278 this._R = sig.R;
62279 if (sig.S instanceof BN)
62280 this._S = sig.S;
62281
62282 this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
62283 this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
62284}
62285
62286cachedProperty(Signature, 'S', function S() {
62287 return this.eddsa.decodeInt(this.Sencoded());
62288});
62289
62290cachedProperty(Signature, 'R', function R() {
62291 return this.eddsa.decodePoint(this.Rencoded());
62292});
62293
62294cachedProperty(Signature, 'Rencoded', function Rencoded() {
62295 return this.eddsa.encodePoint(this.R());
62296});
62297
62298cachedProperty(Signature, 'Sencoded', function Sencoded() {
62299 return this.eddsa.encodeInt(this.S());
62300});
62301
62302Signature.prototype.toBytes = function toBytes() {
62303 return this.Rencoded().concat(this.Sencoded());
62304};
62305
62306Signature.prototype.toHex = function toHex() {
62307 return utils.encode(this.toBytes(), 'hex').toUpperCase();
62308};
62309
62310module.exports = Signature;
62311
62312},{"../../elliptic":317,"bn.js":108}],330:[function(require,module,exports){
62313module.exports = {
62314 doubles: {
62315 step: 4,
62316 points: [
62317 [
62318 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
62319 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
62320 ],
62321 [
62322 '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
62323 '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
62324 ],
62325 [
62326 '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
62327 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
62328 ],
62329 [
62330 '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
62331 '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
62332 ],
62333 [
62334 '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
62335 '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
62336 ],
62337 [
62338 '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
62339 '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
62340 ],
62341 [
62342 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
62343 '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
62344 ],
62345 [
62346 '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
62347 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
62348 ],
62349 [
62350 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
62351 '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
62352 ],
62353 [
62354 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
62355 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
62356 ],
62357 [
62358 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
62359 '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
62360 ],
62361 [
62362 '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
62363 '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
62364 ],
62365 [
62366 '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
62367 '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
62368 ],
62369 [
62370 '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
62371 '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
62372 ],
62373 [
62374 '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
62375 '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
62376 ],
62377 [
62378 '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
62379 '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
62380 ],
62381 [
62382 '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
62383 '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
62384 ],
62385 [
62386 '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
62387 '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
62388 ],
62389 [
62390 '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
62391 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
62392 ],
62393 [
62394 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
62395 '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
62396 ],
62397 [
62398 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
62399 '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
62400 ],
62401 [
62402 '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
62403 '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
62404 ],
62405 [
62406 '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
62407 '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
62408 ],
62409 [
62410 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
62411 '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
62412 ],
62413 [
62414 '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
62415 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
62416 ],
62417 [
62418 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
62419 '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
62420 ],
62421 [
62422 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
62423 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
62424 ],
62425 [
62426 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
62427 '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
62428 ],
62429 [
62430 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
62431 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
62432 ],
62433 [
62434 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
62435 '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
62436 ],
62437 [
62438 '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
62439 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
62440 ],
62441 [
62442 '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
62443 '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
62444 ],
62445 [
62446 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
62447 '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
62448 ],
62449 [
62450 '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
62451 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
62452 ],
62453 [
62454 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
62455 '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
62456 ],
62457 [
62458 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
62459 '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
62460 ],
62461 [
62462 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
62463 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
62464 ],
62465 [
62466 '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
62467 '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
62468 ],
62469 [
62470 '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
62471 '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
62472 ],
62473 [
62474 '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
62475 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
62476 ],
62477 [
62478 '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
62479 '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
62480 ],
62481 [
62482 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
62483 '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
62484 ],
62485 [
62486 '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
62487 '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
62488 ],
62489 [
62490 '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
62491 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
62492 ],
62493 [
62494 '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
62495 '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
62496 ],
62497 [
62498 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
62499 '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
62500 ],
62501 [
62502 '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
62503 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
62504 ],
62505 [
62506 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
62507 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
62508 ],
62509 [
62510 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
62511 '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
62512 ],
62513 [
62514 '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
62515 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
62516 ],
62517 [
62518 '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
62519 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
62520 ],
62521 [
62522 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
62523 '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
62524 ],
62525 [
62526 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
62527 '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
62528 ],
62529 [
62530 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
62531 '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
62532 ],
62533 [
62534 '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
62535 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
62536 ],
62537 [
62538 '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
62539 '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
62540 ],
62541 [
62542 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
62543 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
62544 ],
62545 [
62546 '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
62547 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
62548 ],
62549 [
62550 '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
62551 '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
62552 ],
62553 [
62554 '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
62555 '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
62556 ],
62557 [
62558 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
62559 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
62560 ],
62561 [
62562 '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
62563 '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
62564 ],
62565 [
62566 '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
62567 '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
62568 ],
62569 [
62570 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
62571 '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
62572 ],
62573 [
62574 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
62575 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
62576 ]
62577 ]
62578 },
62579 naf: {
62580 wnd: 7,
62581 points: [
62582 [
62583 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
62584 '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
62585 ],
62586 [
62587 '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
62588 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
62589 ],
62590 [
62591 '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
62592 '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
62593 ],
62594 [
62595 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
62596 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
62597 ],
62598 [
62599 '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
62600 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
62601 ],
62602 [
62603 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
62604 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
62605 ],
62606 [
62607 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
62608 '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
62609 ],
62610 [
62611 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
62612 '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
62613 ],
62614 [
62615 '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
62616 '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
62617 ],
62618 [
62619 '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
62620 '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
62621 ],
62622 [
62623 '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
62624 '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
62625 ],
62626 [
62627 '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
62628 '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
62629 ],
62630 [
62631 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
62632 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
62633 ],
62634 [
62635 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
62636 '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
62637 ],
62638 [
62639 '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
62640 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
62641 ],
62642 [
62643 '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
62644 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
62645 ],
62646 [
62647 '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
62648 '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
62649 ],
62650 [
62651 '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
62652 '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
62653 ],
62654 [
62655 '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
62656 '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
62657 ],
62658 [
62659 '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
62660 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
62661 ],
62662 [
62663 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
62664 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
62665 ],
62666 [
62667 '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
62668 '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
62669 ],
62670 [
62671 '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
62672 '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
62673 ],
62674 [
62675 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
62676 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
62677 ],
62678 [
62679 '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
62680 '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
62681 ],
62682 [
62683 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
62684 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
62685 ],
62686 [
62687 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
62688 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
62689 ],
62690 [
62691 '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
62692 '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
62693 ],
62694 [
62695 '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
62696 '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
62697 ],
62698 [
62699 '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
62700 '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
62701 ],
62702 [
62703 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
62704 '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
62705 ],
62706 [
62707 '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
62708 '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
62709 ],
62710 [
62711 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
62712 '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
62713 ],
62714 [
62715 '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
62716 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
62717 ],
62718 [
62719 '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
62720 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
62721 ],
62722 [
62723 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
62724 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
62725 ],
62726 [
62727 '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
62728 '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
62729 ],
62730 [
62731 '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
62732 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
62733 ],
62734 [
62735 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
62736 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
62737 ],
62738 [
62739 '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
62740 '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
62741 ],
62742 [
62743 '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
62744 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
62745 ],
62746 [
62747 '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
62748 '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
62749 ],
62750 [
62751 '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
62752 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
62753 ],
62754 [
62755 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
62756 '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
62757 ],
62758 [
62759 '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
62760 '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
62761 ],
62762 [
62763 '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
62764 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
62765 ],
62766 [
62767 '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
62768 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
62769 ],
62770 [
62771 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
62772 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
62773 ],
62774 [
62775 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
62776 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
62777 ],
62778 [
62779 '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
62780 '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
62781 ],
62782 [
62783 '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
62784 '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
62785 ],
62786 [
62787 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
62788 '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
62789 ],
62790 [
62791 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
62792 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
62793 ],
62794 [
62795 '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
62796 '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
62797 ],
62798 [
62799 '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
62800 '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
62801 ],
62802 [
62803 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
62804 '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
62805 ],
62806 [
62807 '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
62808 '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
62809 ],
62810 [
62811 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
62812 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
62813 ],
62814 [
62815 '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
62816 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
62817 ],
62818 [
62819 '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
62820 '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
62821 ],
62822 [
62823 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
62824 '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
62825 ],
62826 [
62827 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
62828 '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
62829 ],
62830 [
62831 '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
62832 '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
62833 ],
62834 [
62835 '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
62836 '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
62837 ],
62838 [
62839 '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
62840 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
62841 ],
62842 [
62843 '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
62844 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
62845 ],
62846 [
62847 '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
62848 '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
62849 ],
62850 [
62851 '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
62852 '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
62853 ],
62854 [
62855 '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
62856 '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
62857 ],
62858 [
62859 '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
62860 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
62861 ],
62862 [
62863 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
62864 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
62865 ],
62866 [
62867 '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
62868 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
62869 ],
62870 [
62871 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
62872 '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
62873 ],
62874 [
62875 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
62876 '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
62877 ],
62878 [
62879 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
62880 '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
62881 ],
62882 [
62883 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
62884 '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
62885 ],
62886 [
62887 '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
62888 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
62889 ],
62890 [
62891 '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
62892 '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
62893 ],
62894 [
62895 '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
62896 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
62897 ],
62898 [
62899 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
62900 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
62901 ],
62902 [
62903 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
62904 '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
62905 ],
62906 [
62907 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
62908 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
62909 ],
62910 [
62911 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
62912 '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
62913 ],
62914 [
62915 '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
62916 '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
62917 ],
62918 [
62919 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
62920 '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
62921 ],
62922 [
62923 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
62924 '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
62925 ],
62926 [
62927 '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
62928 '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
62929 ],
62930 [
62931 '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
62932 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
62933 ],
62934 [
62935 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
62936 '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
62937 ],
62938 [
62939 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
62940 '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
62941 ],
62942 [
62943 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
62944 '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
62945 ],
62946 [
62947 '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
62948 '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
62949 ],
62950 [
62951 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
62952 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
62953 ],
62954 [
62955 '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
62956 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
62957 ],
62958 [
62959 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
62960 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
62961 ],
62962 [
62963 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
62964 '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
62965 ],
62966 [
62967 '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
62968 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
62969 ],
62970 [
62971 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
62972 '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
62973 ],
62974 [
62975 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
62976 '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
62977 ],
62978 [
62979 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
62980 '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
62981 ],
62982 [
62983 '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
62984 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
62985 ],
62986 [
62987 '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
62988 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
62989 ],
62990 [
62991 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
62992 '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
62993 ],
62994 [
62995 '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
62996 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
62997 ],
62998 [
62999 '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
63000 '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
63001 ],
63002 [
63003 '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
63004 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
63005 ],
63006 [
63007 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
63008 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
63009 ],
63010 [
63011 '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
63012 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
63013 ],
63014 [
63015 '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
63016 '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
63017 ],
63018 [
63019 '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
63020 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
63021 ],
63022 [
63023 '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
63024 '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
63025 ],
63026 [
63027 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
63028 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
63029 ],
63030 [
63031 '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
63032 '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
63033 ],
63034 [
63035 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
63036 '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
63037 ],
63038 [
63039 '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
63040 '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
63041 ],
63042 [
63043 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
63044 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
63045 ],
63046 [
63047 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
63048 '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
63049 ],
63050 [
63051 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
63052 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
63053 ],
63054 [
63055 '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
63056 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
63057 ],
63058 [
63059 '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
63060 '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
63061 ],
63062 [
63063 '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
63064 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
63065 ],
63066 [
63067 '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
63068 '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
63069 ],
63070 [
63071 '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
63072 '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
63073 ],
63074 [
63075 '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
63076 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
63077 ],
63078 [
63079 '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
63080 '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
63081 ],
63082 [
63083 '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
63084 '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
63085 ],
63086 [
63087 '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
63088 '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
63089 ]
63090 ]
63091 }
63092};
63093
63094},{}],331:[function(require,module,exports){
63095'use strict';
63096
63097var utils = exports;
63098var BN = require('bn.js');
63099var minAssert = require('minimalistic-assert');
63100var minUtils = require('minimalistic-crypto-utils');
63101
63102utils.assert = minAssert;
63103utils.toArray = minUtils.toArray;
63104utils.zero2 = minUtils.zero2;
63105utils.toHex = minUtils.toHex;
63106utils.encode = minUtils.encode;
63107
63108// Represent num in a w-NAF form
63109function getNAF(num, w) {
63110 var naf = [];
63111 var ws = 1 << (w + 1);
63112 var k = num.clone();
63113 while (k.cmpn(1) >= 0) {
63114 var z;
63115 if (k.isOdd()) {
63116 var mod = k.andln(ws - 1);
63117 if (mod > (ws >> 1) - 1)
63118 z = (ws >> 1) - mod;
63119 else
63120 z = mod;
63121 k.isubn(z);
63122 } else {
63123 z = 0;
63124 }
63125 naf.push(z);
63126
63127 // Optimization, shift by word if possible
63128 var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;
63129 for (var i = 1; i < shift; i++)
63130 naf.push(0);
63131 k.iushrn(shift);
63132 }
63133
63134 return naf;
63135}
63136utils.getNAF = getNAF;
63137
63138// Represent k1, k2 in a Joint Sparse Form
63139function getJSF(k1, k2) {
63140 var jsf = [
63141 [],
63142 []
63143 ];
63144
63145 k1 = k1.clone();
63146 k2 = k2.clone();
63147 var d1 = 0;
63148 var d2 = 0;
63149 while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
63150
63151 // First phase
63152 var m14 = (k1.andln(3) + d1) & 3;
63153 var m24 = (k2.andln(3) + d2) & 3;
63154 if (m14 === 3)
63155 m14 = -1;
63156 if (m24 === 3)
63157 m24 = -1;
63158 var u1;
63159 if ((m14 & 1) === 0) {
63160 u1 = 0;
63161 } else {
63162 var m8 = (k1.andln(7) + d1) & 7;
63163 if ((m8 === 3 || m8 === 5) && m24 === 2)
63164 u1 = -m14;
63165 else
63166 u1 = m14;
63167 }
63168 jsf[0].push(u1);
63169
63170 var u2;
63171 if ((m24 & 1) === 0) {
63172 u2 = 0;
63173 } else {
63174 var m8 = (k2.andln(7) + d2) & 7;
63175 if ((m8 === 3 || m8 === 5) && m14 === 2)
63176 u2 = -m24;
63177 else
63178 u2 = m24;
63179 }
63180 jsf[1].push(u2);
63181
63182 // Second phase
63183 if (2 * d1 === u1 + 1)
63184 d1 = 1 - d1;
63185 if (2 * d2 === u2 + 1)
63186 d2 = 1 - d2;
63187 k1.iushrn(1);
63188 k2.iushrn(1);
63189 }
63190
63191 return jsf;
63192}
63193utils.getJSF = getJSF;
63194
63195function cachedProperty(obj, name, computer) {
63196 var key = '_' + name;
63197 obj.prototype[name] = function cachedProperty() {
63198 return this[key] !== undefined ? this[key] :
63199 this[key] = computer.call(this);
63200 };
63201}
63202utils.cachedProperty = cachedProperty;
63203
63204function parseBytes(bytes) {
63205 return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
63206 bytes;
63207}
63208utils.parseBytes = parseBytes;
63209
63210function intFromLE(bytes) {
63211 return new BN(bytes, 'hex', 'le');
63212}
63213utils.intFromLE = intFromLE;
63214
63215
63216},{"bn.js":108,"minimalistic-assert":640,"minimalistic-crypto-utils":641}],332:[function(require,module,exports){
63217module.exports={
63218 "_from": "elliptic@=6.4.0",
63219 "_id": "elliptic@6.4.0",
63220 "_inBundle": false,
63221 "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",
63222 "_location": "/elliptic",
63223 "_phantomChildren": {},
63224 "_requested": {
63225 "type": "version",
63226 "registry": true,
63227 "raw": "elliptic@=6.4.0",
63228 "name": "elliptic",
63229 "escapedName": "elliptic",
63230 "rawSpec": "=6.4.0",
63231 "saveSpec": null,
63232 "fetchSpec": "=6.4.0"
63233 },
63234 "_requiredBy": [
63235 "/browserify-sign",
63236 "/create-ecdh",
63237 "/elastos-wallet-js/bitcore-lib-p256"
63238 ],
63239 "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",
63240 "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df",
63241 "_spec": "elliptic@=6.4.0",
63242 "_where": "/home/ian/git/bitcoin/bip39/libs/combined/node_modules/elastos-wallet-js/node_modules/bitcore-lib-p256",
63243 "author": {
63244 "name": "Fedor Indutny",
63245 "email": "fedor@indutny.com"
63246 },
63247 "bugs": {
63248 "url": "https://github.com/indutny/elliptic/issues"
63249 },
63250 "bundleDependencies": false,
63251 "dependencies": {
63252 "bn.js": "^4.4.0",
63253 "brorand": "^1.0.1",
63254 "hash.js": "^1.0.0",
63255 "hmac-drbg": "^1.0.0",
63256 "inherits": "^2.0.1",
63257 "minimalistic-assert": "^1.0.0",
63258 "minimalistic-crypto-utils": "^1.0.0"
63259 },
63260 "deprecated": false,
63261 "description": "EC cryptography",
63262 "devDependencies": {
63263 "brfs": "^1.4.3",
63264 "coveralls": "^2.11.3",
63265 "grunt": "^0.4.5",
63266 "grunt-browserify": "^5.0.0",
63267 "grunt-cli": "^1.2.0",
63268 "grunt-contrib-connect": "^1.0.0",
63269 "grunt-contrib-copy": "^1.0.0",
63270 "grunt-contrib-uglify": "^1.0.1",
63271 "grunt-mocha-istanbul": "^3.0.1",
63272 "grunt-saucelabs": "^8.6.2",
63273 "istanbul": "^0.4.2",
63274 "jscs": "^2.9.0",
63275 "jshint": "^2.6.0",
63276 "mocha": "^2.1.0"
63277 },
63278 "files": [
63279 "lib"
63280 ],
63281 "homepage": "https://github.com/indutny/elliptic",
63282 "keywords": [
63283 "EC",
63284 "Elliptic",
63285 "curve",
63286 "Cryptography"
63287 ],
63288 "license": "MIT",
63289 "main": "lib/elliptic.js",
63290 "name": "elliptic",
63291 "repository": {
63292 "type": "git",
63293 "url": "git+ssh://git@github.com/indutny/elliptic.git"
63294 },
63295 "scripts": {
63296 "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
63297 "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
63298 "lint": "npm run jscs && npm run jshint",
63299 "test": "npm run lint && npm run unit",
63300 "unit": "istanbul test _mocha --reporter=spec test/index.js",
63301 "version": "grunt dist && git add dist/"
63302 },
63303 "version": "6.4.0"
63304}
63305
63306},{}],333:[function(require,module,exports){
63307'use strict';
63308
63309var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
63310
63311var createKeccakHash = require('keccak');
63312var secp256k1 = require('secp256k1');
63313var assert = require('assert');
63314var rlp = require('rlp');
63315var BN = require('bn.js');
63316var createHash = require('create-hash');
63317var Buffer = require('safe-buffer').Buffer;
63318Object.assign(exports, require('ethjs-util'));
63319
63320/**
63321 * the max integer that this VM can handle (a ```BN```)
63322 * @var {BN} MAX_INTEGER
63323 */
63324exports.MAX_INTEGER = new BN('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
63325
63326/**
63327 * 2^256 (a ```BN```)
63328 * @var {BN} TWO_POW256
63329 */
63330exports.TWO_POW256 = new BN('10000000000000000000000000000000000000000000000000000000000000000', 16);
63331
63332/**
63333 * Keccak-256 hash of null (a ```String```)
63334 * @var {String} KECCAK256_NULL_S
63335 */
63336exports.KECCAK256_NULL_S = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470';
63337
63338/**
63339 * Keccak-256 hash of null (a ```Buffer```)
63340 * @var {Buffer} KECCAK256_NULL
63341 */
63342exports.KECCAK256_NULL = Buffer.from(exports.KECCAK256_NULL_S, 'hex');
63343
63344/**
63345 * Keccak-256 of an RLP of an empty array (a ```String```)
63346 * @var {String} KECCAK256_RLP_ARRAY_S
63347 */
63348exports.KECCAK256_RLP_ARRAY_S = '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347';
63349
63350/**
63351 * Keccak-256 of an RLP of an empty array (a ```Buffer```)
63352 * @var {Buffer} KECCAK256_RLP_ARRAY
63353 */
63354exports.KECCAK256_RLP_ARRAY = Buffer.from(exports.KECCAK256_RLP_ARRAY_S, 'hex');
63355
63356/**
63357 * Keccak-256 hash of the RLP of null (a ```String```)
63358 * @var {String} KECCAK256_RLP_S
63359 */
63360exports.KECCAK256_RLP_S = '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421';
63361
63362/**
63363 * Keccak-256 hash of the RLP of null (a ```Buffer```)
63364 * @var {Buffer} KECCAK256_RLP
63365 */
63366exports.KECCAK256_RLP = Buffer.from(exports.KECCAK256_RLP_S, 'hex');
63367
63368/**
63369 * [`BN`](https://github.com/indutny/bn.js)
63370 * @var {Function}
63371 */
63372exports.BN = BN;
63373
63374/**
63375 * [`rlp`](https://github.com/ethereumjs/rlp)
63376 * @var {Function}
63377 */
63378exports.rlp = rlp;
63379
63380/**
63381 * [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
63382 * @var {Object}
63383 */
63384exports.secp256k1 = secp256k1;
63385
63386/**
63387 * Returns a buffer filled with 0s
63388 * @method zeros
63389 * @param {Number} bytes the number of bytes the buffer should be
63390 * @return {Buffer}
63391 */
63392exports.zeros = function (bytes) {
63393 return Buffer.allocUnsafe(bytes).fill(0);
63394};
63395
63396/**
63397 * Returns a zero address
63398 * @method zeroAddress
63399 * @return {String}
63400 */
63401exports.zeroAddress = function () {
63402 var addressLength = 20;
63403 var zeroAddress = exports.zeros(addressLength);
63404 return exports.bufferToHex(zeroAddress);
63405};
63406
63407/**
63408 * Left Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
63409 * Or it truncates the beginning if it exceeds.
63410 * @method lsetLength
63411 * @param {Buffer|Array} msg the value to pad
63412 * @param {Number} length the number of bytes the output should be
63413 * @param {Boolean} [right=false] whether to start padding form the left or right
63414 * @return {Buffer|Array}
63415 */
63416exports.setLengthLeft = exports.setLength = function (msg, length, right) {
63417 var buf = exports.zeros(length);
63418 msg = exports.toBuffer(msg);
63419 if (right) {
63420 if (msg.length < length) {
63421 msg.copy(buf);
63422 return buf;
63423 }
63424 return msg.slice(0, length);
63425 } else {
63426 if (msg.length < length) {
63427 msg.copy(buf, length - msg.length);
63428 return buf;
63429 }
63430 return msg.slice(-length);
63431 }
63432};
63433
63434/**
63435 * Right Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
63436 * Or it truncates the beginning if it exceeds.
63437 * @param {Buffer|Array} msg the value to pad
63438 * @param {Number} length the number of bytes the output should be
63439 * @return {Buffer|Array}
63440 */
63441exports.setLengthRight = function (msg, length) {
63442 return exports.setLength(msg, length, true);
63443};
63444
63445/**
63446 * Trims leading zeros from a `Buffer` or an `Array`
63447 * @param {Buffer|Array|String} a
63448 * @return {Buffer|Array|String}
63449 */
63450exports.unpad = exports.stripZeros = function (a) {
63451 a = exports.stripHexPrefix(a);
63452 var first = a[0];
63453 while (a.length > 0 && first.toString() === '0') {
63454 a = a.slice(1);
63455 first = a[0];
63456 }
63457 return a;
63458};
63459/**
63460 * Attempts to turn a value into a `Buffer`. As input it supports `Buffer`, `String`, `Number`, null/undefined, `BN` and other objects with a `toArray()` method.
63461 * @param {*} v the value
63462 */
63463exports.toBuffer = function (v) {
63464 if (!Buffer.isBuffer(v)) {
63465 if (Array.isArray(v)) {
63466 v = Buffer.from(v);
63467 } else if (typeof v === 'string') {
63468 if (exports.isHexString(v)) {
63469 v = Buffer.from(exports.padToEven(exports.stripHexPrefix(v)), 'hex');
63470 } else {
63471 v = Buffer.from(v);
63472 }
63473 } else if (typeof v === 'number') {
63474 v = exports.intToBuffer(v);
63475 } else if (v === null || v === undefined) {
63476 v = Buffer.allocUnsafe(0);
63477 } else if (BN.isBN(v)) {
63478 v = v.toArrayLike(Buffer);
63479 } else if (v.toArray) {
63480 // converts a BN to a Buffer
63481 v = Buffer.from(v.toArray());
63482 } else {
63483 throw new Error('invalid type');
63484 }
63485 }
63486 return v;
63487};
63488
63489/**
63490 * Converts a `Buffer` to a `Number`
63491 * @param {Buffer} buf
63492 * @return {Number}
63493 * @throws If the input number exceeds 53 bits.
63494 */
63495exports.bufferToInt = function (buf) {
63496 return new BN(exports.toBuffer(buf)).toNumber();
63497};
63498
63499/**
63500 * Converts a `Buffer` into a hex `String`
63501 * @param {Buffer} buf
63502 * @return {String}
63503 */
63504exports.bufferToHex = function (buf) {
63505 buf = exports.toBuffer(buf);
63506 return '0x' + buf.toString('hex');
63507};
63508
63509/**
63510 * Interprets a `Buffer` as a signed integer and returns a `BN`. Assumes 256-bit numbers.
63511 * @param {Buffer} num
63512 * @return {BN}
63513 */
63514exports.fromSigned = function (num) {
63515 return new BN(num).fromTwos(256);
63516};
63517
63518/**
63519 * Converts a `BN` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers.
63520 * @param {BN} num
63521 * @return {Buffer}
63522 */
63523exports.toUnsigned = function (num) {
63524 return Buffer.from(num.toTwos(256).toArray());
63525};
63526
63527/**
63528 * Creates Keccak hash of the input
63529 * @param {Buffer|Array|String|Number} a the input data
63530 * @param {Number} [bits=256] the Keccak width
63531 * @return {Buffer}
63532 */
63533exports.keccak = function (a, bits) {
63534 a = exports.toBuffer(a);
63535 if (!bits) bits = 256;
63536
63537 return createKeccakHash('keccak' + bits).update(a).digest();
63538};
63539
63540/**
63541 * Creates Keccak-256 hash of the input, alias for keccak(a, 256)
63542 * @param {Buffer|Array|String|Number} a the input data
63543 * @return {Buffer}
63544 */
63545exports.keccak256 = function (a) {
63546 return exports.keccak(a);
63547};
63548
63549/**
63550 * Creates SHA256 hash of the input
63551 * @param {Buffer|Array|String|Number} a the input data
63552 * @return {Buffer}
63553 */
63554exports.sha256 = function (a) {
63555 a = exports.toBuffer(a);
63556 return createHash('sha256').update(a).digest();
63557};
63558
63559/**
63560 * Creates RIPEMD160 hash of the input
63561 * @param {Buffer|Array|String|Number} a the input data
63562 * @param {Boolean} padded whether it should be padded to 256 bits or not
63563 * @return {Buffer}
63564 */
63565exports.ripemd160 = function (a, padded) {
63566 a = exports.toBuffer(a);
63567 var hash = createHash('rmd160').update(a).digest();
63568 if (padded === true) {
63569 return exports.setLength(hash, 32);
63570 } else {
63571 return hash;
63572 }
63573};
63574
63575/**
63576 * Creates SHA-3 hash of the RLP encoded version of the input
63577 * @param {Buffer|Array|String|Number} a the input data
63578 * @return {Buffer}
63579 */
63580exports.rlphash = function (a) {
63581 return exports.keccak(rlp.encode(a));
63582};
63583
63584/**
63585 * Checks if the private key satisfies the rules of the curve secp256k1.
63586 * @param {Buffer} privateKey
63587 * @return {Boolean}
63588 */
63589exports.isValidPrivate = function (privateKey) {
63590 return secp256k1.privateKeyVerify(privateKey);
63591};
63592
63593/**
63594 * Checks if the public key satisfies the rules of the curve secp256k1
63595 * and the requirements of Ethereum.
63596 * @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
63597 * @param {Boolean} [sanitize=false] Accept public keys in other formats
63598 * @return {Boolean}
63599 */
63600exports.isValidPublic = function (publicKey, sanitize) {
63601 if (publicKey.length === 64) {
63602 // Convert to SEC1 for secp256k1
63603 return secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]), publicKey]));
63604 }
63605
63606 if (!sanitize) {
63607 return false;
63608 }
63609
63610 return secp256k1.publicKeyVerify(publicKey);
63611};
63612
63613/**
63614 * Returns the ethereum address of a given public key.
63615 * Accepts "Ethereum public keys" and SEC1 encoded keys.
63616 * @param {Buffer} pubKey The two points of an uncompressed key, unless sanitize is enabled
63617 * @param {Boolean} [sanitize=false] Accept public keys in other formats
63618 * @return {Buffer}
63619 */
63620exports.pubToAddress = exports.publicToAddress = function (pubKey, sanitize) {
63621 pubKey = exports.toBuffer(pubKey);
63622 if (sanitize && pubKey.length !== 64) {
63623 pubKey = secp256k1.publicKeyConvert(pubKey, false).slice(1);
63624 }
63625 assert(pubKey.length === 64);
63626 // Only take the lower 160bits of the hash
63627 return exports.keccak(pubKey).slice(-20);
63628};
63629
63630/**
63631 * Returns the ethereum public key of a given private key
63632 * @param {Buffer} privateKey A private key must be 256 bits wide
63633 * @return {Buffer}
63634 */
63635var privateToPublic = exports.privateToPublic = function (privateKey) {
63636 privateKey = exports.toBuffer(privateKey);
63637 // skip the type flag and use the X, Y points
63638 return secp256k1.publicKeyCreate(privateKey, false).slice(1);
63639};
63640
63641/**
63642 * Converts a public key to the Ethereum format.
63643 * @param {Buffer} publicKey
63644 * @return {Buffer}
63645 */
63646exports.importPublic = function (publicKey) {
63647 publicKey = exports.toBuffer(publicKey);
63648 if (publicKey.length !== 64) {
63649 publicKey = secp256k1.publicKeyConvert(publicKey, false).slice(1);
63650 }
63651 return publicKey;
63652};
63653
63654/**
63655 * ECDSA sign
63656 * @param {Buffer} msgHash
63657 * @param {Buffer} privateKey
63658 * @param {Number} [chainId]
63659 * @return {Object}
63660 */
63661exports.ecsign = function (msgHash, privateKey, chainId) {
63662 var sig = secp256k1.sign(msgHash, privateKey);
63663
63664 var ret = {};
63665 ret.r = sig.signature.slice(0, 32);
63666 ret.s = sig.signature.slice(32, 64);
63667 ret.v = chainId ? sig.recovery + (chainId * 2 + 35) : sig.recovery + 27;
63668 return ret;
63669};
63670
63671/**
63672 * Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call.
63673 * The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign`
63674 * call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key
63675 * used to produce the signature.
63676 * @param message
63677 * @returns {Buffer} hash
63678 */
63679exports.hashPersonalMessage = function (message) {
63680 var prefix = exports.toBuffer('\x19Ethereum Signed Message:\n' + message.length.toString());
63681 return exports.keccak(Buffer.concat([prefix, message]));
63682};
63683
63684/**
63685 * ECDSA public key recovery from signature
63686 * @param {Buffer} msgHash
63687 * @param {Number} v
63688 * @param {Buffer} r
63689 * @param {Buffer} s
63690 * @param {Number} [chainId]
63691 * @return {Buffer} publicKey
63692 */
63693exports.ecrecover = function (msgHash, v, r, s, chainId) {
63694 var signature = Buffer.concat([exports.setLength(r, 32), exports.setLength(s, 32)], 64);
63695 var recovery = calculateSigRecovery(v, chainId);
63696 if (!isValidSigRecovery(recovery)) {
63697 throw new Error('Invalid signature v value');
63698 }
63699 var senderPubKey = secp256k1.recover(msgHash, signature, recovery);
63700 return secp256k1.publicKeyConvert(senderPubKey, false).slice(1);
63701};
63702
63703/**
63704 * Convert signature parameters into the format of `eth_sign` RPC method
63705 * @param {Number} v
63706 * @param {Buffer} r
63707 * @param {Buffer} s
63708 * @param {Number} [chainId]
63709 * @return {String} sig
63710 */
63711exports.toRpcSig = function (v, r, s, chainId) {
63712 var recovery = calculateSigRecovery(v, chainId);
63713 if (!isValidSigRecovery(recovery)) {
63714 throw new Error('Invalid signature v value');
63715 }
63716
63717 // geth (and the RPC eth_sign method) uses the 65 byte format used by Bitcoin
63718 return exports.bufferToHex(Buffer.concat([exports.setLengthLeft(r, 32), exports.setLengthLeft(s, 32), exports.toBuffer(v)]));
63719};
63720
63721/**
63722 * Convert signature format of the `eth_sign` RPC method to signature parameters
63723 * NOTE: all because of a bug in geth: https://github.com/ethereum/go-ethereum/issues/2053
63724 * @param {String} sig
63725 * @return {Object}
63726 */
63727exports.fromRpcSig = function (sig) {
63728 sig = exports.toBuffer(sig);
63729
63730 // NOTE: with potential introduction of chainId this might need to be updated
63731 if (sig.length !== 65) {
63732 throw new Error('Invalid signature length');
63733 }
63734
63735 var v = sig[64];
63736 // support both versions of `eth_sign` responses
63737 if (v < 27) {
63738 v += 27;
63739 }
63740
63741 return {
63742 v: v,
63743 r: sig.slice(0, 32),
63744 s: sig.slice(32, 64)
63745 };
63746};
63747
63748/**
63749 * Returns the ethereum address of a given private key
63750 * @param {Buffer} privateKey A private key must be 256 bits wide
63751 * @return {Buffer}
63752 */
63753exports.privateToAddress = function (privateKey) {
63754 return exports.publicToAddress(privateToPublic(privateKey));
63755};
63756
63757/**
63758 * Checks if the address is a valid. Accepts checksummed addresses too
63759 * @param {String} address
63760 * @return {Boolean}
63761 */
63762exports.isValidAddress = function (address) {
63763 return (/^0x[0-9a-fA-F]{40}$/.test(address)
63764 );
63765};
63766
63767/**
63768 * Checks if a given address is a zero address
63769 * @method isZeroAddress
63770 * @param {String} address
63771 * @return {Boolean}
63772 */
63773exports.isZeroAddress = function (address) {
63774 var zeroAddress = exports.zeroAddress();
63775 return zeroAddress === exports.addHexPrefix(address);
63776};
63777
63778/**
63779 * Returns a checksummed address
63780 * @param {String} address
63781 * @return {String}
63782 */
63783exports.toChecksumAddress = function (address) {
63784 address = exports.stripHexPrefix(address).toLowerCase();
63785 var hash = exports.keccak(address).toString('hex');
63786 var ret = '0x';
63787
63788 for (var i = 0; i < address.length; i++) {
63789 if (parseInt(hash[i], 16) >= 8) {
63790 ret += address[i].toUpperCase();
63791 } else {
63792 ret += address[i];
63793 }
63794 }
63795
63796 return ret;
63797};
63798
63799/**
63800 * Checks if the address is a valid checksummed address
63801 * @param {Buffer} address
63802 * @return {Boolean}
63803 */
63804exports.isValidChecksumAddress = function (address) {
63805 return exports.isValidAddress(address) && exports.toChecksumAddress(address) === address;
63806};
63807
63808/**
63809 * Generates an address of a newly created contract
63810 * @param {Buffer} from the address which is creating this new address
63811 * @param {Buffer} nonce the nonce of the from account
63812 * @return {Buffer}
63813 */
63814exports.generateAddress = function (from, nonce) {
63815 from = exports.toBuffer(from);
63816 nonce = new BN(nonce);
63817
63818 if (nonce.isZero()) {
63819 // in RLP we want to encode null in the case of zero nonce
63820 // read the RLP documentation for an answer if you dare
63821 nonce = null;
63822 } else {
63823 nonce = Buffer.from(nonce.toArray());
63824 }
63825
63826 // Only take the lower 160bits of the hash
63827 return exports.rlphash([from, nonce]).slice(-20);
63828};
63829
63830/**
63831 * Generates an address for a contract created using CREATE2
63832 * @param {Buffer} from the address which is creating this new address
63833 * @param {Buffer} salt a salt
63834 * @param {Buffer} initCode the init code of the contract being created
63835 * @return {Buffer}
63836 */
63837exports.generateAddress2 = function (from, salt, initCode) {
63838 from = exports.toBuffer(from);
63839 salt = exports.toBuffer(salt);
63840 initCode = exports.toBuffer(initCode);
63841
63842 assert(from.length === 20);
63843 assert(salt.length === 32);
63844
63845 var address = exports.keccak256(Buffer.concat([Buffer.from('ff', 'hex'), from, salt, exports.keccak256(initCode)]));
63846
63847 return address.slice(-20);
63848};
63849
63850/**
63851 * Returns true if the supplied address belongs to a precompiled account (Byzantium)
63852 * @param {Buffer|String} address
63853 * @return {Boolean}
63854 */
63855exports.isPrecompiled = function (address) {
63856 var a = exports.unpad(address);
63857 return a.length === 1 && a[0] >= 1 && a[0] <= 8;
63858};
63859
63860/**
63861 * Adds "0x" to a given `String` if it does not already start with "0x"
63862 * @param {String} str
63863 * @return {String}
63864 */
63865exports.addHexPrefix = function (str) {
63866 if (typeof str !== 'string') {
63867 return str;
63868 }
63869
63870 return exports.isHexPrefixed(str) ? str : '0x' + str;
63871};
63872
63873/**
63874 * Validate ECDSA signature
63875 * @method isValidSignature
63876 * @param {Buffer} v
63877 * @param {Buffer} r
63878 * @param {Buffer} s
63879 * @param {Boolean} [homestead=true]
63880 * @param {Number} [chainId]
63881 * @return {Boolean}
63882 */
63883
63884exports.isValidSignature = function (v, r, s, homestead, chainId) {
63885 var SECP256K1_N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16);
63886 var SECP256K1_N = new BN('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 16);
63887
63888 if (r.length !== 32 || s.length !== 32) {
63889 return false;
63890 }
63891
63892 if (!isValidSigRecovery(calculateSigRecovery(v, chainId))) {
63893 return false;
63894 }
63895
63896 r = new BN(r);
63897 s = new BN(s);
63898
63899 if (r.isZero() || r.gt(SECP256K1_N) || s.isZero() || s.gt(SECP256K1_N)) {
63900 return false;
63901 }
63902
63903 if (homestead === false && new BN(s).cmp(SECP256K1_N_DIV_2) === 1) {
63904 return false;
63905 }
63906
63907 return true;
63908};
63909
63910/**
63911 * Converts a `Buffer` or `Array` to JSON
63912 * @param {Buffer|Array} ba
63913 * @return {Array|String|null}
63914 */
63915exports.baToJSON = function (ba) {
63916 if (Buffer.isBuffer(ba)) {
63917 return '0x' + ba.toString('hex');
63918 } else if (ba instanceof Array) {
63919 var array = [];
63920 for (var i = 0; i < ba.length; i++) {
63921 array.push(exports.baToJSON(ba[i]));
63922 }
63923 return array;
63924 }
63925};
63926
63927/**
63928 * Defines properties on a `Object`. It make the assumption that underlying data is binary.
63929 * @param {Object} self the `Object` to define properties on
63930 * @param {Array} fields an array fields to define. Fields can contain:
63931 * * `name` - the name of the properties
63932 * * `length` - the number of bytes the field can have
63933 * * `allowLess` - if the field can be less than the length
63934 * * `allowEmpty`
63935 * @param {*} data data to be validated against the definitions
63936 */
63937exports.defineProperties = function (self, fields, data) {
63938 self.raw = [];
63939 self._fields = [];
63940
63941 // attach the `toJSON`
63942 self.toJSON = function (label) {
63943 if (label) {
63944 var obj = {};
63945 self._fields.forEach(function (field) {
63946 obj[field] = '0x' + self[field].toString('hex');
63947 });
63948 return obj;
63949 }
63950 return exports.baToJSON(this.raw);
63951 };
63952
63953 self.serialize = function serialize() {
63954 return rlp.encode(self.raw);
63955 };
63956
63957 fields.forEach(function (field, i) {
63958 self._fields.push(field.name);
63959 function getter() {
63960 return self.raw[i];
63961 }
63962 function setter(v) {
63963 v = exports.toBuffer(v);
63964
63965 if (v.toString('hex') === '00' && !field.allowZero) {
63966 v = Buffer.allocUnsafe(0);
63967 }
63968
63969 if (field.allowLess && field.length) {
63970 v = exports.stripZeros(v);
63971 assert(field.length >= v.length, 'The field ' + field.name + ' must not have more ' + field.length + ' bytes');
63972 } else if (!(field.allowZero && v.length === 0) && field.length) {
63973 assert(field.length === v.length, 'The field ' + field.name + ' must have byte length of ' + field.length);
63974 }
63975
63976 self.raw[i] = v;
63977 }
63978
63979 Object.defineProperty(self, field.name, {
63980 enumerable: true,
63981 configurable: true,
63982 get: getter,
63983 set: setter
63984 });
63985
63986 if (field.default) {
63987 self[field.name] = field.default;
63988 }
63989
63990 // attach alias
63991 if (field.alias) {
63992 Object.defineProperty(self, field.alias, {
63993 enumerable: false,
63994 configurable: true,
63995 set: setter,
63996 get: getter
63997 });
63998 }
63999 });
64000
64001 // if the constuctor is passed data
64002 if (data) {
64003 if (typeof data === 'string') {
64004 data = Buffer.from(exports.stripHexPrefix(data), 'hex');
64005 }
64006
64007 if (Buffer.isBuffer(data)) {
64008 data = rlp.decode(data);
64009 }
64010
64011 if (Array.isArray(data)) {
64012 if (data.length > self._fields.length) {
64013 throw new Error('wrong number of fields in data');
64014 }
64015
64016 // make sure all the items are buffers
64017 data.forEach(function (d, i) {
64018 self[self._fields[i]] = exports.toBuffer(d);
64019 });
64020 } else if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') {
64021 var keys = Object.keys(data);
64022 fields.forEach(function (field) {
64023 if (keys.indexOf(field.name) !== -1) self[field.name] = data[field.name];
64024 if (keys.indexOf(field.alias) !== -1) self[field.alias] = data[field.alias];
64025 });
64026 } else {
64027 throw new Error('invalid data');
64028 }
64029 }
64030};
64031
64032function calculateSigRecovery(v, chainId) {
64033 return chainId ? v - (2 * chainId + 35) : v - 27;
64034}
64035
64036function isValidSigRecovery(recovery) {
64037 return recovery === 0 || recovery === 1;
64038}
64039},{"assert":26,"bn.js":108,"create-hash":239,"ethjs-util":334,"keccak":429,"rlp":741,"safe-buffer":742,"secp256k1":747}],334:[function(require,module,exports){
64040(function (Buffer){
64041'use strict';
64042
64043var isHexPrefixed = require('is-hex-prefixed');
64044var stripHexPrefix = require('strip-hex-prefix');
64045
64046/**
64047 * Pads a `String` to have an even length
64048 * @param {String} value
64049 * @return {String} output
64050 */
64051function padToEven(value) {
64052 var a = value; // eslint-disable-line
64053
64054 if (typeof a !== 'string') {
64055 throw new Error('[ethjs-util] while padding to even, value must be string, is currently ' + typeof a + ', while padToEven.');
64056 }
64057
64058 if (a.length % 2) {
64059 a = '0' + a;
64060 }
64061
64062 return a;
64063}
64064
64065/**
64066 * Converts a `Number` into a hex `String`
64067 * @param {Number} i
64068 * @return {String}
64069 */
64070function intToHex(i) {
64071 var hex = i.toString(16); // eslint-disable-line
64072
64073 return '0x' + hex;
64074}
64075
64076/**
64077 * Converts an `Number` to a `Buffer`
64078 * @param {Number} i
64079 * @return {Buffer}
64080 */
64081function intToBuffer(i) {
64082 var hex = intToHex(i);
64083
64084 return new Buffer(padToEven(hex.slice(2)), 'hex');
64085}
64086
64087/**
64088 * Get the binary size of a string
64089 * @param {String} str
64090 * @return {Number}
64091 */
64092function getBinarySize(str) {
64093 if (typeof str !== 'string') {
64094 throw new Error('[ethjs-util] while getting binary size, method getBinarySize requires input \'str\' to be type String, got \'' + typeof str + '\'.');
64095 }
64096
64097 return Buffer.byteLength(str, 'utf8');
64098}
64099
64100/**
64101 * Returns TRUE if the first specified array contains all elements
64102 * from the second one. FALSE otherwise.
64103 *
64104 * @param {array} superset
64105 * @param {array} subset
64106 *
64107 * @returns {boolean}
64108 */
64109function arrayContainsArray(superset, subset, some) {
64110 if (Array.isArray(superset) !== true) {
64111 throw new Error('[ethjs-util] method arrayContainsArray requires input \'superset\' to be an array got type \'' + typeof superset + '\'');
64112 }
64113 if (Array.isArray(subset) !== true) {
64114 throw new Error('[ethjs-util] method arrayContainsArray requires input \'subset\' to be an array got type \'' + typeof subset + '\'');
64115 }
64116
64117 return subset[Boolean(some) && 'some' || 'every'](function (value) {
64118 return superset.indexOf(value) >= 0;
64119 });
64120}
64121
64122/**
64123 * Should be called to get utf8 from it's hex representation
64124 *
64125 * @method toUtf8
64126 * @param {String} string in hex
64127 * @returns {String} ascii string representation of hex value
64128 */
64129function toUtf8(hex) {
64130 var bufferValue = new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g, '')), 'hex');
64131
64132 return bufferValue.toString('utf8');
64133}
64134
64135/**
64136 * Should be called to get ascii from it's hex representation
64137 *
64138 * @method toAscii
64139 * @param {String} string in hex
64140 * @returns {String} ascii string representation of hex value
64141 */
64142function toAscii(hex) {
64143 var str = ''; // eslint-disable-line
64144 var i = 0,
64145 l = hex.length; // eslint-disable-line
64146
64147 if (hex.substring(0, 2) === '0x') {
64148 i = 2;
64149 }
64150
64151 for (; i < l; i += 2) {
64152 var code = parseInt(hex.substr(i, 2), 16);
64153 str += String.fromCharCode(code);
64154 }
64155
64156 return str;
64157}
64158
64159/**
64160 * Should be called to get hex representation (prefixed by 0x) of utf8 string
64161 *
64162 * @method fromUtf8
64163 * @param {String} string
64164 * @param {Number} optional padding
64165 * @returns {String} hex representation of input string
64166 */
64167function fromUtf8(stringValue) {
64168 var str = new Buffer(stringValue, 'utf8');
64169
64170 return '0x' + padToEven(str.toString('hex')).replace(/^0+|0+$/g, '');
64171}
64172
64173/**
64174 * Should be called to get hex representation (prefixed by 0x) of ascii string
64175 *
64176 * @method fromAscii
64177 * @param {String} string
64178 * @param {Number} optional padding
64179 * @returns {String} hex representation of input string
64180 */
64181function fromAscii(stringValue) {
64182 var hex = ''; // eslint-disable-line
64183 for (var i = 0; i < stringValue.length; i++) {
64184 // eslint-disable-line
64185 var code = stringValue.charCodeAt(i);
64186 var n = code.toString(16);
64187 hex += n.length < 2 ? '0' + n : n;
64188 }
64189
64190 return '0x' + hex;
64191}
64192
64193/**
64194 * getKeys([{a: 1, b: 2}, {a: 3, b: 4}], 'a') => [1, 3]
64195 *
64196 * @method getKeys get specific key from inner object array of objects
64197 * @param {String} params
64198 * @param {String} key
64199 * @param {Boolean} allowEmpty
64200 * @returns {Array} output just a simple array of output keys
64201 */
64202function getKeys(params, key, allowEmpty) {
64203 if (!Array.isArray(params)) {
64204 throw new Error('[ethjs-util] method getKeys expecting type Array as \'params\' input, got \'' + typeof params + '\'');
64205 }
64206 if (typeof key !== 'string') {
64207 throw new Error('[ethjs-util] method getKeys expecting type String for input \'key\' got \'' + typeof key + '\'.');
64208 }
64209
64210 var result = []; // eslint-disable-line
64211
64212 for (var i = 0; i < params.length; i++) {
64213 // eslint-disable-line
64214 var value = params[i][key]; // eslint-disable-line
64215 if (allowEmpty && !value) {
64216 value = '';
64217 } else if (typeof value !== 'string') {
64218 throw new Error('invalid abi');
64219 }
64220 result.push(value);
64221 }
64222
64223 return result;
64224}
64225
64226/**
64227 * Is the string a hex string.
64228 *
64229 * @method check if string is hex string of specific length
64230 * @param {String} value
64231 * @param {Number} length
64232 * @returns {Boolean} output the string is a hex string
64233 */
64234function isHexString(value, length) {
64235 if (typeof value !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {
64236 return false;
64237 }
64238
64239 if (length && value.length !== 2 + 2 * length) {
64240 return false;
64241 }
64242
64243 return true;
64244}
64245
64246module.exports = {
64247 arrayContainsArray: arrayContainsArray,
64248 intToBuffer: intToBuffer,
64249 getBinarySize: getBinarySize,
64250 isHexPrefixed: isHexPrefixed,
64251 stripHexPrefix: stripHexPrefix,
64252 padToEven: padToEven,
64253 intToHex: intToHex,
64254 fromAscii: fromAscii,
64255 fromUtf8: fromUtf8,
64256 toAscii: toAscii,
64257 toUtf8: toUtf8,
64258 getKeys: getKeys,
64259 isHexString: isHexString
64260};
64261}).call(this,require("buffer").Buffer)
64262},{"buffer":146,"is-hex-prefixed":399,"strip-hex-prefix":811}],335:[function(require,module,exports){
64263// Copyright Joyent, Inc. and other Node contributors.
64264//
64265// Permission is hereby granted, free of charge, to any person obtaining a
64266// copy of this software and associated documentation files (the
64267// "Software"), to deal in the Software without restriction, including
64268// without limitation the rights to use, copy, modify, merge, publish,
64269// distribute, sublicense, and/or sell copies of the Software, and to permit
64270// persons to whom the Software is furnished to do so, subject to the
64271// following conditions:
64272//
64273// The above copyright notice and this permission notice shall be included
64274// in all copies or substantial portions of the Software.
64275//
64276// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
64277// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
64278// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
64279// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
64280// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
64281// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
64282// USE OR OTHER DEALINGS IN THE SOFTWARE.
64283
64284var objectCreate = Object.create || objectCreatePolyfill
64285var objectKeys = Object.keys || objectKeysPolyfill
64286var bind = Function.prototype.bind || functionBindPolyfill
64287
64288function EventEmitter() {
64289 if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
64290 this._events = objectCreate(null);
64291 this._eventsCount = 0;
64292 }
64293
64294 this._maxListeners = this._maxListeners || undefined;
64295}
64296module.exports = EventEmitter;
64297
64298// Backwards-compat with node 0.10.x
64299EventEmitter.EventEmitter = EventEmitter;
64300
64301EventEmitter.prototype._events = undefined;
64302EventEmitter.prototype._maxListeners = undefined;
64303
64304// By default EventEmitters will print a warning if more than 10 listeners are
64305// added to it. This is a useful default which helps finding memory leaks.
64306var defaultMaxListeners = 10;
64307
64308var hasDefineProperty;
64309try {
64310 var o = {};
64311 if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
64312 hasDefineProperty = o.x === 0;
64313} catch (err) { hasDefineProperty = false }
64314if (hasDefineProperty) {
64315 Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
64316 enumerable: true,
64317 get: function() {
64318 return defaultMaxListeners;
64319 },
64320 set: function(arg) {
64321 // check whether the input is a positive number (whose value is zero or
64322 // greater and not a NaN).
64323 if (typeof arg !== 'number' || arg < 0 || arg !== arg)
64324 throw new TypeError('"defaultMaxListeners" must be a positive number');
64325 defaultMaxListeners = arg;
64326 }
64327 });
64328} else {
64329 EventEmitter.defaultMaxListeners = defaultMaxListeners;
64330}
64331
64332// Obviously not all Emitters should be limited to 10. This function allows
64333// that to be increased. Set to zero for unlimited.
64334EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
64335 if (typeof n !== 'number' || n < 0 || isNaN(n))
64336 throw new TypeError('"n" argument must be a positive number');
64337 this._maxListeners = n;
64338 return this;
64339};
64340
64341function $getMaxListeners(that) {
64342 if (that._maxListeners === undefined)
64343 return EventEmitter.defaultMaxListeners;
64344 return that._maxListeners;
64345}
64346
64347EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
64348 return $getMaxListeners(this);
64349};
64350
64351// These standalone emit* functions are used to optimize calling of event
64352// handlers for fast cases because emit() itself often has a variable number of
64353// arguments and can be deoptimized because of that. These functions always have
64354// the same number of arguments and thus do not get deoptimized, so the code
64355// inside them can execute faster.
64356function emitNone(handler, isFn, self) {
64357 if (isFn)
64358 handler.call(self);
64359 else {
64360 var len = handler.length;
64361 var listeners = arrayClone(handler, len);
64362 for (var i = 0; i < len; ++i)
64363 listeners[i].call(self);
64364 }
64365}
64366function emitOne(handler, isFn, self, arg1) {
64367 if (isFn)
64368 handler.call(self, arg1);
64369 else {
64370 var len = handler.length;
64371 var listeners = arrayClone(handler, len);
64372 for (var i = 0; i < len; ++i)
64373 listeners[i].call(self, arg1);
64374 }
64375}
64376function emitTwo(handler, isFn, self, arg1, arg2) {
64377 if (isFn)
64378 handler.call(self, arg1, arg2);
64379 else {
64380 var len = handler.length;
64381 var listeners = arrayClone(handler, len);
64382 for (var i = 0; i < len; ++i)
64383 listeners[i].call(self, arg1, arg2);
64384 }
64385}
64386function emitThree(handler, isFn, self, arg1, arg2, arg3) {
64387 if (isFn)
64388 handler.call(self, arg1, arg2, arg3);
64389 else {
64390 var len = handler.length;
64391 var listeners = arrayClone(handler, len);
64392 for (var i = 0; i < len; ++i)
64393 listeners[i].call(self, arg1, arg2, arg3);
64394 }
64395}
64396
64397function emitMany(handler, isFn, self, args) {
64398 if (isFn)
64399 handler.apply(self, args);
64400 else {
64401 var len = handler.length;
64402 var listeners = arrayClone(handler, len);
64403 for (var i = 0; i < len; ++i)
64404 listeners[i].apply(self, args);
64405 }
64406}
64407
64408EventEmitter.prototype.emit = function emit(type) {
64409 var er, handler, len, args, i, events;
64410 var doError = (type === 'error');
64411
64412 events = this._events;
64413 if (events)
64414 doError = (doError && events.error == null);
64415 else if (!doError)
64416 return false;
64417
64418 // If there is no 'error' event listener then throw.
64419 if (doError) {
64420 if (arguments.length > 1)
64421 er = arguments[1];
64422 if (er instanceof Error) {
64423 throw er; // Unhandled 'error' event
64424 } else {
64425 // At least give some kind of context to the user
64426 var err = new Error('Unhandled "error" event. (' + er + ')');
64427 err.context = er;
64428 throw err;
64429 }
64430 return false;
64431 }
64432
64433 handler = events[type];
64434
64435 if (!handler)
64436 return false;
64437
64438 var isFn = typeof handler === 'function';
64439 len = arguments.length;
64440 switch (len) {
64441 // fast cases
64442 case 1:
64443 emitNone(handler, isFn, this);
64444 break;
64445 case 2:
64446 emitOne(handler, isFn, this, arguments[1]);
64447 break;
64448 case 3:
64449 emitTwo(handler, isFn, this, arguments[1], arguments[2]);
64450 break;
64451 case 4:
64452 emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
64453 break;
64454 // slower
64455 default:
64456 args = new Array(len - 1);
64457 for (i = 1; i < len; i++)
64458 args[i - 1] = arguments[i];
64459 emitMany(handler, isFn, this, args);
64460 }
64461
64462 return true;
64463};
64464
64465function _addListener(target, type, listener, prepend) {
64466 var m;
64467 var events;
64468 var existing;
64469
64470 if (typeof listener !== 'function')
64471 throw new TypeError('"listener" argument must be a function');
64472
64473 events = target._events;
64474 if (!events) {
64475 events = target._events = objectCreate(null);
64476 target._eventsCount = 0;
64477 } else {
64478 // To avoid recursion in the case that type === "newListener"! Before
64479 // adding it to the listeners, first emit "newListener".
64480 if (events.newListener) {
64481 target.emit('newListener', type,
64482 listener.listener ? listener.listener : listener);
64483
64484 // Re-assign `events` because a newListener handler could have caused the
64485 // this._events to be assigned to a new object
64486 events = target._events;
64487 }
64488 existing = events[type];
64489 }
64490
64491 if (!existing) {
64492 // Optimize the case of one listener. Don't need the extra array object.
64493 existing = events[type] = listener;
64494 ++target._eventsCount;
64495 } else {
64496 if (typeof existing === 'function') {
64497 // Adding the second element, need to change to array.
64498 existing = events[type] =
64499 prepend ? [listener, existing] : [existing, listener];
64500 } else {
64501 // If we've already got an array, just append.
64502 if (prepend) {
64503 existing.unshift(listener);
64504 } else {
64505 existing.push(listener);
64506 }
64507 }
64508
64509 // Check for listener leak
64510 if (!existing.warned) {
64511 m = $getMaxListeners(target);
64512 if (m && m > 0 && existing.length > m) {
64513 existing.warned = true;
64514 var w = new Error('Possible EventEmitter memory leak detected. ' +
64515 existing.length + ' "' + String(type) + '" listeners ' +
64516 'added. Use emitter.setMaxListeners() to ' +
64517 'increase limit.');
64518 w.name = 'MaxListenersExceededWarning';
64519 w.emitter = target;
64520 w.type = type;
64521 w.count = existing.length;
64522 if (typeof console === 'object' && console.warn) {
64523 console.warn('%s: %s', w.name, w.message);
64524 }
64525 }
64526 }
64527 }
64528
64529 return target;
64530}
64531
64532EventEmitter.prototype.addListener = function addListener(type, listener) {
64533 return _addListener(this, type, listener, false);
64534};
64535
64536EventEmitter.prototype.on = EventEmitter.prototype.addListener;
64537
64538EventEmitter.prototype.prependListener =
64539 function prependListener(type, listener) {
64540 return _addListener(this, type, listener, true);
64541 };
64542
64543function onceWrapper() {
64544 if (!this.fired) {
64545 this.target.removeListener(this.type, this.wrapFn);
64546 this.fired = true;
64547 switch (arguments.length) {
64548 case 0:
64549 return this.listener.call(this.target);
64550 case 1:
64551 return this.listener.call(this.target, arguments[0]);
64552 case 2:
64553 return this.listener.call(this.target, arguments[0], arguments[1]);
64554 case 3:
64555 return this.listener.call(this.target, arguments[0], arguments[1],
64556 arguments[2]);
64557 default:
64558 var args = new Array(arguments.length);
64559 for (var i = 0; i < args.length; ++i)
64560 args[i] = arguments[i];
64561 this.listener.apply(this.target, args);
64562 }
64563 }
64564}
64565
64566function _onceWrap(target, type, listener) {
64567 var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
64568 var wrapped = bind.call(onceWrapper, state);
64569 wrapped.listener = listener;
64570 state.wrapFn = wrapped;
64571 return wrapped;
64572}
64573
64574EventEmitter.prototype.once = function once(type, listener) {
64575 if (typeof listener !== 'function')
64576 throw new TypeError('"listener" argument must be a function');
64577 this.on(type, _onceWrap(this, type, listener));
64578 return this;
64579};
64580
64581EventEmitter.prototype.prependOnceListener =
64582 function prependOnceListener(type, listener) {
64583 if (typeof listener !== 'function')
64584 throw new TypeError('"listener" argument must be a function');
64585 this.prependListener(type, _onceWrap(this, type, listener));
64586 return this;
64587 };
64588
64589// Emits a 'removeListener' event if and only if the listener was removed.
64590EventEmitter.prototype.removeListener =
64591 function removeListener(type, listener) {
64592 var list, events, position, i, originalListener;
64593
64594 if (typeof listener !== 'function')
64595 throw new TypeError('"listener" argument must be a function');
64596
64597 events = this._events;
64598 if (!events)
64599 return this;
64600
64601 list = events[type];
64602 if (!list)
64603 return this;
64604
64605 if (list === listener || list.listener === listener) {
64606 if (--this._eventsCount === 0)
64607 this._events = objectCreate(null);
64608 else {
64609 delete events[type];
64610 if (events.removeListener)
64611 this.emit('removeListener', type, list.listener || listener);
64612 }
64613 } else if (typeof list !== 'function') {
64614 position = -1;
64615
64616 for (i = list.length - 1; i >= 0; i--) {
64617 if (list[i] === listener || list[i].listener === listener) {
64618 originalListener = list[i].listener;
64619 position = i;
64620 break;
64621 }
64622 }
64623
64624 if (position < 0)
64625 return this;
64626
64627 if (position === 0)
64628 list.shift();
64629 else
64630 spliceOne(list, position);
64631
64632 if (list.length === 1)
64633 events[type] = list[0];
64634
64635 if (events.removeListener)
64636 this.emit('removeListener', type, originalListener || listener);
64637 }
64638
64639 return this;
64640 };
64641
64642EventEmitter.prototype.removeAllListeners =
64643 function removeAllListeners(type) {
64644 var listeners, events, i;
64645
64646 events = this._events;
64647 if (!events)
64648 return this;
64649
64650 // not listening for removeListener, no need to emit
64651 if (!events.removeListener) {
64652 if (arguments.length === 0) {
64653 this._events = objectCreate(null);
64654 this._eventsCount = 0;
64655 } else if (events[type]) {
64656 if (--this._eventsCount === 0)
64657 this._events = objectCreate(null);
64658 else
64659 delete events[type];
64660 }
64661 return this;
64662 }
64663
64664 // emit removeListener for all listeners on all events
64665 if (arguments.length === 0) {
64666 var keys = objectKeys(events);
64667 var key;
64668 for (i = 0; i < keys.length; ++i) {
64669 key = keys[i];
64670 if (key === 'removeListener') continue;
64671 this.removeAllListeners(key);
64672 }
64673 this.removeAllListeners('removeListener');
64674 this._events = objectCreate(null);
64675 this._eventsCount = 0;
64676 return this;
64677 }
64678
64679 listeners = events[type];
64680
64681 if (typeof listeners === 'function') {
64682 this.removeListener(type, listeners);
64683 } else if (listeners) {
64684 // LIFO order
64685 for (i = listeners.length - 1; i >= 0; i--) {
64686 this.removeListener(type, listeners[i]);
64687 }
64688 }
64689
64690 return this;
64691 };
64692
64693function _listeners(target, type, unwrap) {
64694 var events = target._events;
64695
64696 if (!events)
64697 return [];
64698
64699 var evlistener = events[type];
64700 if (!evlistener)
64701 return [];
64702
64703 if (typeof evlistener === 'function')
64704 return unwrap ? [evlistener.listener || evlistener] : [evlistener];
64705
64706 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
64707}
64708
64709EventEmitter.prototype.listeners = function listeners(type) {
64710 return _listeners(this, type, true);
64711};
64712
64713EventEmitter.prototype.rawListeners = function rawListeners(type) {
64714 return _listeners(this, type, false);
64715};
64716
64717EventEmitter.listenerCount = function(emitter, type) {
64718 if (typeof emitter.listenerCount === 'function') {
64719 return emitter.listenerCount(type);
64720 } else {
64721 return listenerCount.call(emitter, type);
64722 }
64723};
64724
64725EventEmitter.prototype.listenerCount = listenerCount;
64726function listenerCount(type) {
64727 var events = this._events;
64728
64729 if (events) {
64730 var evlistener = events[type];
64731
64732 if (typeof evlistener === 'function') {
64733 return 1;
64734 } else if (evlistener) {
64735 return evlistener.length;
64736 }
64737 }
64738
64739 return 0;
64740}
64741
64742EventEmitter.prototype.eventNames = function eventNames() {
64743 return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
64744};
64745
64746// About 1.5x faster than the two-arg version of Array#splice().
64747function spliceOne(list, index) {
64748 for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
64749 list[i] = list[k];
64750 list.pop();
64751}
64752
64753function arrayClone(arr, n) {
64754 var copy = new Array(n);
64755 for (var i = 0; i < n; ++i)
64756 copy[i] = arr[i];
64757 return copy;
64758}
64759
64760function unwrapListeners(arr) {
64761 var ret = new Array(arr.length);
64762 for (var i = 0; i < ret.length; ++i) {
64763 ret[i] = arr[i].listener || arr[i];
64764 }
64765 return ret;
64766}
64767
64768function objectCreatePolyfill(proto) {
64769 var F = function() {};
64770 F.prototype = proto;
64771 return new F;
64772}
64773function objectKeysPolyfill(obj) {
64774 var keys = [];
64775 for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
64776 keys.push(k);
64777 }
64778 return k;
64779}
64780function functionBindPolyfill(context) {
64781 var fn = this;
64782 return function () {
64783 return fn.apply(context, arguments);
64784 };
64785}
64786
64787},{}],336:[function(require,module,exports){
64788var Buffer = require('safe-buffer').Buffer
64789var MD5 = require('md5.js')
64790
64791/* eslint-disable camelcase */
64792function EVP_BytesToKey (password, salt, keyBits, ivLen) {
64793 if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
64794 if (salt) {
64795 if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
64796 if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
64797 }
64798
64799 var keyLen = keyBits / 8
64800 var key = Buffer.alloc(keyLen)
64801 var iv = Buffer.alloc(ivLen || 0)
64802 var tmp = Buffer.alloc(0)
64803
64804 while (keyLen > 0 || ivLen > 0) {
64805 var hash = new MD5()
64806 hash.update(tmp)
64807 hash.update(password)
64808 if (salt) hash.update(salt)
64809 tmp = hash.digest()
64810
64811 var used = 0
64812
64813 if (keyLen > 0) {
64814 var keyStart = key.length - keyLen
64815 used = Math.min(keyLen, tmp.length)
64816 tmp.copy(key, keyStart, 0, used)
64817 keyLen -= used
64818 }
64819
64820 if (used < tmp.length && ivLen > 0) {
64821 var ivStart = iv.length - ivLen
64822 var length = Math.min(ivLen, tmp.length - used)
64823 tmp.copy(iv, ivStart, used, used + length)
64824 ivLen -= length
64825 }
64826 }
64827
64828 tmp.fill(0)
64829 return { key: key, iv: iv }
64830}
64831
64832module.exports = EVP_BytesToKey
64833
64834},{"md5.js":637,"safe-buffer":742}],337:[function(require,module,exports){
64835'use strict';
64836
64837var hasOwn = Object.prototype.hasOwnProperty;
64838var toStr = Object.prototype.toString;
64839var defineProperty = Object.defineProperty;
64840var gOPD = Object.getOwnPropertyDescriptor;
64841
64842var isArray = function isArray(arr) {
64843 if (typeof Array.isArray === 'function') {
64844 return Array.isArray(arr);
64845 }
64846
64847 return toStr.call(arr) === '[object Array]';
64848};
64849
64850var isPlainObject = function isPlainObject(obj) {
64851 if (!obj || toStr.call(obj) !== '[object Object]') {
64852 return false;
64853 }
64854
64855 var hasOwnConstructor = hasOwn.call(obj, 'constructor');
64856 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
64857 // Not own constructor property must be Object
64858 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
64859 return false;
64860 }
64861
64862 // Own properties are enumerated firstly, so to speed up,
64863 // if last one is own, then all properties are own.
64864 var key;
64865 for (key in obj) { /**/ }
64866
64867 return typeof key === 'undefined' || hasOwn.call(obj, key);
64868};
64869
64870// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
64871var setProperty = function setProperty(target, options) {
64872 if (defineProperty && options.name === '__proto__') {
64873 defineProperty(target, options.name, {
64874 enumerable: true,
64875 configurable: true,
64876 value: options.newValue,
64877 writable: true
64878 });
64879 } else {
64880 target[options.name] = options.newValue;
64881 }
64882};
64883
64884// Return undefined instead of __proto__ if '__proto__' is not an own property
64885var getProperty = function getProperty(obj, name) {
64886 if (name === '__proto__') {
64887 if (!hasOwn.call(obj, name)) {
64888 return void 0;
64889 } else if (gOPD) {
64890 // In early versions of node, obj['__proto__'] is buggy when obj has
64891 // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
64892 return gOPD(obj, name).value;
64893 }
64894 }
64895
64896 return obj[name];
64897};
64898
64899module.exports = function extend() {
64900 var options, name, src, copy, copyIsArray, clone;
64901 var target = arguments[0];
64902 var i = 1;
64903 var length = arguments.length;
64904 var deep = false;
64905
64906 // Handle a deep copy situation
64907 if (typeof target === 'boolean') {
64908 deep = target;
64909 target = arguments[1] || {};
64910 // skip the boolean and the target
64911 i = 2;
64912 }
64913 if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
64914 target = {};
64915 }
64916
64917 for (; i < length; ++i) {
64918 options = arguments[i];
64919 // Only deal with non-null/undefined values
64920 if (options != null) {
64921 // Extend the base object
64922 for (name in options) {
64923 src = getProperty(target, name);
64924 copy = getProperty(options, name);
64925
64926 // Prevent never-ending loop
64927 if (target !== copy) {
64928 // Recurse if we're merging plain objects or arrays
64929 if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
64930 if (copyIsArray) {
64931 copyIsArray = false;
64932 clone = src && isArray(src) ? src : [];
64933 } else {
64934 clone = src && isPlainObject(src) ? src : {};
64935 }
64936
64937 // Never move original objects, clone them
64938 setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
64939
64940 // Don't bring in undefined values
64941 } else if (typeof copy !== 'undefined') {
64942 setProperty(target, { name: name, newValue: copy });
64943 }
64944 }
64945 }
64946 }
64947 }
64948
64949 // Return the modified object
64950 return target;
64951};
64952
64953},{}],338:[function(require,module,exports){
64954(function() {
64955 'use strict';
64956
64957 var collator;
64958 try {
64959 collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null;
64960 } catch (err){
64961 console.log("Collator could not be initialized and wouldn't be used");
64962 }
64963 // arrays to re-use
64964 var prevRow = [],
64965 str2Char = [];
64966
64967 /**
64968 * Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance.
64969 */
64970 var Levenshtein = {
64971 /**
64972 * Calculate levenshtein distance of the two strings.
64973 *
64974 * @param str1 String the first string.
64975 * @param str2 String the second string.
64976 * @param [options] Additional options.
64977 * @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
64978 * @return Integer the levenshtein distance (0 and above).
64979 */
64980 get: function(str1, str2, options) {
64981 var useCollator = (options && collator && options.useCollator);
64982
64983 var str1Len = str1.length,
64984 str2Len = str2.length;
64985
64986 // base cases
64987 if (str1Len === 0) return str2Len;
64988 if (str2Len === 0) return str1Len;
64989
64990 // two rows
64991 var curCol, nextCol, i, j, tmp;
64992
64993 // initialise previous row
64994 for (i=0; i<str2Len; ++i) {
64995 prevRow[i] = i;
64996 str2Char[i] = str2.charCodeAt(i);
64997 }
64998 prevRow[str2Len] = str2Len;
64999
65000 var strCmp;
65001 if (useCollator) {
65002 // calculate current row distance from previous row using collator
65003 for (i = 0; i < str1Len; ++i) {
65004 nextCol = i + 1;
65005
65006 for (j = 0; j < str2Len; ++j) {
65007 curCol = nextCol;
65008
65009 // substution
65010 strCmp = 0 === collator.compare(str1.charAt(i), String.fromCharCode(str2Char[j]));
65011
65012 nextCol = prevRow[j] + (strCmp ? 0 : 1);
65013
65014 // insertion
65015 tmp = curCol + 1;
65016 if (nextCol > tmp) {
65017 nextCol = tmp;
65018 }
65019 // deletion
65020 tmp = prevRow[j + 1] + 1;
65021 if (nextCol > tmp) {
65022 nextCol = tmp;
65023 }
65024
65025 // copy current col value into previous (in preparation for next iteration)
65026 prevRow[j] = curCol;
65027 }
65028
65029 // copy last col value into previous (in preparation for next iteration)
65030 prevRow[j] = nextCol;
65031 }
65032 }
65033 else {
65034 // calculate current row distance from previous row without collator
65035 for (i = 0; i < str1Len; ++i) {
65036 nextCol = i + 1;
65037
65038 for (j = 0; j < str2Len; ++j) {
65039 curCol = nextCol;
65040
65041 // substution
65042 strCmp = str1.charCodeAt(i) === str2Char[j];
65043
65044 nextCol = prevRow[j] + (strCmp ? 0 : 1);
65045
65046 // insertion
65047 tmp = curCol + 1;
65048 if (nextCol > tmp) {
65049 nextCol = tmp;
65050 }
65051 // deletion
65052 tmp = prevRow[j + 1] + 1;
65053 if (nextCol > tmp) {
65054 nextCol = tmp;
65055 }
65056
65057 // copy current col value into previous (in preparation for next iteration)
65058 prevRow[j] = curCol;
65059 }
65060
65061 // copy last col value into previous (in preparation for next iteration)
65062 prevRow[j] = nextCol;
65063 }
65064 }
65065 return nextCol;
65066 }
65067
65068 };
65069
65070 // amd
65071 if (typeof define !== "undefined" && define !== null && define.amd) {
65072 define(function() {
65073 return Levenshtein;
65074 });
65075 }
65076 // commonjs
65077 else if (typeof module !== "undefined" && module !== null && typeof exports !== "undefined" && module.exports === exports) {
65078 module.exports = Levenshtein;
65079 }
65080 // web worker
65081 else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') {
65082 self.Levenshtein = Levenshtein;
65083 }
65084 // browser main thread
65085 else if (typeof window !== "undefined" && window !== null) {
65086 window.Levenshtein = Levenshtein;
65087 }
65088}());
65089
65090
65091},{}],339:[function(require,module,exports){
65092'use strict';
65093
65094var groestl = require('./lib/groestl');
65095var h = require('./lib/helper');
65096
65097var x11hash = module.exports;
65098
65099module.exports.groestl512 = function(str,format, output) {
65100 return groestl(str,format,output);
65101}
65102
65103module.exports.groestl = function(str,format, output) {
65104 var a = groestl(str,format,2);
65105 a = a.slice(0,8);
65106 if (output === 2) {
65107 return a;
65108 }
65109 else if (output === 1) {
65110 return h.int32Buffer2Bytes(a);
65111 }
65112 else {
65113 return h.int32ArrayToHexString(a);
65114 }
65115}
65116
65117module.exports.groestl_2 = function(str,format, output) {
65118 var a = groestl(str,format,2);
65119 a = groestl(a,2,2);
65120 a = a.slice(0,8);
65121 if (output === 2) {
65122 return a;
65123 }
65124 else if (output === 1) {
65125 return h.int32Buffer2Bytes(a);
65126 }
65127 else {
65128 return h.int32ArrayToHexString(a);
65129 }
65130}
65131},{"./lib/groestl":340,"./lib/helper":341}],340:[function(require,module,exports){
65132/////////////////////////////////////
65133//////////// groestl ///////////////
65134
65135//// Written by Quantum Explorer ////
65136////////// Dash Foundation //////////
65137/// Released under the MIT License //
65138/////////////////////////////////////
65139
65140var o = require('./op');
65141var h = require('./helper');
65142
65143var T0 = h.bytes2Int64Buffer(h.b64Decode("xjL0pfSXpcb4b5eEl+uE+O5esJmwx5nu9nqMjYz3jfb/6BcNF+UN/9YK3L3ct73W3hbIscinsd6RbfxU/DlUkWCQ8FDwwFBgAgcFAwUEAwLOLuCp4IepzlbRh32HrH1W58wrGSvVGee1E6ZipnFitU18MeYxmuZN7Fm1mrXDmuyPQM9FzwVFjx+jvJ28Pp0fiUnAQMAJQIn6aJKHku+H+u/QPxU/xRXvspQm6yZ/67KOzkDJQAfJjvvmHQsd7Qv7QW4v7C+C7EGzGqlnqX1ns19DHP0cvv1fRWAl6iWK6kUj+dq/2ka/I1NRAvcCpvdT5EWhlqHTluSbdu1b7S1bm3UoXcJd6sJ14cUkHCTZHOE91Omu6XquPUzyvmq+mGpMbILuWu7YWmx+vcNBw/xBfvXzBgIG8QL1g1LRT9EdT4NojORc5NBcaFFWB/QHovRR0Y1cNFy5NNH54RgIGOkI+eJMrpOu35Piqz6Vc5VNc6til/VT9cRTYiprQT9BVD8qCBwUDBQQDAiVY/ZS9jFSlUbpr2WvjGVGnX/iXuIhXp0wSHgoeGAoMDfP+KH4bqE3ChsRDxEUDwov68S1xF61Lw4VGwkbHAkOJH5aNlpINiQbrbabtjabG9+YRz1HpT3fzadqJmqBJs1O9btpu5xpTn8zTM1M/s1/6lC6n7rPn+oSPy0bLSQbEh2kuZ65Op4dWMScdJywdFg0RnIucmguNDZBdy13bC023BHNss2jsty0nSnuKXPutFtNFvsWtvtbpKUB9gFT9qR2oddN1+xNdrcUo2GjdWG3fTRJzkn6zn1S3417jaR7Ut2fQj5CoT7dXs2TcZO8cV4TsaKXoiaXE6aiBPUEV/WmuQG4aLhpaLkAAAAAAAAAAMG1dCx0mSzBQOCgYKCAYEDjwiEfId0f43k6Q8hD8sh5tpos7Sx37bbUDdm+2bO+1I1HykbKAUaNZxdw2XDO2Wdyr91L3eRLcpTted55M96UmP9n1Gcr1JiwkyPoI3vosIVb3kreEUqFuwa9a71ta7vFu34qfpEqxU97NOU0nuVP7dc6FjrBFu2G0lTFVBfFhpr4YtdiL9eaZpn/Vf/MVWYRtqeUpyKUEYrASs9KD8+K6dkwEDDJEOkEDgoGCggGBP5mmIGY54H+oKsL8Atb8KB4tMxEzPBEeCXw1brVSrolS3U+4z6W40uirA7zDl/zol1EGf4Zuv5dgNtbwFsbwIAFgIWKhQqKBT/T7K3sfq0/If7fvN9CvCFwqNhI2OBIcPH9DAQM+QTxYxl633rG32N3L1jBWO7Bd68wn3WfRXWvQuelY6WEY0IgcFAwUEAwIOXLLhou0Rrl/e8SDhLhDv2/CLdtt2Vtv4FV1EzUGUyBGCQ8FDwwFBgmeV81X0w1JsOycS9xnS/DvoY44Thn4b41yP2i/WqiNYjHT8xPC8yILmVLOUtcOS6TavlX+T1Xk1VYDfINqvJV/GGdgp3jgvx6s8lHyfRHesgn76zvi6zIuogy5zJv57oyT30rfWQrMuZCpJWk15XmwDv7oPuboMAZqrOYszKYGZ72aNFoJ9GeoyKBf4Fdf6NE7qpmqohmRFTWgn6CqH5UO93mq+Z2qzsLlZ6DnhaDC4zJRcpFA8qMx7x7KXuVKcdrBW7TbtbTayhsRDxEUDwopyyLeYtVeae8gT3iPWPivBYxJx0nLB0WrTeadppBdq3blk07Ta0722Se+lb6yFZkdKbSTtLoTnQUNiIeIigeFJLkdtt2P9uSDBIeCh4YCgxI/LRstJBsSLiPN+Q3a+S4n3jnXeclXZ+9D7JusmFuvUNpKu8qhu9DxDXxpvGTpsQ52uOo43KoOTHG96T3YqQx04pZN1m9N9PydIaLhv+L8tWDVjJWsTLVi07FQ8UNQ4tuhetZ69xZbtoYwrfCr7faAY6PjI8CjAGxHaxkrHlksZzxbdJtI9KcSXI74DuS4EnYH8e0x6u02Ky5FfoVQ/qs8/oJBwn9B/PPoG8lb4Ulz8og6q/qj6/K9H2JjonzjvRHZyDpII7pRxA4KBgoIBgQbwtk1WTe1W/wc4OIg/uI8Er7sW+xlG9KXMqWcpa4clw4VGwkbHAkOFdfCPEIrvFXcyFSx1Lmx3OXZPNR8zVRl8uuZSNljSPLoSWEfIRZfKHoV7+cv8uc6D5dYyFjfCE+lup83Xw33ZZhHn/cf8LcYQ2ckYaRGoYND5uUhZQehQ/gS6uQq9uQ4Hy6xkLG+EJ8cSZXxFfixHHMKeWq5YOqzJDjc9hzO9iQBgkPBQ8MBQb39AMBA/UB9xwqNhI2OBIcwjz+o/6fo8Jqi+Ff4dRfaq6+EPkQR/muaQJr0GvS0GkXv6iRqC6RF5lx6FjoKViZOlNpJ2l0Jzon99C50E65J9mRSDhIqTjZ6941EzXNE+sr5c6zzlazKyJ3VTNVRDMi0gTWu9a/u9KpOZBwkElwqQeHgImADokHM8Hyp/JmpzMt7MG2wVq2LTxaZiJmeCI8Fbitkq0qkhXJqWAgYIkgyYdc20nbFUmHqrAa/xpP/6pQ2Ih4iKB4UKUrjnqOUXqlA4mKj4oGjwNZShP4E7L4WQmSm4CbEoAJGiM5Fzk0FxplEHXadcraZdeEUzFTtTHXhNVRxlETxoTQA9O407u40ILcXsNeH8OCKeLLsMtSsClaw5l3mbR3Wh4tMxEzPBEeez1Gy0b2y3uotx/8H0v8qG0MYdZh2tZtLGJOOk5YOiw="));
65144var T1 = h.bytes2Int64Buffer(h.b64Decode("xsYy9KX0l6X4+G+XhJfrhO7uXrCZsMeZ9vZ6jI2M943//+gXDRflDdbWCty93Le93t4WyLHIp7GRkW38VPw5VGBgkPBQ8MBQAgIHBQMFBAPOzi7gqeCHqVZW0Yd9h6x95+fMKxkr1Rm1tROmYqZxYk1NfDHmMZrm7OxZtZq1w5qPj0DPRc8FRR8fo7ydvD6diYlJwEDACUD6+miSh5Lvh+/v0D8VP8UVsrKUJusmf+uOjs5AyUAHyfv75h0LHe0LQUFuL+wvguyzsxqpZ6l9Z19fQxz9HL79RUVgJeoliuojI/nav9pGv1NTUQL3Aqb35ORFoZah05abm3btW+0tW3V1KF3CXerC4eHFJBwk2Rw9PdTprul6rkxM8r5qvphqbGyC7lru2Fp+fr3DQcP8QfX18wYCBvECg4NS0U/RHU9oaIzkXOTQXFFRVgf0B6L00dGNXDRcuTT5+eEYCBjpCOLiTK6Trt+Tq6s+lXOVTXNiYpf1U/XEUyoqa0E/QVQ/CAgcFAwUEAyVlWP2UvYxUkZG6a9lr4xlnZ1/4l7iIV4wMEh4KHhgKDc3z/ih+G6hCgobEQ8RFA8vL+vEtcRetQ4OFRsJGxwJJCR+WjZaSDYbG622m7Y2m9/fmEc9R6U9zc2naiZqgSZOTvW7abucaX9/M0zNTP7N6upQup+6z58SEj8tGy0kGx0dpLmeuTqeWFjEnHScsHQ0NEZyLnJoLjY2QXctd2wt3NwRzbLNo7K0tJ0p7ilz7ltbTRb7Frb7pKSlAfYBU/Z2dqHXTdfsTbe3FKNho3VhfX00Sc5J+s5SUt+Ne42ke93dn0I+QqE+Xl7Nk3GTvHETE7Gil6Iml6amogT1BFf1ubkBuGi4aWgAAAAAAAAAAMHBtXQsdJksQEDgoGCggGDj48IhHyHdH3l5OkPIQ/LItraaLO0sd+3U1A3Zvtmzvo2NR8pGygFGZ2cXcNlwztlycq/dS93kS5SU7XneeTPemJj/Z9RnK9SwsJMj6CN76IWFW95K3hFKu7sGvWu9bWvFxbt+Kn6RKk9PezTlNJ7l7e3XOhY6wRaGhtJUxVQXxZqa+GLXYi/XZmaZ/1X/zFUREbanlKcilIqKwErPSg/P6enZMBAwyRAEBA4KBgoIBv7+ZpiBmOeBoKCrC/ALW/B4eLTMRMzwRCUl8NW61Uq6S0t1PuM+luOioqwO8w5f811dRBn+Gbr+gIDbW8BbG8AFBYCFioUKij8/0+yt7H6tISH+37zfQrxwcKjYSNjgSPHx/QwEDPkEY2MZet96xt93dy9YwVjuwa+vMJ91n0V1QkLnpWOlhGMgIHBQMFBAMOXlyy4aLtEa/f3vEg4S4Q6/vwi3bbdlbYGBVdRM1BlMGBgkPBQ8MBQmJnlfNV9MNcPDsnEvcZ0vvr6GOOE4Z+E1Ncj9ov1qooiIx0/MTwvMLi5lSzlLXDmTk2r5V/k9V1VVWA3yDary/PxhnYKd44J6erPJR8n0R8jIJ++s74usurqIMucyb+cyMk99K31kK+bmQqSVpNeVwMA7+6D7m6AZGaqzmLMymJ6e9mjRaCfRo6MigX+BXX9ERO6qZqqIZlRU1oJ+gqh+Ozvd5qvmdqsLC5Weg54Wg4yMyUXKRQPKx8e8eyl7lSlrawVu027W0ygobEQ8RFA8p6csi3mLVXm8vIE94j1j4hYWMScdJywdra03mnaaQXbb25ZNO02tO2RknvpW+shWdHSm0k7S6E4UFDYiHiIoHpKS5Hbbdj/bDAwSHgoeGApISPy0bLSQbLi4jzfkN2vkn594513nJV29vQ+ybrJhbkNDaSrvKobvxMQ18abxk6Y5OdrjqONyqDExxvek92Kk09OKWTdZvTfy8nSGi4b/i9XVg1YyVrEyi4tOxUPFDUNuboXrWevcWdraGMK3wq+3AQGOj4yPAoyxsR2sZKx5ZJyc8W3SbSPSSUlyO+A7kuDY2B/HtMertKysuRX6FUP68/P6CQcJ/QfPz6BvJW+FJcrKIOqv6o+v9PR9iY6J845HR2cg6SCO6RAQOCgYKCAYb28LZNVk3tXw8HODiIP7iEpK+7FvsZRvXFzKlnKWuHI4OFRsJGxwJFdXXwjxCK7xc3MhUsdS5seXl2TzUfM1UcvLrmUjZY0joaElhHyEWXzo6Fe/nL/LnD4+XWMhY3whlpbqfN18N91hYR5/3H/C3A0NnJGGkRqGDw+blIWUHoXg4EurkKvbkHx8usZCxvhCcXEmV8RX4sTMzCnlquWDqpCQ43PYczvYBgYJDwUPDAX39/QDAQP1ARwcKjYSNjgSwsI8/qP+n6NqaovhX+HUX66uvhD5EEf5aWkCa9Br0tAXF7+okagukZmZcehY6ClYOjpTaSdpdCcnJ/fQudBOudnZkUg4SKk46+veNRM1zRMrK+XOs85WsyIid1UzVUQz0tIE1rvWv7upqTmQcJBJcAcHh4CJgA6JMzPB8qfyZqctLezBtsFatjw8WmYiZngiFRW4rZKtKpLJyalgIGCJIIeHXNtJ2xVJqqqwGv8aT/9QUNiIeIigeKWlK456jlF6AwOJio+KBo9ZWUoT+BOy+AkJkpuAmxKAGhojORc5NBdlZRB12nXK2tfXhFMxU7UxhITVUcZRE8bQ0APTuNO7uIKC3F7DXh/DKSniy7DLUrBaWsOZd5m0dx4eLTMRMzwRe3s9RstG9suoqLcf/B9L/G1tDGHWYdrWLCxiTjpOWDo="));
65145var T2 = h.bytes2Int64Buffer(h.b64Decode("pcbGMvSl9JeE+Phvl4SX65nu7l6wmbDHjfb2eoyNjPcN///oFw0X5b3W1grcvdy3sd7eFsixyKdUkZFt/FT8OVBgYJDwUPDAAwICBwUDBQSpzs4u4Kngh31WVtGHfYesGefnzCsZK9VitbUTpmKmceZNTXwx5jGamuzsWbWatcNFj49Az0XPBZ0fH6O8nbw+QImJScBAwAmH+vpokoeS7xXv79A/FT/F67KylCbrJn/Jjo7OQMlABwv7++YdCx3t7EFBbi/sL4Jns7MaqWepff1fX0Mc/Ry+6kVFYCXqJYq/IyP52r/aRvdTU1EC9wKmluTkRaGWodNbm5t27VvtLcJ1dShdwl3qHOHhxSQcJNmuPT3U6a7pempMTPK+ar6YWmxsgu5a7thBfn69w0HD/AL19fMGAgbxT4ODUtFP0R1caGiM5Fzk0PRRUVYH9AeiNNHRjVw0XLkI+fnhGAgY6ZPi4kyuk67fc6urPpVzlU1TYmKX9VP1xD8qKmtBP0FUDAgIHBQMFBBSlZVj9lL2MWVGRumvZa+MXp2df+Je4iEoMDBIeCh4YKE3N8/4ofhuDwoKGxEPERS1Ly/rxLXEXgkODhUbCRscNiQkflo2WkibGxuttpu2Nj3f35hHPUelJs3Np2omaoFpTk71u2m7nM1/fzNMzUz+n+rqULqfus8bEhI/LRstJJ4dHaS5nrk6dFhYxJx0nLAuNDRGci5yaC02NkF3LXdsstzcEc2yzaPutLSdKe4pc/tbW00W+xa29qSkpQH2AVNNdnah103X7GG3txSjYaN1zn19NEnOSfp7UlLfjXuNpD7d3Z9CPkKhcV5ezZNxk7yXExOxopeiJvWmpqIE9QRXaLm5AbhouGkAAAAAAAAAACzBwbV0LHSZYEBA4KBgoIAf4+PCIR8h3ch5eTpDyEPy7ba2miztLHe+1NQN2b7Zs0aNjUfKRsoB2WdnF3DZcM5LcnKv3Uvd5N6UlO153nkz1JiY/2fUZyvosLCTI+gje0qFhVveSt4Ra7u7Br1rvW0qxcW7fip+keVPT3s05TSeFu3t1zoWOsHFhobSVMVUF9eamvhi12IvVWZmmf9V/8yUERG2p5SnIs+KisBKz0oPEOnp2TAQMMkGBAQOCgYKCIH+/maYgZjn8KCgqwvwC1tEeHi0zETM8LolJfDVutVK40tLdT7jPpbzoqKsDvMOX/5dXUQZ/hm6wICA21vAWxuKBQWAhYqFCq0/P9Psrex+vCEh/t+830JIcHCo2EjY4ATx8f0MBAz532NjGXrfesbBd3cvWMFY7nWvrzCfdZ9FY0JC56VjpYQwICBwUDBQQBrl5csuGi7RDv397xIOEuFtv78It223ZUyBgVXUTNQZFBgYJDwUPDA1JiZ5XzVfTC/Dw7JxL3Gd4b6+hjjhOGeiNTXI/aL9asyIiMdPzE8LOS4uZUs5S1xXk5Nq+Vf5PfJVVVgN8g2qgvz8YZ2CneNHenqzyUfJ9KzIyCfvrO+L57q6iDLnMm8rMjJPfSt9ZJXm5kKklaTXoMDAO/ug+5uYGRmqs5izMtGenvZo0Wgnf6OjIoF/gV1mRETuqmaqiH5UVNaCfoKoqzs73ear5naDCwuVnoOeFsqMjMlFykUDKcfHvHspe5XTa2sFbtNu1jwoKGxEPERQeaenLIt5i1XivLyBPeI9Yx0WFjEnHScsdq2tN5p2mkE729uWTTtNrVZkZJ76VvrITnR0ptJO0ugeFBQ2Ih4iKNuSkuR223Y/CgwMEh4KHhhsSEj8tGy0kOS4uI835DdrXZ+feOdd5yVuvb0Psm6yYe9DQ2kq7yqGpsTENfGm8ZOoOTna46jjcqQxMcb3pPdiN9PTilk3Wb2L8vJ0houG/zLV1YNWMlaxQ4uLTsVDxQ1Zbm6F61nr3Lfa2hjCt8KvjAEBjo+MjwJksbEdrGSsedKcnPFt0m0j4ElJcjvgO5K02Ngfx7THq/qsrLkV+hVDB/Pz+gkHCf0lz8+gbyVvha/KyiDqr+qPjvT0fYmOifPpR0dnIOkgjhgQEDgoGCgg1W9vC2TVZN6I8PBzg4iD+29KSvuxb7GUclxcypZylrgkODhUbCRscPFXV18I8Qiux3NzIVLHUuZRl5dk81HzNSPLy65lI2WNfKGhJYR8hFmc6OhXv5y/yyE+Pl1jIWN83ZaW6nzdfDfcYWEef9x/woYNDZyRhpEahQ8Pm5SFlB6Q4OBLq5Cr20J8fLrGQsb4xHFxJlfEV+KqzMwp5arlg9iQkONz2HM7BQYGCQ8FDwwB9/f0AwED9RIcHCo2EjY4o8LCPP6j/p9famqL4V/h1Pmurr4Q+RBH0GlpAmvQa9KRFxe/qJGoLliZmXHoWOgpJzo6U2knaXS5Jyf30LnQTjjZ2ZFIOEipE+vr3jUTNc2zKyvlzrPOVjMiIndVM1VEu9LSBNa71r9wqak5kHCQSYkHB4eAiYAOpzMzwfKn8ma2LS3swbbBWiI8PFpmImZ4khUVuK2SrSogycmpYCBgiUmHh1zbSdsV/6qqsBr/Gk94UFDYiHiIoHqlpSuOeo5RjwMDiYqPigb4WVlKE/gTsoAJCZKbgJsSFxoaIzkXOTTaZWUQddp1yjHX14RTMVO1xoSE1VHGURO40NAD07jTu8OCgtxew14fsCkp4suwy1J3WlrDmXeZtBEeHi0zETM8y3t7PUbLRvb8qKi3H/wfS9ZtbQxh1mHaOiwsYk46Tlg="));
65146var T3 = h.bytes2Int64Buffer(h.b64Decode("l6XGxjL0pfTrhPj4b5eEl8eZ7u5esJmw94329nqMjYzlDf//6BcNF7e91tYK3L3cp7He3hbIscg5VJGRbfxU/MBQYGCQ8FDwBAMCAgcFAwWHqc7OLuCp4Kx9VlbRh32H1Rnn58wrGStxYrW1E6ZipprmTU18MeYxw5rs7Fm1mrUFRY+PQM9Fzz6dHx+jvJ28CUCJiUnAQMDvh/r6aJKHksUV7+/QPxU/f+uyspQm6yYHyY6OzkDJQO0L+/vmHQsdguxBQW4v7C99Z7OzGqlnqb79X19DHP0ciupFRWAl6iVGvyMj+dq/2qb3U1NRAvcC05bk5EWhlqEtW5ubdu1b7erCdXUoXcJd2Rzh4cUkHCR6rj091Omu6ZhqTEzyvmq+2FpsbILuWu78QX5+vcNBw/EC9fXzBgIGHU+Dg1LRT9HQXGhojORc5KL0UVFWB/QHuTTR0Y1cNFzpCPn54RgIGN+T4uJMrpOuTXOrqz6Vc5XEU2Jil/VT9VQ/KiprQT9BEAwICBwUDBQxUpWVY/ZS9oxlRkbpr2WvIV6dnX/iXuJgKDAwSHgoeG6hNzfP+KH4FA8KChsRDxFetS8v68S1xBwJDg4VGwkbSDYkJH5aNlo2mxsbrbabtqU939+YRz1HgSbNzadqJmqcaU5O9btpu/7Nf38zTM1Mz5/q6lC6n7okGxISPy0bLTqeHR2kuZ65sHRYWMScdJxoLjQ0RnIucmwtNjZBdy13o7Lc3BHNss1z7rS0nSnuKbb7W1tNFvsWU/akpKUB9gHsTXZ2oddN13Vht7cUo2Gj+s59fTRJzkmke1JS3417jaE+3d2fQj5CvHFeXs2TcZMmlxMTsaKXolf1pqaiBPUEaWi5uQG4aLgAAAAAAAAAAJkswcG1dCx0gGBAQOCgYKDdH+PjwiEfIfLIeXk6Q8hDd+22tpos7SyzvtTUDdm+2QFGjY1HykbKztlnZxdw2XDkS3Jyr91L3TPelJTted55K9SYmP9n1Gd76LCwkyPoIxFKhYVb3krebWu7uwa9a72RKsXFu34qfp7lT097NOU0wRbt7dc6FjoXxYaG0lTFVC/Xmpr4YtdizFVmZpn/Vf8ilBERtqeUpw/PiorASs9KyRDp6dkwEDAIBgQEDgoGCueB/v5mmIGYW/CgoKsL8AvwRHh4tMxEzEq6JSXw1brVluNLS3U+4z5f86KirA7zDrr+XV1EGf4ZG8CAgNtbwFsKigUFgIWKhX6tPz/T7K3sQrwhIf7fvN/gSHBwqNhI2PkE8fH9DAQMxt9jYxl633ruwXd3L1jBWEV1r68wn3WfhGNCQuelY6VAMCAgcFAwUNEa5eXLLhou4Q79/e8SDhJlbb+/CLdttxlMgYFV1EzUMBQYGCQ8FDxMNSYmeV81X50vw8OycS9xZ+G+voY44ThqojU1yP2i/QvMiIjHT8xPXDkuLmVLOUs9V5OTavlX+aryVVVYDfIN44L8/GGdgp30R3p6s8lHyYusyMgn76zvb+e6uogy5zJkKzIyT30rfdeV5uZCpJWkm6DAwDv7oPsymBkZqrOYsyfRnp72aNFoXX+joyKBf4GIZkRE7qpmqqh+VFTWgn6Cdqs7O93mq+YWgwsLlZ6DngPKjIzJRcpFlSnHx7x7KXvW02trBW7TblA8KChsRDxEVXmnpyyLeYtj4ry8gT3iPSwdFhYxJx0nQXatrTeadpqtO9vblk07TchWZGSe+lb66E50dKbSTtIoHhQUNiIeIj/bkpLkdtt2GAoMDBIeCh6QbEhI/LRstGvkuLiPN+Q3JV2fn3jnXedhbr29D7JusobvQ0NpKu8qk6bExDXxpvFyqDk52uOo42KkMTHG96T3vTfT04pZN1n/i/LydIaLhrEy1dWDVjJWDUOLi07FQ8XcWW5uhetZ66+32toYwrfCAowBAY6PjI95ZLGxHaxkrCPSnJzxbdJtkuBJSXI74DurtNjYH8e0x0P6rKy5FfoV/Qfz8/oJBwmFJc/PoG8lb4+vysog6q/q84709H2JjomO6UdHZyDpICAYEBA4KBgo3tVvbwtk1WT7iPDwc4OIg5RvSkr7sW+xuHJcXMqWcpZwJDg4VGwkbK7xV1dfCPEI5sdzcyFSx1I1UZeXZPNR840jy8uuZSNlWXyhoSWEfITLnOjoV7+cv3whPj5dYyFjN92Wlup83XzC3GFhHn/cfxqGDQ2ckYaRHoUPD5uUhZTbkODgS6uQq/hCfHy6xkLG4sRxcSZXxFeDqszMKeWq5TvYkJDjc9hzDAUGBgkPBQ/1Aff39AMBAzgSHBwqNhI2n6PCwjz+o/7UX2pqi+Ff4Uf5rq6+EPkQ0tBpaQJr0GsukRcXv6iRqClYmZlx6FjodCc6OlNpJ2lOuScn99C50Kk42dmRSDhIzRPr6941EzVWsysr5c6zzkQzIiJ3VTNVv7vS0gTWu9ZJcKmpOZBwkA6JBweHgImAZqczM8Hyp/Jati0t7MG2wXgiPDxaZiJmKpIVFbitkq2JIMnJqWAgYBVJh4dc20nbT/+qqrAa/xqgeFBQ2Ih4iFF6paUrjnqOBo8DA4mKj4qy+FlZShP4ExKACQmSm4CbNBcaGiM5FznK2mVlEHXadbUx19eEUzFTE8aEhNVRxlG7uNDQA9O40x/DgoLcXsNeUrApKeLLsMu0d1paw5l3mTwRHh4tMxEz9st7ez1Gy0ZL/Kiotx/8H9rWbW0MYdZhWDosLGJOOk4="));
65147var T4 = h.bytes2Int64Buffer(h.b64Decode("9JelxsYy9KWX64T4+G+XhLDHme7uXrCZjPeN9vZ6jI0X5Q3//+gXDdy3vdbWCty9yKex3t4WyLH8OVSRkW38VPDAUGBgkPBQBQQDAgIHBQPgh6nOzi7gqYesfVZW0Yd9K9UZ5+fMKxmmcWK1tROmYjGa5k1NfDHmtcOa7OxZtZrPBUWPj0DPRbw+nR8fo7ydwAlAiYlJwECS74f6+miShz/FFe/v0D8VJn/rsrKUJutAB8mOjs5AyR3tC/v75h0LL4LsQUFuL+ypfWezsxqpZxy+/V9fQxz9JYrqRUVgJeraRr8jI/navwKm91NTUQL3odOW5ORFoZbtLVubm3btW13qwnV1KF3CJNkc4eHFJBzpeq49PdTprr6YakxM8r5q7thabGyC7lrD/EF+fr3DQQbxAvX18wYC0R1Pg4NS0U/k0FxoaIzkXAei9FFRVgf0XLk00dGNXDQY6Qj5+eEYCK7fk+LiTK6TlU1zq6s+lXP1xFNiYpf1U0FUPyoqa0E/FBAMCAgcFAz2MVKVlWP2Uq+MZUZG6a9l4iFenZ1/4l54YCgwMEh4KPhuoTc3z/ihERQPCgobEQ/EXrUvL+vEtRscCQ4OFRsJWkg2JCR+Wja2NpsbG622m0elPd/fmEc9aoEmzc2naia7nGlOTvW7aUz+zX9/M0zNus+f6upQup8tJBsSEj8tG7k6nh0dpLmenLB0WFjEnHRyaC40NEZyLndsLTY2QXctzaOy3NwRzbIpc+60tJ0p7ha2+1tbTRb7AVP2pKSlAfbX7E12dqHXTaN1Ybe3FKNhSfrOfX00Sc6NpHtSUt+Ne0KhPt3dn0I+k7xxXl7Nk3GiJpcTE7GilwRX9aamogT1uGloubkBuGgAAAAAAAAAAHSZLMHBtXQsoIBgQEDgoGAh3R/j48IhH0PyyHl5OkPILHfttraaLO3Zs77U1A3ZvsoBRo2NR8pGcM7ZZ2cXcNnd5Etycq/dS3kz3pSU7XneZyvUmJj/Z9Qje+iwsJMj6N4RSoWFW95KvW1ru7sGvWt+kSrFxbt+KjSe5U9PezTlOsEW7e3XOhZUF8WGhtJUxWIv15qa+GLX/8xVZmaZ/1WnIpQREbanlEoPz4qKwErPMMkQ6enZMBAKCAYEBA4KBpjngf7+ZpiBC1vwoKCrC/DM8ER4eLTMRNVKuiUl8NW6PpbjS0t1PuMOX/OioqwO8xm6/l1dRBn+WxvAgIDbW8CFCooFBYCFiux+rT8/0+yt30K8ISH+37zY4EhwcKjYSAz5BPHx/QwEesbfY2MZet9Y7sF3dy9YwZ9Fda+vMJ91pYRjQkLnpWNQQDAgIHBQMC7RGuXlyy4aEuEO/f3vEg63ZW2/vwi3bdQZTIGBVdRMPDAUGBgkPBRfTDUmJnlfNXGdL8PDsnEvOGfhvr6GOOH9aqI1Ncj9ok8LzIiIx0/MS1w5Li5lSzn5PVeTk2r5Vw2q8lVVWA3yneOC/PxhnYLJ9Ed6erPJR++LrMjIJ++sMm/nurqIMud9ZCsyMk99K6TXlebmQqSV+5ugwMA7+6CzMpgZGaqzmGgn0Z6e9mjRgV1/o6MigX+qiGZERO6qZoKoflRU1oJ+5narOzvd5queFoMLC5Weg0UDyoyMyUXKe5Upx8e8eylu1tNrawVu00RQPCgobEQ8i1V5p6csi3k9Y+K8vIE94icsHRYWMScdmkF2ra03mnZNrTvb25ZNO/rIVmRknvpW0uhOdHSm0k4iKB4UFDYiHnY/25KS5HbbHhgKDAwSHgq0kGxISPy0bDdr5Li4jzfk5yVdn594512yYW69vQ+ybiqG70NDaSrv8ZOmxMQ18abjcqg5OdrjqPdipDExxvekWb0309OKWTeG/4vy8nSGi1axMtXVg1YyxQ1Di4tOxUPr3FluboXrWcKvt9raGMK3jwKMAQGOj4yseWSxsR2sZG0j0pyc8W3SO5LgSUlyO+DHq7TY2B/HtBVD+qysuRX6Cf0H8/P6CQdvhSXPz6BvJeqPr8rKIOqvifOO9PR9iY4gjulHR2cg6SggGBAQOCgYZN7Vb28LZNWD+4jw8HODiLGUb0pK+7FvlrhyXFzKlnJscCQ4OFRsJAiu8VdXXwjxUubHc3MhUsfzNVGXl2TzUWWNI8vLrmUjhFl8oaElhHy/y5zo6Fe/nGN8IT4+XWMhfDfdlpbqfN1/wtxhYR5/3JEahg0NnJGGlB6FDw+blIWr25Dg4EurkMb4Qnx8usZCV+LEcXEmV8Tlg6rMzCnlqnM72JCQ43PYDwwFBgYJDwUD9QH39/QDATY4EhwcKjYS/p+jwsI8/qPh1F9qaovhXxBH+a6uvhD5a9LQaWkCa9CoLpEXF7+okegpWJmZcehYaXQnOjpTaSfQTrknJ/fQuUipONnZkUg4Nc0T6+veNRPOVrMrK+XOs1VEMyIid1Uz1r+70tIE1ruQSXCpqTmQcIAOiQcHh4CJ8manMzPB8qfBWrYtLezBtmZ4Ijw8WmYirSqSFRW4rZJgiSDJyalgINsVSYeHXNtJGk//qqqwGv+IoHhQUNiIeI5ReqWlK456igaPAwOJio8TsvhZWUoT+JsSgAkJkpuAOTQXGhojORd1ytplZRB12lO1MdfXhFMxURPGhITVUcbTu7jQ0APTuF4fw4KC3F7Dy1KwKSniy7CZtHdaWsOZdzM8ER4eLTMRRvbLe3s9RssfS/yoqLcf/GHa1m1tDGHWTlg6LCxiTjo="));
65148var T5 = h.bytes2Int64Buffer(h.b64Decode("pfSXpcbGMvSEl+uE+Phvl5mwx5nu7l6wjYz3jfb2eowNF+UN///oF73ct73W1grcscinsd7eFshU/DlUkZFt/FDwwFBgYJDwAwUEAwICBwWp4Iepzs4u4H2HrH1WVtGHGSvVGefnzCtipnFitbUTpuYxmuZNTXwxmrXDmuzsWbVFzwVFj49Az528Pp0fH6O8QMAJQImJScCHku+H+vpokhU/xRXv79A/6yZ/67KylCbJQAfJjo7OQAsd7Qv7++Yd7C+C7EFBbi9nqX1ns7Maqf0cvv1fX0Mc6iWK6kVFYCW/2ka/IyP52vcCpvdTU1EClqHTluTkRaFb7S1bm5t27cJd6sJ1dShdHCTZHOHhxSSu6XquPT3U6Wq+mGpMTPK+Wu7YWmxsgu5Bw/xBfn69wwIG8QL19fMGT9EdT4ODUtFc5NBcaGiM5PQHovRRUVYHNFy5NNHRjVwIGOkI+fnhGJOu35Pi4kyuc5VNc6urPpVT9cRTYmKX9T9BVD8qKmtBDBQQDAgIHBRS9jFSlZVj9mWvjGVGRumvXuIhXp2df+IoeGAoMDBIeKH4bqE3N8/4DxEUDwoKGxG1xF61Ly/rxAkbHAkODhUbNlpINiQkflqbtjabGxuttj1HpT3f35hHJmqBJs3Np2ppu5xpTk71u81M/s1/fzNMn7rPn+rqULobLSQbEhI/LZ65Op4dHaS5dJywdFhYxJwucmguNDRGci13bC02NkF3ss2jstzcEc3uKXPutLSdKfsWtvtbW00W9gFT9qSkpQFN1+xNdnah12GjdWG3txSjzkn6zn19NEl7jaR7UlLfjT5CoT7d3Z9CcZO8cV5ezZOXoiaXExOxovUEV/WmpqIEaLhpaLm5AbgAAAAAAAAAACx0mSzBwbV0YKCAYEBA4KAfId0f4+PCIchD8sh5eTpD7Sx37ba2miy+2bO+1NQN2UbKAUaNjUfK2XDO2WdnF3BL3eRLcnKv3d55M96UlO151Gcr1JiY/2foI3vosLCTI0reEUqFhVvea71ta7u7Br0qfpEqxcW7fuU0nuVPT3s0FjrBFu3t1zrFVBfFhobSVNdiL9eamvhiVf/MVWZmmf+UpyKUERG2p89KD8+KisBKEDDJEOnp2TAGCggGBAQOCoGY54H+/maY8Atb8KCgqwtEzPBEeHi0zLrVSrolJfDV4z6W40tLdT7zDl/zoqKsDv4Zuv5dXUQZwFsbwICA21uKhQqKBQWAha3sfq0/P9PsvN9CvCEh/t9I2OBIcHCo2AQM+QTx8f0M33rG32NjGXrBWO7Bd3cvWHWfRXWvrzCfY6WEY0JC56UwUEAwICBwUBou0Rrl5csuDhLhDv397xJtt2Vtv78It0zUGUyBgVXUFDwwFBgYJDw1X0w1JiZ5Xy9xnS/Dw7Jx4Thn4b6+hjii/WqiNTXI/cxPC8yIiMdPOUtcOS4uZUtX+T1Xk5Nq+fINqvJVVVgNgp3jgvz8YZ1HyfRHenqzyazvi6zIyCfv5zJv57q6iDIrfWQrMjJPfZWk15Xm5kKkoPuboMDAO/uYszKYGRmqs9FoJ9GenvZof4Fdf6OjIoFmqohmRETuqn6CqH5UVNaCq+Z2qzs73eaDnhaDCwuVnspFA8qMjMlFKXuVKcfHvHvTbtbTa2sFbjxEUDwoKGxEeYtVeaenLIviPWPivLyBPR0nLB0WFjEndppBdq2tN5o7Ta0729uWTVb6yFZkZJ76TtLoTnR0ptIeIigeFBQ2Itt2P9uSkuR2Ch4YCgwMEh5stJBsSEj8tOQ3a+S4uI83XeclXZ+feOdusmFuvb0Psu8qhu9DQ2kqpvGTpsTENfGo43KoOTna46T3YqQxMcb3N1m9N9PTilmLhv+L8vJ0hjJWsTLV1YNWQ8UNQ4uLTsVZ69xZbm6F67fCr7fa2hjCjI8CjAEBjo9krHlksbEdrNJtI9KcnPFt4DuS4ElJcju0x6u02Ngfx/oVQ/qsrLkVBwn9B/Pz+gklb4Ulz8+gb6/qj6/KyiDqjonzjvT0fYnpII7pR0dnIBgoIBgQEDgo1WTe1W9vC2SIg/uI8PBzg2+xlG9KSvuxcpa4clxcypYkbHAkODhUbPEIrvFXV18Ix1Lmx3NzIVJR8zVRl5dk8yNljSPLy65lfIRZfKGhJYScv8uc6OhXvyFjfCE+Pl1j3Xw33ZaW6nzcf8LcYWEef4aRGoYNDZyRhZQehQ8Pm5SQq9uQ4OBLq0LG+EJ8fLrGxFfixHFxJleq5YOqzMwp5dhzO9iQkONzBQ8MBQYGCQ8BA/UB9/f0AxI2OBIcHCo2o/6fo8LCPP5f4dRfamqL4fkQR/murr4Q0GvS0GlpAmuRqC6RFxe/qFjoKViZmXHoJ2l0Jzo6U2m50E65Jyf30DhIqTjZ2ZFIEzXNE+vr3jWzzlazKyvlzjNVRDMiIndVu9a/u9LSBNZwkElwqak5kImADokHB4eAp/JmpzMzwfK2wVq2LS3swSJmeCI8PFpmkq0qkhUVuK0gYIkgycmpYEnbFUmHh1zb/xpP/6qqsBp4iKB4UFDYiHqOUXqlpSuOj4oGjwMDiYr4E7L4WVlKE4CbEoAJCZKbFzk0FxoaIznadcraZWUQdTFTtTHX14RTxlETxoSE1VG407u40NAD08NeH8OCgtxesMtSsCkp4st3mbR3WlrDmREzPBEeHi0zy0b2y3t7PUb8H0v8qKi3H9Zh2tZtbQxhOk5YOiwsYk4="));
65149var T6 = h.bytes2Int64Buffer(h.b64Decode("9KX0l6XGxjKXhJfrhPj4b7CZsMeZ7u5ejI2M94329noXDRflDf//6Ny93Le91tYKyLHIp7He3hb8VPw5VJGRbfBQ8MBQYGCQBQMFBAMCAgfgqeCHqc7OLod9h6x9VlbRKxkr1Rnn58ymYqZxYrW1EzHmMZrmTU18tZq1w5rs7FnPRc8FRY+PQLydvD6dHx+jwEDACUCJiUmSh5Lvh/r6aD8VP8UV7+/QJusmf+uyspRAyUAHyY6Ozh0LHe0L+/vmL+wvguxBQW6pZ6l9Z7OzGhz9HL79X19DJeoliupFRWDav9pGvyMj+QL3Aqb3U1NRoZah05bk5EXtW+0tW5ubdl3CXerCdXUoJBwk2Rzh4cXprul6rj091L5qvphqTEzy7lru2FpsbILDQcP8QX5+vQYCBvEC9fXz0U/RHU+Dg1LkXOTQXGhojAf0B6L0UVFWXDRcuTTR0Y0YCBjpCPn54a6Trt+T4uJMlXOVTXOrqz71U/XEU2Jil0E/QVQ/KiprFAwUEAwICBz2UvYxUpWVY69lr4xlRkbp4l7iIV6dnX94KHhgKDAwSPih+G6hNzfPEQ8RFA8KChvEtcRetS8v6xsJGxwJDg4VWjZaSDYkJH62m7Y2mxsbrUc9R6U939+YaiZqgSbNzae7abucaU5O9UzNTP7Nf38zup+6z5/q6lAtGy0kGxISP7meuTqeHR2knHScsHRYWMRyLnJoLjQ0Rnctd2wtNjZBzbLNo7Lc3BEp7ilz7rS0nRb7Frb7W1tNAfYBU/akpKXXTdfsTXZ2oaNho3Vht7cUSc5J+s59fTSNe42ke1JS30I+QqE+3d2fk3GTvHFeXs2il6ImlxMTsQT1BFf1pqaiuGi4aWi5uQEAAAAAAAAAAHQsdJkswcG1oGCggGBAQOAhHyHdH+PjwkPIQ/LIeXk6LO0sd+22tprZvtmzvtTUDcpGygFGjY1HcNlwztlnZxfdS93kS3Jyr3neeTPelJTtZ9RnK9SYmP8j6CN76LCwk95K3hFKhYVbvWu9bWu7uwZ+Kn6RKsXFuzTlNJ7lT097OhY6wRbt7ddUxVQXxYaG0mLXYi/Xmpr4/1X/zFVmZpmnlKcilBERtkrPSg/PiorAMBAwyRDp6dkKBgoIBgQEDpiBmOeB/v5mC/ALW/CgoKvMRMzwRHh4tNW61Uq6JSXwPuM+luNLS3UO8w5f86KirBn+Gbr+XV1EW8BbG8CAgNuFioUKigUFgOyt7H6tPz/T37zfQrwhIf7YSNjgSHBwqAwEDPkE8fH9et96xt9jYxlYwVjuwXd3L591n0V1r68wpWOlhGNCQudQMFBAMCAgcC4aLtEa5eXLEg4S4Q79/e+3bbdlbb+/CNRM1BlMgYFVPBQ8MBQYGCRfNV9MNSYmeXEvcZ0vw8OyOOE4Z+G+vob9ov1qojU1yE/MTwvMiIjHSzlLXDkuLmX5V/k9V5OTag3yDaryVVVYnYKd44L8/GHJR8n0R3p6s++s74usyMgnMucyb+e6uoh9K31kKzIyT6SVpNeV5uZC+6D7m6DAwDuzmLMymBkZqmjRaCfRnp72gX+BXX+joyKqZqqIZkRE7oJ+gqh+VFTW5qvmdqs7O92eg54WgwsLlUXKRQPKjIzJeyl7lSnHx7xu027W02trBUQ8RFA8KChsi3mLVXmnpyw94j1j4ry8gScdJywdFhYxmnaaQXatrTdNO02tO9vblvpW+shWZGSe0k7S6E50dKYiHiIoHhQUNnbbdj/bkpLkHgoeGAoMDBK0bLSQbEhI/DfkN2vkuLiP513nJV2fn3iybrJhbr29DyrvKobvQ0Np8abxk6bExDXjqONyqDk52vek92KkMTHGWTdZvTfT04qGi4b/i/LydFYyVrEy1dWDxUPFDUOLi07rWevcWW5uhcK3wq+32toYj4yPAowBAY6sZKx5ZLGxHW3SbSPSnJzxO+A7kuBJSXLHtMertNjYHxX6FUP6rKy5CQcJ/Qfz8/pvJW+FJc/PoOqv6o+vysogiY6J84709H0g6SCO6UdHZygYKCAYEBA4ZNVk3tVvbwuDiIP7iPDwc7FvsZRvSkr7lnKWuHJcXMpsJGxwJDg4VAjxCK7xV1dfUsdS5sdzcyHzUfM1UZeXZGUjZY0jy8uuhHyEWXyhoSW/nL/LnOjoV2MhY3whPj5dfN18N92Wlup/3H/C3GFhHpGGkRqGDQ2clIWUHoUPD5urkKvbkODgS8ZCxvhCfHy6V8RX4sRxcSblquWDqszMKXPYczvYkJDjDwUPDAUGBgkDAQP1Aff39DYSNjgSHBwq/qP+n6PCwjzhX+HUX2pqixD5EEf5rq6+a9Br0tBpaQKokagukRcXv+hY6ClYmZlxaSdpdCc6OlPQudBOuScn90g4SKk42dmRNRM1zRPr697Os85Wsysr5VUzVUQzIiJ31rvWv7vS0gSQcJBJcKmpOYCJgA6JBweH8qfyZqczM8HBtsFati0t7GYiZngiPDxarZKtKpIVFbhgIGCJIMnJqdtJ2xVJh4dcGv8aT/+qqrCIeIigeFBQ2I56jlF6paUrio+KBo8DA4kT+BOy+FlZSpuAmxKACQmSORc5NBcaGiN12nXK2mVlEFMxU7Ux19eEUcZRE8aEhNXTuNO7uNDQA17DXh/DgoLcy7DLUrApKeKZd5m0d1pawzMRMzwRHh4tRstG9st7ez0f/B9L/Kiot2HWYdrWbW0MTjpOWDosLGI="));
65150var T7 = h.bytes2Int64Buffer(h.b64Decode("MvSl9JelxsZvl4SX64T4+F6wmbDHme7ueoyNjPeN9vboFw0X5Q3//wrcvdy3vdbWFsixyKex3t5t/FT8OVSRkZDwUPDAUGBgBwUDBQQDAgIu4Kngh6nOztGHfYesfVZWzCsZK9UZ5+cTpmKmcWK1tXwx5jGa5k1NWbWatcOa7OxAz0XPBUWPj6O8nbw+nR8fScBAwAlAiYlokoeS74f6+tA/FT/FFe/vlCbrJn/rsrLOQMlAB8mOjuYdCx3tC/v7bi/sL4LsQUEaqWepfWezs0Mc/Ry+/V9fYCXqJYrqRUX52r/aRr8jI1EC9wKm91NTRaGWodOW5OR27VvtLVubmyhdwl3qwnV1xSQcJNkc4eHU6a7peq49PfK+ar6YakxMgu5a7thabGy9w0HD/EF+fvMGAgbxAvX1UtFP0R1Pg4OM5Fzk0FxoaFYH9Aei9FFRjVw0XLk00dHhGAgY6Qj5+Uyuk67fk+LiPpVzlU1zq6uX9VP1xFNiYmtBP0FUPyoqHBQMFBAMCAhj9lL2MVKVlemvZa+MZUZGf+Je4iFenZ1IeCh4YCgwMM/4ofhuoTc3GxEPERQPCgrrxLXEXrUvLxUbCRscCQ4Oflo2Wkg2JCSttpu2NpsbG5hHPUelPd/fp2omaoEmzc31u2m7nGlOTjNMzUz+zX9/ULqfus+f6uo/LRstJBsSEqS5nrk6nh0dxJx0nLB0WFhGci5yaC40NEF3LXdsLTY2Ec2yzaOy3NydKe4pc+60tE0W+xa2+1tbpQH2AVP2pKSh103X7E12dhSjYaN1Ybe3NEnOSfrOfX3fjXuNpHtSUp9CPkKhPt3dzZNxk7xxXl6xopeiJpcTE6IE9QRX9aamAbhouGloubkAAAAAAAAAALV0LHSZLMHB4KBgoIBgQEDCIR8h3R/j4zpDyEPyyHl5miztLHfttrYN2b7Zs77U1EfKRsoBRo2NF3DZcM7ZZ2ev3Uvd5Etycu153nkz3pSU/2fUZyvUmJiTI+gje+iwsFveSt4RSoWFBr1rvW1ru7u7fip+kSrFxXs05TSe5U9P1zoWOsEW7e3SVMVUF8WGhvhi12Iv15qamf9V/8xVZma2p5SnIpQREcBKz0oPz4qK2TAQMMkQ6ekOCgYKCAYEBGaYgZjngf7+qwvwC1vwoKC0zETM8ER4ePDVutVKuiUldT7jPpbjS0usDvMOX/OiokQZ/hm6/l1d21vAWxvAgICAhYqFCooFBdPsrex+rT8//t+830K8ISGo2EjY4EhwcP0MBAz5BPHxGXrfesbfY2MvWMFY7sF3dzCfdZ9Fda+v56VjpYRjQkJwUDBQQDAgIMsuGi7RGuXl7xIOEuEO/f0It223ZW2/v1XUTNQZTIGBJDwUPDAUGBh5XzVfTDUmJrJxL3GdL8PDhjjhOGfhvr7I/aL9aqI1NcdPzE8LzIiIZUs5S1w5Li5q+Vf5PVeTk1gN8g2q8lVVYZ2CneOC/PyzyUfJ9Ed6eifvrO+LrMjIiDLnMm/nurpPfSt9ZCsyMkKklaTXlebmO/ug+5ugwMCqs5izMpgZGfZo0Wgn0Z6eIoF/gV1/o6PuqmaqiGZERNaCfoKoflRU3ear5narOzuVnoOeFoMLC8lFykUDyoyMvHspe5Upx8cFbtNu1tNra2xEPERQPCgoLIt5i1V5p6eBPeI9Y+K8vDEnHScsHRYWN5p2mkF2ra2WTTtNrTvb2576VvrIVmRkptJO0uhOdHQ2Ih4iKB4UFOR223Y/25KSEh4KHhgKDAz8tGy0kGxISI835Ddr5Li4eOdd5yVdn58Psm6yYW69vWkq7yqG70NDNfGm8ZOmxMTa46jjcqg5Ocb3pPdipDExilk3Wb0309N0houG/4vy8oNWMlaxMtXVTsVDxQ1Di4uF61nr3FlubhjCt8Kvt9rajo+MjwKMAQEdrGSseWSxsfFt0m0j0pyccjvgO5LgSUkfx7THq7TY2LkV+hVD+qys+gkHCf0H8/OgbyVvhSXPzyDqr+qPr8rKfYmOifOO9PRnIOkgjulHRzgoGCggGBAQC2TVZN7Vb29zg4iD+4jw8Puxb7GUb0pKypZylrhyXFxUbCRscCQ4OF8I8Qiu8VdXIVLHUubHc3Nk81HzNVGXl65lI2WNI8vLJYR8hFl8oaFXv5y/y5zo6F1jIWN8IT4+6nzdfDfdlpYef9x/wtxhYZyRhpEahg0Nm5SFlB6FDw9Lq5Cr25Dg4LrGQsb4Qnx8JlfEV+LEcXEp5arlg6rMzONz2HM72JCQCQ8FDwwFBgb0AwED9QH39yo2EjY4EhwcPP6j/p+jwsKL4V/h1F9qar4Q+RBH+a6uAmvQa9LQaWm/qJGoLpEXF3HoWOgpWJmZU2knaXQnOjr30LnQTrknJ5FIOEipONnZ3jUTNc0T6+vlzrPOVrMrK3dVM1VEMyIiBNa71r+70tI5kHCQSXCpqYeAiYAOiQcHwfKn8manMzPswbbBWrYtLVpmImZ4Ijw8uK2SrSqSFRWpYCBgiSDJyVzbSdsVSYeHsBr/Gk//qqrYiHiIoHhQUCuOeo5ReqWliYqPigaPAwNKE/gTsvhZWZKbgJsSgAkJIzkXOTQXGhoQddp1ytplZYRTMVO1MdfX1VHGURPGhIQD07jTu7jQ0Nxew14fw4KC4suwy1KwKSnDmXeZtHdaWi0zETM8ER4ePUbLRvbLe3u3H/wfS/yoqAxh1mHa1m1tYk46Tlg6LCw="));
65151
65152// var T0 = [
65153// o.u(0xc632f4a5, 0xf497a5c6), o.u(0xf86f9784, 0x97eb84f8),
65154// o.u(0xee5eb099, 0xb0c799ee), o.u(0xf67a8c8d, 0x8cf78df6),
65155// o.u(0xffe8170d, 0x17e50dff), o.u(0xd60adcbd, 0xdcb7bdd6),
65156// o.u(0xde16c8b1, 0xc8a7b1de), o.u(0x916dfc54, 0xfc395491),
65157// o.u(0x6090f050, 0xf0c05060), o.u(0x02070503, 0x05040302),
65158// o.u(0xce2ee0a9, 0xe087a9ce), o.u(0x56d1877d, 0x87ac7d56),
65159// o.u(0xe7cc2b19, 0x2bd519e7), o.u(0xb513a662, 0xa67162b5),
65160// o.u(0x4d7c31e6, 0x319ae64d), o.u(0xec59b59a, 0xb5c39aec),
65161// o.u(0x8f40cf45, 0xcf05458f), o.u(0x1fa3bc9d, 0xbc3e9d1f),
65162// o.u(0x8949c040, 0xc0094089), o.u(0xfa689287, 0x92ef87fa),
65163// o.u(0xefd03f15, 0x3fc515ef), o.u(0xb29426eb, 0x267febb2),
65164// o.u(0x8ece40c9, 0x4007c98e), o.u(0xfbe61d0b, 0x1ded0bfb),
65165// o.u(0x416e2fec, 0x2f82ec41), o.u(0xb31aa967, 0xa97d67b3),
65166// o.u(0x5f431cfd, 0x1cbefd5f), o.u(0x456025ea, 0x258aea45),
65167// o.u(0x23f9dabf, 0xda46bf23), o.u(0x535102f7, 0x02a6f753),
65168// o.u(0xe445a196, 0xa1d396e4), o.u(0x9b76ed5b, 0xed2d5b9b),
65169// o.u(0x75285dc2, 0x5deac275), o.u(0xe1c5241c, 0x24d91ce1),
65170// o.u(0x3dd4e9ae, 0xe97aae3d), o.u(0x4cf2be6a, 0xbe986a4c),
65171// o.u(0x6c82ee5a, 0xeed85a6c), o.u(0x7ebdc341, 0xc3fc417e),
65172// o.u(0xf5f30602, 0x06f102f5), o.u(0x8352d14f, 0xd11d4f83),
65173// o.u(0x688ce45c, 0xe4d05c68), o.u(0x515607f4, 0x07a2f451),
65174// o.u(0xd18d5c34, 0x5cb934d1), o.u(0xf9e11808, 0x18e908f9),
65175// o.u(0xe24cae93, 0xaedf93e2), o.u(0xab3e9573, 0x954d73ab),
65176// o.u(0x6297f553, 0xf5c45362), o.u(0x2a6b413f, 0x41543f2a),
65177// o.u(0x081c140c, 0x14100c08), o.u(0x9563f652, 0xf6315295),
65178// o.u(0x46e9af65, 0xaf8c6546), o.u(0x9d7fe25e, 0xe2215e9d),
65179// o.u(0x30487828, 0x78602830), o.u(0x37cff8a1, 0xf86ea137),
65180// o.u(0x0a1b110f, 0x11140f0a), o.u(0x2febc4b5, 0xc45eb52f),
65181// o.u(0x0e151b09, 0x1b1c090e), o.u(0x247e5a36, 0x5a483624),
65182// o.u(0x1badb69b, 0xb6369b1b), o.u(0xdf98473d, 0x47a53ddf),
65183// o.u(0xcda76a26, 0x6a8126cd), o.u(0x4ef5bb69, 0xbb9c694e),
65184// o.u(0x7f334ccd, 0x4cfecd7f), o.u(0xea50ba9f, 0xbacf9fea),
65185// o.u(0x123f2d1b, 0x2d241b12), o.u(0x1da4b99e, 0xb93a9e1d),
65186// o.u(0x58c49c74, 0x9cb07458), o.u(0x3446722e, 0x72682e34),
65187// o.u(0x3641772d, 0x776c2d36), o.u(0xdc11cdb2, 0xcda3b2dc),
65188// o.u(0xb49d29ee, 0x2973eeb4), o.u(0x5b4d16fb, 0x16b6fb5b),
65189// o.u(0xa4a501f6, 0x0153f6a4), o.u(0x76a1d74d, 0xd7ec4d76),
65190// o.u(0xb714a361, 0xa37561b7), o.u(0x7d3449ce, 0x49face7d),
65191// o.u(0x52df8d7b, 0x8da47b52), o.u(0xdd9f423e, 0x42a13edd),
65192// o.u(0x5ecd9371, 0x93bc715e), o.u(0x13b1a297, 0xa2269713),
65193// o.u(0xa6a204f5, 0x0457f5a6), o.u(0xb901b868, 0xb86968b9),
65194// o.u(0x00000000, 0x00000000), o.u(0xc1b5742c, 0x74992cc1),
65195// o.u(0x40e0a060, 0xa0806040), o.u(0xe3c2211f, 0x21dd1fe3),
65196// o.u(0x793a43c8, 0x43f2c879), o.u(0xb69a2ced, 0x2c77edb6),
65197// o.u(0xd40dd9be, 0xd9b3bed4), o.u(0x8d47ca46, 0xca01468d),
65198// o.u(0x671770d9, 0x70ced967), o.u(0x72afdd4b, 0xdde44b72),
65199// o.u(0x94ed79de, 0x7933de94), o.u(0x98ff67d4, 0x672bd498),
65200// o.u(0xb09323e8, 0x237be8b0), o.u(0x855bde4a, 0xde114a85),
65201// o.u(0xbb06bd6b, 0xbd6d6bbb), o.u(0xc5bb7e2a, 0x7e912ac5),
65202// o.u(0x4f7b34e5, 0x349ee54f), o.u(0xedd73a16, 0x3ac116ed),
65203// o.u(0x86d254c5, 0x5417c586), o.u(0x9af862d7, 0x622fd79a),
65204// o.u(0x6699ff55, 0xffcc5566), o.u(0x11b6a794, 0xa7229411),
65205// o.u(0x8ac04acf, 0x4a0fcf8a), o.u(0xe9d93010, 0x30c910e9),
65206// o.u(0x040e0a06, 0x0a080604), o.u(0xfe669881, 0x98e781fe),
65207// o.u(0xa0ab0bf0, 0x0b5bf0a0), o.u(0x78b4cc44, 0xccf04478),
65208// o.u(0x25f0d5ba, 0xd54aba25), o.u(0x4b753ee3, 0x3e96e34b),
65209// o.u(0xa2ac0ef3, 0x0e5ff3a2), o.u(0x5d4419fe, 0x19bafe5d),
65210// o.u(0x80db5bc0, 0x5b1bc080), o.u(0x0580858a, 0x850a8a05),
65211// o.u(0x3fd3ecad, 0xec7ead3f), o.u(0x21fedfbc, 0xdf42bc21),
65212// o.u(0x70a8d848, 0xd8e04870), o.u(0xf1fd0c04, 0x0cf904f1),
65213// o.u(0x63197adf, 0x7ac6df63), o.u(0x772f58c1, 0x58eec177),
65214// o.u(0xaf309f75, 0x9f4575af), o.u(0x42e7a563, 0xa5846342),
65215// o.u(0x20705030, 0x50403020), o.u(0xe5cb2e1a, 0x2ed11ae5),
65216// o.u(0xfdef120e, 0x12e10efd), o.u(0xbf08b76d, 0xb7656dbf),
65217// o.u(0x8155d44c, 0xd4194c81), o.u(0x18243c14, 0x3c301418),
65218// o.u(0x26795f35, 0x5f4c3526), o.u(0xc3b2712f, 0x719d2fc3),
65219// o.u(0xbe8638e1, 0x3867e1be), o.u(0x35c8fda2, 0xfd6aa235),
65220// o.u(0x88c74fcc, 0x4f0bcc88), o.u(0x2e654b39, 0x4b5c392e),
65221// o.u(0x936af957, 0xf93d5793), o.u(0x55580df2, 0x0daaf255),
65222// o.u(0xfc619d82, 0x9de382fc), o.u(0x7ab3c947, 0xc9f4477a),
65223// o.u(0xc827efac, 0xef8bacc8), o.u(0xba8832e7, 0x326fe7ba),
65224// o.u(0x324f7d2b, 0x7d642b32), o.u(0xe642a495, 0xa4d795e6),
65225// o.u(0xc03bfba0, 0xfb9ba0c0), o.u(0x19aab398, 0xb3329819),
65226// o.u(0x9ef668d1, 0x6827d19e), o.u(0xa322817f, 0x815d7fa3),
65227// o.u(0x44eeaa66, 0xaa886644), o.u(0x54d6827e, 0x82a87e54),
65228// o.u(0x3bdde6ab, 0xe676ab3b), o.u(0x0b959e83, 0x9e16830b),
65229// o.u(0x8cc945ca, 0x4503ca8c), o.u(0xc7bc7b29, 0x7b9529c7),
65230// o.u(0x6b056ed3, 0x6ed6d36b), o.u(0x286c443c, 0x44503c28),
65231// o.u(0xa72c8b79, 0x8b5579a7), o.u(0xbc813de2, 0x3d63e2bc),
65232// o.u(0x1631271d, 0x272c1d16), o.u(0xad379a76, 0x9a4176ad),
65233// o.u(0xdb964d3b, 0x4dad3bdb), o.u(0x649efa56, 0xfac85664),
65234// o.u(0x74a6d24e, 0xd2e84e74), o.u(0x1436221e, 0x22281e14),
65235// o.u(0x92e476db, 0x763fdb92), o.u(0x0c121e0a, 0x1e180a0c),
65236// o.u(0x48fcb46c, 0xb4906c48), o.u(0xb88f37e4, 0x376be4b8),
65237// o.u(0x9f78e75d, 0xe7255d9f), o.u(0xbd0fb26e, 0xb2616ebd),
65238// o.u(0x43692aef, 0x2a86ef43), o.u(0xc435f1a6, 0xf193a6c4),
65239// o.u(0x39dae3a8, 0xe372a839), o.u(0x31c6f7a4, 0xf762a431),
65240// o.u(0xd38a5937, 0x59bd37d3), o.u(0xf274868b, 0x86ff8bf2),
65241// o.u(0xd5835632, 0x56b132d5), o.u(0x8b4ec543, 0xc50d438b),
65242// o.u(0x6e85eb59, 0xebdc596e), o.u(0xda18c2b7, 0xc2afb7da),
65243// o.u(0x018e8f8c, 0x8f028c01), o.u(0xb11dac64, 0xac7964b1),
65244// o.u(0x9cf16dd2, 0x6d23d29c), o.u(0x49723be0, 0x3b92e049),
65245// o.u(0xd81fc7b4, 0xc7abb4d8), o.u(0xacb915fa, 0x1543faac),
65246// o.u(0xf3fa0907, 0x09fd07f3), o.u(0xcfa06f25, 0x6f8525cf),
65247// o.u(0xca20eaaf, 0xea8fafca), o.u(0xf47d898e, 0x89f38ef4),
65248// o.u(0x476720e9, 0x208ee947), o.u(0x10382818, 0x28201810),
65249// o.u(0x6f0b64d5, 0x64ded56f), o.u(0xf0738388, 0x83fb88f0),
65250// o.u(0x4afbb16f, 0xb1946f4a), o.u(0x5cca9672, 0x96b8725c),
65251// o.u(0x38546c24, 0x6c702438), o.u(0x575f08f1, 0x08aef157),
65252// o.u(0x732152c7, 0x52e6c773), o.u(0x9764f351, 0xf3355197),
65253// o.u(0xcbae6523, 0x658d23cb), o.u(0xa125847c, 0x84597ca1),
65254// o.u(0xe857bf9c, 0xbfcb9ce8), o.u(0x3e5d6321, 0x637c213e),
65255// o.u(0x96ea7cdd, 0x7c37dd96), o.u(0x611e7fdc, 0x7fc2dc61),
65256// o.u(0x0d9c9186, 0x911a860d), o.u(0x0f9b9485, 0x941e850f),
65257// o.u(0xe04bab90, 0xabdb90e0), o.u(0x7cbac642, 0xc6f8427c),
65258// o.u(0x712657c4, 0x57e2c471), o.u(0xcc29e5aa, 0xe583aacc),
65259// o.u(0x90e373d8, 0x733bd890), o.u(0x06090f05, 0x0f0c0506),
65260// o.u(0xf7f40301, 0x03f501f7), o.u(0x1c2a3612, 0x3638121c),
65261// o.u(0xc23cfea3, 0xfe9fa3c2), o.u(0x6a8be15f, 0xe1d45f6a),
65262// o.u(0xaebe10f9, 0x1047f9ae), o.u(0x69026bd0, 0x6bd2d069),
65263// o.u(0x17bfa891, 0xa82e9117), o.u(0x9971e858, 0xe8295899),
65264// o.u(0x3a536927, 0x6974273a), o.u(0x27f7d0b9, 0xd04eb927),
65265// o.u(0xd9914838, 0x48a938d9), o.u(0xebde3513, 0x35cd13eb),
65266// o.u(0x2be5ceb3, 0xce56b32b), o.u(0x22775533, 0x55443322),
65267// o.u(0xd204d6bb, 0xd6bfbbd2), o.u(0xa9399070, 0x904970a9),
65268// o.u(0x07878089, 0x800e8907), o.u(0x33c1f2a7, 0xf266a733),
65269// o.u(0x2decc1b6, 0xc15ab62d), o.u(0x3c5a6622, 0x6678223c),
65270// o.u(0x15b8ad92, 0xad2a9215), o.u(0xc9a96020, 0x608920c9),
65271// o.u(0x875cdb49, 0xdb154987), o.u(0xaab01aff, 0x1a4fffaa),
65272// o.u(0x50d88878, 0x88a07850), o.u(0xa52b8e7a, 0x8e517aa5),
65273// o.u(0x03898a8f, 0x8a068f03), o.u(0x594a13f8, 0x13b2f859),
65274// o.u(0x09929b80, 0x9b128009), o.u(0x1a233917, 0x3934171a),
65275// o.u(0x651075da, 0x75cada65), o.u(0xd7845331, 0x53b531d7),
65276// o.u(0x84d551c6, 0x5113c684), o.u(0xd003d3b8, 0xd3bbb8d0),
65277// o.u(0x82dc5ec3, 0x5e1fc382), o.u(0x29e2cbb0, 0xcb52b029),
65278// o.u(0x5ac39977, 0x99b4775a), o.u(0x1e2d3311, 0x333c111e),
65279// o.u(0x7b3d46cb, 0x46f6cb7b), o.u(0xa8b71ffc, 0x1f4bfca8),
65280// o.u(0x6d0c61d6, 0x61dad66d), o.u(0x2c624e3a, 0x4e583a2c)
65281// ];
65282
65283// var T1 = [
65284// o.u(0xc6c632f4, 0xa5f497a5), o.u(0xf8f86f97, 0x8497eb84),
65285// o.u(0xeeee5eb0, 0x99b0c799), o.u(0xf6f67a8c, 0x8d8cf78d),
65286// o.u(0xffffe817, 0xd17e50d), o.u(0xd6d60adc, 0xbddcb7bd),
65287// o.u(0xdede16c8, 0xb1c8a7b1), o.u(0x91916dfc, 0x54fc3954),
65288// o.u(0x606090f0, 0x50f0c050), o.u(0x2020705, 0x3050403),
65289// o.u(0xcece2ee0, 0xa9e087a9), o.u(0x5656d187, 0x7d87ac7d),
65290// o.u(0xe7e7cc2b, 0x192bd519), o.u(0xb5b513a6, 0x62a67162),
65291// o.u(0x4d4d7c31, 0xe6319ae6), o.u(0xecec59b5, 0x9ab5c39a),
65292// o.u(0x8f8f40cf, 0x45cf0545), o.u(0x1f1fa3bc, 0x9dbc3e9d),
65293// o.u(0x898949c0, 0x40c00940), o.u(0xfafa6892, 0x8792ef87),
65294// o.u(0xefefd03f, 0x153fc515), o.u(0xb2b29426, 0xeb267feb),
65295// o.u(0x8e8ece40, 0xc94007c9), o.u(0xfbfbe61d, 0xb1ded0b),
65296// o.u(0x41416e2f, 0xec2f82ec), o.u(0xb3b31aa9, 0x67a97d67),
65297// o.u(0x5f5f431c, 0xfd1cbefd), o.u(0x45456025, 0xea258aea),
65298// o.u(0x2323f9da, 0xbfda46bf), o.u(0x53535102, 0xf702a6f7),
65299// o.u(0xe4e445a1, 0x96a1d396), o.u(0x9b9b76ed, 0x5bed2d5b),
65300// o.u(0x7575285d, 0xc25deac2), o.u(0xe1e1c524, 0x1c24d91c),
65301// o.u(0x3d3dd4e9, 0xaee97aae), o.u(0x4c4cf2be, 0x6abe986a),
65302// o.u(0x6c6c82ee, 0x5aeed85a), o.u(0x7e7ebdc3, 0x41c3fc41),
65303// o.u(0xf5f5f306, 0x206f102), o.u(0x838352d1, 0x4fd11d4f),
65304// o.u(0x68688ce4, 0x5ce4d05c), o.u(0x51515607, 0xf407a2f4),
65305// o.u(0xd1d18d5c, 0x345cb934), o.u(0xf9f9e118, 0x818e908),
65306// o.u(0xe2e24cae, 0x93aedf93), o.u(0xabab3e95, 0x73954d73),
65307// o.u(0x626297f5, 0x53f5c453), o.u(0x2a2a6b41, 0x3f41543f),
65308// o.u(0x8081c14, 0xc14100c), o.u(0x959563f6, 0x52f63152),
65309// o.u(0x4646e9af, 0x65af8c65), o.u(0x9d9d7fe2, 0x5ee2215e),
65310// o.u(0x30304878, 0x28786028), o.u(0x3737cff8, 0xa1f86ea1),
65311// o.u(0xa0a1b11, 0xf11140f), o.u(0x2f2febc4, 0xb5c45eb5),
65312// o.u(0xe0e151b, 0x91b1c09), o.u(0x24247e5a, 0x365a4836),
65313// o.u(0x1b1badb6, 0x9bb6369b), o.u(0xdfdf9847, 0x3d47a53d),
65314// o.u(0xcdcda76a, 0x266a8126), o.u(0x4e4ef5bb, 0x69bb9c69),
65315// o.u(0x7f7f334c, 0xcd4cfecd), o.u(0xeaea50ba, 0x9fbacf9f),
65316// o.u(0x12123f2d, 0x1b2d241b), o.u(0x1d1da4b9, 0x9eb93a9e),
65317// o.u(0x5858c49c, 0x749cb074), o.u(0x34344672, 0x2e72682e),
65318// o.u(0x36364177, 0x2d776c2d), o.u(0xdcdc11cd, 0xb2cda3b2),
65319// o.u(0xb4b49d29, 0xee2973ee), o.u(0x5b5b4d16, 0xfb16b6fb),
65320// o.u(0xa4a4a501, 0xf60153f6), o.u(0x7676a1d7, 0x4dd7ec4d),
65321// o.u(0xb7b714a3, 0x61a37561), o.u(0x7d7d3449, 0xce49face),
65322// o.u(0x5252df8d, 0x7b8da47b), o.u(0xdddd9f42, 0x3e42a13e),
65323// o.u(0x5e5ecd93, 0x7193bc71), o.u(0x1313b1a2, 0x97a22697),
65324// o.u(0xa6a6a204, 0xf50457f5), o.u(0xb9b901b8, 0x68b86968),
65325// o.u(0x0, 0x0), o.u(0xc1c1b574, 0x2c74992c),
65326// o.u(0x4040e0a0, 0x60a08060), o.u(0xe3e3c221, 0x1f21dd1f),
65327// o.u(0x79793a43, 0xc843f2c8), o.u(0xb6b69a2c, 0xed2c77ed),
65328// o.u(0xd4d40dd9, 0xbed9b3be), o.u(0x8d8d47ca, 0x46ca0146),
65329// o.u(0x67671770, 0xd970ced9), o.u(0x7272afdd, 0x4bdde44b),
65330// o.u(0x9494ed79, 0xde7933de), o.u(0x9898ff67, 0xd4672bd4),
65331// o.u(0xb0b09323, 0xe8237be8), o.u(0x85855bde, 0x4ade114a),
65332// o.u(0xbbbb06bd, 0x6bbd6d6b), o.u(0xc5c5bb7e, 0x2a7e912a),
65333// o.u(0x4f4f7b34, 0xe5349ee5), o.u(0xededd73a, 0x163ac116),
65334// o.u(0x8686d254, 0xc55417c5), o.u(0x9a9af862, 0xd7622fd7),
65335// o.u(0x666699ff, 0x55ffcc55), o.u(0x1111b6a7, 0x94a72294),
65336// o.u(0x8a8ac04a, 0xcf4a0fcf), o.u(0xe9e9d930, 0x1030c910),
65337// o.u(0x4040e0a, 0x60a0806), o.u(0xfefe6698, 0x8198e781),
65338// o.u(0xa0a0ab0b, 0xf00b5bf0), o.u(0x7878b4cc, 0x44ccf044),
65339// o.u(0x2525f0d5, 0xbad54aba), o.u(0x4b4b753e, 0xe33e96e3),
65340// o.u(0xa2a2ac0e, 0xf30e5ff3), o.u(0x5d5d4419, 0xfe19bafe),
65341// o.u(0x8080db5b, 0xc05b1bc0), o.u(0x5058085, 0x8a850a8a),
65342// o.u(0x3f3fd3ec, 0xadec7ead), o.u(0x2121fedf, 0xbcdf42bc),
65343// o.u(0x7070a8d8, 0x48d8e048), o.u(0xf1f1fd0c, 0x40cf904),
65344// o.u(0x6363197a, 0xdf7ac6df), o.u(0x77772f58, 0xc158eec1),
65345// o.u(0xafaf309f, 0x759f4575), o.u(0x4242e7a5, 0x63a58463),
65346// o.u(0x20207050, 0x30504030), o.u(0xe5e5cb2e, 0x1a2ed11a),
65347// o.u(0xfdfdef12, 0xe12e10e), o.u(0xbfbf08b7, 0x6db7656d),
65348// o.u(0x818155d4, 0x4cd4194c), o.u(0x1818243c, 0x143c3014),
65349// o.u(0x2626795f, 0x355f4c35), o.u(0xc3c3b271, 0x2f719d2f),
65350// o.u(0xbebe8638, 0xe13867e1), o.u(0x3535c8fd, 0xa2fd6aa2),
65351// o.u(0x8888c74f, 0xcc4f0bcc), o.u(0x2e2e654b, 0x394b5c39),
65352// o.u(0x93936af9, 0x57f93d57), o.u(0x5555580d, 0xf20daaf2),
65353// o.u(0xfcfc619d, 0x829de382), o.u(0x7a7ab3c9, 0x47c9f447),
65354// o.u(0xc8c827ef, 0xacef8bac), o.u(0xbaba8832, 0xe7326fe7),
65355// o.u(0x32324f7d, 0x2b7d642b), o.u(0xe6e642a4, 0x95a4d795),
65356// o.u(0xc0c03bfb, 0xa0fb9ba0), o.u(0x1919aab3, 0x98b33298),
65357// o.u(0x9e9ef668, 0xd16827d1), o.u(0xa3a32281, 0x7f815d7f),
65358// o.u(0x4444eeaa, 0x66aa8866), o.u(0x5454d682, 0x7e82a87e),
65359// o.u(0x3b3bdde6, 0xabe676ab), o.u(0xb0b959e, 0x839e1683),
65360// o.u(0x8c8cc945, 0xca4503ca), o.u(0xc7c7bc7b, 0x297b9529),
65361// o.u(0x6b6b056e, 0xd36ed6d3), o.u(0x28286c44, 0x3c44503c),
65362// o.u(0xa7a72c8b, 0x798b5579), o.u(0xbcbc813d, 0xe23d63e2),
65363// o.u(0x16163127, 0x1d272c1d), o.u(0xadad379a, 0x769a4176),
65364// o.u(0xdbdb964d, 0x3b4dad3b), o.u(0x64649efa, 0x56fac856),
65365// o.u(0x7474a6d2, 0x4ed2e84e), o.u(0x14143622, 0x1e22281e),
65366// o.u(0x9292e476, 0xdb763fdb), o.u(0xc0c121e, 0xa1e180a),
65367// o.u(0x4848fcb4, 0x6cb4906c), o.u(0xb8b88f37, 0xe4376be4),
65368// o.u(0x9f9f78e7, 0x5de7255d), o.u(0xbdbd0fb2, 0x6eb2616e),
65369// o.u(0x4343692a, 0xef2a86ef), o.u(0xc4c435f1, 0xa6f193a6),
65370// o.u(0x3939dae3, 0xa8e372a8), o.u(0x3131c6f7, 0xa4f762a4),
65371// o.u(0xd3d38a59, 0x3759bd37), o.u(0xf2f27486, 0x8b86ff8b),
65372// o.u(0xd5d58356, 0x3256b132), o.u(0x8b8b4ec5, 0x43c50d43),
65373// o.u(0x6e6e85eb, 0x59ebdc59), o.u(0xdada18c2, 0xb7c2afb7),
65374// o.u(0x1018e8f, 0x8c8f028c), o.u(0xb1b11dac, 0x64ac7964),
65375// o.u(0x9c9cf16d, 0xd26d23d2), o.u(0x4949723b, 0xe03b92e0),
65376// o.u(0xd8d81fc7, 0xb4c7abb4), o.u(0xacacb915, 0xfa1543fa),
65377// o.u(0xf3f3fa09, 0x709fd07), o.u(0xcfcfa06f, 0x256f8525),
65378// o.u(0xcaca20ea, 0xafea8faf), o.u(0xf4f47d89, 0x8e89f38e),
65379// o.u(0x47476720, 0xe9208ee9), o.u(0x10103828, 0x18282018),
65380// o.u(0x6f6f0b64, 0xd564ded5), o.u(0xf0f07383, 0x8883fb88),
65381// o.u(0x4a4afbb1, 0x6fb1946f), o.u(0x5c5cca96, 0x7296b872),
65382// o.u(0x3838546c, 0x246c7024), o.u(0x57575f08, 0xf108aef1),
65383// o.u(0x73732152, 0xc752e6c7), o.u(0x979764f3, 0x51f33551),
65384// o.u(0xcbcbae65, 0x23658d23), o.u(0xa1a12584, 0x7c84597c),
65385// o.u(0xe8e857bf, 0x9cbfcb9c), o.u(0x3e3e5d63, 0x21637c21),
65386// o.u(0x9696ea7c, 0xdd7c37dd), o.u(0x61611e7f, 0xdc7fc2dc),
65387// o.u(0xd0d9c91, 0x86911a86), o.u(0xf0f9b94, 0x85941e85),
65388// o.u(0xe0e04bab, 0x90abdb90), o.u(0x7c7cbac6, 0x42c6f842),
65389// o.u(0x71712657, 0xc457e2c4), o.u(0xcccc29e5, 0xaae583aa),
65390// o.u(0x9090e373, 0xd8733bd8), o.u(0x606090f, 0x50f0c05),
65391// o.u(0xf7f7f403, 0x103f501), o.u(0x1c1c2a36, 0x12363812),
65392// o.u(0xc2c23cfe, 0xa3fe9fa3), o.u(0x6a6a8be1, 0x5fe1d45f),
65393// o.u(0xaeaebe10, 0xf91047f9), o.u(0x6969026b, 0xd06bd2d0),
65394// o.u(0x1717bfa8, 0x91a82e91), o.u(0x999971e8, 0x58e82958),
65395// o.u(0x3a3a5369, 0x27697427), o.u(0x2727f7d0, 0xb9d04eb9),
65396// o.u(0xd9d99148, 0x3848a938), o.u(0xebebde35, 0x1335cd13),
65397// o.u(0x2b2be5ce, 0xb3ce56b3), o.u(0x22227755, 0x33554433),
65398// o.u(0xd2d204d6, 0xbbd6bfbb), o.u(0xa9a93990, 0x70904970),
65399// o.u(0x7078780, 0x89800e89), o.u(0x3333c1f2, 0xa7f266a7),
65400// o.u(0x2d2decc1, 0xb6c15ab6), o.u(0x3c3c5a66, 0x22667822),
65401// o.u(0x1515b8ad, 0x92ad2a92), o.u(0xc9c9a960, 0x20608920),
65402// o.u(0x87875cdb, 0x49db1549), o.u(0xaaaab01a, 0xff1a4fff),
65403// o.u(0x5050d888, 0x7888a078), o.u(0xa5a52b8e, 0x7a8e517a),
65404// o.u(0x303898a, 0x8f8a068f), o.u(0x59594a13, 0xf813b2f8),
65405// o.u(0x909929b, 0x809b1280), o.u(0x1a1a2339, 0x17393417),
65406// o.u(0x65651075, 0xda75cada), o.u(0xd7d78453, 0x3153b531),
65407// o.u(0x8484d551, 0xc65113c6), o.u(0xd0d003d3, 0xb8d3bbb8),
65408// o.u(0x8282dc5e, 0xc35e1fc3), o.u(0x2929e2cb, 0xb0cb52b0),
65409// o.u(0x5a5ac399, 0x7799b477), o.u(0x1e1e2d33, 0x11333c11),
65410// o.u(0x7b7b3d46, 0xcb46f6cb), o.u(0xa8a8b71f, 0xfc1f4bfc),
65411// o.u(0x6d6d0c61, 0xd661dad6), o.u(0x2c2c624e, 0x3a4e583a)
65412// ];
65413
65414// var T2 = [
65415// o.u(0xa5c6c632, 0xf4a5f497), o.u(0x84f8f86f, 0x978497eb),
65416// o.u(0x99eeee5e, 0xb099b0c7), o.u(0x8df6f67a, 0x8c8d8cf7),
65417// o.u(0xdffffe8, 0x170d17e5), o.u(0xbdd6d60a, 0xdcbddcb7),
65418// o.u(0xb1dede16, 0xc8b1c8a7), o.u(0x5491916d, 0xfc54fc39),
65419// o.u(0x50606090, 0xf050f0c0), o.u(0x3020207, 0x5030504),
65420// o.u(0xa9cece2e, 0xe0a9e087), o.u(0x7d5656d1, 0x877d87ac),
65421// o.u(0x19e7e7cc, 0x2b192bd5), o.u(0x62b5b513, 0xa662a671),
65422// o.u(0xe64d4d7c, 0x31e6319a), o.u(0x9aecec59, 0xb59ab5c3),
65423// o.u(0x458f8f40, 0xcf45cf05), o.u(0x9d1f1fa3, 0xbc9dbc3e),
65424// o.u(0x40898949, 0xc040c009), o.u(0x87fafa68, 0x928792ef),
65425// o.u(0x15efefd0, 0x3f153fc5), o.u(0xebb2b294, 0x26eb267f),
65426// o.u(0xc98e8ece, 0x40c94007), o.u(0xbfbfbe6, 0x1d0b1ded),
65427// o.u(0xec41416e, 0x2fec2f82), o.u(0x67b3b31a, 0xa967a97d),
65428// o.u(0xfd5f5f43, 0x1cfd1cbe), o.u(0xea454560, 0x25ea258a),
65429// o.u(0xbf2323f9, 0xdabfda46), o.u(0xf7535351, 0x2f702a6),
65430// o.u(0x96e4e445, 0xa196a1d3), o.u(0x5b9b9b76, 0xed5bed2d),
65431// o.u(0xc2757528, 0x5dc25dea), o.u(0x1ce1e1c5, 0x241c24d9),
65432// o.u(0xae3d3dd4, 0xe9aee97a), o.u(0x6a4c4cf2, 0xbe6abe98),
65433// o.u(0x5a6c6c82, 0xee5aeed8), o.u(0x417e7ebd, 0xc341c3fc),
65434// o.u(0x2f5f5f3, 0x60206f1), o.u(0x4f838352, 0xd14fd11d),
65435// o.u(0x5c68688c, 0xe45ce4d0), o.u(0xf4515156, 0x7f407a2),
65436// o.u(0x34d1d18d, 0x5c345cb9), o.u(0x8f9f9e1, 0x180818e9),
65437// o.u(0x93e2e24c, 0xae93aedf), o.u(0x73abab3e, 0x9573954d),
65438// o.u(0x53626297, 0xf553f5c4), o.u(0x3f2a2a6b, 0x413f4154),
65439// o.u(0xc08081c, 0x140c1410), o.u(0x52959563, 0xf652f631),
65440// o.u(0x654646e9, 0xaf65af8c), o.u(0x5e9d9d7f, 0xe25ee221),
65441// o.u(0x28303048, 0x78287860), o.u(0xa13737cf, 0xf8a1f86e),
65442// o.u(0xf0a0a1b, 0x110f1114), o.u(0xb52f2feb, 0xc4b5c45e),
65443// o.u(0x90e0e15, 0x1b091b1c), o.u(0x3624247e, 0x5a365a48),
65444// o.u(0x9b1b1bad, 0xb69bb636), o.u(0x3ddfdf98, 0x473d47a5),
65445// o.u(0x26cdcda7, 0x6a266a81), o.u(0x694e4ef5, 0xbb69bb9c),
65446// o.u(0xcd7f7f33, 0x4ccd4cfe), o.u(0x9feaea50, 0xba9fbacf),
65447// o.u(0x1b12123f, 0x2d1b2d24), o.u(0x9e1d1da4, 0xb99eb93a),
65448// o.u(0x745858c4, 0x9c749cb0), o.u(0x2e343446, 0x722e7268),
65449// o.u(0x2d363641, 0x772d776c), o.u(0xb2dcdc11, 0xcdb2cda3),
65450// o.u(0xeeb4b49d, 0x29ee2973), o.u(0xfb5b5b4d, 0x16fb16b6),
65451// o.u(0xf6a4a4a5, 0x1f60153), o.u(0x4d7676a1, 0xd74dd7ec),
65452// o.u(0x61b7b714, 0xa361a375), o.u(0xce7d7d34, 0x49ce49fa),
65453// o.u(0x7b5252df, 0x8d7b8da4), o.u(0x3edddd9f, 0x423e42a1),
65454// o.u(0x715e5ecd, 0x937193bc), o.u(0x971313b1, 0xa297a226),
65455// o.u(0xf5a6a6a2, 0x4f50457), o.u(0x68b9b901, 0xb868b869),
65456// o.u(0x0, 0x0), o.u(0x2cc1c1b5, 0x742c7499),
65457// o.u(0x604040e0, 0xa060a080), o.u(0x1fe3e3c2, 0x211f21dd),
65458// o.u(0xc879793a, 0x43c843f2), o.u(0xedb6b69a, 0x2ced2c77),
65459// o.u(0xbed4d40d, 0xd9bed9b3), o.u(0x468d8d47, 0xca46ca01),
65460// o.u(0xd9676717, 0x70d970ce), o.u(0x4b7272af, 0xdd4bdde4),
65461// o.u(0xde9494ed, 0x79de7933), o.u(0xd49898ff, 0x67d4672b),
65462// o.u(0xe8b0b093, 0x23e8237b), o.u(0x4a85855b, 0xde4ade11),
65463// o.u(0x6bbbbb06, 0xbd6bbd6d), o.u(0x2ac5c5bb, 0x7e2a7e91),
65464// o.u(0xe54f4f7b, 0x34e5349e), o.u(0x16ededd7, 0x3a163ac1),
65465// o.u(0xc58686d2, 0x54c55417), o.u(0xd79a9af8, 0x62d7622f),
65466// o.u(0x55666699, 0xff55ffcc), o.u(0x941111b6, 0xa794a722),
65467// o.u(0xcf8a8ac0, 0x4acf4a0f), o.u(0x10e9e9d9, 0x301030c9),
65468// o.u(0x604040e, 0xa060a08), o.u(0x81fefe66, 0x988198e7),
65469// o.u(0xf0a0a0ab, 0xbf00b5b), o.u(0x447878b4, 0xcc44ccf0),
65470// o.u(0xba2525f0, 0xd5bad54a), o.u(0xe34b4b75, 0x3ee33e96),
65471// o.u(0xf3a2a2ac, 0xef30e5f), o.u(0xfe5d5d44, 0x19fe19ba),
65472// o.u(0xc08080db, 0x5bc05b1b), o.u(0x8a050580, 0x858a850a),
65473// o.u(0xad3f3fd3, 0xecadec7e), o.u(0xbc2121fe, 0xdfbcdf42),
65474// o.u(0x487070a8, 0xd848d8e0), o.u(0x4f1f1fd, 0xc040cf9),
65475// o.u(0xdf636319, 0x7adf7ac6), o.u(0xc177772f, 0x58c158ee),
65476// o.u(0x75afaf30, 0x9f759f45), o.u(0x634242e7, 0xa563a584),
65477// o.u(0x30202070, 0x50305040), o.u(0x1ae5e5cb, 0x2e1a2ed1),
65478// o.u(0xefdfdef, 0x120e12e1), o.u(0x6dbfbf08, 0xb76db765),
65479// o.u(0x4c818155, 0xd44cd419), o.u(0x14181824, 0x3c143c30),
65480// o.u(0x35262679, 0x5f355f4c), o.u(0x2fc3c3b2, 0x712f719d),
65481// o.u(0xe1bebe86, 0x38e13867), o.u(0xa23535c8, 0xfda2fd6a),
65482// o.u(0xcc8888c7, 0x4fcc4f0b), o.u(0x392e2e65, 0x4b394b5c),
65483// o.u(0x5793936a, 0xf957f93d), o.u(0xf2555558, 0xdf20daa),
65484// o.u(0x82fcfc61, 0x9d829de3), o.u(0x477a7ab3, 0xc947c9f4),
65485// o.u(0xacc8c827, 0xefacef8b), o.u(0xe7baba88, 0x32e7326f),
65486// o.u(0x2b32324f, 0x7d2b7d64), o.u(0x95e6e642, 0xa495a4d7),
65487// o.u(0xa0c0c03b, 0xfba0fb9b), o.u(0x981919aa, 0xb398b332),
65488// o.u(0xd19e9ef6, 0x68d16827), o.u(0x7fa3a322, 0x817f815d),
65489// o.u(0x664444ee, 0xaa66aa88), o.u(0x7e5454d6, 0x827e82a8),
65490// o.u(0xab3b3bdd, 0xe6abe676), o.u(0x830b0b95, 0x9e839e16),
65491// o.u(0xca8c8cc9, 0x45ca4503), o.u(0x29c7c7bc, 0x7b297b95),
65492// o.u(0xd36b6b05, 0x6ed36ed6), o.u(0x3c28286c, 0x443c4450),
65493// o.u(0x79a7a72c, 0x8b798b55), o.u(0xe2bcbc81, 0x3de23d63),
65494// o.u(0x1d161631, 0x271d272c), o.u(0x76adad37, 0x9a769a41),
65495// o.u(0x3bdbdb96, 0x4d3b4dad), o.u(0x5664649e, 0xfa56fac8),
65496// o.u(0x4e7474a6, 0xd24ed2e8), o.u(0x1e141436, 0x221e2228),
65497// o.u(0xdb9292e4, 0x76db763f), o.u(0xa0c0c12, 0x1e0a1e18),
65498// o.u(0x6c4848fc, 0xb46cb490), o.u(0xe4b8b88f, 0x37e4376b),
65499// o.u(0x5d9f9f78, 0xe75de725), o.u(0x6ebdbd0f, 0xb26eb261),
65500// o.u(0xef434369, 0x2aef2a86), o.u(0xa6c4c435, 0xf1a6f193),
65501// o.u(0xa83939da, 0xe3a8e372), o.u(0xa43131c6, 0xf7a4f762),
65502// o.u(0x37d3d38a, 0x593759bd), o.u(0x8bf2f274, 0x868b86ff),
65503// o.u(0x32d5d583, 0x563256b1), o.u(0x438b8b4e, 0xc543c50d),
65504// o.u(0x596e6e85, 0xeb59ebdc), o.u(0xb7dada18, 0xc2b7c2af),
65505// o.u(0x8c01018e, 0x8f8c8f02), o.u(0x64b1b11d, 0xac64ac79),
65506// o.u(0xd29c9cf1, 0x6dd26d23), o.u(0xe0494972, 0x3be03b92),
65507// o.u(0xb4d8d81f, 0xc7b4c7ab), o.u(0xfaacacb9, 0x15fa1543),
65508// o.u(0x7f3f3fa, 0x90709fd), o.u(0x25cfcfa0, 0x6f256f85),
65509// o.u(0xafcaca20, 0xeaafea8f), o.u(0x8ef4f47d, 0x898e89f3),
65510// o.u(0xe9474767, 0x20e9208e), o.u(0x18101038, 0x28182820),
65511// o.u(0xd56f6f0b, 0x64d564de), o.u(0x88f0f073, 0x838883fb),
65512// o.u(0x6f4a4afb, 0xb16fb194), o.u(0x725c5cca, 0x967296b8),
65513// o.u(0x24383854, 0x6c246c70), o.u(0xf157575f, 0x8f108ae),
65514// o.u(0xc7737321, 0x52c752e6), o.u(0x51979764, 0xf351f335),
65515// o.u(0x23cbcbae, 0x6523658d), o.u(0x7ca1a125, 0x847c8459),
65516// o.u(0x9ce8e857, 0xbf9cbfcb), o.u(0x213e3e5d, 0x6321637c),
65517// o.u(0xdd9696ea, 0x7cdd7c37), o.u(0xdc61611e, 0x7fdc7fc2),
65518// o.u(0x860d0d9c, 0x9186911a), o.u(0x850f0f9b, 0x9485941e),
65519// o.u(0x90e0e04b, 0xab90abdb), o.u(0x427c7cba, 0xc642c6f8),
65520// o.u(0xc4717126, 0x57c457e2), o.u(0xaacccc29, 0xe5aae583),
65521// o.u(0xd89090e3, 0x73d8733b), o.u(0x5060609, 0xf050f0c),
65522// o.u(0x1f7f7f4, 0x30103f5), o.u(0x121c1c2a, 0x36123638),
65523// o.u(0xa3c2c23c, 0xfea3fe9f), o.u(0x5f6a6a8b, 0xe15fe1d4),
65524// o.u(0xf9aeaebe, 0x10f91047), o.u(0xd0696902, 0x6bd06bd2),
65525// o.u(0x911717bf, 0xa891a82e), o.u(0x58999971, 0xe858e829),
65526// o.u(0x273a3a53, 0x69276974), o.u(0xb92727f7, 0xd0b9d04e),
65527// o.u(0x38d9d991, 0x483848a9), o.u(0x13ebebde, 0x351335cd),
65528// o.u(0xb32b2be5, 0xceb3ce56), o.u(0x33222277, 0x55335544),
65529// o.u(0xbbd2d204, 0xd6bbd6bf), o.u(0x70a9a939, 0x90709049),
65530// o.u(0x89070787, 0x8089800e), o.u(0xa73333c1, 0xf2a7f266),
65531// o.u(0xb62d2dec, 0xc1b6c15a), o.u(0x223c3c5a, 0x66226678),
65532// o.u(0x921515b8, 0xad92ad2a), o.u(0x20c9c9a9, 0x60206089),
65533// o.u(0x4987875c, 0xdb49db15), o.u(0xffaaaab0, 0x1aff1a4f),
65534// o.u(0x785050d8, 0x887888a0), o.u(0x7aa5a52b, 0x8e7a8e51),
65535// o.u(0x8f030389, 0x8a8f8a06), o.u(0xf859594a, 0x13f813b2),
65536// o.u(0x80090992, 0x9b809b12), o.u(0x171a1a23, 0x39173934),
65537// o.u(0xda656510, 0x75da75ca), o.u(0x31d7d784, 0x533153b5),
65538// o.u(0xc68484d5, 0x51c65113), o.u(0xb8d0d003, 0xd3b8d3bb),
65539// o.u(0xc38282dc, 0x5ec35e1f), o.u(0xb02929e2, 0xcbb0cb52),
65540// o.u(0x775a5ac3, 0x997799b4), o.u(0x111e1e2d, 0x3311333c),
65541// o.u(0xcb7b7b3d, 0x46cb46f6), o.u(0xfca8a8b7, 0x1ffc1f4b),
65542// o.u(0xd66d6d0c, 0x61d661da), o.u(0x3a2c2c62, 0x4e3a4e58)
65543// ];
65544
65545// var T3 = [
65546// o.u(0x97a5c6c6, 0x32f4a5f4), o.u(0xeb84f8f8, 0x6f978497),
65547// o.u(0xc799eeee, 0x5eb099b0), o.u(0xf78df6f6, 0x7a8c8d8c),
65548// o.u(0xe50dffff, 0xe8170d17), o.u(0xb7bdd6d6, 0xadcbddc),
65549// o.u(0xa7b1dede, 0x16c8b1c8), o.u(0x39549191, 0x6dfc54fc),
65550// o.u(0xc0506060, 0x90f050f0), o.u(0x4030202, 0x7050305),
65551// o.u(0x87a9cece, 0x2ee0a9e0), o.u(0xac7d5656, 0xd1877d87),
65552// o.u(0xd519e7e7, 0xcc2b192b), o.u(0x7162b5b5, 0x13a662a6),
65553// o.u(0x9ae64d4d, 0x7c31e631), o.u(0xc39aecec, 0x59b59ab5),
65554// o.u(0x5458f8f, 0x40cf45cf), o.u(0x3e9d1f1f, 0xa3bc9dbc),
65555// o.u(0x9408989, 0x49c040c0), o.u(0xef87fafa, 0x68928792),
65556// o.u(0xc515efef, 0xd03f153f), o.u(0x7febb2b2, 0x9426eb26),
65557// o.u(0x7c98e8e, 0xce40c940), o.u(0xed0bfbfb, 0xe61d0b1d),
65558// o.u(0x82ec4141, 0x6e2fec2f), o.u(0x7d67b3b3, 0x1aa967a9),
65559// o.u(0xbefd5f5f, 0x431cfd1c), o.u(0x8aea4545, 0x6025ea25),
65560// o.u(0x46bf2323, 0xf9dabfda), o.u(0xa6f75353, 0x5102f702),
65561// o.u(0xd396e4e4, 0x45a196a1), o.u(0x2d5b9b9b, 0x76ed5bed),
65562// o.u(0xeac27575, 0x285dc25d), o.u(0xd91ce1e1, 0xc5241c24),
65563// o.u(0x7aae3d3d, 0xd4e9aee9), o.u(0x986a4c4c, 0xf2be6abe),
65564// o.u(0xd85a6c6c, 0x82ee5aee), o.u(0xfc417e7e, 0xbdc341c3),
65565// o.u(0xf102f5f5, 0xf3060206), o.u(0x1d4f8383, 0x52d14fd1),
65566// o.u(0xd05c6868, 0x8ce45ce4), o.u(0xa2f45151, 0x5607f407),
65567// o.u(0xb934d1d1, 0x8d5c345c), o.u(0xe908f9f9, 0xe1180818),
65568// o.u(0xdf93e2e2, 0x4cae93ae), o.u(0x4d73abab, 0x3e957395),
65569// o.u(0xc4536262, 0x97f553f5), o.u(0x543f2a2a, 0x6b413f41),
65570// o.u(0x100c0808, 0x1c140c14), o.u(0x31529595, 0x63f652f6),
65571// o.u(0x8c654646, 0xe9af65af), o.u(0x215e9d9d, 0x7fe25ee2),
65572// o.u(0x60283030, 0x48782878), o.u(0x6ea13737, 0xcff8a1f8),
65573// o.u(0x140f0a0a, 0x1b110f11), o.u(0x5eb52f2f, 0xebc4b5c4),
65574// o.u(0x1c090e0e, 0x151b091b), o.u(0x48362424, 0x7e5a365a),
65575// o.u(0x369b1b1b, 0xadb69bb6), o.u(0xa53ddfdf, 0x98473d47),
65576// o.u(0x8126cdcd, 0xa76a266a), o.u(0x9c694e4e, 0xf5bb69bb),
65577// o.u(0xfecd7f7f, 0x334ccd4c), o.u(0xcf9feaea, 0x50ba9fba),
65578// o.u(0x241b1212, 0x3f2d1b2d), o.u(0x3a9e1d1d, 0xa4b99eb9),
65579// o.u(0xb0745858, 0xc49c749c), o.u(0x682e3434, 0x46722e72),
65580// o.u(0x6c2d3636, 0x41772d77), o.u(0xa3b2dcdc, 0x11cdb2cd),
65581// o.u(0x73eeb4b4, 0x9d29ee29), o.u(0xb6fb5b5b, 0x4d16fb16),
65582// o.u(0x53f6a4a4, 0xa501f601), o.u(0xec4d7676, 0xa1d74dd7),
65583// o.u(0x7561b7b7, 0x14a361a3), o.u(0xface7d7d, 0x3449ce49),
65584// o.u(0xa47b5252, 0xdf8d7b8d), o.u(0xa13edddd, 0x9f423e42),
65585// o.u(0xbc715e5e, 0xcd937193), o.u(0x26971313, 0xb1a297a2),
65586// o.u(0x57f5a6a6, 0xa204f504), o.u(0x6968b9b9, 0x1b868b8),
65587// o.u(0x0, 0x0), o.u(0x992cc1c1, 0xb5742c74),
65588// o.u(0x80604040, 0xe0a060a0), o.u(0xdd1fe3e3, 0xc2211f21),
65589// o.u(0xf2c87979, 0x3a43c843), o.u(0x77edb6b6, 0x9a2ced2c),
65590// o.u(0xb3bed4d4, 0xdd9bed9), o.u(0x1468d8d, 0x47ca46ca),
65591// o.u(0xced96767, 0x1770d970), o.u(0xe44b7272, 0xafdd4bdd),
65592// o.u(0x33de9494, 0xed79de79), o.u(0x2bd49898, 0xff67d467),
65593// o.u(0x7be8b0b0, 0x9323e823), o.u(0x114a8585, 0x5bde4ade),
65594// o.u(0x6d6bbbbb, 0x6bd6bbd), o.u(0x912ac5c5, 0xbb7e2a7e),
65595// o.u(0x9ee54f4f, 0x7b34e534), o.u(0xc116eded, 0xd73a163a),
65596// o.u(0x17c58686, 0xd254c554), o.u(0x2fd79a9a, 0xf862d762),
65597// o.u(0xcc556666, 0x99ff55ff), o.u(0x22941111, 0xb6a794a7),
65598// o.u(0xfcf8a8a, 0xc04acf4a), o.u(0xc910e9e9, 0xd9301030),
65599// o.u(0x8060404, 0xe0a060a), o.u(0xe781fefe, 0x66988198),
65600// o.u(0x5bf0a0a0, 0xab0bf00b), o.u(0xf0447878, 0xb4cc44cc),
65601// o.u(0x4aba2525, 0xf0d5bad5), o.u(0x96e34b4b, 0x753ee33e),
65602// o.u(0x5ff3a2a2, 0xac0ef30e), o.u(0xbafe5d5d, 0x4419fe19),
65603// o.u(0x1bc08080, 0xdb5bc05b), o.u(0xa8a0505, 0x80858a85),
65604// o.u(0x7ead3f3f, 0xd3ecadec), o.u(0x42bc2121, 0xfedfbcdf),
65605// o.u(0xe0487070, 0xa8d848d8), o.u(0xf904f1f1, 0xfd0c040c),
65606// o.u(0xc6df6363, 0x197adf7a), o.u(0xeec17777, 0x2f58c158),
65607// o.u(0x4575afaf, 0x309f759f), o.u(0x84634242, 0xe7a563a5),
65608// o.u(0x40302020, 0x70503050), o.u(0xd11ae5e5, 0xcb2e1a2e),
65609// o.u(0xe10efdfd, 0xef120e12), o.u(0x656dbfbf, 0x8b76db7),
65610// o.u(0x194c8181, 0x55d44cd4), o.u(0x30141818, 0x243c143c),
65611// o.u(0x4c352626, 0x795f355f), o.u(0x9d2fc3c3, 0xb2712f71),
65612// o.u(0x67e1bebe, 0x8638e138), o.u(0x6aa23535, 0xc8fda2fd),
65613// o.u(0xbcc8888, 0xc74fcc4f), o.u(0x5c392e2e, 0x654b394b),
65614// o.u(0x3d579393, 0x6af957f9), o.u(0xaaf25555, 0x580df20d),
65615// o.u(0xe382fcfc, 0x619d829d), o.u(0xf4477a7a, 0xb3c947c9),
65616// o.u(0x8bacc8c8, 0x27efacef), o.u(0x6fe7baba, 0x8832e732),
65617// o.u(0x642b3232, 0x4f7d2b7d), o.u(0xd795e6e6, 0x42a495a4),
65618// o.u(0x9ba0c0c0, 0x3bfba0fb), o.u(0x32981919, 0xaab398b3),
65619// o.u(0x27d19e9e, 0xf668d168), o.u(0x5d7fa3a3, 0x22817f81),
65620// o.u(0x88664444, 0xeeaa66aa), o.u(0xa87e5454, 0xd6827e82),
65621// o.u(0x76ab3b3b, 0xdde6abe6), o.u(0x16830b0b, 0x959e839e),
65622// o.u(0x3ca8c8c, 0xc945ca45), o.u(0x9529c7c7, 0xbc7b297b),
65623// o.u(0xd6d36b6b, 0x56ed36e), o.u(0x503c2828, 0x6c443c44),
65624// o.u(0x5579a7a7, 0x2c8b798b), o.u(0x63e2bcbc, 0x813de23d),
65625// o.u(0x2c1d1616, 0x31271d27), o.u(0x4176adad, 0x379a769a),
65626// o.u(0xad3bdbdb, 0x964d3b4d), o.u(0xc8566464, 0x9efa56fa),
65627// o.u(0xe84e7474, 0xa6d24ed2), o.u(0x281e1414, 0x36221e22),
65628// o.u(0x3fdb9292, 0xe476db76), o.u(0x180a0c0c, 0x121e0a1e),
65629// o.u(0x906c4848, 0xfcb46cb4), o.u(0x6be4b8b8, 0x8f37e437),
65630// o.u(0x255d9f9f, 0x78e75de7), o.u(0x616ebdbd, 0xfb26eb2),
65631// o.u(0x86ef4343, 0x692aef2a), o.u(0x93a6c4c4, 0x35f1a6f1),
65632// o.u(0x72a83939, 0xdae3a8e3), o.u(0x62a43131, 0xc6f7a4f7),
65633// o.u(0xbd37d3d3, 0x8a593759), o.u(0xff8bf2f2, 0x74868b86),
65634// o.u(0xb132d5d5, 0x83563256), o.u(0xd438b8b, 0x4ec543c5),
65635// o.u(0xdc596e6e, 0x85eb59eb), o.u(0xafb7dada, 0x18c2b7c2),
65636// o.u(0x28c0101, 0x8e8f8c8f), o.u(0x7964b1b1, 0x1dac64ac),
65637// o.u(0x23d29c9c, 0xf16dd26d), o.u(0x92e04949, 0x723be03b),
65638// o.u(0xabb4d8d8, 0x1fc7b4c7), o.u(0x43faacac, 0xb915fa15),
65639// o.u(0xfd07f3f3, 0xfa090709), o.u(0x8525cfcf, 0xa06f256f),
65640// o.u(0x8fafcaca, 0x20eaafea), o.u(0xf38ef4f4, 0x7d898e89),
65641// o.u(0x8ee94747, 0x6720e920), o.u(0x20181010, 0x38281828),
65642// o.u(0xded56f6f, 0xb64d564), o.u(0xfb88f0f0, 0x73838883),
65643// o.u(0x946f4a4a, 0xfbb16fb1), o.u(0xb8725c5c, 0xca967296),
65644// o.u(0x70243838, 0x546c246c), o.u(0xaef15757, 0x5f08f108),
65645// o.u(0xe6c77373, 0x2152c752), o.u(0x35519797, 0x64f351f3),
65646// o.u(0x8d23cbcb, 0xae652365), o.u(0x597ca1a1, 0x25847c84),
65647// o.u(0xcb9ce8e8, 0x57bf9cbf), o.u(0x7c213e3e, 0x5d632163),
65648// o.u(0x37dd9696, 0xea7cdd7c), o.u(0xc2dc6161, 0x1e7fdc7f),
65649// o.u(0x1a860d0d, 0x9c918691), o.u(0x1e850f0f, 0x9b948594),
65650// o.u(0xdb90e0e0, 0x4bab90ab), o.u(0xf8427c7c, 0xbac642c6),
65651// o.u(0xe2c47171, 0x2657c457), o.u(0x83aacccc, 0x29e5aae5),
65652// o.u(0x3bd89090, 0xe373d873), o.u(0xc050606, 0x90f050f),
65653// o.u(0xf501f7f7, 0xf4030103), o.u(0x38121c1c, 0x2a361236),
65654// o.u(0x9fa3c2c2, 0x3cfea3fe), o.u(0xd45f6a6a, 0x8be15fe1),
65655// o.u(0x47f9aeae, 0xbe10f910), o.u(0xd2d06969, 0x26bd06b),
65656// o.u(0x2e911717, 0xbfa891a8), o.u(0x29589999, 0x71e858e8),
65657// o.u(0x74273a3a, 0x53692769), o.u(0x4eb92727, 0xf7d0b9d0),
65658// o.u(0xa938d9d9, 0x91483848), o.u(0xcd13ebeb, 0xde351335),
65659// o.u(0x56b32b2b, 0xe5ceb3ce), o.u(0x44332222, 0x77553355),
65660// o.u(0xbfbbd2d2, 0x4d6bbd6), o.u(0x4970a9a9, 0x39907090),
65661// o.u(0xe890707, 0x87808980), o.u(0x66a73333, 0xc1f2a7f2),
65662// o.u(0x5ab62d2d, 0xecc1b6c1), o.u(0x78223c3c, 0x5a662266),
65663// o.u(0x2a921515, 0xb8ad92ad), o.u(0x8920c9c9, 0xa9602060),
65664// o.u(0x15498787, 0x5cdb49db), o.u(0x4fffaaaa, 0xb01aff1a),
65665// o.u(0xa0785050, 0xd8887888), o.u(0x517aa5a5, 0x2b8e7a8e),
65666// o.u(0x68f0303, 0x898a8f8a), o.u(0xb2f85959, 0x4a13f813),
65667// o.u(0x12800909, 0x929b809b), o.u(0x34171a1a, 0x23391739),
65668// o.u(0xcada6565, 0x1075da75), o.u(0xb531d7d7, 0x84533153),
65669// o.u(0x13c68484, 0xd551c651), o.u(0xbbb8d0d0, 0x3d3b8d3),
65670// o.u(0x1fc38282, 0xdc5ec35e), o.u(0x52b02929, 0xe2cbb0cb),
65671// o.u(0xb4775a5a, 0xc3997799), o.u(0x3c111e1e, 0x2d331133),
65672// o.u(0xf6cb7b7b, 0x3d46cb46), o.u(0x4bfca8a8, 0xb71ffc1f),
65673// o.u(0xdad66d6d, 0xc61d661), o.u(0x583a2c2c, 0x624e3a4e)
65674// ]
65675
65676// var T4 = [
65677// o.u(0xf497a5c6, 0xc632f4a5), o.u(0x97eb84f8, 0xf86f9784),
65678// o.u(0xb0c799ee, 0xee5eb099), o.u(0x8cf78df6, 0xf67a8c8d),
65679// o.u(0x17e50dff, 0xffe8170d), o.u(0xdcb7bdd6, 0xd60adcbd),
65680// o.u(0xc8a7b1de, 0xde16c8b1), o.u(0xfc395491, 0x916dfc54),
65681// o.u(0xf0c05060, 0x6090f050), o.u(0x05040302, 0x02070503),
65682// o.u(0xe087a9ce, 0xce2ee0a9), o.u(0x87ac7d56, 0x56d1877d),
65683// o.u(0x2bd519e7, 0xe7cc2b19), o.u(0xa67162b5, 0xb513a662),
65684// o.u(0x319ae64d, 0x4d7c31e6), o.u(0xb5c39aec, 0xec59b59a),
65685// o.u(0xcf05458f, 0x8f40cf45), o.u(0xbc3e9d1f, 0x1fa3bc9d),
65686// o.u(0xc0094089, 0x8949c040), o.u(0x92ef87fa, 0xfa689287),
65687// o.u(0x3fc515ef, 0xefd03f15), o.u(0x267febb2, 0xb29426eb),
65688// o.u(0x4007c98e, 0x8ece40c9), o.u(0x1ded0bfb, 0xfbe61d0b),
65689// o.u(0x2f82ec41, 0x416e2fec), o.u(0xa97d67b3, 0xb31aa967),
65690// o.u(0x1cbefd5f, 0x5f431cfd), o.u(0x258aea45, 0x456025ea),
65691// o.u(0xda46bf23, 0x23f9dabf), o.u(0x02a6f753, 0x535102f7),
65692// o.u(0xa1d396e4, 0xe445a196), o.u(0xed2d5b9b, 0x9b76ed5b),
65693// o.u(0x5deac275, 0x75285dc2), o.u(0x24d91ce1, 0xe1c5241c),
65694// o.u(0xe97aae3d, 0x3dd4e9ae), o.u(0xbe986a4c, 0x4cf2be6a),
65695// o.u(0xeed85a6c, 0x6c82ee5a), o.u(0xc3fc417e, 0x7ebdc341),
65696// o.u(0x06f102f5, 0xf5f30602), o.u(0xd11d4f83, 0x8352d14f),
65697// o.u(0xe4d05c68, 0x688ce45c), o.u(0x07a2f451, 0x515607f4),
65698// o.u(0x5cb934d1, 0xd18d5c34), o.u(0x18e908f9, 0xf9e11808),
65699// o.u(0xaedf93e2, 0xe24cae93), o.u(0x954d73ab, 0xab3e9573),
65700// o.u(0xf5c45362, 0x6297f553), o.u(0x41543f2a, 0x2a6b413f),
65701// o.u(0x14100c08, 0x081c140c), o.u(0xf6315295, 0x9563f652),
65702// o.u(0xaf8c6546, 0x46e9af65), o.u(0xe2215e9d, 0x9d7fe25e),
65703// o.u(0x78602830, 0x30487828), o.u(0xf86ea137, 0x37cff8a1),
65704// o.u(0x11140f0a, 0x0a1b110f), o.u(0xc45eb52f, 0x2febc4b5),
65705// o.u(0x1b1c090e, 0x0e151b09), o.u(0x5a483624, 0x247e5a36),
65706// o.u(0xb6369b1b, 0x1badb69b), o.u(0x47a53ddf, 0xdf98473d),
65707// o.u(0x6a8126cd, 0xcda76a26), o.u(0xbb9c694e, 0x4ef5bb69),
65708// o.u(0x4cfecd7f, 0x7f334ccd), o.u(0xbacf9fea, 0xea50ba9f),
65709// o.u(0x2d241b12, 0x123f2d1b), o.u(0xb93a9e1d, 0x1da4b99e),
65710// o.u(0x9cb07458, 0x58c49c74), o.u(0x72682e34, 0x3446722e),
65711// o.u(0x776c2d36, 0x3641772d), o.u(0xcda3b2dc, 0xdc11cdb2),
65712// o.u(0x2973eeb4, 0xb49d29ee), o.u(0x16b6fb5b, 0x5b4d16fb),
65713// o.u(0x0153f6a4, 0xa4a501f6), o.u(0xd7ec4d76, 0x76a1d74d),
65714// o.u(0xa37561b7, 0xb714a361), o.u(0x49face7d, 0x7d3449ce),
65715// o.u(0x8da47b52, 0x52df8d7b), o.u(0x42a13edd, 0xdd9f423e),
65716// o.u(0x93bc715e, 0x5ecd9371), o.u(0xa2269713, 0x13b1a297),
65717// o.u(0x0457f5a6, 0xa6a204f5), o.u(0xb86968b9, 0xb901b868),
65718// o.u(0x00000000, 0x00000000), o.u(0x74992cc1, 0xc1b5742c),
65719// o.u(0xa0806040, 0x40e0a060), o.u(0x21dd1fe3, 0xe3c2211f),
65720// o.u(0x43f2c879, 0x793a43c8), o.u(0x2c77edb6, 0xb69a2ced),
65721// o.u(0xd9b3bed4, 0xd40dd9be), o.u(0xca01468d, 0x8d47ca46),
65722// o.u(0x70ced967, 0x671770d9), o.u(0xdde44b72, 0x72afdd4b),
65723// o.u(0x7933de94, 0x94ed79de), o.u(0x672bd498, 0x98ff67d4),
65724// o.u(0x237be8b0, 0xb09323e8), o.u(0xde114a85, 0x855bde4a),
65725// o.u(0xbd6d6bbb, 0xbb06bd6b), o.u(0x7e912ac5, 0xc5bb7e2a),
65726// o.u(0x349ee54f, 0x4f7b34e5), o.u(0x3ac116ed, 0xedd73a16),
65727// o.u(0x5417c586, 0x86d254c5), o.u(0x622fd79a, 0x9af862d7),
65728// o.u(0xffcc5566, 0x6699ff55), o.u(0xa7229411, 0x11b6a794),
65729// o.u(0x4a0fcf8a, 0x8ac04acf), o.u(0x30c910e9, 0xe9d93010),
65730// o.u(0x0a080604, 0x040e0a06), o.u(0x98e781fe, 0xfe669881),
65731// o.u(0x0b5bf0a0, 0xa0ab0bf0), o.u(0xccf04478, 0x78b4cc44),
65732// o.u(0xd54aba25, 0x25f0d5ba), o.u(0x3e96e34b, 0x4b753ee3),
65733// o.u(0x0e5ff3a2, 0xa2ac0ef3), o.u(0x19bafe5d, 0x5d4419fe),
65734// o.u(0x5b1bc080, 0x80db5bc0), o.u(0x850a8a05, 0x0580858a),
65735// o.u(0xec7ead3f, 0x3fd3ecad), o.u(0xdf42bc21, 0x21fedfbc),
65736// o.u(0xd8e04870, 0x70a8d848), o.u(0x0cf904f1, 0xf1fd0c04),
65737// o.u(0x7ac6df63, 0x63197adf), o.u(0x58eec177, 0x772f58c1),
65738// o.u(0x9f4575af, 0xaf309f75), o.u(0xa5846342, 0x42e7a563),
65739// o.u(0x50403020, 0x20705030), o.u(0x2ed11ae5, 0xe5cb2e1a),
65740// o.u(0x12e10efd, 0xfdef120e), o.u(0xb7656dbf, 0xbf08b76d),
65741// o.u(0xd4194c81, 0x8155d44c), o.u(0x3c301418, 0x18243c14),
65742// o.u(0x5f4c3526, 0x26795f35), o.u(0x719d2fc3, 0xc3b2712f),
65743// o.u(0x3867e1be, 0xbe8638e1), o.u(0xfd6aa235, 0x35c8fda2),
65744// o.u(0x4f0bcc88, 0x88c74fcc), o.u(0x4b5c392e, 0x2e654b39),
65745// o.u(0xf93d5793, 0x936af957), o.u(0x0daaf255, 0x55580df2),
65746// o.u(0x9de382fc, 0xfc619d82), o.u(0xc9f4477a, 0x7ab3c947),
65747// o.u(0xef8bacc8, 0xc827efac), o.u(0x326fe7ba, 0xba8832e7),
65748// o.u(0x7d642b32, 0x324f7d2b), o.u(0xa4d795e6, 0xe642a495),
65749// o.u(0xfb9ba0c0, 0xc03bfba0), o.u(0xb3329819, 0x19aab398),
65750// o.u(0x6827d19e, 0x9ef668d1), o.u(0x815d7fa3, 0xa322817f),
65751// o.u(0xaa886644, 0x44eeaa66), o.u(0x82a87e54, 0x54d6827e),
65752// o.u(0xe676ab3b, 0x3bdde6ab), o.u(0x9e16830b, 0x0b959e83),
65753// o.u(0x4503ca8c, 0x8cc945ca), o.u(0x7b9529c7, 0xc7bc7b29),
65754// o.u(0x6ed6d36b, 0x6b056ed3), o.u(0x44503c28, 0x286c443c),
65755// o.u(0x8b5579a7, 0xa72c8b79), o.u(0x3d63e2bc, 0xbc813de2),
65756// o.u(0x272c1d16, 0x1631271d), o.u(0x9a4176ad, 0xad379a76),
65757// o.u(0x4dad3bdb, 0xdb964d3b), o.u(0xfac85664, 0x649efa56),
65758// o.u(0xd2e84e74, 0x74a6d24e), o.u(0x22281e14, 0x1436221e),
65759// o.u(0x763fdb92, 0x92e476db), o.u(0x1e180a0c, 0x0c121e0a),
65760// o.u(0xb4906c48, 0x48fcb46c), o.u(0x376be4b8, 0xb88f37e4),
65761// o.u(0xe7255d9f, 0x9f78e75d), o.u(0xb2616ebd, 0xbd0fb26e),
65762// o.u(0x2a86ef43, 0x43692aef), o.u(0xf193a6c4, 0xc435f1a6),
65763// o.u(0xe372a839, 0x39dae3a8), o.u(0xf762a431, 0x31c6f7a4),
65764// o.u(0x59bd37d3, 0xd38a5937), o.u(0x86ff8bf2, 0xf274868b),
65765// o.u(0x56b132d5, 0xd5835632), o.u(0xc50d438b, 0x8b4ec543),
65766// o.u(0xebdc596e, 0x6e85eb59), o.u(0xc2afb7da, 0xda18c2b7),
65767// o.u(0x8f028c01, 0x018e8f8c), o.u(0xac7964b1, 0xb11dac64),
65768// o.u(0x6d23d29c, 0x9cf16dd2), o.u(0x3b92e049, 0x49723be0),
65769// o.u(0xc7abb4d8, 0xd81fc7b4), o.u(0x1543faac, 0xacb915fa),
65770// o.u(0x09fd07f3, 0xf3fa0907), o.u(0x6f8525cf, 0xcfa06f25),
65771// o.u(0xea8fafca, 0xca20eaaf), o.u(0x89f38ef4, 0xf47d898e),
65772// o.u(0x208ee947, 0x476720e9), o.u(0x28201810, 0x10382818),
65773// o.u(0x64ded56f, 0x6f0b64d5), o.u(0x83fb88f0, 0xf0738388),
65774// o.u(0xb1946f4a, 0x4afbb16f), o.u(0x96b8725c, 0x5cca9672),
65775// o.u(0x6c702438, 0x38546c24), o.u(0x08aef157, 0x575f08f1),
65776// o.u(0x52e6c773, 0x732152c7), o.u(0xf3355197, 0x9764f351),
65777// o.u(0x658d23cb, 0xcbae6523), o.u(0x84597ca1, 0xa125847c),
65778// o.u(0xbfcb9ce8, 0xe857bf9c), o.u(0x637c213e, 0x3e5d6321),
65779// o.u(0x7c37dd96, 0x96ea7cdd), o.u(0x7fc2dc61, 0x611e7fdc),
65780// o.u(0x911a860d, 0x0d9c9186), o.u(0x941e850f, 0x0f9b9485),
65781// o.u(0xabdb90e0, 0xe04bab90), o.u(0xc6f8427c, 0x7cbac642),
65782// o.u(0x57e2c471, 0x712657c4), o.u(0xe583aacc, 0xcc29e5aa),
65783// o.u(0x733bd890, 0x90e373d8), o.u(0x0f0c0506, 0x06090f05),
65784// o.u(0x03f501f7, 0xf7f40301), o.u(0x3638121c, 0x1c2a3612),
65785// o.u(0xfe9fa3c2, 0xc23cfea3), o.u(0xe1d45f6a, 0x6a8be15f),
65786// o.u(0x1047f9ae, 0xaebe10f9), o.u(0x6bd2d069, 0x69026bd0),
65787// o.u(0xa82e9117, 0x17bfa891), o.u(0xe8295899, 0x9971e858),
65788// o.u(0x6974273a, 0x3a536927), o.u(0xd04eb927, 0x27f7d0b9),
65789// o.u(0x48a938d9, 0xd9914838), o.u(0x35cd13eb, 0xebde3513),
65790// o.u(0xce56b32b, 0x2be5ceb3), o.u(0x55443322, 0x22775533),
65791// o.u(0xd6bfbbd2, 0xd204d6bb), o.u(0x904970a9, 0xa9399070),
65792// o.u(0x800e8907, 0x07878089), o.u(0xf266a733, 0x33c1f2a7),
65793// o.u(0xc15ab62d, 0x2decc1b6), o.u(0x6678223c, 0x3c5a6622),
65794// o.u(0xad2a9215, 0x15b8ad92), o.u(0x608920c9, 0xc9a96020),
65795// o.u(0xdb154987, 0x875cdb49), o.u(0x1a4fffaa, 0xaab01aff),
65796// o.u(0x88a07850, 0x50d88878), o.u(0x8e517aa5, 0xa52b8e7a),
65797// o.u(0x8a068f03, 0x03898a8f), o.u(0x13b2f859, 0x594a13f8),
65798// o.u(0x9b128009, 0x09929b80), o.u(0x3934171a, 0x1a233917),
65799// o.u(0x75cada65, 0x651075da), o.u(0x53b531d7, 0xd7845331),
65800// o.u(0x5113c684, 0x84d551c6), o.u(0xd3bbb8d0, 0xd003d3b8),
65801// o.u(0x5e1fc382, 0x82dc5ec3), o.u(0xcb52b029, 0x29e2cbb0),
65802// o.u(0x99b4775a, 0x5ac39977), o.u(0x333c111e, 0x1e2d3311),
65803// o.u(0x46f6cb7b, 0x7b3d46cb), o.u(0x1f4bfca8, 0xa8b71ffc),
65804// o.u(0x61dad66d, 0x6d0c61d6), o.u(0x4e583a2c, 0x2c624e3a)
65805// ];
65806
65807// var T5 = [
65808// o.u(0xa5f497a5, 0xc6c632f4), o.u(0x8497eb84, 0xf8f86f97),
65809// o.u(0x99b0c799, 0xeeee5eb0), o.u(0x8d8cf78d, 0xf6f67a8c),
65810// o.u(0xd17e50d, 0xffffe817), o.u(0xbddcb7bd, 0xd6d60adc),
65811// o.u(0xb1c8a7b1, 0xdede16c8), o.u(0x54fc3954, 0x91916dfc),
65812// o.u(0x50f0c050, 0x606090f0), o.u(0x3050403, 0x2020705),
65813// o.u(0xa9e087a9, 0xcece2ee0), o.u(0x7d87ac7d, 0x5656d187),
65814// o.u(0x192bd519, 0xe7e7cc2b), o.u(0x62a67162, 0xb5b513a6),
65815// o.u(0xe6319ae6, 0x4d4d7c31), o.u(0x9ab5c39a, 0xecec59b5),
65816// o.u(0x45cf0545, 0x8f8f40cf), o.u(0x9dbc3e9d, 0x1f1fa3bc),
65817// o.u(0x40c00940, 0x898949c0), o.u(0x8792ef87, 0xfafa6892),
65818// o.u(0x153fc515, 0xefefd03f), o.u(0xeb267feb, 0xb2b29426),
65819// o.u(0xc94007c9, 0x8e8ece40), o.u(0xb1ded0b, 0xfbfbe61d),
65820// o.u(0xec2f82ec, 0x41416e2f), o.u(0x67a97d67, 0xb3b31aa9),
65821// o.u(0xfd1cbefd, 0x5f5f431c), o.u(0xea258aea, 0x45456025),
65822// o.u(0xbfda46bf, 0x2323f9da), o.u(0xf702a6f7, 0x53535102),
65823// o.u(0x96a1d396, 0xe4e445a1), o.u(0x5bed2d5b, 0x9b9b76ed),
65824// o.u(0xc25deac2, 0x7575285d), o.u(0x1c24d91c, 0xe1e1c524),
65825// o.u(0xaee97aae, 0x3d3dd4e9), o.u(0x6abe986a, 0x4c4cf2be),
65826// o.u(0x5aeed85a, 0x6c6c82ee), o.u(0x41c3fc41, 0x7e7ebdc3),
65827// o.u(0x206f102, 0xf5f5f306), o.u(0x4fd11d4f, 0x838352d1),
65828// o.u(0x5ce4d05c, 0x68688ce4), o.u(0xf407a2f4, 0x51515607),
65829// o.u(0x345cb934, 0xd1d18d5c), o.u(0x818e908, 0xf9f9e118),
65830// o.u(0x93aedf93, 0xe2e24cae), o.u(0x73954d73, 0xabab3e95),
65831// o.u(0x53f5c453, 0x626297f5), o.u(0x3f41543f, 0x2a2a6b41),
65832// o.u(0xc14100c, 0x8081c14), o.u(0x52f63152, 0x959563f6),
65833// o.u(0x65af8c65, 0x4646e9af), o.u(0x5ee2215e, 0x9d9d7fe2),
65834// o.u(0x28786028, 0x30304878), o.u(0xa1f86ea1, 0x3737cff8),
65835// o.u(0xf11140f, 0xa0a1b11), o.u(0xb5c45eb5, 0x2f2febc4),
65836// o.u(0x91b1c09, 0xe0e151b), o.u(0x365a4836, 0x24247e5a),
65837// o.u(0x9bb6369b, 0x1b1badb6), o.u(0x3d47a53d, 0xdfdf9847),
65838// o.u(0x266a8126, 0xcdcda76a), o.u(0x69bb9c69, 0x4e4ef5bb),
65839// o.u(0xcd4cfecd, 0x7f7f334c), o.u(0x9fbacf9f, 0xeaea50ba),
65840// o.u(0x1b2d241b, 0x12123f2d), o.u(0x9eb93a9e, 0x1d1da4b9),
65841// o.u(0x749cb074, 0x5858c49c), o.u(0x2e72682e, 0x34344672),
65842// o.u(0x2d776c2d, 0x36364177), o.u(0xb2cda3b2, 0xdcdc11cd),
65843// o.u(0xee2973ee, 0xb4b49d29), o.u(0xfb16b6fb, 0x5b5b4d16),
65844// o.u(0xf60153f6, 0xa4a4a501), o.u(0x4dd7ec4d, 0x7676a1d7),
65845// o.u(0x61a37561, 0xb7b714a3), o.u(0xce49face, 0x7d7d3449),
65846// o.u(0x7b8da47b, 0x5252df8d), o.u(0x3e42a13e, 0xdddd9f42),
65847// o.u(0x7193bc71, 0x5e5ecd93), o.u(0x97a22697, 0x1313b1a2),
65848// o.u(0xf50457f5, 0xa6a6a204), o.u(0x68b86968, 0xb9b901b8),
65849// o.u(0x0, 0x0), o.u(0x2c74992c, 0xc1c1b574),
65850// o.u(0x60a08060, 0x4040e0a0), o.u(0x1f21dd1f, 0xe3e3c221),
65851// o.u(0xc843f2c8, 0x79793a43), o.u(0xed2c77ed, 0xb6b69a2c),
65852// o.u(0xbed9b3be, 0xd4d40dd9), o.u(0x46ca0146, 0x8d8d47ca),
65853// o.u(0xd970ced9, 0x67671770), o.u(0x4bdde44b, 0x7272afdd),
65854// o.u(0xde7933de, 0x9494ed79), o.u(0xd4672bd4, 0x9898ff67),
65855// o.u(0xe8237be8, 0xb0b09323), o.u(0x4ade114a, 0x85855bde),
65856// o.u(0x6bbd6d6b, 0xbbbb06bd), o.u(0x2a7e912a, 0xc5c5bb7e),
65857// o.u(0xe5349ee5, 0x4f4f7b34), o.u(0x163ac116, 0xededd73a),
65858// o.u(0xc55417c5, 0x8686d254), o.u(0xd7622fd7, 0x9a9af862),
65859// o.u(0x55ffcc55, 0x666699ff), o.u(0x94a72294, 0x1111b6a7),
65860// o.u(0xcf4a0fcf, 0x8a8ac04a), o.u(0x1030c910, 0xe9e9d930),
65861// o.u(0x60a0806, 0x4040e0a), o.u(0x8198e781, 0xfefe6698),
65862// o.u(0xf00b5bf0, 0xa0a0ab0b), o.u(0x44ccf044, 0x7878b4cc),
65863// o.u(0xbad54aba, 0x2525f0d5), o.u(0xe33e96e3, 0x4b4b753e),
65864// o.u(0xf30e5ff3, 0xa2a2ac0e), o.u(0xfe19bafe, 0x5d5d4419),
65865// o.u(0xc05b1bc0, 0x8080db5b), o.u(0x8a850a8a, 0x5058085),
65866// o.u(0xadec7ead, 0x3f3fd3ec), o.u(0xbcdf42bc, 0x2121fedf),
65867// o.u(0x48d8e048, 0x7070a8d8), o.u(0x40cf904, 0xf1f1fd0c),
65868// o.u(0xdf7ac6df, 0x6363197a), o.u(0xc158eec1, 0x77772f58),
65869// o.u(0x759f4575, 0xafaf309f), o.u(0x63a58463, 0x4242e7a5),
65870// o.u(0x30504030, 0x20207050), o.u(0x1a2ed11a, 0xe5e5cb2e),
65871// o.u(0xe12e10e, 0xfdfdef12), o.u(0x6db7656d, 0xbfbf08b7),
65872// o.u(0x4cd4194c, 0x818155d4), o.u(0x143c3014, 0x1818243c),
65873// o.u(0x355f4c35, 0x2626795f), o.u(0x2f719d2f, 0xc3c3b271),
65874// o.u(0xe13867e1, 0xbebe8638), o.u(0xa2fd6aa2, 0x3535c8fd),
65875// o.u(0xcc4f0bcc, 0x8888c74f), o.u(0x394b5c39, 0x2e2e654b),
65876// o.u(0x57f93d57, 0x93936af9), o.u(0xf20daaf2, 0x5555580d),
65877// o.u(0x829de382, 0xfcfc619d), o.u(0x47c9f447, 0x7a7ab3c9),
65878// o.u(0xacef8bac, 0xc8c827ef), o.u(0xe7326fe7, 0xbaba8832),
65879// o.u(0x2b7d642b, 0x32324f7d), o.u(0x95a4d795, 0xe6e642a4),
65880// o.u(0xa0fb9ba0, 0xc0c03bfb), o.u(0x98b33298, 0x1919aab3),
65881// o.u(0xd16827d1, 0x9e9ef668), o.u(0x7f815d7f, 0xa3a32281),
65882// o.u(0x66aa8866, 0x4444eeaa), o.u(0x7e82a87e, 0x5454d682),
65883// o.u(0xabe676ab, 0x3b3bdde6), o.u(0x839e1683, 0xb0b959e),
65884// o.u(0xca4503ca, 0x8c8cc945), o.u(0x297b9529, 0xc7c7bc7b),
65885// o.u(0xd36ed6d3, 0x6b6b056e), o.u(0x3c44503c, 0x28286c44),
65886// o.u(0x798b5579, 0xa7a72c8b), o.u(0xe23d63e2, 0xbcbc813d),
65887// o.u(0x1d272c1d, 0x16163127), o.u(0x769a4176, 0xadad379a),
65888// o.u(0x3b4dad3b, 0xdbdb964d), o.u(0x56fac856, 0x64649efa),
65889// o.u(0x4ed2e84e, 0x7474a6d2), o.u(0x1e22281e, 0x14143622),
65890// o.u(0xdb763fdb, 0x9292e476), o.u(0xa1e180a, 0xc0c121e),
65891// o.u(0x6cb4906c, 0x4848fcb4), o.u(0xe4376be4, 0xb8b88f37),
65892// o.u(0x5de7255d, 0x9f9f78e7), o.u(0x6eb2616e, 0xbdbd0fb2),
65893// o.u(0xef2a86ef, 0x4343692a), o.u(0xa6f193a6, 0xc4c435f1),
65894// o.u(0xa8e372a8, 0x3939dae3), o.u(0xa4f762a4, 0x3131c6f7),
65895// o.u(0x3759bd37, 0xd3d38a59), o.u(0x8b86ff8b, 0xf2f27486),
65896// o.u(0x3256b132, 0xd5d58356), o.u(0x43c50d43, 0x8b8b4ec5),
65897// o.u(0x59ebdc59, 0x6e6e85eb), o.u(0xb7c2afb7, 0xdada18c2),
65898// o.u(0x8c8f028c, 0x1018e8f), o.u(0x64ac7964, 0xb1b11dac),
65899// o.u(0xd26d23d2, 0x9c9cf16d), o.u(0xe03b92e0, 0x4949723b),
65900// o.u(0xb4c7abb4, 0xd8d81fc7), o.u(0xfa1543fa, 0xacacb915),
65901// o.u(0x709fd07, 0xf3f3fa09), o.u(0x256f8525, 0xcfcfa06f),
65902// o.u(0xafea8faf, 0xcaca20ea), o.u(0x8e89f38e, 0xf4f47d89),
65903// o.u(0xe9208ee9, 0x47476720), o.u(0x18282018, 0x10103828),
65904// o.u(0xd564ded5, 0x6f6f0b64), o.u(0x8883fb88, 0xf0f07383),
65905// o.u(0x6fb1946f, 0x4a4afbb1), o.u(0x7296b872, 0x5c5cca96),
65906// o.u(0x246c7024, 0x3838546c), o.u(0xf108aef1, 0x57575f08),
65907// o.u(0xc752e6c7, 0x73732152), o.u(0x51f33551, 0x979764f3),
65908// o.u(0x23658d23, 0xcbcbae65), o.u(0x7c84597c, 0xa1a12584),
65909// o.u(0x9cbfcb9c, 0xe8e857bf), o.u(0x21637c21, 0x3e3e5d63),
65910// o.u(0xdd7c37dd, 0x9696ea7c), o.u(0xdc7fc2dc, 0x61611e7f),
65911// o.u(0x86911a86, 0xd0d9c91), o.u(0x85941e85, 0xf0f9b94),
65912// o.u(0x90abdb90, 0xe0e04bab), o.u(0x42c6f842, 0x7c7cbac6),
65913// o.u(0xc457e2c4, 0x71712657), o.u(0xaae583aa, 0xcccc29e5),
65914// o.u(0xd8733bd8, 0x9090e373), o.u(0x50f0c05, 0x606090f),
65915// o.u(0x103f501, 0xf7f7f403), o.u(0x12363812, 0x1c1c2a36),
65916// o.u(0xa3fe9fa3, 0xc2c23cfe), o.u(0x5fe1d45f, 0x6a6a8be1),
65917// o.u(0xf91047f9, 0xaeaebe10), o.u(0xd06bd2d0, 0x6969026b),
65918// o.u(0x91a82e91, 0x1717bfa8), o.u(0x58e82958, 0x999971e8),
65919// o.u(0x27697427, 0x3a3a5369), o.u(0xb9d04eb9, 0x2727f7d0),
65920// o.u(0x3848a938, 0xd9d99148), o.u(0x1335cd13, 0xebebde35),
65921// o.u(0xb3ce56b3, 0x2b2be5ce), o.u(0x33554433, 0x22227755),
65922// o.u(0xbbd6bfbb, 0xd2d204d6), o.u(0x70904970, 0xa9a93990),
65923// o.u(0x89800e89, 0x7078780), o.u(0xa7f266a7, 0x3333c1f2),
65924// o.u(0xb6c15ab6, 0x2d2decc1), o.u(0x22667822, 0x3c3c5a66),
65925// o.u(0x92ad2a92, 0x1515b8ad), o.u(0x20608920, 0xc9c9a960),
65926// o.u(0x49db1549, 0x87875cdb), o.u(0xff1a4fff, 0xaaaab01a),
65927// o.u(0x7888a078, 0x5050d888), o.u(0x7a8e517a, 0xa5a52b8e),
65928// o.u(0x8f8a068f, 0x303898a), o.u(0xf813b2f8, 0x59594a13),
65929// o.u(0x809b1280, 0x909929b), o.u(0x17393417, 0x1a1a2339),
65930// o.u(0xda75cada, 0x65651075), o.u(0x3153b531, 0xd7d78453),
65931// o.u(0xc65113c6, 0x8484d551), o.u(0xb8d3bbb8, 0xd0d003d3),
65932// o.u(0xc35e1fc3, 0x8282dc5e), o.u(0xb0cb52b0, 0x2929e2cb),
65933// o.u(0x7799b477, 0x5a5ac399), o.u(0x11333c11, 0x1e1e2d33),
65934// o.u(0xcb46f6cb, 0x7b7b3d46), o.u(0xfc1f4bfc, 0xa8a8b71f),
65935// o.u(0xd661dad6, 0x6d6d0c61), o.u(0x3a4e583a, 0x2c2c624e)
65936// ];
65937
65938// var T6 = [
65939// o.u(0xf4a5f497, 0xa5c6c632), o.u(0x978497eb, 0x84f8f86f),
65940// o.u(0xb099b0c7, 0x99eeee5e), o.u(0x8c8d8cf7, 0x8df6f67a),
65941// o.u(0x170d17e5, 0xdffffe8), o.u(0xdcbddcb7, 0xbdd6d60a),
65942// o.u(0xc8b1c8a7, 0xb1dede16), o.u(0xfc54fc39, 0x5491916d),
65943// o.u(0xf050f0c0, 0x50606090), o.u(0x5030504, 0x3020207),
65944// o.u(0xe0a9e087, 0xa9cece2e), o.u(0x877d87ac, 0x7d5656d1),
65945// o.u(0x2b192bd5, 0x19e7e7cc), o.u(0xa662a671, 0x62b5b513),
65946// o.u(0x31e6319a, 0xe64d4d7c), o.u(0xb59ab5c3, 0x9aecec59),
65947// o.u(0xcf45cf05, 0x458f8f40), o.u(0xbc9dbc3e, 0x9d1f1fa3),
65948// o.u(0xc040c009, 0x40898949), o.u(0x928792ef, 0x87fafa68),
65949// o.u(0x3f153fc5, 0x15efefd0), o.u(0x26eb267f, 0xebb2b294),
65950// o.u(0x40c94007, 0xc98e8ece), o.u(0x1d0b1ded, 0xbfbfbe6),
65951// o.u(0x2fec2f82, 0xec41416e), o.u(0xa967a97d, 0x67b3b31a),
65952// o.u(0x1cfd1cbe, 0xfd5f5f43), o.u(0x25ea258a, 0xea454560),
65953// o.u(0xdabfda46, 0xbf2323f9), o.u(0x2f702a6, 0xf7535351),
65954// o.u(0xa196a1d3, 0x96e4e445), o.u(0xed5bed2d, 0x5b9b9b76),
65955// o.u(0x5dc25dea, 0xc2757528), o.u(0x241c24d9, 0x1ce1e1c5),
65956// o.u(0xe9aee97a, 0xae3d3dd4), o.u(0xbe6abe98, 0x6a4c4cf2),
65957// o.u(0xee5aeed8, 0x5a6c6c82), o.u(0xc341c3fc, 0x417e7ebd),
65958// o.u(0x60206f1, 0x2f5f5f3), o.u(0xd14fd11d, 0x4f838352),
65959// o.u(0xe45ce4d0, 0x5c68688c), o.u(0x7f407a2, 0xf4515156),
65960// o.u(0x5c345cb9, 0x34d1d18d), o.u(0x180818e9, 0x8f9f9e1),
65961// o.u(0xae93aedf, 0x93e2e24c), o.u(0x9573954d, 0x73abab3e),
65962// o.u(0xf553f5c4, 0x53626297), o.u(0x413f4154, 0x3f2a2a6b),
65963// o.u(0x140c1410, 0xc08081c), o.u(0xf652f631, 0x52959563),
65964// o.u(0xaf65af8c, 0x654646e9), o.u(0xe25ee221, 0x5e9d9d7f),
65965// o.u(0x78287860, 0x28303048), o.u(0xf8a1f86e, 0xa13737cf),
65966// o.u(0x110f1114, 0xf0a0a1b), o.u(0xc4b5c45e, 0xb52f2feb),
65967// o.u(0x1b091b1c, 0x90e0e15), o.u(0x5a365a48, 0x3624247e),
65968// o.u(0xb69bb636, 0x9b1b1bad), o.u(0x473d47a5, 0x3ddfdf98),
65969// o.u(0x6a266a81, 0x26cdcda7), o.u(0xbb69bb9c, 0x694e4ef5),
65970// o.u(0x4ccd4cfe, 0xcd7f7f33), o.u(0xba9fbacf, 0x9feaea50),
65971// o.u(0x2d1b2d24, 0x1b12123f), o.u(0xb99eb93a, 0x9e1d1da4),
65972// o.u(0x9c749cb0, 0x745858c4), o.u(0x722e7268, 0x2e343446),
65973// o.u(0x772d776c, 0x2d363641), o.u(0xcdb2cda3, 0xb2dcdc11),
65974// o.u(0x29ee2973, 0xeeb4b49d), o.u(0x16fb16b6, 0xfb5b5b4d),
65975// o.u(0x1f60153, 0xf6a4a4a5), o.u(0xd74dd7ec, 0x4d7676a1),
65976// o.u(0xa361a375, 0x61b7b714), o.u(0x49ce49fa, 0xce7d7d34),
65977// o.u(0x8d7b8da4, 0x7b5252df), o.u(0x423e42a1, 0x3edddd9f),
65978// o.u(0x937193bc, 0x715e5ecd), o.u(0xa297a226, 0x971313b1),
65979// o.u(0x4f50457, 0xf5a6a6a2), o.u(0xb868b869, 0x68b9b901),
65980// o.u(0x0, 0x0), o.u(0x742c7499, 0x2cc1c1b5),
65981// o.u(0xa060a080, 0x604040e0), o.u(0x211f21dd, 0x1fe3e3c2),
65982// o.u(0x43c843f2, 0xc879793a), o.u(0x2ced2c77, 0xedb6b69a),
65983// o.u(0xd9bed9b3, 0xbed4d40d), o.u(0xca46ca01, 0x468d8d47),
65984// o.u(0x70d970ce, 0xd9676717), o.u(0xdd4bdde4, 0x4b7272af),
65985// o.u(0x79de7933, 0xde9494ed), o.u(0x67d4672b, 0xd49898ff),
65986// o.u(0x23e8237b, 0xe8b0b093), o.u(0xde4ade11, 0x4a85855b),
65987// o.u(0xbd6bbd6d, 0x6bbbbb06), o.u(0x7e2a7e91, 0x2ac5c5bb),
65988// o.u(0x34e5349e, 0xe54f4f7b), o.u(0x3a163ac1, 0x16ededd7),
65989// o.u(0x54c55417, 0xc58686d2), o.u(0x62d7622f, 0xd79a9af8),
65990// o.u(0xff55ffcc, 0x55666699), o.u(0xa794a722, 0x941111b6),
65991// o.u(0x4acf4a0f, 0xcf8a8ac0), o.u(0x301030c9, 0x10e9e9d9),
65992// o.u(0xa060a08, 0x604040e), o.u(0x988198e7, 0x81fefe66),
65993// o.u(0xbf00b5b, 0xf0a0a0ab), o.u(0xcc44ccf0, 0x447878b4),
65994// o.u(0xd5bad54a, 0xba2525f0), o.u(0x3ee33e96, 0xe34b4b75),
65995// o.u(0xef30e5f, 0xf3a2a2ac), o.u(0x19fe19ba, 0xfe5d5d44),
65996// o.u(0x5bc05b1b, 0xc08080db), o.u(0x858a850a, 0x8a050580),
65997// o.u(0xecadec7e, 0xad3f3fd3), o.u(0xdfbcdf42, 0xbc2121fe),
65998// o.u(0xd848d8e0, 0x487070a8), o.u(0xc040cf9, 0x4f1f1fd),
65999// o.u(0x7adf7ac6, 0xdf636319), o.u(0x58c158ee, 0xc177772f),
66000// o.u(0x9f759f45, 0x75afaf30), o.u(0xa563a584, 0x634242e7),
66001// o.u(0x50305040, 0x30202070), o.u(0x2e1a2ed1, 0x1ae5e5cb),
66002// o.u(0x120e12e1, 0xefdfdef), o.u(0xb76db765, 0x6dbfbf08),
66003// o.u(0xd44cd419, 0x4c818155), o.u(0x3c143c30, 0x14181824),
66004// o.u(0x5f355f4c, 0x35262679), o.u(0x712f719d, 0x2fc3c3b2),
66005// o.u(0x38e13867, 0xe1bebe86), o.u(0xfda2fd6a, 0xa23535c8),
66006// o.u(0x4fcc4f0b, 0xcc8888c7), o.u(0x4b394b5c, 0x392e2e65),
66007// o.u(0xf957f93d, 0x5793936a), o.u(0xdf20daa, 0xf2555558),
66008// o.u(0x9d829de3, 0x82fcfc61), o.u(0xc947c9f4, 0x477a7ab3),
66009// o.u(0xefacef8b, 0xacc8c827), o.u(0x32e7326f, 0xe7baba88),
66010// o.u(0x7d2b7d64, 0x2b32324f), o.u(0xa495a4d7, 0x95e6e642),
66011// o.u(0xfba0fb9b, 0xa0c0c03b), o.u(0xb398b332, 0x981919aa),
66012// o.u(0x68d16827, 0xd19e9ef6), o.u(0x817f815d, 0x7fa3a322),
66013// o.u(0xaa66aa88, 0x664444ee), o.u(0x827e82a8, 0x7e5454d6),
66014// o.u(0xe6abe676, 0xab3b3bdd), o.u(0x9e839e16, 0x830b0b95),
66015// o.u(0x45ca4503, 0xca8c8cc9), o.u(0x7b297b95, 0x29c7c7bc),
66016// o.u(0x6ed36ed6, 0xd36b6b05), o.u(0x443c4450, 0x3c28286c),
66017// o.u(0x8b798b55, 0x79a7a72c), o.u(0x3de23d63, 0xe2bcbc81),
66018// o.u(0x271d272c, 0x1d161631), o.u(0x9a769a41, 0x76adad37),
66019// o.u(0x4d3b4dad, 0x3bdbdb96), o.u(0xfa56fac8, 0x5664649e),
66020// o.u(0xd24ed2e8, 0x4e7474a6), o.u(0x221e2228, 0x1e141436),
66021// o.u(0x76db763f, 0xdb9292e4), o.u(0x1e0a1e18, 0xa0c0c12),
66022// o.u(0xb46cb490, 0x6c4848fc), o.u(0x37e4376b, 0xe4b8b88f),
66023// o.u(0xe75de725, 0x5d9f9f78), o.u(0xb26eb261, 0x6ebdbd0f),
66024// o.u(0x2aef2a86, 0xef434369), o.u(0xf1a6f193, 0xa6c4c435),
66025// o.u(0xe3a8e372, 0xa83939da), o.u(0xf7a4f762, 0xa43131c6),
66026// o.u(0x593759bd, 0x37d3d38a), o.u(0x868b86ff, 0x8bf2f274),
66027// o.u(0x563256b1, 0x32d5d583), o.u(0xc543c50d, 0x438b8b4e),
66028// o.u(0xeb59ebdc, 0x596e6e85), o.u(0xc2b7c2af, 0xb7dada18),
66029// o.u(0x8f8c8f02, 0x8c01018e), o.u(0xac64ac79, 0x64b1b11d),
66030// o.u(0x6dd26d23, 0xd29c9cf1), o.u(0x3be03b92, 0xe0494972),
66031// o.u(0xc7b4c7ab, 0xb4d8d81f), o.u(0x15fa1543, 0xfaacacb9),
66032// o.u(0x90709fd, 0x7f3f3fa), o.u(0x6f256f85, 0x25cfcfa0),
66033// o.u(0xeaafea8f, 0xafcaca20), o.u(0x898e89f3, 0x8ef4f47d),
66034// o.u(0x20e9208e, 0xe9474767), o.u(0x28182820, 0x18101038),
66035// o.u(0x64d564de, 0xd56f6f0b), o.u(0x838883fb, 0x88f0f073),
66036// o.u(0xb16fb194, 0x6f4a4afb), o.u(0x967296b8, 0x725c5cca),
66037// o.u(0x6c246c70, 0x24383854), o.u(0x8f108ae, 0xf157575f),
66038// o.u(0x52c752e6, 0xc7737321), o.u(0xf351f335, 0x51979764),
66039// o.u(0x6523658d, 0x23cbcbae), o.u(0x847c8459, 0x7ca1a125),
66040// o.u(0xbf9cbfcb, 0x9ce8e857), o.u(0x6321637c, 0x213e3e5d),
66041// o.u(0x7cdd7c37, 0xdd9696ea), o.u(0x7fdc7fc2, 0xdc61611e),
66042// o.u(0x9186911a, 0x860d0d9c), o.u(0x9485941e, 0x850f0f9b),
66043// o.u(0xab90abdb, 0x90e0e04b), o.u(0xc642c6f8, 0x427c7cba),
66044// o.u(0x57c457e2, 0xc4717126), o.u(0xe5aae583, 0xaacccc29),
66045// o.u(0x73d8733b, 0xd89090e3), o.u(0xf050f0c, 0x5060609),
66046// o.u(0x30103f5, 0x1f7f7f4), o.u(0x36123638, 0x121c1c2a),
66047// o.u(0xfea3fe9f, 0xa3c2c23c), o.u(0xe15fe1d4, 0x5f6a6a8b),
66048// o.u(0x10f91047, 0xf9aeaebe), o.u(0x6bd06bd2, 0xd0696902),
66049// o.u(0xa891a82e, 0x911717bf), o.u(0xe858e829, 0x58999971),
66050// o.u(0x69276974, 0x273a3a53), o.u(0xd0b9d04e, 0xb92727f7),
66051// o.u(0x483848a9, 0x38d9d991), o.u(0x351335cd, 0x13ebebde),
66052// o.u(0xceb3ce56, 0xb32b2be5), o.u(0x55335544, 0x33222277),
66053// o.u(0xd6bbd6bf, 0xbbd2d204), o.u(0x90709049, 0x70a9a939),
66054// o.u(0x8089800e, 0x89070787), o.u(0xf2a7f266, 0xa73333c1),
66055// o.u(0xc1b6c15a, 0xb62d2dec), o.u(0x66226678, 0x223c3c5a),
66056// o.u(0xad92ad2a, 0x921515b8), o.u(0x60206089, 0x20c9c9a9),
66057// o.u(0xdb49db15, 0x4987875c), o.u(0x1aff1a4f, 0xffaaaab0),
66058// o.u(0x887888a0, 0x785050d8), o.u(0x8e7a8e51, 0x7aa5a52b),
66059// o.u(0x8a8f8a06, 0x8f030389), o.u(0x13f813b2, 0xf859594a),
66060// o.u(0x9b809b12, 0x80090992), o.u(0x39173934, 0x171a1a23),
66061// o.u(0x75da75ca, 0xda656510), o.u(0x533153b5, 0x31d7d784),
66062// o.u(0x51c65113, 0xc68484d5), o.u(0xd3b8d3bb, 0xb8d0d003),
66063// o.u(0x5ec35e1f, 0xc38282dc), o.u(0xcbb0cb52, 0xb02929e2),
66064// o.u(0x997799b4, 0x775a5ac3), o.u(0x3311333c, 0x111e1e2d),
66065// o.u(0x46cb46f6, 0xcb7b7b3d), o.u(0x1ffc1f4b, 0xfca8a8b7),
66066// o.u(0x61d661da, 0xd66d6d0c), o.u(0x4e3a4e58, 0x3a2c2c62)
66067// ];
66068
66069// var T7 = [
66070// o.u(0x32f4a5f4, 0x97a5c6c6), o.u(0x6f978497, 0xeb84f8f8),
66071// o.u(0x5eb099b0, 0xc799eeee), o.u(0x7a8c8d8c, 0xf78df6f6),
66072// o.u(0xe8170d17, 0xe50dffff), o.u(0xadcbddc, 0xb7bdd6d6),
66073// o.u(0x16c8b1c8, 0xa7b1dede), o.u(0x6dfc54fc, 0x39549191),
66074// o.u(0x90f050f0, 0xc0506060), o.u(0x7050305, 0x4030202),
66075// o.u(0x2ee0a9e0, 0x87a9cece), o.u(0xd1877d87, 0xac7d5656),
66076// o.u(0xcc2b192b, 0xd519e7e7), o.u(0x13a662a6, 0x7162b5b5),
66077// o.u(0x7c31e631, 0x9ae64d4d), o.u(0x59b59ab5, 0xc39aecec),
66078// o.u(0x40cf45cf, 0x5458f8f), o.u(0xa3bc9dbc, 0x3e9d1f1f),
66079// o.u(0x49c040c0, 0x9408989), o.u(0x68928792, 0xef87fafa),
66080// o.u(0xd03f153f, 0xc515efef), o.u(0x9426eb26, 0x7febb2b2),
66081// o.u(0xce40c940, 0x7c98e8e), o.u(0xe61d0b1d, 0xed0bfbfb),
66082// o.u(0x6e2fec2f, 0x82ec4141), o.u(0x1aa967a9, 0x7d67b3b3),
66083// o.u(0x431cfd1c, 0xbefd5f5f), o.u(0x6025ea25, 0x8aea4545),
66084// o.u(0xf9dabfda, 0x46bf2323), o.u(0x5102f702, 0xa6f75353),
66085// o.u(0x45a196a1, 0xd396e4e4), o.u(0x76ed5bed, 0x2d5b9b9b),
66086// o.u(0x285dc25d, 0xeac27575), o.u(0xc5241c24, 0xd91ce1e1),
66087// o.u(0xd4e9aee9, 0x7aae3d3d), o.u(0xf2be6abe, 0x986a4c4c),
66088// o.u(0x82ee5aee, 0xd85a6c6c), o.u(0xbdc341c3, 0xfc417e7e),
66089// o.u(0xf3060206, 0xf102f5f5), o.u(0x52d14fd1, 0x1d4f8383),
66090// o.u(0x8ce45ce4, 0xd05c6868), o.u(0x5607f407, 0xa2f45151),
66091// o.u(0x8d5c345c, 0xb934d1d1), o.u(0xe1180818, 0xe908f9f9),
66092// o.u(0x4cae93ae, 0xdf93e2e2), o.u(0x3e957395, 0x4d73abab),
66093// o.u(0x97f553f5, 0xc4536262), o.u(0x6b413f41, 0x543f2a2a),
66094// o.u(0x1c140c14, 0x100c0808), o.u(0x63f652f6, 0x31529595),
66095// o.u(0xe9af65af, 0x8c654646), o.u(0x7fe25ee2, 0x215e9d9d),
66096// o.u(0x48782878, 0x60283030), o.u(0xcff8a1f8, 0x6ea13737),
66097// o.u(0x1b110f11, 0x140f0a0a), o.u(0xebc4b5c4, 0x5eb52f2f),
66098// o.u(0x151b091b, 0x1c090e0e), o.u(0x7e5a365a, 0x48362424),
66099// o.u(0xadb69bb6, 0x369b1b1b), o.u(0x98473d47, 0xa53ddfdf),
66100// o.u(0xa76a266a, 0x8126cdcd), o.u(0xf5bb69bb, 0x9c694e4e),
66101// o.u(0x334ccd4c, 0xfecd7f7f), o.u(0x50ba9fba, 0xcf9feaea),
66102// o.u(0x3f2d1b2d, 0x241b1212), o.u(0xa4b99eb9, 0x3a9e1d1d),
66103// o.u(0xc49c749c, 0xb0745858), o.u(0x46722e72, 0x682e3434),
66104// o.u(0x41772d77, 0x6c2d3636), o.u(0x11cdb2cd, 0xa3b2dcdc),
66105// o.u(0x9d29ee29, 0x73eeb4b4), o.u(0x4d16fb16, 0xb6fb5b5b),
66106// o.u(0xa501f601, 0x53f6a4a4), o.u(0xa1d74dd7, 0xec4d7676),
66107// o.u(0x14a361a3, 0x7561b7b7), o.u(0x3449ce49, 0xface7d7d),
66108// o.u(0xdf8d7b8d, 0xa47b5252), o.u(0x9f423e42, 0xa13edddd),
66109// o.u(0xcd937193, 0xbc715e5e), o.u(0xb1a297a2, 0x26971313),
66110// o.u(0xa204f504, 0x57f5a6a6), o.u(0x1b868b8, 0x6968b9b9),
66111// o.u(0x0, 0x0), o.u(0xb5742c74, 0x992cc1c1),
66112// o.u(0xe0a060a0, 0x80604040), o.u(0xc2211f21, 0xdd1fe3e3),
66113// o.u(0x3a43c843, 0xf2c87979), o.u(0x9a2ced2c, 0x77edb6b6),
66114// o.u(0xdd9bed9, 0xb3bed4d4), o.u(0x47ca46ca, 0x1468d8d),
66115// o.u(0x1770d970, 0xced96767), o.u(0xafdd4bdd, 0xe44b7272),
66116// o.u(0xed79de79, 0x33de9494), o.u(0xff67d467, 0x2bd49898),
66117// o.u(0x9323e823, 0x7be8b0b0), o.u(0x5bde4ade, 0x114a8585),
66118// o.u(0x6bd6bbd, 0x6d6bbbbb), o.u(0xbb7e2a7e, 0x912ac5c5),
66119// o.u(0x7b34e534, 0x9ee54f4f), o.u(0xd73a163a, 0xc116eded),
66120// o.u(0xd254c554, 0x17c58686), o.u(0xf862d762, 0x2fd79a9a),
66121// o.u(0x99ff55ff, 0xcc556666), o.u(0xb6a794a7, 0x22941111),
66122// o.u(0xc04acf4a, 0xfcf8a8a), o.u(0xd9301030, 0xc910e9e9),
66123// o.u(0xe0a060a, 0x8060404), o.u(0x66988198, 0xe781fefe),
66124// o.u(0xab0bf00b, 0x5bf0a0a0), o.u(0xb4cc44cc, 0xf0447878),
66125// o.u(0xf0d5bad5, 0x4aba2525), o.u(0x753ee33e, 0x96e34b4b),
66126// o.u(0xac0ef30e, 0x5ff3a2a2), o.u(0x4419fe19, 0xbafe5d5d),
66127// o.u(0xdb5bc05b, 0x1bc08080), o.u(0x80858a85, 0xa8a0505),
66128// o.u(0xd3ecadec, 0x7ead3f3f), o.u(0xfedfbcdf, 0x42bc2121),
66129// o.u(0xa8d848d8, 0xe0487070), o.u(0xfd0c040c, 0xf904f1f1),
66130// o.u(0x197adf7a, 0xc6df6363), o.u(0x2f58c158, 0xeec17777),
66131// o.u(0x309f759f, 0x4575afaf), o.u(0xe7a563a5, 0x84634242),
66132// o.u(0x70503050, 0x40302020), o.u(0xcb2e1a2e, 0xd11ae5e5),
66133// o.u(0xef120e12, 0xe10efdfd), o.u(0x8b76db7, 0x656dbfbf),
66134// o.u(0x55d44cd4, 0x194c8181), o.u(0x243c143c, 0x30141818),
66135// o.u(0x795f355f, 0x4c352626), o.u(0xb2712f71, 0x9d2fc3c3),
66136// o.u(0x8638e138, 0x67e1bebe), o.u(0xc8fda2fd, 0x6aa23535),
66137// o.u(0xc74fcc4f, 0xbcc8888), o.u(0x654b394b, 0x5c392e2e),
66138// o.u(0x6af957f9, 0x3d579393), o.u(0x580df20d, 0xaaf25555),
66139// o.u(0x619d829d, 0xe382fcfc), o.u(0xb3c947c9, 0xf4477a7a),
66140// o.u(0x27efacef, 0x8bacc8c8), o.u(0x8832e732, 0x6fe7baba),
66141// o.u(0x4f7d2b7d, 0x642b3232), o.u(0x42a495a4, 0xd795e6e6),
66142// o.u(0x3bfba0fb, 0x9ba0c0c0), o.u(0xaab398b3, 0x32981919),
66143// o.u(0xf668d168, 0x27d19e9e), o.u(0x22817f81, 0x5d7fa3a3),
66144// o.u(0xeeaa66aa, 0x88664444), o.u(0xd6827e82, 0xa87e5454),
66145// o.u(0xdde6abe6, 0x76ab3b3b), o.u(0x959e839e, 0x16830b0b),
66146// o.u(0xc945ca45, 0x3ca8c8c), o.u(0xbc7b297b, 0x9529c7c7),
66147// o.u(0x56ed36e, 0xd6d36b6b), o.u(0x6c443c44, 0x503c2828),
66148// o.u(0x2c8b798b, 0x5579a7a7), o.u(0x813de23d, 0x63e2bcbc),
66149// o.u(0x31271d27, 0x2c1d1616), o.u(0x379a769a, 0x4176adad),
66150// o.u(0x964d3b4d, 0xad3bdbdb), o.u(0x9efa56fa, 0xc8566464),
66151// o.u(0xa6d24ed2, 0xe84e7474), o.u(0x36221e22, 0x281e1414),
66152// o.u(0xe476db76, 0x3fdb9292), o.u(0x121e0a1e, 0x180a0c0c),
66153// o.u(0xfcb46cb4, 0x906c4848), o.u(0x8f37e437, 0x6be4b8b8),
66154// o.u(0x78e75de7, 0x255d9f9f), o.u(0xfb26eb2, 0x616ebdbd),
66155// o.u(0x692aef2a, 0x86ef4343), o.u(0x35f1a6f1, 0x93a6c4c4),
66156// o.u(0xdae3a8e3, 0x72a83939), o.u(0xc6f7a4f7, 0x62a43131),
66157// o.u(0x8a593759, 0xbd37d3d3), o.u(0x74868b86, 0xff8bf2f2),
66158// o.u(0x83563256, 0xb132d5d5), o.u(0x4ec543c5, 0xd438b8b),
66159// o.u(0x85eb59eb, 0xdc596e6e), o.u(0x18c2b7c2, 0xafb7dada),
66160// o.u(0x8e8f8c8f, 0x28c0101), o.u(0x1dac64ac, 0x7964b1b1),
66161// o.u(0xf16dd26d, 0x23d29c9c), o.u(0x723be03b, 0x92e04949),
66162// o.u(0x1fc7b4c7, 0xabb4d8d8), o.u(0xb915fa15, 0x43faacac),
66163// o.u(0xfa090709, 0xfd07f3f3), o.u(0xa06f256f, 0x8525cfcf),
66164// o.u(0x20eaafea, 0x8fafcaca), o.u(0x7d898e89, 0xf38ef4f4),
66165// o.u(0x6720e920, 0x8ee94747), o.u(0x38281828, 0x20181010),
66166// o.u(0xb64d564, 0xded56f6f), o.u(0x73838883, 0xfb88f0f0),
66167// o.u(0xfbb16fb1, 0x946f4a4a), o.u(0xca967296, 0xb8725c5c),
66168// o.u(0x546c246c, 0x70243838), o.u(0x5f08f108, 0xaef15757),
66169// o.u(0x2152c752, 0xe6c77373), o.u(0x64f351f3, 0x35519797),
66170// o.u(0xae652365, 0x8d23cbcb), o.u(0x25847c84, 0x597ca1a1),
66171// o.u(0x57bf9cbf, 0xcb9ce8e8), o.u(0x5d632163, 0x7c213e3e),
66172// o.u(0xea7cdd7c, 0x37dd9696), o.u(0x1e7fdc7f, 0xc2dc6161),
66173// o.u(0x9c918691, 0x1a860d0d), o.u(0x9b948594, 0x1e850f0f),
66174// o.u(0x4bab90ab, 0xdb90e0e0), o.u(0xbac642c6, 0xf8427c7c),
66175// o.u(0x2657c457, 0xe2c47171), o.u(0x29e5aae5, 0x83aacccc),
66176// o.u(0xe373d873, 0x3bd89090), o.u(0x90f050f, 0xc050606),
66177// o.u(0xf4030103, 0xf501f7f7), o.u(0x2a361236, 0x38121c1c),
66178// o.u(0x3cfea3fe, 0x9fa3c2c2), o.u(0x8be15fe1, 0xd45f6a6a),
66179// o.u(0xbe10f910, 0x47f9aeae), o.u(0x26bd06b, 0xd2d06969),
66180// o.u(0xbfa891a8, 0x2e911717), o.u(0x71e858e8, 0x29589999),
66181// o.u(0x53692769, 0x74273a3a), o.u(0xf7d0b9d0, 0x4eb92727),
66182// o.u(0x91483848, 0xa938d9d9), o.u(0xde351335, 0xcd13ebeb),
66183// o.u(0xe5ceb3ce, 0x56b32b2b), o.u(0x77553355, 0x44332222),
66184// o.u(0x4d6bbd6, 0xbfbbd2d2), o.u(0x39907090, 0x4970a9a9),
66185// o.u(0x87808980, 0xe890707), o.u(0xc1f2a7f2, 0x66a73333),
66186// o.u(0xecc1b6c1, 0x5ab62d2d), o.u(0x5a662266, 0x78223c3c),
66187// o.u(0xb8ad92ad, 0x2a921515), o.u(0xa9602060, 0x8920c9c9),
66188// o.u(0x5cdb49db, 0x15498787), o.u(0xb01aff1a, 0x4fffaaaa),
66189// o.u(0xd8887888, 0xa0785050), o.u(0x2b8e7a8e, 0x517aa5a5),
66190// o.u(0x898a8f8a, 0x68f0303), o.u(0x4a13f813, 0xb2f85959),
66191// o.u(0x929b809b, 0x12800909), o.u(0x23391739, 0x34171a1a),
66192// o.u(0x1075da75, 0xcada6565), o.u(0x84533153, 0xb531d7d7),
66193// o.u(0xd551c651, 0x13c68484), o.u(0x3d3b8d3, 0xbbb8d0d0),
66194// o.u(0xdc5ec35e, 0x1fc38282), o.u(0xe2cbb0cb, 0x52b02929),
66195// o.u(0xc3997799, 0xb4775a5a), o.u(0x2d331133, 0x3c111e1e),
66196// o.u(0x3d46cb46, 0xf6cb7b7b), o.u(0xb71ffc1f, 0x4bfca8a8),
66197// o.u(0xc61d661, 0xdad66d6d), o.u(0x624e3a4e, 0x583a2c2c)
66198// ];
66199
66200var B64 = function(n, x) {
66201 if (n === 7) {
66202 return x.lo & 0xFF;
66203 }
66204 var bits = (7 - n) * 8;
66205 if (bits >= 32) { //faster than >= 32
66206 return (x.hi >>> (bits - 32)) & 0xFF;
66207 }
66208 else {
66209 var bitsOff32 = 32 - bits,
66210 toMoveDown = this.hi << bitsOff32 >>> bitsOff32;
66211 return (x.lo >>> bits | (toMoveDown << bitsOff32)) & 0xFF;
66212 }
66213}
66214
66215var j64 = [o.u(0, 0), o.u(0, 0x10), o.u(0, 0x20), o.u(0, 0x30), o.u(0, 0x40), o.u(0, 0x50), o.u(0, 0x60),
66216 o.u(0, 0x70), o.u(0, 0x80), o.u(0, 0x90), o.u(0, 0xA0), o.u(0, 0xB0), o.u(0, 0xC0),
66217 o.u(0, 0xD0), o.u(0, 0xE0), o.u(0, 0xF0)
66218];
66219
66220var nj64 = [o.u(0xFFFFFFFF, 0xFFFFFFFF), o.u(0xFFFFFFFF, 0xFFFFFFEF), o.u(0xFFFFFFFF, 0xFFFFFFDF), o.u(0xFFFFFFFF, 0xFFFFFFCF), o.u(0xFFFFFFFF, 0xFFFFFFBF), o.u(0xFFFFFFFF, 0xFFFFFFAF), o.u(0xFFFFFFFF, 0xFFFFFF9F),
66221 o.u(0xFFFFFFFF, 0xFFFFFF8F), o.u(0xFFFFFFFF, 0xFFFFFF7F), o.u(0xFFFFFFFF, 0xFFFFFF6F), o.u(0xFFFFFFFF, 0xFFFFFF5F), o.u(0xFFFFFFFF, 0xFFFFFF4F), o.u(0xFFFFFFFF, 0xFFFFFF3F),
66222 o.u(0xFFFFFFFF, 0xFFFFFF2F), o.u(0xFFFFFFFF, 0xFFFFFF1F), o.u(0xFFFFFFFF, 0xFFFFFF0F)
66223];
66224
66225var r64 = [o.u(0, 0), o.u(0, 1), o.u(0, 2), o.u(0, 3), o.u(0, 4), o.u(0, 5), o.u(0, 6), o.u(0, 7),
66226 o.u(0, 8), o.u(0, 9), o.u(0, 10), o.u(0, 11), o.u(0, 12), o.u(0, 13)
66227];
66228
66229var compress = function(int64buf, state) {
66230 var g = new Array(16);
66231 var m = new Array(16);
66232 for (var u = 0; u < 16; u++) {
66233 m[u] = int64buf[u];
66234 g[u] = m[u].xor(state[u]);
66235 }
66236 var t = new Array(16);
66237 for (var r = 0; r < 14; r++) {
66238 for (var i = 0; i < 16; i++) {
66239 g[i].setxor64(j64[i].plus(r64[r]).setShiftLeft(56));
66240 }
66241
66242 for (var u = 0; u < 16; u++) {
66243 t[u] = o.xor64(T0[B64(0, g[u])], T1[B64(1, g[(u + 1) & 0xF])], T2[B64(2, g[(u + 2) & 0xF])], T3[B64(3, g[(u + 3) & 0xF])], T4[B64(4, g[(u + 4) & 0xF])], T5[B64(5, g[(u + 5) & 0xF])], T6[B64(6, g[(u + 6) & 0xF])], T7[B64(7, g[(u + 11) & 0xF])]);
66244 }
66245 var temp = g;
66246 g = t;
66247 t = temp;
66248 }
66249 for (var r = 0; r < 14; r++) {
66250 for (var i = 0; i < 16; i++) {
66251 m[i].setxor64(r64[r], nj64[i]);
66252 }
66253 for (var u = 0; u < 16; u++) {
66254 t[u] = o.xor64(T0[B64(0, m[(u + 1) & 0xF])], T1[B64(1, m[(u + 3) & 0xF])], T2[B64(2, m[(u + 5) & 0xF])], T3[B64(3, m[(u + 11) & 0xF])], T4[B64(4, m[(u + 0) & 0xF])], T5[B64(5, m[(u + 2) & 0xF])], T6[B64(6, m[(u + 4) & 0xF])], T7[B64(7, m[(u + 6) & 0xF])]);
66255 }
66256 var temp = m;
66257 m = t;
66258 t = temp;
66259 }
66260 for (var u = 0; u < 16; u++) {
66261 state[u].setxor64(g[u], m[u]);
66262 }
66263}
66264
66265var final = function(state) {
66266 var g = new Array(16);
66267 o.bufferInsert64(g, 0, state, 16);
66268 var t = new Array(16);
66269 for (var r = 0; r < 14; r++) {
66270
66271 for (var i = 0; i < 16; i++) {
66272 g[i].setxor64(j64[i].plus(r64[r]).setShiftLeft(56));
66273 }
66274
66275 for (var u = 0; u < 16; u++) {
66276 t[u] = o.xor64(T0[B64(0, g[u])], T1[B64(1, g[(u + 1) & 0xF])], T2[B64(2, g[(u + 2) & 0xF])], T3[B64(3, g[(u + 3) & 0xF])], T4[B64(4, g[(u + 4) & 0xF])], T5[B64(5, g[(u + 5) & 0xF])], T6[B64(6, g[(u + 6) & 0xF])], T7[B64(7, g[(u + 11) & 0xF])]);
66277 }
66278 var temp = g;
66279 g = t;
66280 t = temp;
66281 }
66282 for (var u = 0; u < 16; u++)
66283 state[u].setxor64(g[u]);
66284}
66285
66286var groestl = function(ctx, data, len) {
66287 var buf, ptr;
66288 //create a local copy of states
66289 var V = new Array(16);
66290 buf = ctx.buffer;
66291 ptr = ctx.ptr;
66292 if (len < ctx.buffer.length - ptr) {
66293 o.bufferInsert(buf, ptr, data, data.length);
66294 ptr += data.length;
66295 ctx.ptr = ptr;
66296 return;
66297 }
66298 //perform a deep copy of current state
66299 o.bufferInsert(V, 0, ctx.state, 16);
66300 while (len > 0) {
66301 var clen = ctx.buffer.length - ptr;
66302 if (clen > len) clen = len;
66303 o.bufferInsert(buf, ptr, data, clen);
66304 ptr += clen;
66305 data = data.slice(clen);
66306 len -= clen;
66307 if (ptr === ctx.buffer.length) {
66308 var int64Buf = h.bytes2Int64Buffer(buf);
66309 compress(int64Buf, V);
66310 ctx.count.addOne();
66311 ptr = 0;
66312 }
66313 }
66314 ctx.state = V;
66315 ctx.ptr = ptr;
66316}
66317
66318var groestlClose = function(ctx) {
66319 var buf = ctx.buffer;
66320 var ptr = ctx.ptr;
66321 var pad = new Array(136);
66322 var len = buf.length;
66323 var padLen;
66324 var count;
66325 pad[0] = 0x80;
66326 if (ptr < 120) {
66327 padLen = 128 - ptr;
66328 count = ctx.count.plus(o.u(0, 1));
66329 }
66330 else {
66331 padLen = 256 - ptr;
66332 count = ctx.count.plus(o.u(0, 2));
66333 }
66334 o.bufferSet(pad, 1, 0, padLen - 9);
66335 h.bufferEncode64(pad, padLen - 8, count);
66336 groestl(ctx, pad, padLen);
66337 final(ctx.state);
66338 var out = new Array(16);
66339 for (var u = 0, v = 8; u < 8; u++, v++) {
66340 out[2 * u] = ctx.state[v].hi;
66341 out[2 * u + 1] = ctx.state[v].lo;
66342 }
66343 return out;
66344}
66345
66346module.exports = function(input, format, output) {
66347 var msg;
66348 if (format === 1) {
66349 msg = input;
66350 }
66351 else if (format === 2) {
66352 msg = h.int32Buffer2Bytes(input);
66353 }
66354 else {
66355 msg = h.string2bytes(input);
66356 }
66357 var ctx = {};
66358 ctx.state = new Array(16);
66359 for (var i = 0; i < 15; i++) {
66360 ctx.state[i] = new o.u64(0, 0);
66361 }
66362 ctx.state[15] = new o.u64(0, 512);
66363 ctx.ptr = 0;
66364 ctx.count = new o.u64(0,0);
66365 ctx.buffer = new Array(128);
66366 groestl(ctx, msg, msg.length);
66367 var r = groestlClose(ctx, 0, 0);
66368 var out;
66369 if (output === 2) {
66370 out = r;
66371 }
66372 else if (output === 1) {
66373 out = h.int32Buffer2Bytes(r)
66374 }
66375 else {
66376 out = h.int32ArrayToHexString(r)
66377 }
66378 return out;
66379}
66380},{"./helper":341,"./op":342}],341:[function(require,module,exports){
66381'use strict';
66382// String functions
66383
66384var op = require('./op.js');
66385
66386module.exports.int8ArrayToHexString = function toString(array) {
66387 var string = '';
66388
66389 for (var i = 0; i < array.length; i++) {
66390 if (array[i] < 16) {
66391 string += '0' + array[i].toString(16);
66392 }
66393 else {
66394 string += array[i].toString(16);
66395 }
66396 }
66397 return string;
66398}
66399
66400module.exports.int32ArrayToHexString = function toString(array) {
66401 var string = '';
66402 var len = array.length;
66403 for (var i = 0; i < len; i++) {
66404 var s = array[i];
66405 if (s < 0) {
66406 s = 0xFFFFFFFF + array[i] + 1;
66407 }
66408 var l = s.toString(16);
66409 var padding = 8;
66410 while (l.length < padding) {
66411 l = "0" + l;
66412 }
66413 string += l;
66414 }
66415 return string;
66416}
66417
66418module.exports.hex2string = function toString(s) {
66419 for (var c = [], len = s.length, i = 0; i < len; i += 2)
66420 c.push(String.fromCharCode(parseInt(s.substring(i, i + 2), 16)));
66421 return c.join('');
66422}
66423
66424module.exports.hex2bytes = function toString(s) {
66425 for (var c = [], len = s.length, i = 0; i < len; i += 2)
66426 c.push(parseInt(s.substring(i, i + 2), 16));
66427 return c;
66428}
66429/*
66430module.exports.string2hex = function toString(s) {
66431
66432 for (var p = [], len = s.length, i = 0; i < len; i++) {
66433 p.push((256 + s.charCodeAt(i)).toString(16).substring(1));
66434 }
66435 return p.join('');
66436}
66437*/
66438module.exports.string2bytes = function(s) {
66439 var len = s.length;
66440 var b = new Array(len);
66441 var i = 0;
66442 while (i < len) {
66443 b[i] = s.charCodeAt(i);
66444 i++;
66445 }
66446 return b;
66447}
66448/*
66449module.exports.bytes2Int16Buffer = function(b) {
66450 var len = b.length;
66451 var bufferLength = len ? (((len - 1) >>> 1) + 1) : 0;
66452 var buffer = new Array(bufferLength);
66453 var i = 0;
66454 var j = 0;
66455 while (i < len) {
66456 buffer[j] = (buffer[j] << 8) | b[i];
66457 i++;
66458 if (!(i % 2)) j++;
66459 }
66460 return buffer;
66461}
66462*/
66463
66464module.exports.bytes2Int32Buffer = function(b) {
66465 if (!b) return [];
66466 var len = b.length ? (((b.length - 1) >>> 2) + 1) : 0;
66467 var buffer = new Array(len);
66468 var j = 0;
66469 while (j < len) {
66470 buffer[j] = (b[j * 4] << 24) | (b[j * 4 + 1] << 16) | (b[j * 4 + 2] << 8) | b[j * 4 + 3];
66471 j++;
66472 }
66473 return buffer;
66474}
66475/*
66476module.exports.bytes2Int32BufferLeAligned = function(b) {
66477 var len = b.length;
66478 if (!len) return [];
66479 var len2 = len ? (((len - 1) >>> 2) + 1) : 0;
66480 var buffer = new Array(len);
66481 var j = 0;
66482 while (j < len2) {
66483 buffer[j] = (b[j * 4 + 3] << 24) | (b[j * 4 + 2] << 16) | (b[j * 4 + 1] << 8) | b[j * 4];
66484 j++;
66485 };
66486 return buffer;
66487}
66488*/
66489module.exports.bytes2Int64Buffer = function(b) {
66490 if (!b) return [];
66491 var len = b.length ? (((b.length - 1) >>> 3) + 1) : 0;
66492 var buffer = new Array(len);
66493 var j = 0;
66494 while (j < len) {
66495 buffer[j] = new op.u64((b[j * 8] << 24) | (b[j * 8 + 1] << 16) | (b[j * 8 + 2] << 8) | b[j * 8 + 3], (b[j * 8 + 4] << 24) | (b[j * 8 + 5] << 16) | (b[j * 8 + 6] << 8) | b[j * 8 + 7]);
66496 j++;
66497 }
66498 return buffer;
66499}
66500
66501module.exports.bytes2Int64BufferLeAligned = function(b) {
66502 if (!b) return [];
66503 var len = b.length ? ((( b.length - 1) >>> 3) + 1) : 0;
66504 var buffer = new Array(len);
66505 var j = 0;
66506 while (j < len) {
66507 buffer[j] = new op.u64((b[j * 8 + 7] << 24) | (b[j * 8 + 6] << 16) | (b[j * 8 + 5] << 8) | b[j * 8 + 4], (b[j * 8 + 3] << 24) | (b[j * 8 + 2] << 16) | (b[j * 8 + 1] << 8) | b[j * 8]);
66508 j++;
66509 }
66510 return buffer;
66511}
66512
66513module.exports.bufferEncode64leAligned = function(buffer, offset, uint64) {
66514 buffer[offset + 7] = uint64.hi >>> 24;
66515 buffer[offset + 6] = uint64.hi >>> 16 & 0xFF;
66516 buffer[offset + 5] = uint64.hi >>> 8 & 0xFF;
66517 buffer[offset + 4] = uint64.hi & 0xFF;
66518 buffer[offset + 3] = uint64.lo >>> 24;
66519 buffer[offset + 2] = uint64.lo >>> 16 & 0xFF;
66520 buffer[offset + 1] = uint64.lo >>> 8 & 0xFF;
66521 buffer[offset + 0] = uint64.lo & 0xFF;
66522}
66523
66524module.exports.bufferEncode64 = function(buffer, offset, uint64) {
66525 buffer[offset] = uint64.hi >>> 24;
66526 buffer[offset + 1] = uint64.hi >>> 16 & 0xFF;
66527 buffer[offset + 2] = uint64.hi >>> 8 & 0xFF;
66528 buffer[offset + 3] = uint64.hi & 0xFF;
66529 buffer[offset + 4] = uint64.lo >>> 24;
66530 buffer[offset + 5] = uint64.lo >>> 16 & 0xFF;
66531 buffer[offset + 6] = uint64.lo >>> 8 & 0xFF;
66532 buffer[offset + 7] = uint64.lo & 0xFF;
66533}
66534
66535module.exports.int32Buffer2Bytes = function(b) {
66536 var buffer = new Array(b.length);
66537 var len = b.length;
66538 var i = 0;
66539 while (i < len) {
66540 buffer[i * 4] = (b[i] & 0xFF000000) >>> 24;
66541 buffer[i * 4 + 1] = (b[i] & 0x00FF0000) >>> 16;
66542 buffer[i * 4 + 2] = (b[i] & 0x0000FF00) >>> 8;
66543 buffer[i * 4 + 3] = (b[i] & 0x000000FF);
66544 i++;
66545 }
66546 return buffer;
66547}
66548/*
66549module.exports.int64Buffer2Bytes = function(b) {
66550 var buffer = new Array(b.length);
66551 var i = 0;
66552 while (i < b.length) {
66553 buffer[i * 8] = (b[i].hi & 0xFF000000) >>> 24;
66554 buffer[i * 8 + 1] = (b[i].hi & 0x00FF0000) >>> 16;
66555 buffer[i * 8 + 2] = (b[i].hi & 0x0000FF00) >>> 8;
66556 buffer[i * 8 + 3] = (b[i].hi & 0x000000FF);
66557 buffer[i * 8 + 4] = (b[i].lo & 0xFF000000) >>> 24;
66558 buffer[i * 8 + 5] = (b[i].lo & 0x00FF0000) >>> 16;
66559 buffer[i * 8 + 6] = (b[i].lo & 0x0000FF00) >>> 8;
66560 buffer[i * 8 + 7] = (b[i].lo & 0x000000FF);
66561 i++;
66562 }
66563 return buffer;
66564}
66565*/
66566
66567module.exports.string2Int32Buffer = function(s) {
66568 return this.bytes2Int32Buffer(this.string2bytes(s));
66569}
66570
66571var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
66572
66573module.exports.b64Encode = function(input) {
66574 var output = "";
66575 var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
66576 var i = 0;
66577
66578 while (i < input.length) {
66579
66580 chr1 = input[i++];
66581 chr2 = input[i++];
66582 chr3 = input[i++];
66583
66584 enc1 = chr1 >> 2;
66585 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
66586 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
66587 enc4 = chr3 & 63;
66588
66589 if (isNaN(chr2)) {
66590 enc3 = enc4 = 64;
66591 }
66592 else if (isNaN(chr3)) {
66593 enc4 = 64;
66594 }
66595
66596 output +=
66597 keyStr.charAt(enc1) + keyStr.charAt(enc2) +
66598 keyStr.charAt(enc3) + keyStr.charAt(enc4);
66599 }
66600
66601 return output;
66602};
66603
66604module.exports.b64Decode = function(input) {
66605 var output = [];
66606 var chr1, chr2, chr3;
66607 var enc1, enc2, enc3, enc4;
66608 var i = 0;
66609
66610 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
66611
66612 while (i < input.length) {
66613
66614 enc1 = keyStr.indexOf(input.charAt(i++));
66615 enc2 = keyStr.indexOf(input.charAt(i++));
66616 enc3 = keyStr.indexOf(input.charAt(i++));
66617 enc4 = keyStr.indexOf(input.charAt(i++));
66618
66619 chr1 = (enc1 << 2) | (enc2 >> 4);
66620 chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
66621 chr3 = ((enc3 & 3) << 6) | enc4;
66622
66623 output.push(chr1);
66624
66625 if (enc3 != 64) {
66626 output.push(chr2);
66627 }
66628 if (enc4 != 64) {
66629 output.push(chr3);
66630 }
66631 }
66632 return output;
66633};
66634},{"./op.js":342}],342:[function(require,module,exports){
66635'use strict';
66636//the right shift is important, it has to do with 32 bit operations in javascript, it will make things faster
66637function u64(h, l) {
66638 this.hi = h >>> 0;
66639 this.lo = l >>> 0;
66640}
66641
66642u64.prototype.set = function(oWord) {
66643 this.lo = oWord.lo;
66644 this.hi = oWord.hi;
66645}
66646
66647u64.prototype.add = function(oWord) {
66648 var lowest, lowMid, highMid, highest; //four parts of the whole 64 bit number..
66649
66650 //need to add the respective parts from each number and the carry if on is present..
66651 lowest = (this.lo & 0XFFFF) + (oWord.lo & 0XFFFF);
66652 lowMid = (this.lo >>> 16) + (oWord.lo >>> 16) + (lowest >>> 16);
66653 highMid = (this.hi & 0XFFFF) + (oWord.hi & 0XFFFF) + (lowMid >>> 16);
66654 highest = (this.hi >>> 16) + (oWord.hi >>> 16) + (highMid >>> 16);
66655
66656 //now set the hgih and the low accordingly..
66657 this.lo = (lowMid << 16) | (lowest & 0XFFFF);
66658 this.hi = (highest << 16) | (highMid & 0XFFFF);
66659
66660 return this; //for chaining..
66661};
66662
66663u64.prototype.addOne = function() {
66664 if (this.lo === -1 || this.lo === 0xFFFFFFFF) {
66665 this.lo = 0;
66666 this.hi++;
66667 }
66668 else {
66669 this.lo++;
66670 }
66671}
66672
66673u64.prototype.plus = function(oWord) {
66674 var c = new u64(0, 0);
66675 var lowest, lowMid, highMid, highest; //four parts of the whole 64 bit number..
66676
66677 //need to add the respective parts from each number and the carry if on is present..
66678 lowest = (this.lo & 0XFFFF) + (oWord.lo & 0XFFFF);
66679 lowMid = (this.lo >>> 16) + (oWord.lo >>> 16) + (lowest >>> 16);
66680 highMid = (this.hi & 0XFFFF) + (oWord.hi & 0XFFFF) + (lowMid >>> 16);
66681 highest = (this.hi >>> 16) + (oWord.hi >>> 16) + (highMid >>> 16);
66682
66683 //now set the hgih and the low accordingly..
66684 c.lo = (lowMid << 16) | (lowest & 0XFFFF);
66685 c.hi = (highest << 16) | (highMid & 0XFFFF);
66686
66687 return c; //for chaining..
66688};
66689
66690u64.prototype.not = function() {
66691 return new u64(~this.hi, ~this.lo);
66692}
66693
66694u64.prototype.one = function() {
66695 return new u64(0x0, 0x1);
66696}
66697
66698u64.prototype.zero = function() {
66699 return new u64(0x0, 0x0);
66700}
66701
66702u64.prototype.neg = function() {
66703 return this.not().plus(this.one());
66704}
66705
66706u64.prototype.minus = function(oWord) {
66707 return this.plus(oWord.neg());
66708};
66709
66710u64.prototype.isZero = function() {
66711 return (this.lo === 0) && (this.hi === 0);
66712}
66713
66714function isLong(obj) {
66715 return (obj && obj["__isLong__"]) === true;
66716}
66717
66718function fromNumber(value) {
66719 if (isNaN(value) || !isFinite(value))
66720 return this.zero();
66721 var pow32 = (1 << 32);
66722 return new u64((value % pow32) | 0, (value / pow32) | 0);
66723}
66724
66725u64.prototype.multiply = function(multiplier) {
66726 if (this.isZero())
66727 return this.zero();
66728 if (!isLong(multiplier))
66729 multiplier = fromNumber(multiplier);
66730 if (multiplier.isZero())
66731 return this.zero();
66732
66733 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
66734 // We can skip products that would overflow.
66735
66736 var a48 = this.hi >>> 16;
66737 var a32 = this.hi & 0xFFFF;
66738 var a16 = this.lo >>> 16;
66739 var a00 = this.lo & 0xFFFF;
66740
66741 var b48 = multiplier.hi >>> 16;
66742 var b32 = multiplier.hi & 0xFFFF;
66743 var b16 = multiplier.lo >>> 16;
66744 var b00 = multiplier.lo & 0xFFFF;
66745
66746 var c48 = 0,
66747 c32 = 0,
66748 c16 = 0,
66749 c00 = 0;
66750 c00 += a00 * b00;
66751 c16 += c00 >>> 16;
66752 c00 &= 0xFFFF;
66753 c16 += a16 * b00;
66754 c32 += c16 >>> 16;
66755 c16 &= 0xFFFF;
66756 c16 += a00 * b16;
66757 c32 += c16 >>> 16;
66758 c16 &= 0xFFFF;
66759 c32 += a32 * b00;
66760 c48 += c32 >>> 16;
66761 c32 &= 0xFFFF;
66762 c32 += a16 * b16;
66763 c48 += c32 >>> 16;
66764 c32 &= 0xFFFF;
66765 c32 += a00 * b32;
66766 c48 += c32 >>> 16;
66767 c32 &= 0xFFFF;
66768 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
66769 c48 &= 0xFFFF;
66770 return new u64((c48 << 16) | c32, (c16 << 16) | c00);
66771};
66772
66773u64.prototype.shiftLeft = function(bits) {
66774 bits = bits % 64;
66775 var c = new u64(0, 0);
66776 if (bits === 0) {
66777 return this.clone();
66778 }
66779 else if (bits > 31) {
66780 c.lo = 0;
66781 c.hi = this.lo << (bits - 32);
66782 }
66783 else {
66784 var toMoveUp = this.lo >>> 32 - bits;
66785 c.lo = this.lo << bits;
66786 c.hi = (this.hi << bits) | toMoveUp;
66787 }
66788 return c; //for chaining..
66789};
66790
66791u64.prototype.setShiftLeft = function(bits) {
66792 if (bits === 0) {
66793 return this;
66794 }
66795 if (bits > 63) {
66796 bits = bits % 64;
66797 }
66798
66799 if (bits > 31) {
66800 this.hi = this.lo << (bits - 32);
66801 this.lo = 0;
66802 }
66803 else {
66804 var toMoveUp = this.lo >>> 32 - bits;
66805 this.lo <<= bits;
66806 this.hi = (this.hi << bits) | toMoveUp;
66807 }
66808 return this; //for chaining..
66809};
66810//Shifts this word by the given number of bits to the right (max 32)..
66811u64.prototype.shiftRight = function(bits) {
66812 bits = bits % 64;
66813 var c = new u64(0, 0);
66814 if (bits === 0) {
66815 return this.clone();
66816 }
66817 else if (bits >= 32) {
66818 c.hi = 0;
66819 c.lo = this.hi >>> (bits - 32);
66820 }
66821 else {
66822 var bitsOff32 = 32 - bits,
66823 toMoveDown = this.hi << bitsOff32 >>> bitsOff32;
66824 c.hi = this.hi >>> bits;
66825 c.lo = this.lo >>> bits | (toMoveDown << bitsOff32);
66826 }
66827 return c; //for chaining..
66828};
66829//Rotates the bits of this word round to the left (max 32)..
66830u64.prototype.rotateLeft = function(bits) {
66831 if (bits > 32) {
66832 return this.rotateRight(64 - bits);
66833 }
66834 var c = new u64(0, 0);
66835 if (bits === 0) {
66836 c.lo = this.lo >>> 0;
66837 c.hi = this.hi >>> 0;
66838 }
66839 else if (bits === 32) { //just switch high and low over in this case..
66840 c.lo = this.hi;
66841 c.hi = this.lo;
66842 }
66843 else {
66844 c.lo = (this.lo << bits) | (this.hi >>> (32 - bits));
66845 c.hi = (this.hi << bits) | (this.lo >>> (32 - bits));
66846 }
66847 return c; //for chaining..
66848};
66849
66850u64.prototype.setRotateLeft = function(bits) {
66851 if (bits > 32) {
66852 return this.setRotateRight(64 - bits);
66853 }
66854 var newHigh;
66855 if (bits === 0) {
66856 return this;
66857 }
66858 else if (bits === 32) { //just switch high and low over in this case..
66859 newHigh = this.lo;
66860 this.lo = this.hi;
66861 this.hi = newHigh;
66862 }
66863 else {
66864 newHigh = (this.hi << bits) | (this.lo >>> (32 - bits));
66865 this.lo = (this.lo << bits) | (this.hi >>> (32 - bits));
66866 this.hi = newHigh;
66867 }
66868 return this; //for chaining..
66869};
66870//Rotates the bits of this word round to the right (max 32)..
66871u64.prototype.rotateRight = function(bits) {
66872 if (bits > 32) {
66873 return this.rotateLeft(64 - bits);
66874 }
66875 var c = new u64(0, 0);
66876 if (bits === 0) {
66877 c.lo = this.lo >>> 0;
66878 c.hi = this.hi >>> 0;
66879 }
66880 else if (bits === 32) { //just switch high and low over in this case..
66881 c.lo = this.hi;
66882 c.hi = this.lo;
66883 }
66884 else {
66885 c.lo = (this.hi << (32 - bits)) | (this.lo >>> bits);
66886 c.hi = (this.lo << (32 - bits)) | (this.hi >>> bits);
66887 }
66888 return c; //for chaining..
66889};
66890u64.prototype.setFlip = function() {
66891 var newHigh;
66892 newHigh = this.lo;
66893 this.lo = this.hi;
66894 this.hi = newHigh;
66895 return this;
66896};
66897//Rotates the bits of this word round to the right (max 32)..
66898u64.prototype.setRotateRight = function(bits) {
66899 if (bits > 32) {
66900 return this.setRotateLeft(64 - bits);
66901 }
66902
66903 if (bits === 0) {
66904 return this;
66905 }
66906 else if (bits === 32) { //just switch high and low over in this case..
66907 var newHigh;
66908 newHigh = this.lo;
66909 this.lo = this.hi;
66910 this.hi = newHigh;
66911 }
66912 else {
66913 newHigh = (this.lo << (32 - bits)) | (this.hi >>> bits);
66914 this.lo = (this.hi << (32 - bits)) | (this.lo >>> bits);
66915 this.hi = newHigh;
66916 }
66917 return this; //for chaining..
66918};
66919//Xors this word with the given other..
66920u64.prototype.xor = function(oWord) {
66921 var c = new u64(0, 0);
66922 c.hi = this.hi ^ oWord.hi;
66923 c.lo = this.lo ^ oWord.lo;
66924 return c; //for chaining..
66925};
66926//Xors this word with the given other..
66927u64.prototype.setxorOne = function(oWord) {
66928 this.hi ^= oWord.hi;
66929 this.lo ^= oWord.lo;
66930 return this; //for chaining..
66931};
66932//Ands this word with the given other..
66933u64.prototype.and = function(oWord) {
66934 var c = new u64(0, 0);
66935 c.hi = this.hi & oWord.hi;
66936 c.lo = this.lo & oWord.lo;
66937 return c; //for chaining..
66938};
66939
66940//Creates a deep copy of this Word..
66941u64.prototype.clone = function() {
66942 return new u64(this.hi, this.lo);
66943};
66944
66945u64.prototype.setxor64 = function() {
66946 var a = arguments;
66947 var i = a.length;
66948 while (i--) {
66949 this.hi ^= a[i].hi;
66950 this.lo ^= a[i].lo;
66951 }
66952 return this;
66953}
66954
66955module.exports.u64 = u64;
66956
66957module.exports.u = function(h, l) {
66958 return new u64(h, l);
66959}
66960/*
66961module.exports.add64 = function(a, b) {
66962 var lowest, lowMid, highMid, highest; //four parts of the whole 64 bit number..
66963
66964 //need to add the respective parts from each number and the carry if on is present..
66965 lowest = (a.lo & 0XFFFF) + (b.lo & 0XFFFF);
66966 lowMid = (a.lo >>> 16) + (b.lo >>> 16) + (lowest >>> 16);
66967 highMid = (a.hi & 0XFFFF) + (b.hi & 0XFFFF) + (lowMid >>> 16);
66968 highest = (a.hi >>> 16) + (b.hi >>> 16) + (highMid >>> 16);
66969
66970 var r = new this.u64((highest << 16) | (highMid & 0XFFFF), (lowMid << 16) | (lowest & 0XFFFF));
66971
66972 return r;
66973};
66974*/
66975module.exports.xor64 = function() {
66976 var a = arguments,
66977 h = a[0].hi,
66978 l = a[0].lo;
66979 var i = a.length-1;
66980 do {
66981 h ^= a[i].hi;
66982 l ^= a[i].lo;
66983 i--;
66984 } while (i>0);
66985 return new this.u64(h, l);
66986}
66987
66988module.exports.clone64Array = function(array) {
66989 var i = 0;
66990 var len = array.length;
66991 var a = new Array(len);
66992 while(i<len) {
66993 a[i] = array[i];
66994 i++;
66995 }
66996 return a;
66997}
66998
66999//this shouldn't be a problem, but who knows in the future javascript might support 64bits
67000module.exports.t32 = function(x) {
67001 return (x & 0xFFFFFFFF)
67002}
67003
67004module.exports.rotl32 = function(x, c) {
67005 return (((x) << (c)) | ((x) >>> (32 - (c)))) & (0xFFFFFFFF);
67006}
67007
67008module.exports.rotr32 = function(x, c) {
67009 return this.rotl32(x, (32 - (c)));
67010}
67011
67012module.exports.swap32 = function(val) {
67013 return ((val & 0xFF) << 24) |
67014 ((val & 0xFF00) << 8) |
67015 ((val >>> 8) & 0xFF00) |
67016 ((val >>> 24) & 0xFF);
67017}
67018
67019module.exports.swap32Array = function(a) {
67020 //can't do this with map because of support for IE8 (Don't hate me plz).
67021 var i = 0, len = a.length;
67022 var r = new Array(i);
67023 while (i<len) {
67024 r[i] = (this.swap32(a[i]));
67025 i++;
67026 }
67027 return r;
67028}
67029
67030module.exports.xnd64 = function(x, y, z) {
67031 return new this.u64(x.hi ^ ((~y.hi) & z.hi), x.lo ^ ((~y.lo) & z.lo));
67032}
67033/*
67034module.exports.load64 = function(x, i) {
67035 var l = x[i] | (x[i + 1] << 8) | (x[i + 2] << 16) | (x[i + 3] << 24);
67036 var h = x[i + 4] | (x[i + 5] << 8) | (x[i + 6] << 16) | (x[i + 7] << 24);
67037 return new this.u64(h, l);
67038}
67039*/
67040module.exports.bufferInsert = function(buffer, bufferOffset, data, len, dataOffset) {
67041 dataOffset = dataOffset | 0;
67042 var i = 0;
67043 while (i < len) {
67044 buffer[i + bufferOffset] = data[i + dataOffset];
67045 i++;
67046 }
67047}
67048
67049module.exports.bufferInsert64 = function(buffer, bufferOffset, data, len) {
67050 var i = 0;
67051 while (i < len) {
67052 buffer[i + bufferOffset] = data[i].clone();
67053 i++;
67054 }
67055}
67056/*
67057module.exports.buffer2Insert = function(buffer, bufferOffset, bufferOffset2, data, len, len2) {
67058 while (len--) {
67059 var j = len2;
67060 while (j--) {
67061 buffer[len + bufferOffset][j + bufferOffset2] = data[len][j];
67062 }
67063 }
67064}
67065*/
67066module.exports.bufferInsertBackwards = function(buffer, bufferOffset, data, len) {
67067 var i = 0;
67068 while (i < len) {
67069 buffer[i + bufferOffset] = data[len - 1 - i];
67070 i++;
67071 }
67072}
67073
67074module.exports.bufferSet = function(buffer, bufferOffset, value, len) {
67075 var i = 0;
67076 while (i < len) {
67077 buffer[i + bufferOffset] = value;
67078 i++;
67079 }
67080}
67081
67082module.exports.bufferXORInsert = function(buffer, bufferOffset, data, dataOffset, len) {
67083 var i = 0;
67084 while (i < len) {
67085 buffer[i + bufferOffset] ^= data[i + dataOffset];
67086 i++;
67087 }
67088}
67089
67090module.exports.xORTable = function(d, s1, s2, len) {
67091 var i = 0;
67092 while (i < len) {
67093 d[i] = s1[i] ^ s2[i];
67094 i++
67095 }
67096}
67097
67098},{}],343:[function(require,module,exports){
67099var Buffer = require('safe-buffer').Buffer
67100var bech32 = require('bech32')
67101var bs58grscheck = require('bs58grscheck')
67102var bscript = require('./script')
67103var btemplates = require('./templates')
67104var networks = require('./networks')
67105var typeforce = require('typeforce')
67106var types = require('./types')
67107
67108function fromBase58GrsCheck (address) {
67109 var payload = bs58grscheck.decode(address)
67110
67111 // TODO: 4.0.0, move to "toOutputScript"
67112 if (payload.length < 21) throw new TypeError(address + ' is too short')
67113 if (payload.length > 21) throw new TypeError(address + ' is too long')
67114
67115 var version = payload.readUInt8(0)
67116 var hash = payload.slice(1)
67117
67118 return { version: version, hash: hash }
67119}
67120
67121function fromBech32 (address) {
67122 var result = bech32.decode(address)
67123 var data = bech32.fromWords(result.words.slice(1))
67124
67125 return {
67126 version: result.words[0],
67127 prefix: result.prefix,
67128 data: Buffer.from(data)
67129 }
67130}
67131
67132function toBase58GrsCheck (hash, version) {
67133 typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments)
67134
67135 var payload = Buffer.allocUnsafe(21)
67136 payload.writeUInt8(version, 0)
67137 hash.copy(payload, 1)
67138
67139 return bs58grscheck.encode(payload)
67140}
67141
67142function toBech32 (data, version, prefix) {
67143 var words = bech32.toWords(data)
67144 words.unshift(version)
67145
67146 return bech32.encode(prefix, words)
67147}
67148
67149function fromOutputScript (outputScript, network) {
67150 network = network || networks.bitcoin
67151
67152 if (btemplates.pubKeyHash.output.check(outputScript)) return toBase58GrsCheck(bscript.compile(outputScript).slice(3, 23), network.pubKeyHash)
67153 if (btemplates.scriptHash.output.check(outputScript)) return toBase58GrsCheck(bscript.compile(outputScript).slice(2, 22), network.scriptHash)
67154 if (btemplates.witnessPubKeyHash.output.check(outputScript)) return toBech32(bscript.compile(outputScript).slice(2, 22), 0, network.bech32)
67155 if (btemplates.witnessScriptHash.output.check(outputScript)) return toBech32(bscript.compile(outputScript).slice(2, 34), 0, network.bech32)
67156
67157 throw new Error(bscript.toASM(outputScript) + ' has no matching Address')
67158}
67159
67160function toOutputScript (address, network) {
67161 network = network || networks.bitcoin
67162
67163 var decode
67164 try {
67165 decode = fromBase58GrsCheck(address)
67166 } catch (e) {}
67167
67168 if (decode) {
67169 if (decode.version === network.pubKeyHash) return btemplates.pubKeyHash.output.encode(decode.hash)
67170 if (decode.version === network.scriptHash) return btemplates.scriptHash.output.encode(decode.hash)
67171 } else {
67172 try {
67173 decode = fromBech32(address)
67174 } catch (e) {}
67175
67176 if (decode) {
67177 if (decode.prefix !== network.bech32) throw new Error(address + ' has an invalid prefix')
67178 if (decode.version === 0) {
67179 if (decode.data.length === 20) return btemplates.witnessPubKeyHash.output.encode(decode.data)
67180 if (decode.data.length === 32) return btemplates.witnessScriptHash.output.encode(decode.data)
67181 }
67182 }
67183 }
67184
67185 throw new Error(address + ' has no matching Script')
67186}
67187
67188module.exports = {
67189 fromBase58GrsCheck: fromBase58GrsCheck,
67190 fromBech32: fromBech32,
67191 fromOutputScript: fromOutputScript,
67192 toBase58GrsCheck: toBase58GrsCheck,
67193 toBech32: toBech32,
67194 toOutputScript: toOutputScript
67195}
67196
67197},{"./networks":352,"./script":353,"./templates":355,"./types":379,"bech32":59,"bs58grscheck":142,"safe-buffer":742,"typeforce":816}],344:[function(require,module,exports){
67198var Buffer = require('safe-buffer').Buffer
67199var bcrypto = require('./crypto')
67200var fastMerkleRoot = require('merkle-lib/fastRoot')
67201var typeforce = require('typeforce')
67202var types = require('./types')
67203var varuint = require('varuint-bitcoin')
67204
67205var Transaction = require('./transaction')
67206
67207function Block () {
67208 this.version = 1
67209 this.prevHash = null
67210 this.merkleRoot = null
67211 this.timestamp = 0
67212 this.bits = 0
67213 this.nonce = 0
67214}
67215
67216Block.fromBuffer = function (buffer) {
67217 if (buffer.length < 80) throw new Error('Buffer too small (< 80 bytes)')
67218
67219 var offset = 0
67220 function readSlice (n) {
67221 offset += n
67222 return buffer.slice(offset - n, offset)
67223 }
67224
67225 function readUInt32 () {
67226 var i = buffer.readUInt32LE(offset)
67227 offset += 4
67228 return i
67229 }
67230
67231 function readInt32 () {
67232 var i = buffer.readInt32LE(offset)
67233 offset += 4
67234 return i
67235 }
67236
67237 var block = new Block()
67238 block.version = readInt32()
67239 block.prevHash = readSlice(32)
67240 block.merkleRoot = readSlice(32)
67241 block.timestamp = readUInt32()
67242 block.bits = readUInt32()
67243 block.nonce = readUInt32()
67244
67245 if (buffer.length === 80) return block
67246
67247 function readVarInt () {
67248 var vi = varuint.decode(buffer, offset)
67249 offset += varuint.decode.bytes
67250 return vi
67251 }
67252
67253 function readTransaction () {
67254 var tx = Transaction.fromBuffer(buffer.slice(offset), true)
67255 offset += tx.byteLength()
67256 return tx
67257 }
67258
67259 var nTransactions = readVarInt()
67260 block.transactions = []
67261
67262 for (var i = 0; i < nTransactions; ++i) {
67263 var tx = readTransaction()
67264 block.transactions.push(tx)
67265 }
67266
67267 return block
67268}
67269
67270Block.prototype.byteLength = function (headersOnly) {
67271 if (headersOnly || !this.transactions) return 80
67272
67273 return 80 + varuint.encodingLength(this.transactions.length) + this.transactions.reduce(function (a, x) {
67274 return a + x.byteLength()
67275 }, 0)
67276}
67277
67278Block.fromHex = function (hex) {
67279 return Block.fromBuffer(Buffer.from(hex, 'hex'))
67280}
67281
67282Block.prototype.getHash = function () {
67283 return bcrypto.groestl(this.toBuffer(true))
67284}
67285
67286Block.prototype.getId = function () {
67287 return this.getHash().reverse().toString('hex')
67288}
67289
67290Block.prototype.getUTCDate = function () {
67291 var date = new Date(0) // epoch
67292 date.setUTCSeconds(this.timestamp)
67293
67294 return date
67295}
67296
67297// TODO: buffer, offset compatibility
67298Block.prototype.toBuffer = function (headersOnly) {
67299 var buffer = Buffer.allocUnsafe(this.byteLength(headersOnly))
67300
67301 var offset = 0
67302 function writeSlice (slice) {
67303 slice.copy(buffer, offset)
67304 offset += slice.length
67305 }
67306
67307 function writeInt32 (i) {
67308 buffer.writeInt32LE(i, offset)
67309 offset += 4
67310 }
67311 function writeUInt32 (i) {
67312 buffer.writeUInt32LE(i, offset)
67313 offset += 4
67314 }
67315
67316 writeInt32(this.version)
67317 writeSlice(this.prevHash)
67318 writeSlice(this.merkleRoot)
67319 writeUInt32(this.timestamp)
67320 writeUInt32(this.bits)
67321 writeUInt32(this.nonce)
67322
67323 if (headersOnly || !this.transactions) return buffer
67324
67325 varuint.encode(this.transactions.length, buffer, offset)
67326 offset += varuint.encode.bytes
67327
67328 this.transactions.forEach(function (tx) {
67329 var txSize = tx.byteLength() // TODO: extract from toBuffer?
67330 tx.toBuffer(buffer, offset)
67331 offset += txSize
67332 })
67333
67334 return buffer
67335}
67336
67337Block.prototype.toHex = function (headersOnly) {
67338 return this.toBuffer(headersOnly).toString('hex')
67339}
67340
67341Block.calculateTarget = function (bits) {
67342 var exponent = ((bits & 0xff000000) >> 24) - 3
67343 var mantissa = bits & 0x007fffff
67344 var target = Buffer.alloc(32, 0)
67345 target.writeUInt32BE(mantissa, 28 - exponent)
67346 return target
67347}
67348
67349Block.calculateMerkleRoot = function (transactions) {
67350 typeforce([{ getHash: types.Function }], transactions)
67351 if (transactions.length === 0) throw TypeError('Cannot compute merkle root for zero transactions')
67352
67353 var hashes = transactions.map(function (transaction) {
67354 return transaction.getHash()
67355 })
67356
67357 return fastMerkleRoot(hashes, bcrypto.hash256)
67358}
67359
67360Block.prototype.checkMerkleRoot = function () {
67361 if (!this.transactions) return false
67362
67363 var actualMerkleRoot = Block.calculateMerkleRoot(this.transactions)
67364 return this.merkleRoot.compare(actualMerkleRoot) === 0
67365}
67366
67367Block.prototype.checkProofOfWork = function () {
67368 var hash = this.getHash().reverse()
67369 var target = Block.calculateTarget(this.bits)
67370
67371 return hash.compare(target) <= 0
67372}
67373
67374module.exports = Block
67375
67376},{"./crypto":346,"./transaction":377,"./types":379,"merkle-lib/fastRoot":638,"safe-buffer":742,"typeforce":816,"varuint-bitcoin":830}],345:[function(require,module,exports){
67377arguments[4][73][0].apply(exports,arguments)
67378},{"dup":73,"pushdata-bitcoin":720,"varuint-bitcoin":830}],346:[function(require,module,exports){
67379(function (Buffer){
67380var createHash = require('create-hash')
67381var groestlhash = require('groestl-hash-js')
67382
67383function ripemd160 (buffer) {
67384 return createHash('rmd160').update(buffer).digest()
67385}
67386
67387function sha1 (buffer) {
67388 return createHash('sha1').update(buffer).digest()
67389}
67390
67391function sha256 (buffer) {
67392 return createHash('sha256').update(buffer).digest()
67393}
67394
67395function hash160 (buffer) {
67396 return ripemd160(sha256(buffer))
67397}
67398
67399function hash256 (buffer) {
67400 return sha256(sha256(buffer))
67401}
67402
67403function groestl (buffer) {
67404 return Buffer(groestlhash.groestl_2(buffer, 1, 1))
67405}
67406
67407module.exports = {
67408 hash160: hash160,
67409 hash256: hash256,
67410 ripemd160: ripemd160,
67411 sha1: sha1,
67412 sha256: sha256,
67413 groestl: groestl
67414}
67415
67416}).call(this,require("buffer").Buffer)
67417},{"buffer":146,"create-hash":239,"groestl-hash-js":339}],347:[function(require,module,exports){
67418arguments[4][75][0].apply(exports,arguments)
67419},{"./ecsignature":349,"./types":379,"bigi":63,"create-hmac":241,"dup":75,"ecurve":257,"safe-buffer":742,"typeforce":816}],348:[function(require,module,exports){
67420var baddress = require('./address')
67421var bcrypto = require('./crypto')
67422var ecdsa = require('./ecdsa')
67423var randomBytes = require('randombytes')
67424var typeforce = require('typeforce')
67425var types = require('./types')
67426var wif = require('wifgrs')
67427
67428var NETWORKS = require('./networks')
67429var BigInteger = require('bigi')
67430
67431var ecurve = require('ecurve')
67432var secp256k1 = ecdsa.__curve
67433
67434function ECPair (d, Q, options) {
67435 if (options) {
67436 typeforce({
67437 compressed: types.maybe(types.Boolean),
67438 network: types.maybe(types.Network)
67439 }, options)
67440 }
67441
67442 options = options || {}
67443
67444 if (d) {
67445 if (d.signum() <= 0) throw new Error('Private key must be greater than 0')
67446 if (d.compareTo(secp256k1.n) >= 0) throw new Error('Private key must be less than the curve order')
67447 if (Q) throw new TypeError('Unexpected publicKey parameter')
67448
67449 this.d = d
67450 } else {
67451 typeforce(types.ECPoint, Q)
67452
67453 this.__Q = Q
67454 }
67455
67456 this.compressed = options.compressed === undefined ? true : options.compressed
67457 this.network = options.network || NETWORKS.bitcoin
67458}
67459
67460Object.defineProperty(ECPair.prototype, 'Q', {
67461 get: function () {
67462 if (!this.__Q && this.d) {
67463 this.__Q = secp256k1.G.multiply(this.d)
67464 }
67465
67466 return this.__Q
67467 }
67468})
67469
67470ECPair.fromPublicKeyBuffer = function (buffer, network) {
67471 var Q = ecurve.Point.decodeFrom(secp256k1, buffer)
67472
67473 return new ECPair(null, Q, {
67474 compressed: Q.compressed,
67475 network: network
67476 })
67477}
67478
67479ECPair.fromWIF = function (string, network) {
67480 var decoded = wif.decode(string)
67481 var version = decoded.version
67482
67483 // list of networks?
67484 if (types.Array(network)) {
67485 network = network.filter(function (x) {
67486 return version === x.wif
67487 }).pop()
67488
67489 if (!network) throw new Error('Unknown network version')
67490
67491 // otherwise, assume a network object (or default to bitcoin)
67492 } else {
67493 network = network || NETWORKS.bitcoin
67494
67495 if (version !== network.wif) throw new Error('Invalid network version')
67496 }
67497
67498 var d = BigInteger.fromBuffer(decoded.privateKey)
67499
67500 return new ECPair(d, null, {
67501 compressed: decoded.compressed,
67502 network: network
67503 })
67504}
67505
67506ECPair.makeRandom = function (options) {
67507 options = options || {}
67508
67509 var rng = options.rng || randomBytes
67510
67511 var d
67512 do {
67513 var buffer = rng(32)
67514 typeforce(types.Buffer256bit, buffer)
67515
67516 d = BigInteger.fromBuffer(buffer)
67517 } while (d.signum() <= 0 || d.compareTo(secp256k1.n) >= 0)
67518
67519 return new ECPair(d, null, options)
67520}
67521
67522ECPair.prototype.getAddress = function () {
67523 return baddress.toBase58GrsCheck(bcrypto.hash160(this.getPublicKeyBuffer()), this.getNetwork().pubKeyHash)
67524}
67525
67526ECPair.prototype.getNetwork = function () {
67527 return this.network
67528}
67529
67530ECPair.prototype.getPublicKeyBuffer = function () {
67531 return this.Q.getEncoded(this.compressed)
67532}
67533
67534ECPair.prototype.sign = function (hash) {
67535 if (!this.d) throw new Error('Missing private key')
67536
67537 return ecdsa.sign(hash, this.d)
67538}
67539
67540ECPair.prototype.toWIF = function () {
67541 if (!this.d) throw new Error('Missing private key')
67542
67543 return wif.encode(this.network.wif, this.d.toBuffer(32), this.compressed)
67544}
67545
67546ECPair.prototype.verify = function (hash, signature) {
67547 return ecdsa.verify(hash, signature, this.Q)
67548}
67549
67550module.exports = ECPair
67551
67552},{"./address":343,"./crypto":346,"./ecdsa":347,"./networks":352,"./types":379,"bigi":63,"ecurve":257,"randombytes":724,"typeforce":816,"wifgrs":833}],349:[function(require,module,exports){
67553arguments[4][77][0].apply(exports,arguments)
67554},{"./types":379,"bigi":63,"bip66":68,"buffer":146,"dup":77,"typeforce":816}],350:[function(require,module,exports){
67555var Buffer = require('safe-buffer').Buffer
67556var base58grscheck = require('bs58grscheck')
67557var bcrypto = require('./crypto')
67558var createHmac = require('create-hmac')
67559var typeforce = require('typeforce')
67560var types = require('./types')
67561var NETWORKS = require('./networks')
67562
67563var BigInteger = require('bigi')
67564var ECPair = require('./ecpair')
67565
67566var ecurve = require('ecurve')
67567var curve = ecurve.getCurveByName('secp256k1')
67568
67569function HDNode (keyPair, chainCode) {
67570 typeforce(types.tuple('ECPair', types.Buffer256bit), arguments)
67571
67572 if (!keyPair.compressed) throw new TypeError('BIP32 only allows compressed keyPairs')
67573
67574 this.keyPair = keyPair
67575 this.chainCode = chainCode
67576 this.depth = 0
67577 this.index = 0
67578 this.parentFingerprint = 0x00000000
67579}
67580
67581HDNode.HIGHEST_BIT = 0x80000000
67582HDNode.LENGTH = 78
67583HDNode.MASTER_SECRET = Buffer.from('Bitcoin seed', 'utf8')
67584
67585HDNode.fromSeedBuffer = function (seed, network) {
67586 typeforce(types.tuple(types.Buffer, types.maybe(types.Network)), arguments)
67587
67588 if (seed.length < 16) throw new TypeError('Seed should be at least 128 bits')
67589 if (seed.length > 64) throw new TypeError('Seed should be at most 512 bits')
67590
67591 var I = createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()
67592 var IL = I.slice(0, 32)
67593 var IR = I.slice(32)
67594
67595 // In case IL is 0 or >= n, the master key is invalid
67596 // This is handled by the ECPair constructor
67597 var pIL = BigInteger.fromBuffer(IL)
67598 var keyPair = new ECPair(pIL, null, {
67599 network: network
67600 })
67601
67602 return new HDNode(keyPair, IR)
67603}
67604
67605HDNode.fromSeedHex = function (hex, network) {
67606 return HDNode.fromSeedBuffer(Buffer.from(hex, 'hex'), network)
67607}
67608
67609HDNode.fromBase58 = function (string, networks) {
67610 var buffer = base58grscheck.decode(string)
67611 if (buffer.length !== 78) throw new Error('Invalid buffer length')
67612
67613 // 4 bytes: version bytes
67614 var version = buffer.readUInt32BE(0)
67615 var network
67616
67617 // list of networks?
67618 if (Array.isArray(networks)) {
67619 network = networks.filter(function (x) {
67620 return version === x.bip32.private ||
67621 version === x.bip32.public
67622 }).pop()
67623
67624 if (!network) throw new Error('Unknown network version')
67625
67626 // otherwise, assume a network object (or default to bitcoin)
67627 } else {
67628 network = networks || NETWORKS.bitcoin
67629 }
67630
67631 if (version !== network.bip32.private &&
67632 version !== network.bip32.public) throw new Error('Invalid network version')
67633
67634 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...
67635 var depth = buffer[4]
67636
67637 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
67638 var parentFingerprint = buffer.readUInt32BE(5)
67639 if (depth === 0) {
67640 if (parentFingerprint !== 0x00000000) throw new Error('Invalid parent fingerprint')
67641 }
67642
67643 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
67644 // This is encoded in MSB order. (0x00000000 if master key)
67645 var index = buffer.readUInt32BE(9)
67646 if (depth === 0 && index !== 0) throw new Error('Invalid index')
67647
67648 // 32 bytes: the chain code
67649 var chainCode = buffer.slice(13, 45)
67650 var keyPair
67651
67652 // 33 bytes: private key data (0x00 + k)
67653 if (version === network.bip32.private) {
67654 if (buffer.readUInt8(45) !== 0x00) throw new Error('Invalid private key')
67655
67656 var d = BigInteger.fromBuffer(buffer.slice(46, 78))
67657 keyPair = new ECPair(d, null, { network: network })
67658
67659 // 33 bytes: public key data (0x02 + X or 0x03 + X)
67660 } else {
67661 var Q = ecurve.Point.decodeFrom(curve, buffer.slice(45, 78))
67662 // Q.compressed is assumed, if somehow this assumption is broken, `new HDNode` will throw
67663
67664 // Verify that the X coordinate in the public point corresponds to a point on the curve.
67665 // If not, the extended public key is invalid.
67666 curve.validate(Q)
67667
67668 keyPair = new ECPair(null, Q, { network: network })
67669 }
67670
67671 var hd = new HDNode(keyPair, chainCode)
67672 hd.depth = depth
67673 hd.index = index
67674 hd.parentFingerprint = parentFingerprint
67675
67676 return hd
67677}
67678
67679HDNode.prototype.getAddress = function () {
67680 return this.keyPair.getAddress()
67681}
67682
67683HDNode.prototype.getIdentifier = function () {
67684 return bcrypto.hash160(this.keyPair.getPublicKeyBuffer())
67685}
67686
67687HDNode.prototype.getFingerprint = function () {
67688 return this.getIdentifier().slice(0, 4)
67689}
67690
67691HDNode.prototype.getNetwork = function () {
67692 return this.keyPair.getNetwork()
67693}
67694
67695HDNode.prototype.getPublicKeyBuffer = function () {
67696 return this.keyPair.getPublicKeyBuffer()
67697}
67698
67699HDNode.prototype.neutered = function () {
67700 var neuteredKeyPair = new ECPair(null, this.keyPair.Q, {
67701 network: this.keyPair.network
67702 })
67703
67704 var neutered = new HDNode(neuteredKeyPair, this.chainCode)
67705 neutered.depth = this.depth
67706 neutered.index = this.index
67707 neutered.parentFingerprint = this.parentFingerprint
67708
67709 return neutered
67710}
67711
67712HDNode.prototype.sign = function (hash) {
67713 return this.keyPair.sign(hash)
67714}
67715
67716HDNode.prototype.verify = function (hash, signature) {
67717 return this.keyPair.verify(hash, signature)
67718}
67719
67720HDNode.prototype.toBase58 = function (__isPrivate) {
67721 if (__isPrivate !== undefined) throw new TypeError('Unsupported argument in 2.0.0')
67722
67723 // Version
67724 var network = this.keyPair.network
67725 var version = (!this.isNeutered()) ? network.bip32.private : network.bip32.public
67726 var buffer = Buffer.allocUnsafe(78)
67727
67728 // 4 bytes: version bytes
67729 buffer.writeUInt32BE(version, 0)
67730
67731 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ....
67732 buffer.writeUInt8(this.depth, 4)
67733
67734 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
67735 buffer.writeUInt32BE(this.parentFingerprint, 5)
67736
67737 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
67738 // This is encoded in big endian. (0x00000000 if master key)
67739 buffer.writeUInt32BE(this.index, 9)
67740
67741 // 32 bytes: the chain code
67742 this.chainCode.copy(buffer, 13)
67743
67744 // 33 bytes: the public key or private key data
67745 if (!this.isNeutered()) {
67746 // 0x00 + k for private keys
67747 buffer.writeUInt8(0, 45)
67748 this.keyPair.d.toBuffer(32).copy(buffer, 46)
67749
67750 // 33 bytes: the public key
67751 } else {
67752 // X9.62 encoding for public keys
67753 this.keyPair.getPublicKeyBuffer().copy(buffer, 45)
67754 }
67755
67756 return base58grscheck.encode(buffer)
67757}
67758
67759// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions
67760HDNode.prototype.derive = function (index) {
67761 typeforce(types.UInt32, index)
67762
67763 var isHardened = index >= HDNode.HIGHEST_BIT
67764 var data = Buffer.allocUnsafe(37)
67765
67766 // Hardened child
67767 if (isHardened) {
67768 if (this.isNeutered()) throw new TypeError('Could not derive hardened child key')
67769
67770 // data = 0x00 || ser256(kpar) || ser32(index)
67771 data[0] = 0x00
67772 this.keyPair.d.toBuffer(32).copy(data, 1)
67773 data.writeUInt32BE(index, 33)
67774
67775 // Normal child
67776 } else {
67777 // data = serP(point(kpar)) || ser32(index)
67778 // = serP(Kpar) || ser32(index)
67779 this.keyPair.getPublicKeyBuffer().copy(data, 0)
67780 data.writeUInt32BE(index, 33)
67781 }
67782
67783 var I = createHmac('sha512', this.chainCode).update(data).digest()
67784 var IL = I.slice(0, 32)
67785 var IR = I.slice(32)
67786
67787 var pIL = BigInteger.fromBuffer(IL)
67788
67789 // In case parse256(IL) >= n, proceed with the next value for i
67790 if (pIL.compareTo(curve.n) >= 0) {
67791 return this.derive(index + 1)
67792 }
67793
67794 // Private parent key -> private child key
67795 var derivedKeyPair
67796 if (!this.isNeutered()) {
67797 // ki = parse256(IL) + kpar (mod n)
67798 var ki = pIL.add(this.keyPair.d).mod(curve.n)
67799
67800 // In case ki == 0, proceed with the next value for i
67801 if (ki.signum() === 0) {
67802 return this.derive(index + 1)
67803 }
67804
67805 derivedKeyPair = new ECPair(ki, null, {
67806 network: this.keyPair.network
67807 })
67808
67809 // Public parent key -> public child key
67810 } else {
67811 // Ki = point(parse256(IL)) + Kpar
67812 // = G*IL + Kpar
67813 var Ki = curve.G.multiply(pIL).add(this.keyPair.Q)
67814
67815 // In case Ki is the point at infinity, proceed with the next value for i
67816 if (curve.isInfinity(Ki)) {
67817 return this.derive(index + 1)
67818 }
67819
67820 derivedKeyPair = new ECPair(null, Ki, {
67821 network: this.keyPair.network
67822 })
67823 }
67824
67825 var hd = new HDNode(derivedKeyPair, IR)
67826 hd.depth = this.depth + 1
67827 hd.index = index
67828 hd.parentFingerprint = this.getFingerprint().readUInt32BE(0)
67829
67830 return hd
67831}
67832
67833HDNode.prototype.deriveHardened = function (index) {
67834 typeforce(types.UInt31, index)
67835
67836 // Only derives hardened private keys by default
67837 return this.derive(index + HDNode.HIGHEST_BIT)
67838}
67839
67840// Private === not neutered
67841// Public === neutered
67842HDNode.prototype.isNeutered = function () {
67843 return !(this.keyPair.d)
67844}
67845
67846HDNode.prototype.derivePath = function (path) {
67847 typeforce(types.BIP32Path, path)
67848
67849 var splitPath = path.split('/')
67850 if (splitPath[0] === 'm') {
67851 if (this.parentFingerprint) {
67852 throw new Error('Not a master node')
67853 }
67854
67855 splitPath = splitPath.slice(1)
67856 }
67857
67858 return splitPath.reduce(function (prevHd, indexStr) {
67859 var index
67860 if (indexStr.slice(-1) === "'") {
67861 index = parseInt(indexStr.slice(0, -1), 10)
67862 return prevHd.deriveHardened(index)
67863 } else {
67864 index = parseInt(indexStr, 10)
67865 return prevHd.derive(index)
67866 }
67867 }, this)
67868}
67869
67870module.exports = HDNode
67871
67872},{"./crypto":346,"./ecpair":348,"./networks":352,"./types":379,"bigi":63,"bs58grscheck":142,"create-hmac":241,"ecurve":257,"safe-buffer":742,"typeforce":816}],351:[function(require,module,exports){
67873arguments[4][79][0].apply(exports,arguments)
67874},{"./address":343,"./block":344,"./bufferutils":345,"./crypto":346,"./ecpair":348,"./ecsignature":349,"./hdnode":350,"./networks":352,"./script":353,"./templates":355,"./transaction":377,"./transaction_builder":378,"bitcoin-ops":69,"dup":79}],352:[function(require,module,exports){
67875// https://en.bitcoin.it/wiki/List_of_address_prefixes
67876// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731
67877
67878module.exports = {
67879 bitcoin: {
67880 messagePrefix: '\x1cGroestlCoin Signed Message:\n',
67881 bech32: 'grs',
67882 bip32: {
67883 public: 0x0488b21e,
67884 private: 0x0488ade4
67885 },
67886 pubKeyHash: 0x24,
67887 scriptHash: 0x05,
67888 wif: 0x80
67889 },
67890 testnet: {
67891 messagePrefix: '\x1cGroestlCoin Signed Message:\n',
67892 bech32: 'tgrs',
67893 bip32: {
67894 public: 0x043587cf,
67895 private: 0x04358394
67896 },
67897 pubKeyHash: 0x6f,
67898 scriptHash: 0xc4,
67899 wif: 0xef
67900 },
67901 litecoin: {
67902 messagePrefix: '\x19Litecoin Signed Message:\n',
67903 bip32: {
67904 public: 0x019da462,
67905 private: 0x019d9cfe
67906 },
67907 pubKeyHash: 0x30,
67908 scriptHash: 0x32,
67909 wif: 0xb0
67910 }
67911}
67912
67913},{}],353:[function(require,module,exports){
67914arguments[4][81][0].apply(exports,arguments)
67915},{"./script_number":354,"./types":379,"bip66":68,"bitcoin-ops":69,"bitcoin-ops/map":70,"dup":81,"pushdata-bitcoin":720,"safe-buffer":742,"typeforce":816}],354:[function(require,module,exports){
67916arguments[4][82][0].apply(exports,arguments)
67917},{"dup":82,"safe-buffer":742}],355:[function(require,module,exports){
67918arguments[4][83][0].apply(exports,arguments)
67919},{"../script":353,"./multisig":356,"./nulldata":359,"./pubkey":360,"./pubkeyhash":363,"./scripthash":366,"./witnesscommitment":369,"./witnesspubkeyhash":371,"./witnessscripthash":374,"dup":83}],356:[function(require,module,exports){
67920arguments[4][84][0].apply(exports,arguments)
67921},{"./input":357,"./output":358,"dup":84}],357:[function(require,module,exports){
67922arguments[4][85][0].apply(exports,arguments)
67923},{"../../script":353,"./output":358,"bitcoin-ops":69,"dup":85,"safe-buffer":742,"typeforce":816}],358:[function(require,module,exports){
67924arguments[4][86][0].apply(exports,arguments)
67925},{"../../script":353,"../../types":379,"bitcoin-ops":69,"dup":86,"typeforce":816}],359:[function(require,module,exports){
67926arguments[4][87][0].apply(exports,arguments)
67927},{"../script":353,"../types":379,"bitcoin-ops":69,"dup":87,"typeforce":816}],360:[function(require,module,exports){
67928arguments[4][84][0].apply(exports,arguments)
67929},{"./input":361,"./output":362,"dup":84}],361:[function(require,module,exports){
67930arguments[4][89][0].apply(exports,arguments)
67931},{"../../script":353,"dup":89,"typeforce":816}],362:[function(require,module,exports){
67932arguments[4][90][0].apply(exports,arguments)
67933},{"../../script":353,"bitcoin-ops":69,"dup":90,"typeforce":816}],363:[function(require,module,exports){
67934arguments[4][84][0].apply(exports,arguments)
67935},{"./input":364,"./output":365,"dup":84}],364:[function(require,module,exports){
67936arguments[4][92][0].apply(exports,arguments)
67937},{"../../script":353,"dup":92,"typeforce":816}],365:[function(require,module,exports){
67938arguments[4][93][0].apply(exports,arguments)
67939},{"../../script":353,"../../types":379,"bitcoin-ops":69,"dup":93,"typeforce":816}],366:[function(require,module,exports){
67940arguments[4][84][0].apply(exports,arguments)
67941},{"./input":367,"./output":368,"dup":84}],367:[function(require,module,exports){
67942arguments[4][95][0].apply(exports,arguments)
67943},{"../../script":353,"../multisig/":356,"../pubkey/":360,"../pubkeyhash/":363,"../witnesspubkeyhash/output":373,"../witnessscripthash/output":376,"dup":95,"safe-buffer":742,"typeforce":816}],368:[function(require,module,exports){
67944arguments[4][96][0].apply(exports,arguments)
67945},{"../../script":353,"../../types":379,"bitcoin-ops":69,"dup":96,"typeforce":816}],369:[function(require,module,exports){
67946arguments[4][97][0].apply(exports,arguments)
67947},{"./output":370,"dup":97}],370:[function(require,module,exports){
67948arguments[4][98][0].apply(exports,arguments)
67949},{"../../script":353,"../../types":379,"bitcoin-ops":69,"dup":98,"safe-buffer":742,"typeforce":816}],371:[function(require,module,exports){
67950arguments[4][84][0].apply(exports,arguments)
67951},{"./input":372,"./output":373,"dup":84}],372:[function(require,module,exports){
67952arguments[4][100][0].apply(exports,arguments)
67953},{"../../script":353,"dup":100,"typeforce":816}],373:[function(require,module,exports){
67954arguments[4][101][0].apply(exports,arguments)
67955},{"../../script":353,"../../types":379,"bitcoin-ops":69,"dup":101,"typeforce":816}],374:[function(require,module,exports){
67956arguments[4][84][0].apply(exports,arguments)
67957},{"./input":375,"./output":376,"dup":84}],375:[function(require,module,exports){
67958arguments[4][103][0].apply(exports,arguments)
67959},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":397,"../../script":353,"../../types":379,"../multisig/":356,"../pubkey/":360,"../pubkeyhash/":363,"dup":103,"typeforce":816}],376:[function(require,module,exports){
67960arguments[4][104][0].apply(exports,arguments)
67961},{"../../script":353,"../../types":379,"bitcoin-ops":69,"dup":104,"typeforce":816}],377:[function(require,module,exports){
67962var Buffer = require('safe-buffer').Buffer
67963var bcrypto = require('./crypto')
67964var bscript = require('./script')
67965var bufferutils = require('./bufferutils')
67966var opcodes = require('bitcoin-ops')
67967var typeforce = require('typeforce')
67968var types = require('./types')
67969var varuint = require('varuint-bitcoin')
67970
67971function varSliceSize (someScript) {
67972 var length = someScript.length
67973
67974 return varuint.encodingLength(length) + length
67975}
67976
67977function vectorSize (someVector) {
67978 var length = someVector.length
67979
67980 return varuint.encodingLength(length) + someVector.reduce(function (sum, witness) {
67981 return sum + varSliceSize(witness)
67982 }, 0)
67983}
67984
67985function Transaction () {
67986 this.version = 1
67987 this.locktime = 0
67988 this.ins = []
67989 this.outs = []
67990}
67991
67992Transaction.DEFAULT_SEQUENCE = 0xffffffff
67993Transaction.SIGHASH_ALL = 0x01
67994Transaction.SIGHASH_NONE = 0x02
67995Transaction.SIGHASH_SINGLE = 0x03
67996Transaction.SIGHASH_ANYONECANPAY = 0x80
67997Transaction.ADVANCED_TRANSACTION_MARKER = 0x00
67998Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
67999
68000var EMPTY_SCRIPT = Buffer.allocUnsafe(0)
68001var EMPTY_WITNESS = []
68002var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
68003var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
68004var VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
68005var BLANK_OUTPUT = {
68006 script: EMPTY_SCRIPT,
68007 valueBuffer: VALUE_UINT64_MAX
68008}
68009
68010Transaction.fromBuffer = function (buffer, __noStrict) {
68011 var offset = 0
68012 function readSlice (n) {
68013 offset += n
68014 return buffer.slice(offset - n, offset)
68015 }
68016
68017 function readUInt32 () {
68018 var i = buffer.readUInt32LE(offset)
68019 offset += 4
68020 return i
68021 }
68022
68023 function readInt32 () {
68024 var i = buffer.readInt32LE(offset)
68025 offset += 4
68026 return i
68027 }
68028
68029 function readUInt64 () {
68030 var i = bufferutils.readUInt64LE(buffer, offset)
68031 offset += 8
68032 return i
68033 }
68034
68035 function readVarInt () {
68036 var vi = varuint.decode(buffer, offset)
68037 offset += varuint.decode.bytes
68038 return vi
68039 }
68040
68041 function readVarSlice () {
68042 return readSlice(readVarInt())
68043 }
68044
68045 function readVector () {
68046 var count = readVarInt()
68047 var vector = []
68048 for (var i = 0; i < count; i++) vector.push(readVarSlice())
68049 return vector
68050 }
68051
68052 var tx = new Transaction()
68053 tx.version = readInt32()
68054
68055 var marker = buffer.readUInt8(offset)
68056 var flag = buffer.readUInt8(offset + 1)
68057
68058 var hasWitnesses = false
68059 if (marker === Transaction.ADVANCED_TRANSACTION_MARKER &&
68060 flag === Transaction.ADVANCED_TRANSACTION_FLAG) {
68061 offset += 2
68062 hasWitnesses = true
68063 }
68064
68065 var vinLen = readVarInt()
68066 for (var i = 0; i < vinLen; ++i) {
68067 tx.ins.push({
68068 hash: readSlice(32),
68069 index: readUInt32(),
68070 script: readVarSlice(),
68071 sequence: readUInt32(),
68072 witness: EMPTY_WITNESS
68073 })
68074 }
68075
68076 var voutLen = readVarInt()
68077 for (i = 0; i < voutLen; ++i) {
68078 tx.outs.push({
68079 value: readUInt64(),
68080 script: readVarSlice()
68081 })
68082 }
68083
68084 if (hasWitnesses) {
68085 for (i = 0; i < vinLen; ++i) {
68086 tx.ins[i].witness = readVector()
68087 }
68088
68089 // was this pointless?
68090 if (!tx.hasWitnesses()) throw new Error('Transaction has superfluous witness data')
68091 }
68092
68093 tx.locktime = readUInt32()
68094
68095 if (__noStrict) return tx
68096 if (offset !== buffer.length) throw new Error('Transaction has unexpected data')
68097
68098 return tx
68099}
68100
68101Transaction.fromHex = function (hex) {
68102 return Transaction.fromBuffer(Buffer.from(hex, 'hex'))
68103}
68104
68105Transaction.isCoinbaseHash = function (buffer) {
68106 typeforce(types.Hash256bit, buffer)
68107 for (var i = 0; i < 32; ++i) {
68108 if (buffer[i] !== 0) return false
68109 }
68110 return true
68111}
68112
68113Transaction.prototype.isCoinbase = function () {
68114 return this.ins.length === 1 && Transaction.isCoinbaseHash(this.ins[0].hash)
68115}
68116
68117Transaction.prototype.addInput = function (hash, index, sequence, scriptSig) {
68118 typeforce(types.tuple(
68119 types.Hash256bit,
68120 types.UInt32,
68121 types.maybe(types.UInt32),
68122 types.maybe(types.Buffer)
68123 ), arguments)
68124
68125 if (types.Null(sequence)) {
68126 sequence = Transaction.DEFAULT_SEQUENCE
68127 }
68128
68129 // Add the input and return the input's index
68130 return (this.ins.push({
68131 hash: hash,
68132 index: index,
68133 script: scriptSig || EMPTY_SCRIPT,
68134 sequence: sequence,
68135 witness: EMPTY_WITNESS
68136 }) - 1)
68137}
68138
68139Transaction.prototype.addOutput = function (scriptPubKey, value) {
68140 typeforce(types.tuple(types.Buffer, types.Satoshi), arguments)
68141
68142 // Add the output and return the output's index
68143 return (this.outs.push({
68144 script: scriptPubKey,
68145 value: value
68146 }) - 1)
68147}
68148
68149Transaction.prototype.hasWitnesses = function () {
68150 return this.ins.some(function (x) {
68151 return x.witness.length !== 0
68152 })
68153}
68154
68155Transaction.prototype.weight = function () {
68156 var base = this.__byteLength(false)
68157 var total = this.__byteLength(true)
68158 return base * 3 + total
68159}
68160
68161Transaction.prototype.virtualSize = function () {
68162 return Math.ceil(this.weight() / 4)
68163}
68164
68165Transaction.prototype.byteLength = function () {
68166 return this.__byteLength(true)
68167}
68168
68169Transaction.prototype.__byteLength = function (__allowWitness) {
68170 var hasWitnesses = __allowWitness && this.hasWitnesses()
68171
68172 return (
68173 (hasWitnesses ? 10 : 8) +
68174 varuint.encodingLength(this.ins.length) +
68175 varuint.encodingLength(this.outs.length) +
68176 this.ins.reduce(function (sum, input) { return sum + 40 + varSliceSize(input.script) }, 0) +
68177 this.outs.reduce(function (sum, output) { return sum + 8 + varSliceSize(output.script) }, 0) +
68178 (hasWitnesses ? this.ins.reduce(function (sum, input) { return sum + vectorSize(input.witness) }, 0) : 0)
68179 )
68180}
68181
68182Transaction.prototype.clone = function () {
68183 var newTx = new Transaction()
68184 newTx.version = this.version
68185 newTx.locktime = this.locktime
68186
68187 newTx.ins = this.ins.map(function (txIn) {
68188 return {
68189 hash: txIn.hash,
68190 index: txIn.index,
68191 script: txIn.script,
68192 sequence: txIn.sequence,
68193 witness: txIn.witness
68194 }
68195 })
68196
68197 newTx.outs = this.outs.map(function (txOut) {
68198 return {
68199 script: txOut.script,
68200 value: txOut.value
68201 }
68202 })
68203
68204 return newTx
68205}
68206
68207/**
68208 * Hash transaction for signing a specific input.
68209 *
68210 * Bitcoin uses a different hash for each signed transaction input.
68211 * This method copies the transaction, makes the necessary changes based on the
68212 * hashType, and then hashes the result.
68213 * This hash can then be used to sign the provided transaction input.
68214 */
68215Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {
68216 typeforce(types.tuple(types.UInt32, types.Buffer, /* types.UInt8 */ types.Number), arguments)
68217
68218 // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L29
68219 if (inIndex >= this.ins.length) return ONE
68220
68221 // ignore OP_CODESEPARATOR
68222 var ourScript = bscript.compile(bscript.decompile(prevOutScript).filter(function (x) {
68223 return x !== opcodes.OP_CODESEPARATOR
68224 }))
68225
68226 var txTmp = this.clone()
68227
68228 // SIGHASH_NONE: ignore all outputs? (wildcard payee)
68229 if ((hashType & 0x1f) === Transaction.SIGHASH_NONE) {
68230 txTmp.outs = []
68231
68232 // ignore sequence numbers (except at inIndex)
68233 txTmp.ins.forEach(function (input, i) {
68234 if (i === inIndex) return
68235
68236 input.sequence = 0
68237 })
68238
68239 // SIGHASH_SINGLE: ignore all outputs, except at the same index?
68240 } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE) {
68241 // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L60
68242 if (inIndex >= this.outs.length) return ONE
68243
68244 // truncate outputs after
68245 txTmp.outs.length = inIndex + 1
68246
68247 // "blank" outputs before
68248 for (var i = 0; i < inIndex; i++) {
68249 txTmp.outs[i] = BLANK_OUTPUT
68250 }
68251
68252 // ignore sequence numbers (except at inIndex)
68253 txTmp.ins.forEach(function (input, y) {
68254 if (y === inIndex) return
68255
68256 input.sequence = 0
68257 })
68258 }
68259
68260 // SIGHASH_ANYONECANPAY: ignore inputs entirely?
68261 if (hashType & Transaction.SIGHASH_ANYONECANPAY) {
68262 txTmp.ins = [txTmp.ins[inIndex]]
68263 txTmp.ins[0].script = ourScript
68264
68265 // SIGHASH_ALL: only ignore input scripts
68266 } else {
68267 // "blank" others input scripts
68268 txTmp.ins.forEach(function (input) { input.script = EMPTY_SCRIPT })
68269 txTmp.ins[inIndex].script = ourScript
68270 }
68271
68272 // serialize and hash
68273 var buffer = Buffer.allocUnsafe(txTmp.__byteLength(false) + 4)
68274 buffer.writeInt32LE(hashType, buffer.length - 4)
68275 txTmp.__toBuffer(buffer, 0, false)
68276
68277 return bcrypto.sha256(buffer)
68278}
68279
68280Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value, hashType) {
68281 typeforce(types.tuple(types.UInt32, types.Buffer, types.Satoshi, types.UInt32), arguments)
68282
68283 var tbuffer, toffset
68284 function writeSlice (slice) { toffset += slice.copy(tbuffer, toffset) }
68285 function writeUInt32 (i) { toffset = tbuffer.writeUInt32LE(i, toffset) }
68286 function writeUInt64 (i) { toffset = bufferutils.writeUInt64LE(tbuffer, i, toffset) }
68287 function writeVarInt (i) {
68288 varuint.encode(i, tbuffer, toffset)
68289 toffset += varuint.encode.bytes
68290 }
68291 function writeVarSlice (slice) { writeVarInt(slice.length); writeSlice(slice) }
68292
68293 var hashOutputs = ZERO
68294 var hashPrevouts = ZERO
68295 var hashSequence = ZERO
68296
68297 if (!(hashType & Transaction.SIGHASH_ANYONECANPAY)) {
68298 tbuffer = Buffer.allocUnsafe(36 * this.ins.length)
68299 toffset = 0
68300
68301 this.ins.forEach(function (txIn) {
68302 writeSlice(txIn.hash)
68303 writeUInt32(txIn.index)
68304 })
68305
68306 hashPrevouts = bcrypto.sha256(tbuffer)
68307 }
68308
68309 if (!(hashType & Transaction.SIGHASH_ANYONECANPAY) &&
68310 (hashType & 0x1f) !== Transaction.SIGHASH_SINGLE &&
68311 (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
68312 tbuffer = Buffer.allocUnsafe(4 * this.ins.length)
68313 toffset = 0
68314
68315 this.ins.forEach(function (txIn) {
68316 writeUInt32(txIn.sequence)
68317 })
68318
68319 hashSequence = bcrypto.sha256(tbuffer)
68320 }
68321
68322 if ((hashType & 0x1f) !== Transaction.SIGHASH_SINGLE &&
68323 (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
68324 var txOutsSize = this.outs.reduce(function (sum, output) {
68325 return sum + 8 + varSliceSize(output.script)
68326 }, 0)
68327
68328 tbuffer = Buffer.allocUnsafe(txOutsSize)
68329 toffset = 0
68330
68331 this.outs.forEach(function (out) {
68332 writeUInt64(out.value)
68333 writeVarSlice(out.script)
68334 })
68335
68336 hashOutputs = bcrypto.sha256(tbuffer)
68337 } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE && inIndex < this.outs.length) {
68338 var output = this.outs[inIndex]
68339
68340 tbuffer = Buffer.allocUnsafe(8 + varSliceSize(output.script))
68341 toffset = 0
68342 writeUInt64(output.value)
68343 writeVarSlice(output.script)
68344
68345 hashOutputs = bcrypto.sha256(tbuffer)
68346 }
68347
68348 tbuffer = Buffer.allocUnsafe(156 + varSliceSize(prevOutScript))
68349 toffset = 0
68350
68351 var input = this.ins[inIndex]
68352 writeUInt32(this.version)
68353 writeSlice(hashPrevouts)
68354 writeSlice(hashSequence)
68355 writeSlice(input.hash)
68356 writeUInt32(input.index)
68357 writeVarSlice(prevOutScript)
68358 writeUInt64(value)
68359 writeUInt32(input.sequence)
68360 writeSlice(hashOutputs)
68361 writeUInt32(this.locktime)
68362 writeUInt32(hashType)
68363 return bcrypto.sha256(tbuffer)
68364}
68365
68366Transaction.prototype.getHash = function () {
68367 return bcrypto.sha256(this.__toBuffer(undefined, undefined, false))
68368}
68369
68370Transaction.prototype.getId = function () {
68371 // transaction hash's are displayed in reverse order
68372 return this.getHash().reverse().toString('hex')
68373}
68374
68375Transaction.prototype.toBuffer = function (buffer, initialOffset) {
68376 return this.__toBuffer(buffer, initialOffset, true)
68377}
68378
68379Transaction.prototype.__toBuffer = function (buffer, initialOffset, __allowWitness) {
68380 if (!buffer) buffer = Buffer.allocUnsafe(this.__byteLength(__allowWitness))
68381
68382 var offset = initialOffset || 0
68383 function writeSlice (slice) { offset += slice.copy(buffer, offset) }
68384 function writeUInt8 (i) { offset = buffer.writeUInt8(i, offset) }
68385 function writeUInt32 (i) { offset = buffer.writeUInt32LE(i, offset) }
68386 function writeInt32 (i) { offset = buffer.writeInt32LE(i, offset) }
68387 function writeUInt64 (i) { offset = bufferutils.writeUInt64LE(buffer, i, offset) }
68388 function writeVarInt (i) {
68389 varuint.encode(i, buffer, offset)
68390 offset += varuint.encode.bytes
68391 }
68392 function writeVarSlice (slice) { writeVarInt(slice.length); writeSlice(slice) }
68393 function writeVector (vector) { writeVarInt(vector.length); vector.forEach(writeVarSlice) }
68394
68395 writeInt32(this.version)
68396
68397 var hasWitnesses = __allowWitness && this.hasWitnesses()
68398
68399 if (hasWitnesses) {
68400 writeUInt8(Transaction.ADVANCED_TRANSACTION_MARKER)
68401 writeUInt8(Transaction.ADVANCED_TRANSACTION_FLAG)
68402 }
68403
68404 writeVarInt(this.ins.length)
68405
68406 this.ins.forEach(function (txIn) {
68407 writeSlice(txIn.hash)
68408 writeUInt32(txIn.index)
68409 writeVarSlice(txIn.script)
68410 writeUInt32(txIn.sequence)
68411 })
68412
68413 writeVarInt(this.outs.length)
68414 this.outs.forEach(function (txOut) {
68415 if (!txOut.valueBuffer) {
68416 writeUInt64(txOut.value)
68417 } else {
68418 writeSlice(txOut.valueBuffer)
68419 }
68420
68421 writeVarSlice(txOut.script)
68422 })
68423
68424 if (hasWitnesses) {
68425 this.ins.forEach(function (input) {
68426 writeVector(input.witness)
68427 })
68428 }
68429
68430 writeUInt32(this.locktime)
68431
68432 // avoid slicing unless necessary
68433 if (initialOffset !== undefined) return buffer.slice(initialOffset, offset)
68434 return buffer
68435}
68436
68437Transaction.prototype.toHex = function () {
68438 return this.toBuffer().toString('hex')
68439}
68440
68441Transaction.prototype.setInputScript = function (index, scriptSig) {
68442 typeforce(types.tuple(types.Number, types.Buffer), arguments)
68443
68444 this.ins[index].script = scriptSig
68445}
68446
68447Transaction.prototype.setWitness = function (index, witness) {
68448 typeforce(types.tuple(types.Number, [types.Buffer]), arguments)
68449
68450 this.ins[index].witness = witness
68451}
68452
68453module.exports = Transaction
68454
68455},{"./bufferutils":345,"./crypto":346,"./script":353,"./types":379,"bitcoin-ops":69,"safe-buffer":742,"typeforce":816,"varuint-bitcoin":830}],378:[function(require,module,exports){
68456arguments[4][106][0].apply(exports,arguments)
68457},{"./address":343,"./crypto":346,"./ecpair":348,"./ecsignature":349,"./networks":352,"./script":353,"./templates":355,"./transaction":377,"./types":379,"bitcoin-ops":69,"dup":106,"safe-buffer":742,"typeforce":816}],379:[function(require,module,exports){
68458var typeforce = require('typeforce')
68459
68460var UINT31_MAX = Math.pow(2, 31) - 1
68461function UInt31 (value) {
68462 return typeforce.UInt32(value) && value <= UINT31_MAX
68463}
68464
68465function BIP32Path (value) {
68466 return typeforce.String(value) && value.match(/^(m\/)?(\d+'?\/)*\d+'?$/)
68467}
68468BIP32Path.toJSON = function () { return 'BIP32 derivation path' }
68469
68470var SATOSHI_MAX = 105 * 1e14
68471function Satoshi (value) {
68472 return typeforce.UInt53(value) && value <= SATOSHI_MAX
68473}
68474
68475// external dependent types
68476var BigInt = typeforce.quacksLike('BigInteger')
68477var ECPoint = typeforce.quacksLike('Point')
68478
68479// exposed, external API
68480var ECSignature = typeforce.compile({ r: BigInt, s: BigInt })
68481var Network = typeforce.compile({
68482 messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String),
68483 bip32: {
68484 public: typeforce.UInt32,
68485 private: typeforce.UInt32
68486 },
68487 pubKeyHash: typeforce.UInt8,
68488 scriptHash: typeforce.UInt8,
68489 wif: typeforce.UInt8
68490})
68491
68492// extend typeforce types with ours
68493var types = {
68494 BigInt: BigInt,
68495 BIP32Path: BIP32Path,
68496 Buffer256bit: typeforce.BufferN(32),
68497 ECPoint: ECPoint,
68498 ECSignature: ECSignature,
68499 Hash160bit: typeforce.BufferN(20),
68500 Hash256bit: typeforce.BufferN(32),
68501 Network: Network,
68502 Satoshi: Satoshi,
68503 UInt31: UInt31
68504}
68505
68506for (var typeName in typeforce) {
68507 types[typeName] = typeforce[typeName]
68508}
68509
68510module.exports = types
68511
68512},{"typeforce":816}],380:[function(require,module,exports){
68513'use strict'
68514var Buffer = require('safe-buffer').Buffer
68515var Transform = require('stream').Transform
68516var inherits = require('inherits')
68517
68518function throwIfNotStringOrBuffer (val, prefix) {
68519 if (!Buffer.isBuffer(val) && typeof val !== 'string') {
68520 throw new TypeError(prefix + ' must be a string or a buffer')
68521 }
68522}
68523
68524function HashBase (blockSize) {
68525 Transform.call(this)
68526
68527 this._block = Buffer.allocUnsafe(blockSize)
68528 this._blockSize = blockSize
68529 this._blockOffset = 0
68530 this._length = [0, 0, 0, 0]
68531
68532 this._finalized = false
68533}
68534
68535inherits(HashBase, Transform)
68536
68537HashBase.prototype._transform = function (chunk, encoding, callback) {
68538 var error = null
68539 try {
68540 this.update(chunk, encoding)
68541 } catch (err) {
68542 error = err
68543 }
68544
68545 callback(error)
68546}
68547
68548HashBase.prototype._flush = function (callback) {
68549 var error = null
68550 try {
68551 this.push(this.digest())
68552 } catch (err) {
68553 error = err
68554 }
68555
68556 callback(error)
68557}
68558
68559HashBase.prototype.update = function (data, encoding) {
68560 throwIfNotStringOrBuffer(data, 'Data')
68561 if (this._finalized) throw new Error('Digest already called')
68562 if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
68563
68564 // consume data
68565 var block = this._block
68566 var offset = 0
68567 while (this._blockOffset + data.length - offset >= this._blockSize) {
68568 for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
68569 this._update()
68570 this._blockOffset = 0
68571 }
68572 while (offset < data.length) block[this._blockOffset++] = data[offset++]
68573
68574 // update length
68575 for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
68576 this._length[j] += carry
68577 carry = (this._length[j] / 0x0100000000) | 0
68578 if (carry > 0) this._length[j] -= 0x0100000000 * carry
68579 }
68580
68581 return this
68582}
68583
68584HashBase.prototype._update = function () {
68585 throw new Error('_update is not implemented')
68586}
68587
68588HashBase.prototype.digest = function (encoding) {
68589 if (this._finalized) throw new Error('Digest already called')
68590 this._finalized = true
68591
68592 var digest = this._digest()
68593 if (encoding !== undefined) digest = digest.toString(encoding)
68594
68595 // reset state
68596 this._block.fill(0)
68597 this._blockOffset = 0
68598 for (var i = 0; i < 4; ++i) this._length[i] = 0
68599
68600 return digest
68601}
68602
68603HashBase.prototype._digest = function () {
68604 throw new Error('_digest is not implemented')
68605}
68606
68607module.exports = HashBase
68608
68609},{"inherits":396,"safe-buffer":742,"stream":808}],381:[function(require,module,exports){
68610var hash = exports;
68611
68612hash.utils = require('./hash/utils');
68613hash.common = require('./hash/common');
68614hash.sha = require('./hash/sha');
68615hash.ripemd = require('./hash/ripemd');
68616hash.hmac = require('./hash/hmac');
68617
68618// Proxy hash functions to the main object
68619hash.sha1 = hash.sha.sha1;
68620hash.sha256 = hash.sha.sha256;
68621hash.sha224 = hash.sha.sha224;
68622hash.sha384 = hash.sha.sha384;
68623hash.sha512 = hash.sha.sha512;
68624hash.ripemd160 = hash.ripemd.ripemd160;
68625
68626},{"./hash/common":382,"./hash/hmac":383,"./hash/ripemd":384,"./hash/sha":385,"./hash/utils":392}],382:[function(require,module,exports){
68627'use strict';
68628
68629var utils = require('./utils');
68630var assert = require('minimalistic-assert');
68631
68632function BlockHash() {
68633 this.pending = null;
68634 this.pendingTotal = 0;
68635 this.blockSize = this.constructor.blockSize;
68636 this.outSize = this.constructor.outSize;
68637 this.hmacStrength = this.constructor.hmacStrength;
68638 this.padLength = this.constructor.padLength / 8;
68639 this.endian = 'big';
68640
68641 this._delta8 = this.blockSize / 8;
68642 this._delta32 = this.blockSize / 32;
68643}
68644exports.BlockHash = BlockHash;
68645
68646BlockHash.prototype.update = function update(msg, enc) {
68647 // Convert message to array, pad it, and join into 32bit blocks
68648 msg = utils.toArray(msg, enc);
68649 if (!this.pending)
68650 this.pending = msg;
68651 else
68652 this.pending = this.pending.concat(msg);
68653 this.pendingTotal += msg.length;
68654
68655 // Enough data, try updating
68656 if (this.pending.length >= this._delta8) {
68657 msg = this.pending;
68658
68659 // Process pending data in blocks
68660 var r = msg.length % this._delta8;
68661 this.pending = msg.slice(msg.length - r, msg.length);
68662 if (this.pending.length === 0)
68663 this.pending = null;
68664
68665 msg = utils.join32(msg, 0, msg.length - r, this.endian);
68666 for (var i = 0; i < msg.length; i += this._delta32)
68667 this._update(msg, i, i + this._delta32);
68668 }
68669
68670 return this;
68671};
68672
68673BlockHash.prototype.digest = function digest(enc) {
68674 this.update(this._pad());
68675 assert(this.pending === null);
68676
68677 return this._digest(enc);
68678};
68679
68680BlockHash.prototype._pad = function pad() {
68681 var len = this.pendingTotal;
68682 var bytes = this._delta8;
68683 var k = bytes - ((len + this.padLength) % bytes);
68684 var res = new Array(k + this.padLength);
68685 res[0] = 0x80;
68686 for (var i = 1; i < k; i++)
68687 res[i] = 0;
68688
68689 // Append length
68690 len <<= 3;
68691 if (this.endian === 'big') {
68692 for (var t = 8; t < this.padLength; t++)
68693 res[i++] = 0;
68694
68695 res[i++] = 0;
68696 res[i++] = 0;
68697 res[i++] = 0;
68698 res[i++] = 0;
68699 res[i++] = (len >>> 24) & 0xff;
68700 res[i++] = (len >>> 16) & 0xff;
68701 res[i++] = (len >>> 8) & 0xff;
68702 res[i++] = len & 0xff;
68703 } else {
68704 res[i++] = len & 0xff;
68705 res[i++] = (len >>> 8) & 0xff;
68706 res[i++] = (len >>> 16) & 0xff;
68707 res[i++] = (len >>> 24) & 0xff;
68708 res[i++] = 0;
68709 res[i++] = 0;
68710 res[i++] = 0;
68711 res[i++] = 0;
68712
68713 for (t = 8; t < this.padLength; t++)
68714 res[i++] = 0;
68715 }
68716
68717 return res;
68718};
68719
68720},{"./utils":392,"minimalistic-assert":640}],383:[function(require,module,exports){
68721'use strict';
68722
68723var utils = require('./utils');
68724var assert = require('minimalistic-assert');
68725
68726function Hmac(hash, key, enc) {
68727 if (!(this instanceof Hmac))
68728 return new Hmac(hash, key, enc);
68729 this.Hash = hash;
68730 this.blockSize = hash.blockSize / 8;
68731 this.outSize = hash.outSize / 8;
68732 this.inner = null;
68733 this.outer = null;
68734
68735 this._init(utils.toArray(key, enc));
68736}
68737module.exports = Hmac;
68738
68739Hmac.prototype._init = function init(key) {
68740 // Shorten key, if needed
68741 if (key.length > this.blockSize)
68742 key = new this.Hash().update(key).digest();
68743 assert(key.length <= this.blockSize);
68744
68745 // Add padding to key
68746 for (var i = key.length; i < this.blockSize; i++)
68747 key.push(0);
68748
68749 for (i = 0; i < key.length; i++)
68750 key[i] ^= 0x36;
68751 this.inner = new this.Hash().update(key);
68752
68753 // 0x36 ^ 0x5c = 0x6a
68754 for (i = 0; i < key.length; i++)
68755 key[i] ^= 0x6a;
68756 this.outer = new this.Hash().update(key);
68757};
68758
68759Hmac.prototype.update = function update(msg, enc) {
68760 this.inner.update(msg, enc);
68761 return this;
68762};
68763
68764Hmac.prototype.digest = function digest(enc) {
68765 this.outer.update(this.inner.digest());
68766 return this.outer.digest(enc);
68767};
68768
68769},{"./utils":392,"minimalistic-assert":640}],384:[function(require,module,exports){
68770'use strict';
68771
68772var utils = require('./utils');
68773var common = require('./common');
68774
68775var rotl32 = utils.rotl32;
68776var sum32 = utils.sum32;
68777var sum32_3 = utils.sum32_3;
68778var sum32_4 = utils.sum32_4;
68779var BlockHash = common.BlockHash;
68780
68781function RIPEMD160() {
68782 if (!(this instanceof RIPEMD160))
68783 return new RIPEMD160();
68784
68785 BlockHash.call(this);
68786
68787 this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
68788 this.endian = 'little';
68789}
68790utils.inherits(RIPEMD160, BlockHash);
68791exports.ripemd160 = RIPEMD160;
68792
68793RIPEMD160.blockSize = 512;
68794RIPEMD160.outSize = 160;
68795RIPEMD160.hmacStrength = 192;
68796RIPEMD160.padLength = 64;
68797
68798RIPEMD160.prototype._update = function update(msg, start) {
68799 var A = this.h[0];
68800 var B = this.h[1];
68801 var C = this.h[2];
68802 var D = this.h[3];
68803 var E = this.h[4];
68804 var Ah = A;
68805 var Bh = B;
68806 var Ch = C;
68807 var Dh = D;
68808 var Eh = E;
68809 for (var j = 0; j < 80; j++) {
68810 var T = sum32(
68811 rotl32(
68812 sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
68813 s[j]),
68814 E);
68815 A = E;
68816 E = D;
68817 D = rotl32(C, 10);
68818 C = B;
68819 B = T;
68820 T = sum32(
68821 rotl32(
68822 sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
68823 sh[j]),
68824 Eh);
68825 Ah = Eh;
68826 Eh = Dh;
68827 Dh = rotl32(Ch, 10);
68828 Ch = Bh;
68829 Bh = T;
68830 }
68831 T = sum32_3(this.h[1], C, Dh);
68832 this.h[1] = sum32_3(this.h[2], D, Eh);
68833 this.h[2] = sum32_3(this.h[3], E, Ah);
68834 this.h[3] = sum32_3(this.h[4], A, Bh);
68835 this.h[4] = sum32_3(this.h[0], B, Ch);
68836 this.h[0] = T;
68837};
68838
68839RIPEMD160.prototype._digest = function digest(enc) {
68840 if (enc === 'hex')
68841 return utils.toHex32(this.h, 'little');
68842 else
68843 return utils.split32(this.h, 'little');
68844};
68845
68846function f(j, x, y, z) {
68847 if (j <= 15)
68848 return x ^ y ^ z;
68849 else if (j <= 31)
68850 return (x & y) | ((~x) & z);
68851 else if (j <= 47)
68852 return (x | (~y)) ^ z;
68853 else if (j <= 63)
68854 return (x & z) | (y & (~z));
68855 else
68856 return x ^ (y | (~z));
68857}
68858
68859function K(j) {
68860 if (j <= 15)
68861 return 0x00000000;
68862 else if (j <= 31)
68863 return 0x5a827999;
68864 else if (j <= 47)
68865 return 0x6ed9eba1;
68866 else if (j <= 63)
68867 return 0x8f1bbcdc;
68868 else
68869 return 0xa953fd4e;
68870}
68871
68872function Kh(j) {
68873 if (j <= 15)
68874 return 0x50a28be6;
68875 else if (j <= 31)
68876 return 0x5c4dd124;
68877 else if (j <= 47)
68878 return 0x6d703ef3;
68879 else if (j <= 63)
68880 return 0x7a6d76e9;
68881 else
68882 return 0x00000000;
68883}
68884
68885var r = [
68886 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
68887 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
68888 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
68889 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
68890 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
68891];
68892
68893var rh = [
68894 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
68895 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
68896 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
68897 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
68898 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
68899];
68900
68901var s = [
68902 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
68903 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
68904 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
68905 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
68906 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
68907];
68908
68909var sh = [
68910 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
68911 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
68912 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
68913 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
68914 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
68915];
68916
68917},{"./common":382,"./utils":392}],385:[function(require,module,exports){
68918'use strict';
68919
68920exports.sha1 = require('./sha/1');
68921exports.sha224 = require('./sha/224');
68922exports.sha256 = require('./sha/256');
68923exports.sha384 = require('./sha/384');
68924exports.sha512 = require('./sha/512');
68925
68926},{"./sha/1":386,"./sha/224":387,"./sha/256":388,"./sha/384":389,"./sha/512":390}],386:[function(require,module,exports){
68927'use strict';
68928
68929var utils = require('../utils');
68930var common = require('../common');
68931var shaCommon = require('./common');
68932
68933var rotl32 = utils.rotl32;
68934var sum32 = utils.sum32;
68935var sum32_5 = utils.sum32_5;
68936var ft_1 = shaCommon.ft_1;
68937var BlockHash = common.BlockHash;
68938
68939var sha1_K = [
68940 0x5A827999, 0x6ED9EBA1,
68941 0x8F1BBCDC, 0xCA62C1D6
68942];
68943
68944function SHA1() {
68945 if (!(this instanceof SHA1))
68946 return new SHA1();
68947
68948 BlockHash.call(this);
68949 this.h = [
68950 0x67452301, 0xefcdab89, 0x98badcfe,
68951 0x10325476, 0xc3d2e1f0 ];
68952 this.W = new Array(80);
68953}
68954
68955utils.inherits(SHA1, BlockHash);
68956module.exports = SHA1;
68957
68958SHA1.blockSize = 512;
68959SHA1.outSize = 160;
68960SHA1.hmacStrength = 80;
68961SHA1.padLength = 64;
68962
68963SHA1.prototype._update = function _update(msg, start) {
68964 var W = this.W;
68965
68966 for (var i = 0; i < 16; i++)
68967 W[i] = msg[start + i];
68968
68969 for(; i < W.length; i++)
68970 W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
68971
68972 var a = this.h[0];
68973 var b = this.h[1];
68974 var c = this.h[2];
68975 var d = this.h[3];
68976 var e = this.h[4];
68977
68978 for (i = 0; i < W.length; i++) {
68979 var s = ~~(i / 20);
68980 var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
68981 e = d;
68982 d = c;
68983 c = rotl32(b, 30);
68984 b = a;
68985 a = t;
68986 }
68987
68988 this.h[0] = sum32(this.h[0], a);
68989 this.h[1] = sum32(this.h[1], b);
68990 this.h[2] = sum32(this.h[2], c);
68991 this.h[3] = sum32(this.h[3], d);
68992 this.h[4] = sum32(this.h[4], e);
68993};
68994
68995SHA1.prototype._digest = function digest(enc) {
68996 if (enc === 'hex')
68997 return utils.toHex32(this.h, 'big');
68998 else
68999 return utils.split32(this.h, 'big');
69000};
69001
69002},{"../common":382,"../utils":392,"./common":391}],387:[function(require,module,exports){
69003'use strict';
69004
69005var utils = require('../utils');
69006var SHA256 = require('./256');
69007
69008function SHA224() {
69009 if (!(this instanceof SHA224))
69010 return new SHA224();
69011
69012 SHA256.call(this);
69013 this.h = [
69014 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
69015 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
69016}
69017utils.inherits(SHA224, SHA256);
69018module.exports = SHA224;
69019
69020SHA224.blockSize = 512;
69021SHA224.outSize = 224;
69022SHA224.hmacStrength = 192;
69023SHA224.padLength = 64;
69024
69025SHA224.prototype._digest = function digest(enc) {
69026 // Just truncate output
69027 if (enc === 'hex')
69028 return utils.toHex32(this.h.slice(0, 7), 'big');
69029 else
69030 return utils.split32(this.h.slice(0, 7), 'big');
69031};
69032
69033
69034},{"../utils":392,"./256":388}],388:[function(require,module,exports){
69035'use strict';
69036
69037var utils = require('../utils');
69038var common = require('../common');
69039var shaCommon = require('./common');
69040var assert = require('minimalistic-assert');
69041
69042var sum32 = utils.sum32;
69043var sum32_4 = utils.sum32_4;
69044var sum32_5 = utils.sum32_5;
69045var ch32 = shaCommon.ch32;
69046var maj32 = shaCommon.maj32;
69047var s0_256 = shaCommon.s0_256;
69048var s1_256 = shaCommon.s1_256;
69049var g0_256 = shaCommon.g0_256;
69050var g1_256 = shaCommon.g1_256;
69051
69052var BlockHash = common.BlockHash;
69053
69054var sha256_K = [
69055 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
69056 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
69057 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
69058 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
69059 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
69060 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
69061 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
69062 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
69063 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
69064 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
69065 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
69066 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
69067 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
69068 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
69069 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
69070 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
69071];
69072
69073function SHA256() {
69074 if (!(this instanceof SHA256))
69075 return new SHA256();
69076
69077 BlockHash.call(this);
69078 this.h = [
69079 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
69080 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
69081 ];
69082 this.k = sha256_K;
69083 this.W = new Array(64);
69084}
69085utils.inherits(SHA256, BlockHash);
69086module.exports = SHA256;
69087
69088SHA256.blockSize = 512;
69089SHA256.outSize = 256;
69090SHA256.hmacStrength = 192;
69091SHA256.padLength = 64;
69092
69093SHA256.prototype._update = function _update(msg, start) {
69094 var W = this.W;
69095
69096 for (var i = 0; i < 16; i++)
69097 W[i] = msg[start + i];
69098 for (; i < W.length; i++)
69099 W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
69100
69101 var a = this.h[0];
69102 var b = this.h[1];
69103 var c = this.h[2];
69104 var d = this.h[3];
69105 var e = this.h[4];
69106 var f = this.h[5];
69107 var g = this.h[6];
69108 var h = this.h[7];
69109
69110 assert(this.k.length === W.length);
69111 for (i = 0; i < W.length; i++) {
69112 var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
69113 var T2 = sum32(s0_256(a), maj32(a, b, c));
69114 h = g;
69115 g = f;
69116 f = e;
69117 e = sum32(d, T1);
69118 d = c;
69119 c = b;
69120 b = a;
69121 a = sum32(T1, T2);
69122 }
69123
69124 this.h[0] = sum32(this.h[0], a);
69125 this.h[1] = sum32(this.h[1], b);
69126 this.h[2] = sum32(this.h[2], c);
69127 this.h[3] = sum32(this.h[3], d);
69128 this.h[4] = sum32(this.h[4], e);
69129 this.h[5] = sum32(this.h[5], f);
69130 this.h[6] = sum32(this.h[6], g);
69131 this.h[7] = sum32(this.h[7], h);
69132};
69133
69134SHA256.prototype._digest = function digest(enc) {
69135 if (enc === 'hex')
69136 return utils.toHex32(this.h, 'big');
69137 else
69138 return utils.split32(this.h, 'big');
69139};
69140
69141},{"../common":382,"../utils":392,"./common":391,"minimalistic-assert":640}],389:[function(require,module,exports){
69142'use strict';
69143
69144var utils = require('../utils');
69145
69146var SHA512 = require('./512');
69147
69148function SHA384() {
69149 if (!(this instanceof SHA384))
69150 return new SHA384();
69151
69152 SHA512.call(this);
69153 this.h = [
69154 0xcbbb9d5d, 0xc1059ed8,
69155 0x629a292a, 0x367cd507,
69156 0x9159015a, 0x3070dd17,
69157 0x152fecd8, 0xf70e5939,
69158 0x67332667, 0xffc00b31,
69159 0x8eb44a87, 0x68581511,
69160 0xdb0c2e0d, 0x64f98fa7,
69161 0x47b5481d, 0xbefa4fa4 ];
69162}
69163utils.inherits(SHA384, SHA512);
69164module.exports = SHA384;
69165
69166SHA384.blockSize = 1024;
69167SHA384.outSize = 384;
69168SHA384.hmacStrength = 192;
69169SHA384.padLength = 128;
69170
69171SHA384.prototype._digest = function digest(enc) {
69172 if (enc === 'hex')
69173 return utils.toHex32(this.h.slice(0, 12), 'big');
69174 else
69175 return utils.split32(this.h.slice(0, 12), 'big');
69176};
69177
69178},{"../utils":392,"./512":390}],390:[function(require,module,exports){
69179'use strict';
69180
69181var utils = require('../utils');
69182var common = require('../common');
69183var assert = require('minimalistic-assert');
69184
69185var rotr64_hi = utils.rotr64_hi;
69186var rotr64_lo = utils.rotr64_lo;
69187var shr64_hi = utils.shr64_hi;
69188var shr64_lo = utils.shr64_lo;
69189var sum64 = utils.sum64;
69190var sum64_hi = utils.sum64_hi;
69191var sum64_lo = utils.sum64_lo;
69192var sum64_4_hi = utils.sum64_4_hi;
69193var sum64_4_lo = utils.sum64_4_lo;
69194var sum64_5_hi = utils.sum64_5_hi;
69195var sum64_5_lo = utils.sum64_5_lo;
69196
69197var BlockHash = common.BlockHash;
69198
69199var sha512_K = [
69200 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
69201 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
69202 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
69203 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
69204 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
69205 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
69206 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
69207 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
69208 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
69209 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
69210 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
69211 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
69212 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
69213 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
69214 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
69215 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
69216 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
69217 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
69218 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
69219 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
69220 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
69221 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
69222 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
69223 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
69224 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
69225 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
69226 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
69227 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
69228 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
69229 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
69230 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
69231 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
69232 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
69233 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
69234 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
69235 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
69236 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
69237 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
69238 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
69239 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
69240];
69241
69242function SHA512() {
69243 if (!(this instanceof SHA512))
69244 return new SHA512();
69245
69246 BlockHash.call(this);
69247 this.h = [
69248 0x6a09e667, 0xf3bcc908,
69249 0xbb67ae85, 0x84caa73b,
69250 0x3c6ef372, 0xfe94f82b,
69251 0xa54ff53a, 0x5f1d36f1,
69252 0x510e527f, 0xade682d1,
69253 0x9b05688c, 0x2b3e6c1f,
69254 0x1f83d9ab, 0xfb41bd6b,
69255 0x5be0cd19, 0x137e2179 ];
69256 this.k = sha512_K;
69257 this.W = new Array(160);
69258}
69259utils.inherits(SHA512, BlockHash);
69260module.exports = SHA512;
69261
69262SHA512.blockSize = 1024;
69263SHA512.outSize = 512;
69264SHA512.hmacStrength = 192;
69265SHA512.padLength = 128;
69266
69267SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
69268 var W = this.W;
69269
69270 // 32 x 32bit words
69271 for (var i = 0; i < 32; i++)
69272 W[i] = msg[start + i];
69273 for (; i < W.length; i += 2) {
69274 var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
69275 var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
69276 var c1_hi = W[i - 14]; // i - 7
69277 var c1_lo = W[i - 13];
69278 var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
69279 var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
69280 var c3_hi = W[i - 32]; // i - 16
69281 var c3_lo = W[i - 31];
69282
69283 W[i] = sum64_4_hi(
69284 c0_hi, c0_lo,
69285 c1_hi, c1_lo,
69286 c2_hi, c2_lo,
69287 c3_hi, c3_lo);
69288 W[i + 1] = sum64_4_lo(
69289 c0_hi, c0_lo,
69290 c1_hi, c1_lo,
69291 c2_hi, c2_lo,
69292 c3_hi, c3_lo);
69293 }
69294};
69295
69296SHA512.prototype._update = function _update(msg, start) {
69297 this._prepareBlock(msg, start);
69298
69299 var W = this.W;
69300
69301 var ah = this.h[0];
69302 var al = this.h[1];
69303 var bh = this.h[2];
69304 var bl = this.h[3];
69305 var ch = this.h[4];
69306 var cl = this.h[5];
69307 var dh = this.h[6];
69308 var dl = this.h[7];
69309 var eh = this.h[8];
69310 var el = this.h[9];
69311 var fh = this.h[10];
69312 var fl = this.h[11];
69313 var gh = this.h[12];
69314 var gl = this.h[13];
69315 var hh = this.h[14];
69316 var hl = this.h[15];
69317
69318 assert(this.k.length === W.length);
69319 for (var i = 0; i < W.length; i += 2) {
69320 var c0_hi = hh;
69321 var c0_lo = hl;
69322 var c1_hi = s1_512_hi(eh, el);
69323 var c1_lo = s1_512_lo(eh, el);
69324 var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
69325 var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
69326 var c3_hi = this.k[i];
69327 var c3_lo = this.k[i + 1];
69328 var c4_hi = W[i];
69329 var c4_lo = W[i + 1];
69330
69331 var T1_hi = sum64_5_hi(
69332 c0_hi, c0_lo,
69333 c1_hi, c1_lo,
69334 c2_hi, c2_lo,
69335 c3_hi, c3_lo,
69336 c4_hi, c4_lo);
69337 var T1_lo = sum64_5_lo(
69338 c0_hi, c0_lo,
69339 c1_hi, c1_lo,
69340 c2_hi, c2_lo,
69341 c3_hi, c3_lo,
69342 c4_hi, c4_lo);
69343
69344 c0_hi = s0_512_hi(ah, al);
69345 c0_lo = s0_512_lo(ah, al);
69346 c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
69347 c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
69348
69349 var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
69350 var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
69351
69352 hh = gh;
69353 hl = gl;
69354
69355 gh = fh;
69356 gl = fl;
69357
69358 fh = eh;
69359 fl = el;
69360
69361 eh = sum64_hi(dh, dl, T1_hi, T1_lo);
69362 el = sum64_lo(dl, dl, T1_hi, T1_lo);
69363
69364 dh = ch;
69365 dl = cl;
69366
69367 ch = bh;
69368 cl = bl;
69369
69370 bh = ah;
69371 bl = al;
69372
69373 ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
69374 al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
69375 }
69376
69377 sum64(this.h, 0, ah, al);
69378 sum64(this.h, 2, bh, bl);
69379 sum64(this.h, 4, ch, cl);
69380 sum64(this.h, 6, dh, dl);
69381 sum64(this.h, 8, eh, el);
69382 sum64(this.h, 10, fh, fl);
69383 sum64(this.h, 12, gh, gl);
69384 sum64(this.h, 14, hh, hl);
69385};
69386
69387SHA512.prototype._digest = function digest(enc) {
69388 if (enc === 'hex')
69389 return utils.toHex32(this.h, 'big');
69390 else
69391 return utils.split32(this.h, 'big');
69392};
69393
69394function ch64_hi(xh, xl, yh, yl, zh) {
69395 var r = (xh & yh) ^ ((~xh) & zh);
69396 if (r < 0)
69397 r += 0x100000000;
69398 return r;
69399}
69400
69401function ch64_lo(xh, xl, yh, yl, zh, zl) {
69402 var r = (xl & yl) ^ ((~xl) & zl);
69403 if (r < 0)
69404 r += 0x100000000;
69405 return r;
69406}
69407
69408function maj64_hi(xh, xl, yh, yl, zh) {
69409 var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
69410 if (r < 0)
69411 r += 0x100000000;
69412 return r;
69413}
69414
69415function maj64_lo(xh, xl, yh, yl, zh, zl) {
69416 var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
69417 if (r < 0)
69418 r += 0x100000000;
69419 return r;
69420}
69421
69422function s0_512_hi(xh, xl) {
69423 var c0_hi = rotr64_hi(xh, xl, 28);
69424 var c1_hi = rotr64_hi(xl, xh, 2); // 34
69425 var c2_hi = rotr64_hi(xl, xh, 7); // 39
69426
69427 var r = c0_hi ^ c1_hi ^ c2_hi;
69428 if (r < 0)
69429 r += 0x100000000;
69430 return r;
69431}
69432
69433function s0_512_lo(xh, xl) {
69434 var c0_lo = rotr64_lo(xh, xl, 28);
69435 var c1_lo = rotr64_lo(xl, xh, 2); // 34
69436 var c2_lo = rotr64_lo(xl, xh, 7); // 39
69437
69438 var r = c0_lo ^ c1_lo ^ c2_lo;
69439 if (r < 0)
69440 r += 0x100000000;
69441 return r;
69442}
69443
69444function s1_512_hi(xh, xl) {
69445 var c0_hi = rotr64_hi(xh, xl, 14);
69446 var c1_hi = rotr64_hi(xh, xl, 18);
69447 var c2_hi = rotr64_hi(xl, xh, 9); // 41
69448
69449 var r = c0_hi ^ c1_hi ^ c2_hi;
69450 if (r < 0)
69451 r += 0x100000000;
69452 return r;
69453}
69454
69455function s1_512_lo(xh, xl) {
69456 var c0_lo = rotr64_lo(xh, xl, 14);
69457 var c1_lo = rotr64_lo(xh, xl, 18);
69458 var c2_lo = rotr64_lo(xl, xh, 9); // 41
69459
69460 var r = c0_lo ^ c1_lo ^ c2_lo;
69461 if (r < 0)
69462 r += 0x100000000;
69463 return r;
69464}
69465
69466function g0_512_hi(xh, xl) {
69467 var c0_hi = rotr64_hi(xh, xl, 1);
69468 var c1_hi = rotr64_hi(xh, xl, 8);
69469 var c2_hi = shr64_hi(xh, xl, 7);
69470
69471 var r = c0_hi ^ c1_hi ^ c2_hi;
69472 if (r < 0)
69473 r += 0x100000000;
69474 return r;
69475}
69476
69477function g0_512_lo(xh, xl) {
69478 var c0_lo = rotr64_lo(xh, xl, 1);
69479 var c1_lo = rotr64_lo(xh, xl, 8);
69480 var c2_lo = shr64_lo(xh, xl, 7);
69481
69482 var r = c0_lo ^ c1_lo ^ c2_lo;
69483 if (r < 0)
69484 r += 0x100000000;
69485 return r;
69486}
69487
69488function g1_512_hi(xh, xl) {
69489 var c0_hi = rotr64_hi(xh, xl, 19);
69490 var c1_hi = rotr64_hi(xl, xh, 29); // 61
69491 var c2_hi = shr64_hi(xh, xl, 6);
69492
69493 var r = c0_hi ^ c1_hi ^ c2_hi;
69494 if (r < 0)
69495 r += 0x100000000;
69496 return r;
69497}
69498
69499function g1_512_lo(xh, xl) {
69500 var c0_lo = rotr64_lo(xh, xl, 19);
69501 var c1_lo = rotr64_lo(xl, xh, 29); // 61
69502 var c2_lo = shr64_lo(xh, xl, 6);
69503
69504 var r = c0_lo ^ c1_lo ^ c2_lo;
69505 if (r < 0)
69506 r += 0x100000000;
69507 return r;
69508}
69509
69510},{"../common":382,"../utils":392,"minimalistic-assert":640}],391:[function(require,module,exports){
69511'use strict';
69512
69513var utils = require('../utils');
69514var rotr32 = utils.rotr32;
69515
69516function ft_1(s, x, y, z) {
69517 if (s === 0)
69518 return ch32(x, y, z);
69519 if (s === 1 || s === 3)
69520 return p32(x, y, z);
69521 if (s === 2)
69522 return maj32(x, y, z);
69523}
69524exports.ft_1 = ft_1;
69525
69526function ch32(x, y, z) {
69527 return (x & y) ^ ((~x) & z);
69528}
69529exports.ch32 = ch32;
69530
69531function maj32(x, y, z) {
69532 return (x & y) ^ (x & z) ^ (y & z);
69533}
69534exports.maj32 = maj32;
69535
69536function p32(x, y, z) {
69537 return x ^ y ^ z;
69538}
69539exports.p32 = p32;
69540
69541function s0_256(x) {
69542 return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
69543}
69544exports.s0_256 = s0_256;
69545
69546function s1_256(x) {
69547 return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
69548}
69549exports.s1_256 = s1_256;
69550
69551function g0_256(x) {
69552 return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
69553}
69554exports.g0_256 = g0_256;
69555
69556function g1_256(x) {
69557 return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
69558}
69559exports.g1_256 = g1_256;
69560
69561},{"../utils":392}],392:[function(require,module,exports){
69562'use strict';
69563
69564var assert = require('minimalistic-assert');
69565var inherits = require('inherits');
69566
69567exports.inherits = inherits;
69568
69569function isSurrogatePair(msg, i) {
69570 if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
69571 return false;
69572 }
69573 if (i < 0 || i + 1 >= msg.length) {
69574 return false;
69575 }
69576 return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
69577}
69578
69579function toArray(msg, enc) {
69580 if (Array.isArray(msg))
69581 return msg.slice();
69582 if (!msg)
69583 return [];
69584 var res = [];
69585 if (typeof msg === 'string') {
69586 if (!enc) {
69587 // Inspired by stringToUtf8ByteArray() in closure-library by Google
69588 // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
69589 // Apache License 2.0
69590 // https://github.com/google/closure-library/blob/master/LICENSE
69591 var p = 0;
69592 for (var i = 0; i < msg.length; i++) {
69593 var c = msg.charCodeAt(i);
69594 if (c < 128) {
69595 res[p++] = c;
69596 } else if (c < 2048) {
69597 res[p++] = (c >> 6) | 192;
69598 res[p++] = (c & 63) | 128;
69599 } else if (isSurrogatePair(msg, i)) {
69600 c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
69601 res[p++] = (c >> 18) | 240;
69602 res[p++] = ((c >> 12) & 63) | 128;
69603 res[p++] = ((c >> 6) & 63) | 128;
69604 res[p++] = (c & 63) | 128;
69605 } else {
69606 res[p++] = (c >> 12) | 224;
69607 res[p++] = ((c >> 6) & 63) | 128;
69608 res[p++] = (c & 63) | 128;
69609 }
69610 }
69611 } else if (enc === 'hex') {
69612 msg = msg.replace(/[^a-z0-9]+/ig, '');
69613 if (msg.length % 2 !== 0)
69614 msg = '0' + msg;
69615 for (i = 0; i < msg.length; i += 2)
69616 res.push(parseInt(msg[i] + msg[i + 1], 16));
69617 }
69618 } else {
69619 for (i = 0; i < msg.length; i++)
69620 res[i] = msg[i] | 0;
69621 }
69622 return res;
69623}
69624exports.toArray = toArray;
69625
69626function toHex(msg) {
69627 var res = '';
69628 for (var i = 0; i < msg.length; i++)
69629 res += zero2(msg[i].toString(16));
69630 return res;
69631}
69632exports.toHex = toHex;
69633
69634function htonl(w) {
69635 var res = (w >>> 24) |
69636 ((w >>> 8) & 0xff00) |
69637 ((w << 8) & 0xff0000) |
69638 ((w & 0xff) << 24);
69639 return res >>> 0;
69640}
69641exports.htonl = htonl;
69642
69643function toHex32(msg, endian) {
69644 var res = '';
69645 for (var i = 0; i < msg.length; i++) {
69646 var w = msg[i];
69647 if (endian === 'little')
69648 w = htonl(w);
69649 res += zero8(w.toString(16));
69650 }
69651 return res;
69652}
69653exports.toHex32 = toHex32;
69654
69655function zero2(word) {
69656 if (word.length === 1)
69657 return '0' + word;
69658 else
69659 return word;
69660}
69661exports.zero2 = zero2;
69662
69663function zero8(word) {
69664 if (word.length === 7)
69665 return '0' + word;
69666 else if (word.length === 6)
69667 return '00' + word;
69668 else if (word.length === 5)
69669 return '000' + word;
69670 else if (word.length === 4)
69671 return '0000' + word;
69672 else if (word.length === 3)
69673 return '00000' + word;
69674 else if (word.length === 2)
69675 return '000000' + word;
69676 else if (word.length === 1)
69677 return '0000000' + word;
69678 else
69679 return word;
69680}
69681exports.zero8 = zero8;
69682
69683function join32(msg, start, end, endian) {
69684 var len = end - start;
69685 assert(len % 4 === 0);
69686 var res = new Array(len / 4);
69687 for (var i = 0, k = start; i < res.length; i++, k += 4) {
69688 var w;
69689 if (endian === 'big')
69690 w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
69691 else
69692 w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
69693 res[i] = w >>> 0;
69694 }
69695 return res;
69696}
69697exports.join32 = join32;
69698
69699function split32(msg, endian) {
69700 var res = new Array(msg.length * 4);
69701 for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
69702 var m = msg[i];
69703 if (endian === 'big') {
69704 res[k] = m >>> 24;
69705 res[k + 1] = (m >>> 16) & 0xff;
69706 res[k + 2] = (m >>> 8) & 0xff;
69707 res[k + 3] = m & 0xff;
69708 } else {
69709 res[k + 3] = m >>> 24;
69710 res[k + 2] = (m >>> 16) & 0xff;
69711 res[k + 1] = (m >>> 8) & 0xff;
69712 res[k] = m & 0xff;
69713 }
69714 }
69715 return res;
69716}
69717exports.split32 = split32;
69718
69719function rotr32(w, b) {
69720 return (w >>> b) | (w << (32 - b));
69721}
69722exports.rotr32 = rotr32;
69723
69724function rotl32(w, b) {
69725 return (w << b) | (w >>> (32 - b));
69726}
69727exports.rotl32 = rotl32;
69728
69729function sum32(a, b) {
69730 return (a + b) >>> 0;
69731}
69732exports.sum32 = sum32;
69733
69734function sum32_3(a, b, c) {
69735 return (a + b + c) >>> 0;
69736}
69737exports.sum32_3 = sum32_3;
69738
69739function sum32_4(a, b, c, d) {
69740 return (a + b + c + d) >>> 0;
69741}
69742exports.sum32_4 = sum32_4;
69743
69744function sum32_5(a, b, c, d, e) {
69745 return (a + b + c + d + e) >>> 0;
69746}
69747exports.sum32_5 = sum32_5;
69748
69749function sum64(buf, pos, ah, al) {
69750 var bh = buf[pos];
69751 var bl = buf[pos + 1];
69752
69753 var lo = (al + bl) >>> 0;
69754 var hi = (lo < al ? 1 : 0) + ah + bh;
69755 buf[pos] = hi >>> 0;
69756 buf[pos + 1] = lo;
69757}
69758exports.sum64 = sum64;
69759
69760function sum64_hi(ah, al, bh, bl) {
69761 var lo = (al + bl) >>> 0;
69762 var hi = (lo < al ? 1 : 0) + ah + bh;
69763 return hi >>> 0;
69764}
69765exports.sum64_hi = sum64_hi;
69766
69767function sum64_lo(ah, al, bh, bl) {
69768 var lo = al + bl;
69769 return lo >>> 0;
69770}
69771exports.sum64_lo = sum64_lo;
69772
69773function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
69774 var carry = 0;
69775 var lo = al;
69776 lo = (lo + bl) >>> 0;
69777 carry += lo < al ? 1 : 0;
69778 lo = (lo + cl) >>> 0;
69779 carry += lo < cl ? 1 : 0;
69780 lo = (lo + dl) >>> 0;
69781 carry += lo < dl ? 1 : 0;
69782
69783 var hi = ah + bh + ch + dh + carry;
69784 return hi >>> 0;
69785}
69786exports.sum64_4_hi = sum64_4_hi;
69787
69788function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
69789 var lo = al + bl + cl + dl;
69790 return lo >>> 0;
69791}
69792exports.sum64_4_lo = sum64_4_lo;
69793
69794function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
69795 var carry = 0;
69796 var lo = al;
69797 lo = (lo + bl) >>> 0;
69798 carry += lo < al ? 1 : 0;
69799 lo = (lo + cl) >>> 0;
69800 carry += lo < cl ? 1 : 0;
69801 lo = (lo + dl) >>> 0;
69802 carry += lo < dl ? 1 : 0;
69803 lo = (lo + el) >>> 0;
69804 carry += lo < el ? 1 : 0;
69805
69806 var hi = ah + bh + ch + dh + eh + carry;
69807 return hi >>> 0;
69808}
69809exports.sum64_5_hi = sum64_5_hi;
69810
69811function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
69812 var lo = al + bl + cl + dl + el;
69813
69814 return lo >>> 0;
69815}
69816exports.sum64_5_lo = sum64_5_lo;
69817
69818function rotr64_hi(ah, al, num) {
69819 var r = (al << (32 - num)) | (ah >>> num);
69820 return r >>> 0;
69821}
69822exports.rotr64_hi = rotr64_hi;
69823
69824function rotr64_lo(ah, al, num) {
69825 var r = (ah << (32 - num)) | (al >>> num);
69826 return r >>> 0;
69827}
69828exports.rotr64_lo = rotr64_lo;
69829
69830function shr64_hi(ah, al, num) {
69831 return ah >>> num;
69832}
69833exports.shr64_hi = shr64_hi;
69834
69835function shr64_lo(ah, al, num) {
69836 var r = (ah << (32 - num)) | (al >>> num);
69837 return r >>> 0;
69838}
69839exports.shr64_lo = shr64_lo;
69840
69841},{"inherits":396,"minimalistic-assert":640}],393:[function(require,module,exports){
69842'use strict';
69843
69844var hash = require('hash.js');
69845var utils = require('minimalistic-crypto-utils');
69846var assert = require('minimalistic-assert');
69847
69848function HmacDRBG(options) {
69849 if (!(this instanceof HmacDRBG))
69850 return new HmacDRBG(options);
69851 this.hash = options.hash;
69852 this.predResist = !!options.predResist;
69853
69854 this.outLen = this.hash.outSize;
69855 this.minEntropy = options.minEntropy || this.hash.hmacStrength;
69856
69857 this._reseed = null;
69858 this.reseedInterval = null;
69859 this.K = null;
69860 this.V = null;
69861
69862 var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
69863 var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
69864 var pers = utils.toArray(options.pers, options.persEnc || 'hex');
69865 assert(entropy.length >= (this.minEntropy / 8),
69866 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
69867 this._init(entropy, nonce, pers);
69868}
69869module.exports = HmacDRBG;
69870
69871HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
69872 var seed = entropy.concat(nonce).concat(pers);
69873
69874 this.K = new Array(this.outLen / 8);
69875 this.V = new Array(this.outLen / 8);
69876 for (var i = 0; i < this.V.length; i++) {
69877 this.K[i] = 0x00;
69878 this.V[i] = 0x01;
69879 }
69880
69881 this._update(seed);
69882 this._reseed = 1;
69883 this.reseedInterval = 0x1000000000000; // 2^48
69884};
69885
69886HmacDRBG.prototype._hmac = function hmac() {
69887 return new hash.hmac(this.hash, this.K);
69888};
69889
69890HmacDRBG.prototype._update = function update(seed) {
69891 var kmac = this._hmac()
69892 .update(this.V)
69893 .update([ 0x00 ]);
69894 if (seed)
69895 kmac = kmac.update(seed);
69896 this.K = kmac.digest();
69897 this.V = this._hmac().update(this.V).digest();
69898 if (!seed)
69899 return;
69900
69901 this.K = this._hmac()
69902 .update(this.V)
69903 .update([ 0x01 ])
69904 .update(seed)
69905 .digest();
69906 this.V = this._hmac().update(this.V).digest();
69907};
69908
69909HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
69910 // Optional entropy enc
69911 if (typeof entropyEnc !== 'string') {
69912 addEnc = add;
69913 add = entropyEnc;
69914 entropyEnc = null;
69915 }
69916
69917 entropy = utils.toArray(entropy, entropyEnc);
69918 add = utils.toArray(add, addEnc);
69919
69920 assert(entropy.length >= (this.minEntropy / 8),
69921 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
69922
69923 this._update(entropy.concat(add || []));
69924 this._reseed = 1;
69925};
69926
69927HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
69928 if (this._reseed > this.reseedInterval)
69929 throw new Error('Reseed is required');
69930
69931 // Optional encoding
69932 if (typeof enc !== 'string') {
69933 addEnc = add;
69934 add = enc;
69935 enc = null;
69936 }
69937
69938 // Optional additional data
69939 if (add) {
69940 add = utils.toArray(add, addEnc || 'hex');
69941 this._update(add);
69942 }
69943
69944 var temp = [];
69945 while (temp.length < len) {
69946 this.V = this._hmac().update(this.V).digest();
69947 temp = temp.concat(this.V);
69948 }
69949
69950 var res = temp.slice(0, len);
69951 this._update(add);
69952 this._reseed++;
69953 return utils.encode(res, enc);
69954};
69955
69956},{"hash.js":381,"minimalistic-assert":640,"minimalistic-crypto-utils":641}],394:[function(require,module,exports){
69957/**
69958 * Properly escape JSON for usage as an object literal inside of a `<script>` tag.
69959 * JS implementation of http://golang.org/pkg/encoding/json/#HTMLEscape
69960 * More info: http://timelessrepo.com/json-isnt-a-javascript-subset
69961 */
69962
69963'use strict';
69964
69965var ESCAPE_LOOKUP = {
69966 '&': '\\u0026',
69967 '>': '\\u003e',
69968 '<': '\\u003c',
69969 '\u2028': '\\u2028',
69970 '\u2029': '\\u2029'
69971};
69972
69973var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
69974
69975function escaper(match) {
69976 return ESCAPE_LOOKUP[match];
69977}
69978
69979module.exports = function(obj) {
69980 return JSON.stringify(obj).replace(ESCAPE_REGEX, escaper);
69981};
69982
69983/***/
69984
69985var TERMINATORS_LOOKUP = {
69986 '\u2028': '\\u2028',
69987 '\u2029': '\\u2029'
69988};
69989
69990var TERMINATORS_REGEX = /[\u2028\u2029]/g;
69991
69992function sanitizer(match) {
69993 return TERMINATORS_LOOKUP[match];
69994}
69995
69996module.exports.sanitize = function(str) {
69997 return str.replace(TERMINATORS_REGEX, sanitizer);
69998};
69999
70000},{}],395:[function(require,module,exports){
70001exports.read = function (buffer, offset, isLE, mLen, nBytes) {
70002 var e, m
70003 var eLen = (nBytes * 8) - mLen - 1
70004 var eMax = (1 << eLen) - 1
70005 var eBias = eMax >> 1
70006 var nBits = -7
70007 var i = isLE ? (nBytes - 1) : 0
70008 var d = isLE ? -1 : 1
70009 var s = buffer[offset + i]
70010
70011 i += d
70012
70013 e = s & ((1 << (-nBits)) - 1)
70014 s >>= (-nBits)
70015 nBits += eLen
70016 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
70017
70018 m = e & ((1 << (-nBits)) - 1)
70019 e >>= (-nBits)
70020 nBits += mLen
70021 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
70022
70023 if (e === 0) {
70024 e = 1 - eBias
70025 } else if (e === eMax) {
70026 return m ? NaN : ((s ? -1 : 1) * Infinity)
70027 } else {
70028 m = m + Math.pow(2, mLen)
70029 e = e - eBias
70030 }
70031 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
70032}
70033
70034exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
70035 var e, m, c
70036 var eLen = (nBytes * 8) - mLen - 1
70037 var eMax = (1 << eLen) - 1
70038 var eBias = eMax >> 1
70039 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
70040 var i = isLE ? 0 : (nBytes - 1)
70041 var d = isLE ? 1 : -1
70042 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
70043
70044 value = Math.abs(value)
70045
70046 if (isNaN(value) || value === Infinity) {
70047 m = isNaN(value) ? 1 : 0
70048 e = eMax
70049 } else {
70050 e = Math.floor(Math.log(value) / Math.LN2)
70051 if (value * (c = Math.pow(2, -e)) < 1) {
70052 e--
70053 c *= 2
70054 }
70055 if (e + eBias >= 1) {
70056 value += rt / c
70057 } else {
70058 value += rt * Math.pow(2, 1 - eBias)
70059 }
70060 if (value * c >= 2) {
70061 e++
70062 c /= 2
70063 }
70064
70065 if (e + eBias >= eMax) {
70066 m = 0
70067 e = eMax
70068 } else if (e + eBias >= 1) {
70069 m = ((value * c) - 1) * Math.pow(2, mLen)
70070 e = e + eBias
70071 } else {
70072 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
70073 e = 0
70074 }
70075 }
70076
70077 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
70078
70079 e = (e << mLen) | m
70080 eLen += mLen
70081 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
70082
70083 buffer[offset + i - d] |= s * 128
70084}
70085
70086},{}],396:[function(require,module,exports){
70087if (typeof Object.create === 'function') {
70088 // implementation from standard node.js 'util' module
70089 module.exports = function inherits(ctor, superCtor) {
70090 if (superCtor) {
70091 ctor.super_ = superCtor
70092 ctor.prototype = Object.create(superCtor.prototype, {
70093 constructor: {
70094 value: ctor,
70095 enumerable: false,
70096 writable: true,
70097 configurable: true
70098 }
70099 })
70100 }
70101 };
70102} else {
70103 // old school shim for old browsers
70104 module.exports = function inherits(ctor, superCtor) {
70105 if (superCtor) {
70106 ctor.super_ = superCtor
70107 var TempCtor = function () {}
70108 TempCtor.prototype = superCtor.prototype
70109 ctor.prototype = new TempCtor()
70110 ctor.prototype.constructor = ctor
70111 }
70112 }
70113}
70114
70115},{}],397:[function(require,module,exports){
70116/*!
70117 * Determine if an object is a Buffer
70118 *
70119 * @author Feross Aboukhadijeh <https://feross.org>
70120 * @license MIT
70121 */
70122
70123// The _isBuffer check is for Safari 5-7 support, because it's missing
70124// Object.prototype.constructor. Remove this eventually
70125module.exports = function (obj) {
70126 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
70127}
70128
70129function isBuffer (obj) {
70130 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
70131}
70132
70133// For Node v0.10 support. Remove this eventually.
70134function isSlowBuffer (obj) {
70135 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
70136}
70137
70138},{}],398:[function(require,module,exports){
70139/*!
70140 * Determine if an object is a Buffer
70141 *
70142 * @author Feross Aboukhadijeh <https://feross.org>
70143 * @license MIT
70144 */
70145
70146module.exports = function isBuffer (obj) {
70147 return obj != null && obj.constructor != null &&
70148 typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
70149}
70150
70151},{}],399:[function(require,module,exports){
70152/**
70153 * Returns a `Boolean` on whether or not the a `String` starts with '0x'
70154 * @param {String} str the string input value
70155 * @return {Boolean} a boolean if it is or is not hex prefixed
70156 * @throws if the str input is not a string
70157 */
70158module.exports = function isHexPrefixed(str) {
70159 if (typeof str !== 'string') {
70160 throw new Error("[is-hex-prefixed] value must be type 'string', is currently type " + (typeof str) + ", while checking isHexPrefixed.");
70161 }
70162
70163 return str.slice(0, 2) === '0x';
70164}
70165
70166},{}],400:[function(require,module,exports){
70167var toString = {}.toString;
70168
70169module.exports = Array.isArray || function (arr) {
70170 return toString.call(arr) == '[object Array]';
70171};
70172
70173},{}],401:[function(require,module,exports){
70174/*
70175 JavaScript BigInteger library version 0.9.1
70176 http://silentmatt.com/biginteger/
70177
70178 Copyright (c) 2009 Matthew Crumley <email@matthewcrumley.com>
70179 Copyright (c) 2010,2011 by John Tobey <John.Tobey@gmail.com>
70180 Licensed under the MIT license.
70181
70182 Support for arbitrary internal representation base was added by
70183 Vitaly Magerya.
70184*/
70185
70186/*
70187 File: biginteger.js
70188
70189 Exports:
70190
70191 <BigInteger>
70192*/
70193(function(exports) {
70194"use strict";
70195/*
70196 Class: BigInteger
70197 An arbitrarily-large integer.
70198
70199 <BigInteger> objects should be considered immutable. None of the "built-in"
70200 methods modify *this* or their arguments. All properties should be
70201 considered private.
70202
70203 All the methods of <BigInteger> instances can be called "statically". The
70204 static versions are convenient if you don't already have a <BigInteger>
70205 object.
70206
70207 As an example, these calls are equivalent.
70208
70209 > BigInteger(4).multiply(5); // returns BigInteger(20);
70210 > BigInteger.multiply(4, 5); // returns BigInteger(20);
70211
70212 > var a = 42;
70213 > var a = BigInteger.toJSValue("0b101010"); // Not completely useless...
70214*/
70215
70216var CONSTRUCT = {}; // Unique token to call "private" version of constructor
70217
70218/*
70219 Constructor: BigInteger()
70220 Convert a value to a <BigInteger>.
70221
70222 Although <BigInteger()> is the constructor for <BigInteger> objects, it is
70223 best not to call it as a constructor. If *n* is a <BigInteger> object, it is
70224 simply returned as-is. Otherwise, <BigInteger()> is equivalent to <parse>
70225 without a radix argument.
70226
70227 > var n0 = BigInteger(); // Same as <BigInteger.ZERO>
70228 > var n1 = BigInteger("123"); // Create a new <BigInteger> with value 123
70229 > var n2 = BigInteger(123); // Create a new <BigInteger> with value 123
70230 > var n3 = BigInteger(n2); // Return n2, unchanged
70231
70232 The constructor form only takes an array and a sign. *n* must be an
70233 array of numbers in little-endian order, where each digit is between 0
70234 and BigInteger.base. The second parameter sets the sign: -1 for
70235 negative, +1 for positive, or 0 for zero. The array is *not copied and
70236 may be modified*. If the array contains only zeros, the sign parameter
70237 is ignored and is forced to zero.
70238
70239 > new BigInteger([5], -1): create a new BigInteger with value -5
70240
70241 Parameters:
70242
70243 n - Value to convert to a <BigInteger>.
70244
70245 Returns:
70246
70247 A <BigInteger> value.
70248
70249 See Also:
70250
70251 <parse>, <BigInteger>
70252*/
70253function BigInteger(n, s, token) {
70254 if (token !== CONSTRUCT) {
70255 if (n instanceof BigInteger) {
70256 return n;
70257 }
70258 else if (typeof n === "undefined") {
70259 return ZERO;
70260 }
70261 return BigInteger.parse(n);
70262 }
70263
70264 n = n || []; // Provide the nullary constructor for subclasses.
70265 while (n.length && !n[n.length - 1]) {
70266 --n.length;
70267 }
70268 this._d = n;
70269 this._s = n.length ? (s || 1) : 0;
70270}
70271
70272BigInteger._construct = function(n, s) {
70273 return new BigInteger(n, s, CONSTRUCT);
70274};
70275
70276// Base-10 speedup hacks in parse, toString, exp10 and log functions
70277// require base to be a power of 10. 10^7 is the largest such power
70278// that won't cause a precision loss when digits are multiplied.
70279var BigInteger_base = 10000000;
70280var BigInteger_base_log10 = 7;
70281
70282BigInteger.base = BigInteger_base;
70283BigInteger.base_log10 = BigInteger_base_log10;
70284
70285var ZERO = new BigInteger([], 0, CONSTRUCT);
70286// Constant: ZERO
70287// <BigInteger> 0.
70288BigInteger.ZERO = ZERO;
70289
70290var ONE = new BigInteger([1], 1, CONSTRUCT);
70291// Constant: ONE
70292// <BigInteger> 1.
70293BigInteger.ONE = ONE;
70294
70295var M_ONE = new BigInteger(ONE._d, -1, CONSTRUCT);
70296// Constant: M_ONE
70297// <BigInteger> -1.
70298BigInteger.M_ONE = M_ONE;
70299
70300// Constant: _0
70301// Shortcut for <ZERO>.
70302BigInteger._0 = ZERO;
70303
70304// Constant: _1
70305// Shortcut for <ONE>.
70306BigInteger._1 = ONE;
70307
70308/*
70309 Constant: small
70310 Array of <BigIntegers> from 0 to 36.
70311
70312 These are used internally for parsing, but useful when you need a "small"
70313 <BigInteger>.
70314
70315 See Also:
70316
70317 <ZERO>, <ONE>, <_0>, <_1>
70318*/
70319BigInteger.small = [
70320 ZERO,
70321 ONE,
70322 /* Assuming BigInteger_base > 36 */
70323 new BigInteger( [2], 1, CONSTRUCT),
70324 new BigInteger( [3], 1, CONSTRUCT),
70325 new BigInteger( [4], 1, CONSTRUCT),
70326 new BigInteger( [5], 1, CONSTRUCT),
70327 new BigInteger( [6], 1, CONSTRUCT),
70328 new BigInteger( [7], 1, CONSTRUCT),
70329 new BigInteger( [8], 1, CONSTRUCT),
70330 new BigInteger( [9], 1, CONSTRUCT),
70331 new BigInteger([10], 1, CONSTRUCT),
70332 new BigInteger([11], 1, CONSTRUCT),
70333 new BigInteger([12], 1, CONSTRUCT),
70334 new BigInteger([13], 1, CONSTRUCT),
70335 new BigInteger([14], 1, CONSTRUCT),
70336 new BigInteger([15], 1, CONSTRUCT),
70337 new BigInteger([16], 1, CONSTRUCT),
70338 new BigInteger([17], 1, CONSTRUCT),
70339 new BigInteger([18], 1, CONSTRUCT),
70340 new BigInteger([19], 1, CONSTRUCT),
70341 new BigInteger([20], 1, CONSTRUCT),
70342 new BigInteger([21], 1, CONSTRUCT),
70343 new BigInteger([22], 1, CONSTRUCT),
70344 new BigInteger([23], 1, CONSTRUCT),
70345 new BigInteger([24], 1, CONSTRUCT),
70346 new BigInteger([25], 1, CONSTRUCT),
70347 new BigInteger([26], 1, CONSTRUCT),
70348 new BigInteger([27], 1, CONSTRUCT),
70349 new BigInteger([28], 1, CONSTRUCT),
70350 new BigInteger([29], 1, CONSTRUCT),
70351 new BigInteger([30], 1, CONSTRUCT),
70352 new BigInteger([31], 1, CONSTRUCT),
70353 new BigInteger([32], 1, CONSTRUCT),
70354 new BigInteger([33], 1, CONSTRUCT),
70355 new BigInteger([34], 1, CONSTRUCT),
70356 new BigInteger([35], 1, CONSTRUCT),
70357 new BigInteger([36], 1, CONSTRUCT)
70358];
70359
70360// Used for parsing/radix conversion
70361BigInteger.digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
70362
70363/*
70364 Method: toString
70365 Convert a <BigInteger> to a string.
70366
70367 When *base* is greater than 10, letters are upper case.
70368
70369 Parameters:
70370
70371 base - Optional base to represent the number in (default is base 10).
70372 Must be between 2 and 36 inclusive, or an Error will be thrown.
70373
70374 Returns:
70375
70376 The string representation of the <BigInteger>.
70377*/
70378BigInteger.prototype.toString = function(base) {
70379 base = +base || 10;
70380 if (base < 2 || base > 36) {
70381 throw new Error("illegal radix " + base + ".");
70382 }
70383 if (this._s === 0) {
70384 return "0";
70385 }
70386 if (base === 10) {
70387 var str = this._s < 0 ? "-" : "";
70388 str += this._d[this._d.length - 1].toString();
70389 for (var i = this._d.length - 2; i >= 0; i--) {
70390 var group = this._d[i].toString();
70391 while (group.length < BigInteger_base_log10) group = '0' + group;
70392 str += group;
70393 }
70394 return str;
70395 }
70396 else {
70397 var numerals = BigInteger.digits;
70398 base = BigInteger.small[base];
70399 var sign = this._s;
70400
70401 var n = this.abs();
70402 var digits = [];
70403 var digit;
70404
70405 while (n._s !== 0) {
70406 var divmod = n.divRem(base);
70407 n = divmod[0];
70408 digit = divmod[1];
70409 // TODO: This could be changed to unshift instead of reversing at the end.
70410 // Benchmark both to compare speeds.
70411 digits.push(numerals[digit.valueOf()]);
70412 }
70413 return (sign < 0 ? "-" : "") + digits.reverse().join("");
70414 }
70415};
70416
70417// Verify strings for parsing
70418BigInteger.radixRegex = [
70419 /^$/,
70420 /^$/,
70421 /^[01]*$/,
70422 /^[012]*$/,
70423 /^[0-3]*$/,
70424 /^[0-4]*$/,
70425 /^[0-5]*$/,
70426 /^[0-6]*$/,
70427 /^[0-7]*$/,
70428 /^[0-8]*$/,
70429 /^[0-9]*$/,
70430 /^[0-9aA]*$/,
70431 /^[0-9abAB]*$/,
70432 /^[0-9abcABC]*$/,
70433 /^[0-9a-dA-D]*$/,
70434 /^[0-9a-eA-E]*$/,
70435 /^[0-9a-fA-F]*$/,
70436 /^[0-9a-gA-G]*$/,
70437 /^[0-9a-hA-H]*$/,
70438 /^[0-9a-iA-I]*$/,
70439 /^[0-9a-jA-J]*$/,
70440 /^[0-9a-kA-K]*$/,
70441 /^[0-9a-lA-L]*$/,
70442 /^[0-9a-mA-M]*$/,
70443 /^[0-9a-nA-N]*$/,
70444 /^[0-9a-oA-O]*$/,
70445 /^[0-9a-pA-P]*$/,
70446 /^[0-9a-qA-Q]*$/,
70447 /^[0-9a-rA-R]*$/,
70448 /^[0-9a-sA-S]*$/,
70449 /^[0-9a-tA-T]*$/,
70450 /^[0-9a-uA-U]*$/,
70451 /^[0-9a-vA-V]*$/,
70452 /^[0-9a-wA-W]*$/,
70453 /^[0-9a-xA-X]*$/,
70454 /^[0-9a-yA-Y]*$/,
70455 /^[0-9a-zA-Z]*$/
70456];
70457
70458/*
70459 Function: parse
70460 Parse a string into a <BigInteger>.
70461
70462 *base* is optional but, if provided, must be from 2 to 36 inclusive. If
70463 *base* is not provided, it will be guessed based on the leading characters
70464 of *s* as follows:
70465
70466 - "0x" or "0X": *base* = 16
70467 - "0c" or "0C": *base* = 8
70468 - "0b" or "0B": *base* = 2
70469 - else: *base* = 10
70470
70471 If no base is provided, or *base* is 10, the number can be in exponential
70472 form. For example, these are all valid:
70473
70474 > BigInteger.parse("1e9"); // Same as "1000000000"
70475 > BigInteger.parse("1.234*10^3"); // Same as 1234
70476 > BigInteger.parse("56789 * 10 ** -2"); // Same as 567
70477
70478 If any characters fall outside the range defined by the radix, an exception
70479 will be thrown.
70480
70481 Parameters:
70482
70483 s - The string to parse.
70484 base - Optional radix (default is to guess based on *s*).
70485
70486 Returns:
70487
70488 a <BigInteger> instance.
70489*/
70490BigInteger.parse = function(s, base) {
70491 // Expands a number in exponential form to decimal form.
70492 // expandExponential("-13.441*10^5") === "1344100";
70493 // expandExponential("1.12300e-1") === "0.112300";
70494 // expandExponential(1000000000000000000000000000000) === "1000000000000000000000000000000";
70495 function expandExponential(str) {
70496 str = str.replace(/\s*[*xX]\s*10\s*(\^|\*\*)\s*/, "e");
70497
70498 return str.replace(/^([+\-])?(\d+)\.?(\d*)[eE]([+\-]?\d+)$/, function(x, s, n, f, c) {
70499 c = +c;
70500 var l = c < 0;
70501 var i = n.length + c;
70502 x = (l ? n : f).length;
70503 c = ((c = Math.abs(c)) >= x ? c - x + l : 0);
70504 var z = (new Array(c + 1)).join("0");
70505 var r = n + f;
70506 return (s || "") + (l ? r = z + r : r += z).substr(0, i += l ? z.length : 0) + (i < r.length ? "." + r.substr(i) : "");
70507 });
70508 }
70509
70510 s = s.toString();
70511 if (typeof base === "undefined" || +base === 10) {
70512 s = expandExponential(s);
70513 }
70514
70515 var prefixRE;
70516 if (typeof base === "undefined") {
70517 prefixRE = '0[xcb]';
70518 }
70519 else if (base == 16) {
70520 prefixRE = '0x';
70521 }
70522 else if (base == 8) {
70523 prefixRE = '0c';
70524 }
70525 else if (base == 2) {
70526 prefixRE = '0b';
70527 }
70528 else {
70529 prefixRE = '';
70530 }
70531 var parts = new RegExp('^([+\\-]?)(' + prefixRE + ')?([0-9a-z]*)(?:\\.\\d*)?$', 'i').exec(s);
70532 if (parts) {
70533 var sign = parts[1] || "+";
70534 var baseSection = parts[2] || "";
70535 var digits = parts[3] || "";
70536
70537 if (typeof base === "undefined") {
70538 // Guess base
70539 if (baseSection === "0x" || baseSection === "0X") { // Hex
70540 base = 16;
70541 }
70542 else if (baseSection === "0c" || baseSection === "0C") { // Octal
70543 base = 8;
70544 }
70545 else if (baseSection === "0b" || baseSection === "0B") { // Binary
70546 base = 2;
70547 }
70548 else {
70549 base = 10;
70550 }
70551 }
70552 else if (base < 2 || base > 36) {
70553 throw new Error("Illegal radix " + base + ".");
70554 }
70555
70556 base = +base;
70557
70558 // Check for digits outside the range
70559 if (!(BigInteger.radixRegex[base].test(digits))) {
70560 throw new Error("Bad digit for radix " + base);
70561 }
70562
70563 // Strip leading zeros, and convert to array
70564 digits = digits.replace(/^0+/, "").split("");
70565 if (digits.length === 0) {
70566 return ZERO;
70567 }
70568
70569 // Get the sign (we know it's not zero)
70570 sign = (sign === "-") ? -1 : 1;
70571
70572 // Optimize 10
70573 if (base == 10) {
70574 var d = [];
70575 while (digits.length >= BigInteger_base_log10) {
70576 d.push(parseInt(digits.splice(digits.length-BigInteger.base_log10, BigInteger.base_log10).join(''), 10));
70577 }
70578 d.push(parseInt(digits.join(''), 10));
70579 return new BigInteger(d, sign, CONSTRUCT);
70580 }
70581
70582 // Do the conversion
70583 var d = ZERO;
70584 base = BigInteger.small[base];
70585 var small = BigInteger.small;
70586 for (var i = 0; i < digits.length; i++) {
70587 d = d.multiply(base).add(small[parseInt(digits[i], 36)]);
70588 }
70589 return new BigInteger(d._d, sign, CONSTRUCT);
70590 }
70591 else {
70592 throw new Error("Invalid BigInteger format: " + s);
70593 }
70594};
70595
70596/*
70597 Function: add
70598 Add two <BigIntegers>.
70599
70600 Parameters:
70601
70602 n - The number to add to *this*. Will be converted to a <BigInteger>.
70603
70604 Returns:
70605
70606 The numbers added together.
70607
70608 See Also:
70609
70610 <subtract>, <multiply>, <quotient>, <next>
70611*/
70612BigInteger.prototype.add = function(n) {
70613 if (this._s === 0) {
70614 return BigInteger(n);
70615 }
70616
70617 n = BigInteger(n);
70618 if (n._s === 0) {
70619 return this;
70620 }
70621 if (this._s !== n._s) {
70622 n = n.negate();
70623 return this.subtract(n);
70624 }
70625
70626 var a = this._d;
70627 var b = n._d;
70628 var al = a.length;
70629 var bl = b.length;
70630 var sum = new Array(Math.max(al, bl) + 1);
70631 var size = Math.min(al, bl);
70632 var carry = 0;
70633 var digit;
70634
70635 for (var i = 0; i < size; i++) {
70636 digit = a[i] + b[i] + carry;
70637 sum[i] = digit % BigInteger_base;
70638 carry = (digit / BigInteger_base) | 0;
70639 }
70640 if (bl > al) {
70641 a = b;
70642 al = bl;
70643 }
70644 for (i = size; carry && i < al; i++) {
70645 digit = a[i] + carry;
70646 sum[i] = digit % BigInteger_base;
70647 carry = (digit / BigInteger_base) | 0;
70648 }
70649 if (carry) {
70650 sum[i] = carry;
70651 }
70652
70653 for ( ; i < al; i++) {
70654 sum[i] = a[i];
70655 }
70656
70657 return new BigInteger(sum, this._s, CONSTRUCT);
70658};
70659
70660/*
70661 Function: negate
70662 Get the additive inverse of a <BigInteger>.
70663
70664 Returns:
70665
70666 A <BigInteger> with the same magnatude, but with the opposite sign.
70667
70668 See Also:
70669
70670 <abs>
70671*/
70672BigInteger.prototype.negate = function() {
70673 return new BigInteger(this._d, (-this._s) | 0, CONSTRUCT);
70674};
70675
70676/*
70677 Function: abs
70678 Get the absolute value of a <BigInteger>.
70679
70680 Returns:
70681
70682 A <BigInteger> with the same magnatude, but always positive (or zero).
70683
70684 See Also:
70685
70686 <negate>
70687*/
70688BigInteger.prototype.abs = function() {
70689 return (this._s < 0) ? this.negate() : this;
70690};
70691
70692/*
70693 Function: subtract
70694 Subtract two <BigIntegers>.
70695
70696 Parameters:
70697
70698 n - The number to subtract from *this*. Will be converted to a <BigInteger>.
70699
70700 Returns:
70701
70702 The *n* subtracted from *this*.
70703
70704 See Also:
70705
70706 <add>, <multiply>, <quotient>, <prev>
70707*/
70708BigInteger.prototype.subtract = function(n) {
70709 if (this._s === 0) {
70710 return BigInteger(n).negate();
70711 }
70712
70713 n = BigInteger(n);
70714 if (n._s === 0) {
70715 return this;
70716 }
70717 if (this._s !== n._s) {
70718 n = n.negate();
70719 return this.add(n);
70720 }
70721
70722 var m = this;
70723 // negative - negative => -|a| - -|b| => -|a| + |b| => |b| - |a|
70724 if (this._s < 0) {
70725 m = new BigInteger(n._d, 1, CONSTRUCT);
70726 n = new BigInteger(this._d, 1, CONSTRUCT);
70727 }
70728
70729 // Both are positive => a - b
70730 var sign = m.compareAbs(n);
70731 if (sign === 0) {
70732 return ZERO;
70733 }
70734 else if (sign < 0) {
70735 // swap m and n
70736 var t = n;
70737 n = m;
70738 m = t;
70739 }
70740
70741 // a > b
70742 var a = m._d;
70743 var b = n._d;
70744 var al = a.length;
70745 var bl = b.length;
70746 var diff = new Array(al); // al >= bl since a > b
70747 var borrow = 0;
70748 var i;
70749 var digit;
70750
70751 for (i = 0; i < bl; i++) {
70752 digit = a[i] - borrow - b[i];
70753 if (digit < 0) {
70754 digit += BigInteger_base;
70755 borrow = 1;
70756 }
70757 else {
70758 borrow = 0;
70759 }
70760 diff[i] = digit;
70761 }
70762 for (i = bl; i < al; i++) {
70763 digit = a[i] - borrow;
70764 if (digit < 0) {
70765 digit += BigInteger_base;
70766 }
70767 else {
70768 diff[i++] = digit;
70769 break;
70770 }
70771 diff[i] = digit;
70772 }
70773 for ( ; i < al; i++) {
70774 diff[i] = a[i];
70775 }
70776
70777 return new BigInteger(diff, sign, CONSTRUCT);
70778};
70779
70780(function() {
70781 function addOne(n, sign) {
70782 var a = n._d;
70783 var sum = a.slice();
70784 var carry = true;
70785 var i = 0;
70786
70787 while (true) {
70788 var digit = (a[i] || 0) + 1;
70789 sum[i] = digit % BigInteger_base;
70790 if (digit <= BigInteger_base - 1) {
70791 break;
70792 }
70793 ++i;
70794 }
70795
70796 return new BigInteger(sum, sign, CONSTRUCT);
70797 }
70798
70799 function subtractOne(n, sign) {
70800 var a = n._d;
70801 var sum = a.slice();
70802 var borrow = true;
70803 var i = 0;
70804
70805 while (true) {
70806 var digit = (a[i] || 0) - 1;
70807 if (digit < 0) {
70808 sum[i] = digit + BigInteger_base;
70809 }
70810 else {
70811 sum[i] = digit;
70812 break;
70813 }
70814 ++i;
70815 }
70816
70817 return new BigInteger(sum, sign, CONSTRUCT);
70818 }
70819
70820 /*
70821 Function: next
70822 Get the next <BigInteger> (add one).
70823
70824 Returns:
70825
70826 *this* + 1.
70827
70828 See Also:
70829
70830 <add>, <prev>
70831 */
70832 BigInteger.prototype.next = function() {
70833 switch (this._s) {
70834 case 0:
70835 return ONE;
70836 case -1:
70837 return subtractOne(this, -1);
70838 // case 1:
70839 default:
70840 return addOne(this, 1);
70841 }
70842 };
70843
70844 /*
70845 Function: prev
70846 Get the previous <BigInteger> (subtract one).
70847
70848 Returns:
70849
70850 *this* - 1.
70851
70852 See Also:
70853
70854 <next>, <subtract>
70855 */
70856 BigInteger.prototype.prev = function() {
70857 switch (this._s) {
70858 case 0:
70859 return M_ONE;
70860 case -1:
70861 return addOne(this, -1);
70862 // case 1:
70863 default:
70864 return subtractOne(this, 1);
70865 }
70866 };
70867})();
70868
70869/*
70870 Function: compareAbs
70871 Compare the absolute value of two <BigIntegers>.
70872
70873 Calling <compareAbs> is faster than calling <abs> twice, then <compare>.
70874
70875 Parameters:
70876
70877 n - The number to compare to *this*. Will be converted to a <BigInteger>.
70878
70879 Returns:
70880
70881 -1, 0, or +1 if *|this|* is less than, equal to, or greater than *|n|*.
70882
70883 See Also:
70884
70885 <compare>, <abs>
70886*/
70887BigInteger.prototype.compareAbs = function(n) {
70888 if (this === n) {
70889 return 0;
70890 }
70891
70892 if (!(n instanceof BigInteger)) {
70893 if (!isFinite(n)) {
70894 return(isNaN(n) ? n : -1);
70895 }
70896 n = BigInteger(n);
70897 }
70898
70899 if (this._s === 0) {
70900 return (n._s !== 0) ? -1 : 0;
70901 }
70902 if (n._s === 0) {
70903 return 1;
70904 }
70905
70906 var l = this._d.length;
70907 var nl = n._d.length;
70908 if (l < nl) {
70909 return -1;
70910 }
70911 else if (l > nl) {
70912 return 1;
70913 }
70914
70915 var a = this._d;
70916 var b = n._d;
70917 for (var i = l-1; i >= 0; i--) {
70918 if (a[i] !== b[i]) {
70919 return a[i] < b[i] ? -1 : 1;
70920 }
70921 }
70922
70923 return 0;
70924};
70925
70926/*
70927 Function: compare
70928 Compare two <BigIntegers>.
70929
70930 Parameters:
70931
70932 n - The number to compare to *this*. Will be converted to a <BigInteger>.
70933
70934 Returns:
70935
70936 -1, 0, or +1 if *this* is less than, equal to, or greater than *n*.
70937
70938 See Also:
70939
70940 <compareAbs>, <isPositive>, <isNegative>, <isUnit>
70941*/
70942BigInteger.prototype.compare = function(n) {
70943 if (this === n) {
70944 return 0;
70945 }
70946
70947 n = BigInteger(n);
70948
70949 if (this._s === 0) {
70950 return -n._s;
70951 }
70952
70953 if (this._s === n._s) { // both positive or both negative
70954 var cmp = this.compareAbs(n);
70955 return cmp * this._s;
70956 }
70957 else {
70958 return this._s;
70959 }
70960};
70961
70962/*
70963 Function: isUnit
70964 Return true iff *this* is either 1 or -1.
70965
70966 Returns:
70967
70968 true if *this* compares equal to <BigInteger.ONE> or <BigInteger.M_ONE>.
70969
70970 See Also:
70971
70972 <isZero>, <isNegative>, <isPositive>, <compareAbs>, <compare>,
70973 <BigInteger.ONE>, <BigInteger.M_ONE>
70974*/
70975BigInteger.prototype.isUnit = function() {
70976 return this === ONE ||
70977 this === M_ONE ||
70978 (this._d.length === 1 && this._d[0] === 1);
70979};
70980
70981/*
70982 Function: multiply
70983 Multiply two <BigIntegers>.
70984
70985 Parameters:
70986
70987 n - The number to multiply *this* by. Will be converted to a
70988 <BigInteger>.
70989
70990 Returns:
70991
70992 The numbers multiplied together.
70993
70994 See Also:
70995
70996 <add>, <subtract>, <quotient>, <square>
70997*/
70998BigInteger.prototype.multiply = function(n) {
70999 // TODO: Consider adding Karatsuba multiplication for large numbers
71000 if (this._s === 0) {
71001 return ZERO;
71002 }
71003
71004 n = BigInteger(n);
71005 if (n._s === 0) {
71006 return ZERO;
71007 }
71008 if (this.isUnit()) {
71009 if (this._s < 0) {
71010 return n.negate();
71011 }
71012 return n;
71013 }
71014 if (n.isUnit()) {
71015 if (n._s < 0) {
71016 return this.negate();
71017 }
71018 return this;
71019 }
71020 if (this === n) {
71021 return this.square();
71022 }
71023
71024 var r = (this._d.length >= n._d.length);
71025 var a = (r ? this : n)._d; // a will be longer than b
71026 var b = (r ? n : this)._d;
71027 var al = a.length;
71028 var bl = b.length;
71029
71030 var pl = al + bl;
71031 var partial = new Array(pl);
71032 var i;
71033 for (i = 0; i < pl; i++) {
71034 partial[i] = 0;
71035 }
71036
71037 for (i = 0; i < bl; i++) {
71038 var carry = 0;
71039 var bi = b[i];
71040 var jlimit = al + i;
71041 var digit;
71042 for (var j = i; j < jlimit; j++) {
71043 digit = partial[j] + bi * a[j - i] + carry;
71044 carry = (digit / BigInteger_base) | 0;
71045 partial[j] = (digit % BigInteger_base) | 0;
71046 }
71047 if (carry) {
71048 digit = partial[j] + carry;
71049 carry = (digit / BigInteger_base) | 0;
71050 partial[j] = digit % BigInteger_base;
71051 }
71052 }
71053 return new BigInteger(partial, this._s * n._s, CONSTRUCT);
71054};
71055
71056// Multiply a BigInteger by a single-digit native number
71057// Assumes that this and n are >= 0
71058// This is not really intended to be used outside the library itself
71059BigInteger.prototype.multiplySingleDigit = function(n) {
71060 if (n === 0 || this._s === 0) {
71061 return ZERO;
71062 }
71063 if (n === 1) {
71064 return this;
71065 }
71066
71067 var digit;
71068 if (this._d.length === 1) {
71069 digit = this._d[0] * n;
71070 if (digit >= BigInteger_base) {
71071 return new BigInteger([(digit % BigInteger_base)|0,
71072 (digit / BigInteger_base)|0], 1, CONSTRUCT);
71073 }
71074 return new BigInteger([digit], 1, CONSTRUCT);
71075 }
71076
71077 if (n === 2) {
71078 return this.add(this);
71079 }
71080 if (this.isUnit()) {
71081 return new BigInteger([n], 1, CONSTRUCT);
71082 }
71083
71084 var a = this._d;
71085 var al = a.length;
71086
71087 var pl = al + 1;
71088 var partial = new Array(pl);
71089 for (var i = 0; i < pl; i++) {
71090 partial[i] = 0;
71091 }
71092
71093 var carry = 0;
71094 for (var j = 0; j < al; j++) {
71095 digit = n * a[j] + carry;
71096 carry = (digit / BigInteger_base) | 0;
71097 partial[j] = (digit % BigInteger_base) | 0;
71098 }
71099 if (carry) {
71100 partial[j] = carry;
71101 }
71102
71103 return new BigInteger(partial, 1, CONSTRUCT);
71104};
71105
71106/*
71107 Function: square
71108 Multiply a <BigInteger> by itself.
71109
71110 This is slightly faster than regular multiplication, since it removes the
71111 duplicated multiplcations.
71112
71113 Returns:
71114
71115 > this.multiply(this)
71116
71117 See Also:
71118 <multiply>
71119*/
71120BigInteger.prototype.square = function() {
71121 // Normally, squaring a 10-digit number would take 100 multiplications.
71122 // Of these 10 are unique diagonals, of the remaining 90 (100-10), 45 are repeated.
71123 // This procedure saves (N*(N-1))/2 multiplications, (e.g., 45 of 100 multiplies).
71124 // Based on code by Gary Darby, Intellitech Systems Inc., www.DelphiForFun.org
71125
71126 if (this._s === 0) {
71127 return ZERO;
71128 }
71129 if (this.isUnit()) {
71130 return ONE;
71131 }
71132
71133 var digits = this._d;
71134 var length = digits.length;
71135 var imult1 = new Array(length + length + 1);
71136 var product, carry, k;
71137 var i;
71138
71139 // Calculate diagonal
71140 for (i = 0; i < length; i++) {
71141 k = i * 2;
71142 product = digits[i] * digits[i];
71143 carry = (product / BigInteger_base) | 0;
71144 imult1[k] = product % BigInteger_base;
71145 imult1[k + 1] = carry;
71146 }
71147
71148 // Calculate repeating part
71149 for (i = 0; i < length; i++) {
71150 carry = 0;
71151 k = i * 2 + 1;
71152 for (var j = i + 1; j < length; j++, k++) {
71153 product = digits[j] * digits[i] * 2 + imult1[k] + carry;
71154 carry = (product / BigInteger_base) | 0;
71155 imult1[k] = product % BigInteger_base;
71156 }
71157 k = length + i;
71158 var digit = carry + imult1[k];
71159 carry = (digit / BigInteger_base) | 0;
71160 imult1[k] = digit % BigInteger_base;
71161 imult1[k + 1] += carry;
71162 }
71163
71164 return new BigInteger(imult1, 1, CONSTRUCT);
71165};
71166
71167/*
71168 Function: quotient
71169 Divide two <BigIntegers> and truncate towards zero.
71170
71171 <quotient> throws an exception if *n* is zero.
71172
71173 Parameters:
71174
71175 n - The number to divide *this* by. Will be converted to a <BigInteger>.
71176
71177 Returns:
71178
71179 The *this* / *n*, truncated to an integer.
71180
71181 See Also:
71182
71183 <add>, <subtract>, <multiply>, <divRem>, <remainder>
71184*/
71185BigInteger.prototype.quotient = function(n) {
71186 return this.divRem(n)[0];
71187};
71188
71189/*
71190 Function: divide
71191 Deprecated synonym for <quotient>.
71192*/
71193BigInteger.prototype.divide = BigInteger.prototype.quotient;
71194
71195/*
71196 Function: remainder
71197 Calculate the remainder of two <BigIntegers>.
71198
71199 <remainder> throws an exception if *n* is zero.
71200
71201 Parameters:
71202
71203 n - The remainder after *this* is divided *this* by *n*. Will be
71204 converted to a <BigInteger>.
71205
71206 Returns:
71207
71208 *this* % *n*.
71209
71210 See Also:
71211
71212 <divRem>, <quotient>
71213*/
71214BigInteger.prototype.remainder = function(n) {
71215 return this.divRem(n)[1];
71216};
71217
71218/*
71219 Function: divRem
71220 Calculate the integer quotient and remainder of two <BigIntegers>.
71221
71222 <divRem> throws an exception if *n* is zero.
71223
71224 Parameters:
71225
71226 n - The number to divide *this* by. Will be converted to a <BigInteger>.
71227
71228 Returns:
71229
71230 A two-element array containing the quotient and the remainder.
71231
71232 > a.divRem(b)
71233
71234 is exactly equivalent to
71235
71236 > [a.quotient(b), a.remainder(b)]
71237
71238 except it is faster, because they are calculated at the same time.
71239
71240 See Also:
71241
71242 <quotient>, <remainder>
71243*/
71244BigInteger.prototype.divRem = function(n) {
71245 n = BigInteger(n);
71246 if (n._s === 0) {
71247 throw new Error("Divide by zero");
71248 }
71249 if (this._s === 0) {
71250 return [ZERO, ZERO];
71251 }
71252 if (n._d.length === 1) {
71253 return this.divRemSmall(n._s * n._d[0]);
71254 }
71255
71256 // Test for easy cases -- |n1| <= |n2|
71257 switch (this.compareAbs(n)) {
71258 case 0: // n1 == n2
71259 return [this._s === n._s ? ONE : M_ONE, ZERO];
71260 case -1: // |n1| < |n2|
71261 return [ZERO, this];
71262 }
71263
71264 var sign = this._s * n._s;
71265 var a = n.abs();
71266 var b_digits = this._d;
71267 var b_index = b_digits.length;
71268 var digits = n._d.length;
71269 var quot = [];
71270 var guess;
71271
71272 var part = new BigInteger([], 0, CONSTRUCT);
71273
71274 while (b_index) {
71275 part._d.unshift(b_digits[--b_index]);
71276 part = new BigInteger(part._d, 1, CONSTRUCT);
71277
71278 if (part.compareAbs(n) < 0) {
71279 quot.push(0);
71280 continue;
71281 }
71282 if (part._s === 0) {
71283 guess = 0;
71284 }
71285 else {
71286 var xlen = part._d.length, ylen = a._d.length;
71287 var highx = part._d[xlen-1]*BigInteger_base + part._d[xlen-2];
71288 var highy = a._d[ylen-1]*BigInteger_base + a._d[ylen-2];
71289 if (part._d.length > a._d.length) {
71290 // The length of part._d can either match a._d length,
71291 // or exceed it by one.
71292 highx = (highx+1)*BigInteger_base;
71293 }
71294 guess = Math.ceil(highx/highy);
71295 }
71296 do {
71297 var check = a.multiplySingleDigit(guess);
71298 if (check.compareAbs(part) <= 0) {
71299 break;
71300 }
71301 guess--;
71302 } while (guess);
71303
71304 quot.push(guess);
71305 if (!guess) {
71306 continue;
71307 }
71308 var diff = part.subtract(check);
71309 part._d = diff._d.slice();
71310 }
71311
71312 return [new BigInteger(quot.reverse(), sign, CONSTRUCT),
71313 new BigInteger(part._d, this._s, CONSTRUCT)];
71314};
71315
71316// Throws an exception if n is outside of (-BigInteger.base, -1] or
71317// [1, BigInteger.base). It's not necessary to call this, since the
71318// other division functions will call it if they are able to.
71319BigInteger.prototype.divRemSmall = function(n) {
71320 var r;
71321 n = +n;
71322 if (n === 0) {
71323 throw new Error("Divide by zero");
71324 }
71325
71326 var n_s = n < 0 ? -1 : 1;
71327 var sign = this._s * n_s;
71328 n = Math.abs(n);
71329
71330 if (n < 1 || n >= BigInteger_base) {
71331 throw new Error("Argument out of range");
71332 }
71333
71334 if (this._s === 0) {
71335 return [ZERO, ZERO];
71336 }
71337
71338 if (n === 1 || n === -1) {
71339 return [(sign === 1) ? this.abs() : new BigInteger(this._d, sign, CONSTRUCT), ZERO];
71340 }
71341
71342 // 2 <= n < BigInteger_base
71343
71344 // divide a single digit by a single digit
71345 if (this._d.length === 1) {
71346 var q = new BigInteger([(this._d[0] / n) | 0], 1, CONSTRUCT);
71347 r = new BigInteger([(this._d[0] % n) | 0], 1, CONSTRUCT);
71348 if (sign < 0) {
71349 q = q.negate();
71350 }
71351 if (this._s < 0) {
71352 r = r.negate();
71353 }
71354 return [q, r];
71355 }
71356
71357 var digits = this._d.slice();
71358 var quot = new Array(digits.length);
71359 var part = 0;
71360 var diff = 0;
71361 var i = 0;
71362 var guess;
71363
71364 while (digits.length) {
71365 part = part * BigInteger_base + digits[digits.length - 1];
71366 if (part < n) {
71367 quot[i++] = 0;
71368 digits.pop();
71369 diff = BigInteger_base * diff + part;
71370 continue;
71371 }
71372 if (part === 0) {
71373 guess = 0;
71374 }
71375 else {
71376 guess = (part / n) | 0;
71377 }
71378
71379 var check = n * guess;
71380 diff = part - check;
71381 quot[i++] = guess;
71382 if (!guess) {
71383 digits.pop();
71384 continue;
71385 }
71386
71387 digits.pop();
71388 part = diff;
71389 }
71390
71391 r = new BigInteger([diff], 1, CONSTRUCT);
71392 if (this._s < 0) {
71393 r = r.negate();
71394 }
71395 return [new BigInteger(quot.reverse(), sign, CONSTRUCT), r];
71396};
71397
71398/*
71399 Function: isEven
71400 Return true iff *this* is divisible by two.
71401
71402 Note that <BigInteger.ZERO> is even.
71403
71404 Returns:
71405
71406 true if *this* is even, false otherwise.
71407
71408 See Also:
71409
71410 <isOdd>
71411*/
71412BigInteger.prototype.isEven = function() {
71413 var digits = this._d;
71414 return this._s === 0 || digits.length === 0 || (digits[0] % 2) === 0;
71415};
71416
71417/*
71418 Function: isOdd
71419 Return true iff *this* is not divisible by two.
71420
71421 Returns:
71422
71423 true if *this* is odd, false otherwise.
71424
71425 See Also:
71426
71427 <isEven>
71428*/
71429BigInteger.prototype.isOdd = function() {
71430 return !this.isEven();
71431};
71432
71433/*
71434 Function: sign
71435 Get the sign of a <BigInteger>.
71436
71437 Returns:
71438
71439 * -1 if *this* < 0
71440 * 0 if *this* == 0
71441 * +1 if *this* > 0
71442
71443 See Also:
71444
71445 <isZero>, <isPositive>, <isNegative>, <compare>, <BigInteger.ZERO>
71446*/
71447BigInteger.prototype.sign = function() {
71448 return this._s;
71449};
71450
71451/*
71452 Function: isPositive
71453 Return true iff *this* > 0.
71454
71455 Returns:
71456
71457 true if *this*.compare(<BigInteger.ZERO>) == 1.
71458
71459 See Also:
71460
71461 <sign>, <isZero>, <isNegative>, <isUnit>, <compare>, <BigInteger.ZERO>
71462*/
71463BigInteger.prototype.isPositive = function() {
71464 return this._s > 0;
71465};
71466
71467/*
71468 Function: isNegative
71469 Return true iff *this* < 0.
71470
71471 Returns:
71472
71473 true if *this*.compare(<BigInteger.ZERO>) == -1.
71474
71475 See Also:
71476
71477 <sign>, <isPositive>, <isZero>, <isUnit>, <compare>, <BigInteger.ZERO>
71478*/
71479BigInteger.prototype.isNegative = function() {
71480 return this._s < 0;
71481};
71482
71483/*
71484 Function: isZero
71485 Return true iff *this* == 0.
71486
71487 Returns:
71488
71489 true if *this*.compare(<BigInteger.ZERO>) == 0.
71490
71491 See Also:
71492
71493 <sign>, <isPositive>, <isNegative>, <isUnit>, <BigInteger.ZERO>
71494*/
71495BigInteger.prototype.isZero = function() {
71496 return this._s === 0;
71497};
71498
71499/*
71500 Function: exp10
71501 Multiply a <BigInteger> by a power of 10.
71502
71503 This is equivalent to, but faster than
71504
71505 > if (n >= 0) {
71506 > return this.multiply(BigInteger("1e" + n));
71507 > }
71508 > else { // n <= 0
71509 > return this.quotient(BigInteger("1e" + -n));
71510 > }
71511
71512 Parameters:
71513
71514 n - The power of 10 to multiply *this* by. *n* is converted to a
71515 javascipt number and must be no greater than <BigInteger.MAX_EXP>
71516 (0x7FFFFFFF), or an exception will be thrown.
71517
71518 Returns:
71519
71520 *this* * (10 ** *n*), truncated to an integer if necessary.
71521
71522 See Also:
71523
71524 <pow>, <multiply>
71525*/
71526BigInteger.prototype.exp10 = function(n) {
71527 n = +n;
71528 if (n === 0) {
71529 return this;
71530 }
71531 if (Math.abs(n) > Number(MAX_EXP)) {
71532 throw new Error("exponent too large in BigInteger.exp10");
71533 }
71534 // Optimization for this == 0. This also keeps us from having to trim zeros in the positive n case
71535 if (this._s === 0) {
71536 return ZERO;
71537 }
71538 if (n > 0) {
71539 var k = new BigInteger(this._d.slice(), this._s, CONSTRUCT);
71540
71541 for (; n >= BigInteger_base_log10; n -= BigInteger_base_log10) {
71542 k._d.unshift(0);
71543 }
71544 if (n == 0)
71545 return k;
71546 k._s = 1;
71547 k = k.multiplySingleDigit(Math.pow(10, n));
71548 return (this._s < 0 ? k.negate() : k);
71549 } else if (-n >= this._d.length*BigInteger_base_log10) {
71550 return ZERO;
71551 } else {
71552 var k = new BigInteger(this._d.slice(), this._s, CONSTRUCT);
71553
71554 for (n = -n; n >= BigInteger_base_log10; n -= BigInteger_base_log10) {
71555 k._d.shift();
71556 }
71557 return (n == 0) ? k : k.divRemSmall(Math.pow(10, n))[0];
71558 }
71559};
71560
71561/*
71562 Function: pow
71563 Raise a <BigInteger> to a power.
71564
71565 In this implementation, 0**0 is 1.
71566
71567 Parameters:
71568
71569 n - The exponent to raise *this* by. *n* must be no greater than
71570 <BigInteger.MAX_EXP> (0x7FFFFFFF), or an exception will be thrown.
71571
71572 Returns:
71573
71574 *this* raised to the *nth* power.
71575
71576 See Also:
71577
71578 <modPow>
71579*/
71580BigInteger.prototype.pow = function(n) {
71581 if (this.isUnit()) {
71582 if (this._s > 0) {
71583 return this;
71584 }
71585 else {
71586 return BigInteger(n).isOdd() ? this : this.negate();
71587 }
71588 }
71589
71590 n = BigInteger(n);
71591 if (n._s === 0) {
71592 return ONE;
71593 }
71594 else if (n._s < 0) {
71595 if (this._s === 0) {
71596 throw new Error("Divide by zero");
71597 }
71598 else {
71599 return ZERO;
71600 }
71601 }
71602 if (this._s === 0) {
71603 return ZERO;
71604 }
71605 if (n.isUnit()) {
71606 return this;
71607 }
71608
71609 if (n.compareAbs(MAX_EXP) > 0) {
71610 throw new Error("exponent too large in BigInteger.pow");
71611 }
71612 var x = this;
71613 var aux = ONE;
71614 var two = BigInteger.small[2];
71615
71616 while (n.isPositive()) {
71617 if (n.isOdd()) {
71618 aux = aux.multiply(x);
71619 if (n.isUnit()) {
71620 return aux;
71621 }
71622 }
71623 x = x.square();
71624 n = n.quotient(two);
71625 }
71626
71627 return aux;
71628};
71629
71630/*
71631 Function: modPow
71632 Raise a <BigInteger> to a power (mod m).
71633
71634 Because it is reduced by a modulus, <modPow> is not limited by
71635 <BigInteger.MAX_EXP> like <pow>.
71636
71637 Parameters:
71638
71639 exponent - The exponent to raise *this* by. Must be positive.
71640 modulus - The modulus.
71641
71642 Returns:
71643
71644 *this* ^ *exponent* (mod *modulus*).
71645
71646 See Also:
71647
71648 <pow>, <mod>
71649*/
71650BigInteger.prototype.modPow = function(exponent, modulus) {
71651 var result = ONE;
71652 var base = this;
71653
71654 while (exponent.isPositive()) {
71655 if (exponent.isOdd()) {
71656 result = result.multiply(base).remainder(modulus);
71657 }
71658
71659 exponent = exponent.quotient(BigInteger.small[2]);
71660 if (exponent.isPositive()) {
71661 base = base.square().remainder(modulus);
71662 }
71663 }
71664
71665 return result;
71666};
71667
71668/*
71669 Function: log
71670 Get the natural logarithm of a <BigInteger> as a native JavaScript number.
71671
71672 This is equivalent to
71673
71674 > Math.log(this.toJSValue())
71675
71676 but handles values outside of the native number range.
71677
71678 Returns:
71679
71680 log( *this* )
71681
71682 See Also:
71683
71684 <toJSValue>
71685*/
71686BigInteger.prototype.log = function() {
71687 switch (this._s) {
71688 case 0: return -Infinity;
71689 case -1: return NaN;
71690 default: // Fall through.
71691 }
71692
71693 var l = this._d.length;
71694
71695 if (l*BigInteger_base_log10 < 30) {
71696 return Math.log(this.valueOf());
71697 }
71698
71699 var N = Math.ceil(30/BigInteger_base_log10);
71700 var firstNdigits = this._d.slice(l - N);
71701 return Math.log((new BigInteger(firstNdigits, 1, CONSTRUCT)).valueOf()) + (l - N) * Math.log(BigInteger_base);
71702};
71703
71704/*
71705 Function: valueOf
71706 Convert a <BigInteger> to a native JavaScript integer.
71707
71708 This is called automatically by JavaScipt to convert a <BigInteger> to a
71709 native value.
71710
71711 Returns:
71712
71713 > parseInt(this.toString(), 10)
71714
71715 See Also:
71716
71717 <toString>, <toJSValue>
71718*/
71719BigInteger.prototype.valueOf = function() {
71720 return parseInt(this.toString(), 10);
71721};
71722
71723/*
71724 Function: toJSValue
71725 Convert a <BigInteger> to a native JavaScript integer.
71726
71727 This is the same as valueOf, but more explicitly named.
71728
71729 Returns:
71730
71731 > parseInt(this.toString(), 10)
71732
71733 See Also:
71734
71735 <toString>, <valueOf>
71736*/
71737BigInteger.prototype.toJSValue = function() {
71738 return parseInt(this.toString(), 10);
71739};
71740
71741var MAX_EXP = BigInteger(0x7FFFFFFF);
71742// Constant: MAX_EXP
71743// The largest exponent allowed in <pow> and <exp10> (0x7FFFFFFF or 2147483647).
71744BigInteger.MAX_EXP = MAX_EXP;
71745
71746(function() {
71747 function makeUnary(fn) {
71748 return function(a) {
71749 return fn.call(BigInteger(a));
71750 };
71751 }
71752
71753 function makeBinary(fn) {
71754 return function(a, b) {
71755 return fn.call(BigInteger(a), BigInteger(b));
71756 };
71757 }
71758
71759 function makeTrinary(fn) {
71760 return function(a, b, c) {
71761 return fn.call(BigInteger(a), BigInteger(b), BigInteger(c));
71762 };
71763 }
71764
71765 (function() {
71766 var i, fn;
71767 var unary = "toJSValue,isEven,isOdd,sign,isZero,isNegative,abs,isUnit,square,negate,isPositive,toString,next,prev,log".split(",");
71768 var binary = "compare,remainder,divRem,subtract,add,quotient,divide,multiply,pow,compareAbs".split(",");
71769 var trinary = ["modPow"];
71770
71771 for (i = 0; i < unary.length; i++) {
71772 fn = unary[i];
71773 BigInteger[fn] = makeUnary(BigInteger.prototype[fn]);
71774 }
71775
71776 for (i = 0; i < binary.length; i++) {
71777 fn = binary[i];
71778 BigInteger[fn] = makeBinary(BigInteger.prototype[fn]);
71779 }
71780
71781 for (i = 0; i < trinary.length; i++) {
71782 fn = trinary[i];
71783 BigInteger[fn] = makeTrinary(BigInteger.prototype[fn]);
71784 }
71785
71786 BigInteger.exp10 = function(x, n) {
71787 return BigInteger(x).exp10(n);
71788 };
71789 })();
71790})();
71791
71792exports.BigInteger = BigInteger;
71793})(typeof exports !== 'undefined' ? exports : this);
71794
71795},{}],402:[function(require,module,exports){
71796'use strict';
71797
71798Object.defineProperty(exports, "__esModule", {
71799 value: true
71800});
71801exports.Array = undefined;
71802
71803var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
71804
71805var _every = require('lodash/every');
71806
71807var _every2 = _interopRequireDefault(_every);
71808
71809var _each = require('lodash/each');
71810
71811var _each2 = _interopRequireDefault(_each);
71812
71813var _times = require('lodash/times');
71814
71815var _times2 = _interopRequireDefault(_times);
71816
71817var _isArray = require('lodash/isArray');
71818
71819var _isArray2 = _interopRequireDefault(_isArray);
71820
71821var _ioMixin = require('./io-mixin');
71822
71823var _ioMixin2 = _interopRequireDefault(_ioMixin);
71824
71825function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
71826
71827function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
71828
71829var Array = exports.Array = function () {
71830 function Array(childType, length) {
71831 _classCallCheck(this, Array);
71832
71833 this._childType = childType;
71834 this._length = length;
71835 }
71836
71837 _createClass(Array, [{
71838 key: 'read',
71839 value: function read(io) {
71840 var _this = this;
71841
71842 return (0, _times2.default)(this._length, function () {
71843 return _this._childType.read(io);
71844 });
71845 }
71846 }, {
71847 key: 'write',
71848 value: function write(value, io) {
71849 var _this2 = this;
71850
71851 if (!(0, _isArray2.default)(value)) {
71852 throw new Error('XDR Write Error: value is not array');
71853 }
71854
71855 if (value.length !== this._length) {
71856 throw new Error('XDR Write Error: Got array of size ' + value.length + ',' + ('expected ' + this._length));
71857 }
71858
71859 (0, _each2.default)(value, function (child) {
71860 return _this2._childType.write(child, io);
71861 });
71862 }
71863 }, {
71864 key: 'isValid',
71865 value: function isValid(value) {
71866 var _this3 = this;
71867
71868 if (!(0, _isArray2.default)(value)) {
71869 return false;
71870 }
71871 if (value.length !== this._length) {
71872 return false;
71873 }
71874
71875 return (0, _every2.default)(value, function (child) {
71876 return _this3._childType.isValid(child);
71877 });
71878 }
71879 }]);
71880
71881 return Array;
71882}();
71883
71884(0, _ioMixin2.default)(Array.prototype);
71885},{"./io-mixin":412,"lodash/each":595,"lodash/every":597,"lodash/isArray":605,"lodash/times":630}],403:[function(require,module,exports){
71886'use strict';
71887
71888Object.defineProperty(exports, "__esModule", {
71889 value: true
71890});
71891exports.Bool = undefined;
71892
71893var _isBoolean = require('lodash/isBoolean');
71894
71895var _isBoolean2 = _interopRequireDefault(_isBoolean);
71896
71897var _int = require('./int');
71898
71899var _ioMixin = require('./io-mixin');
71900
71901var _ioMixin2 = _interopRequireDefault(_ioMixin);
71902
71903function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
71904
71905var Bool = exports.Bool = {
71906 read: function read(io) {
71907 var value = _int.Int.read(io);
71908
71909 switch (value) {
71910 case 0:
71911 return false;
71912 case 1:
71913 return true;
71914 default:
71915 throw new Error('XDR Read Error: Got ' + value + ' when trying to read a bool');
71916 }
71917 },
71918 write: function write(value, io) {
71919 var intVal = value ? 1 : 0;
71920 return _int.Int.write(intVal, io);
71921 },
71922 isValid: function isValid(value) {
71923 return (0, _isBoolean2.default)(value);
71924 }
71925};
71926
71927(0, _ioMixin2.default)(Bool);
71928},{"./int":411,"./io-mixin":412,"lodash/isBoolean":607}],404:[function(require,module,exports){
71929'use strict';
71930
71931Object.defineProperty(exports, "__esModule", {
71932 value: true
71933});
71934exports.Reference = undefined;
71935
71936var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
71937
71938exports.config = config;
71939
71940var _isUndefined = require('lodash/isUndefined');
71941
71942var _isUndefined2 = _interopRequireDefault(_isUndefined);
71943
71944var _each = require('lodash/each');
71945
71946var _each2 = _interopRequireDefault(_each);
71947
71948var _types = require('./types');
71949
71950var XDRTypes = _interopRequireWildcard(_types);
71951
71952function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
71953
71954function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
71955
71956function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
71957
71958function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
71959
71960function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
71961
71962function config(fn) {
71963 var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
71964
71965 if (fn) {
71966 var builder = new TypeBuilder(types);
71967 fn(builder);
71968 builder.resolve();
71969 }
71970
71971 return types;
71972}
71973
71974var Reference = exports.Reference = function () {
71975 function Reference() {
71976 _classCallCheck(this, Reference);
71977 }
71978
71979 _createClass(Reference, [{
71980 key: 'resolve',
71981
71982 /* jshint unused: false */
71983 value: function resolve() {
71984 throw new Error('implement resolve in child class');
71985 }
71986 }]);
71987
71988 return Reference;
71989}();
71990
71991var SimpleReference = function (_Reference) {
71992 _inherits(SimpleReference, _Reference);
71993
71994 function SimpleReference(name) {
71995 _classCallCheck(this, SimpleReference);
71996
71997 var _this = _possibleConstructorReturn(this, (SimpleReference.__proto__ || Object.getPrototypeOf(SimpleReference)).call(this));
71998
71999 _this.name = name;
72000 return _this;
72001 }
72002
72003 _createClass(SimpleReference, [{
72004 key: 'resolve',
72005 value: function resolve(context) {
72006 var defn = context.definitions[this.name];
72007 return defn.resolve(context);
72008 }
72009 }]);
72010
72011 return SimpleReference;
72012}(Reference);
72013
72014var ArrayReference = function (_Reference2) {
72015 _inherits(ArrayReference, _Reference2);
72016
72017 function ArrayReference(childReference, length) {
72018 var variable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
72019
72020 _classCallCheck(this, ArrayReference);
72021
72022 var _this2 = _possibleConstructorReturn(this, (ArrayReference.__proto__ || Object.getPrototypeOf(ArrayReference)).call(this));
72023
72024 _this2.childReference = childReference;
72025 _this2.length = length;
72026 _this2.variable = variable;
72027 return _this2;
72028 }
72029
72030 _createClass(ArrayReference, [{
72031 key: 'resolve',
72032 value: function resolve(context) {
72033 var resolvedChild = this.childReference;
72034 var length = this.length;
72035
72036 if (resolvedChild instanceof Reference) {
72037 resolvedChild = resolvedChild.resolve(context);
72038 }
72039
72040 if (length instanceof Reference) {
72041 length = length.resolve(context);
72042 }
72043
72044 if (this.variable) {
72045 return new XDRTypes.VarArray(resolvedChild, length);
72046 }
72047 return new XDRTypes.Array(resolvedChild, length);
72048 }
72049 }]);
72050
72051 return ArrayReference;
72052}(Reference);
72053
72054var OptionReference = function (_Reference3) {
72055 _inherits(OptionReference, _Reference3);
72056
72057 function OptionReference(childReference) {
72058 _classCallCheck(this, OptionReference);
72059
72060 var _this3 = _possibleConstructorReturn(this, (OptionReference.__proto__ || Object.getPrototypeOf(OptionReference)).call(this));
72061
72062 _this3.childReference = childReference;
72063 _this3.name = childReference.name;
72064 return _this3;
72065 }
72066
72067 _createClass(OptionReference, [{
72068 key: 'resolve',
72069 value: function resolve(context) {
72070 var resolvedChild = this.childReference;
72071
72072 if (resolvedChild instanceof Reference) {
72073 resolvedChild = resolvedChild.resolve(context);
72074 }
72075
72076 return new XDRTypes.Option(resolvedChild);
72077 }
72078 }]);
72079
72080 return OptionReference;
72081}(Reference);
72082
72083var SizedReference = function (_Reference4) {
72084 _inherits(SizedReference, _Reference4);
72085
72086 function SizedReference(sizedType, length) {
72087 _classCallCheck(this, SizedReference);
72088
72089 var _this4 = _possibleConstructorReturn(this, (SizedReference.__proto__ || Object.getPrototypeOf(SizedReference)).call(this));
72090
72091 _this4.sizedType = sizedType;
72092 _this4.length = length;
72093 return _this4;
72094 }
72095
72096 _createClass(SizedReference, [{
72097 key: 'resolve',
72098 value: function resolve(context) {
72099 var length = this.length;
72100
72101 if (length instanceof Reference) {
72102 length = length.resolve(context);
72103 }
72104
72105 return new this.sizedType(length);
72106 }
72107 }]);
72108
72109 return SizedReference;
72110}(Reference);
72111
72112var Definition = function () {
72113 function Definition(constructor, name, cfg) {
72114 _classCallCheck(this, Definition);
72115
72116 this.constructor = constructor;
72117 this.name = name;
72118 this.config = cfg;
72119 }
72120
72121 // resolve calls the constructor of this definition with the provided context
72122 // and this definitions config values. The definitions constructor should
72123 // populate the final type on `context.results`, and may refer to other
72124 // definitions through `context.definitions`
72125
72126
72127 _createClass(Definition, [{
72128 key: 'resolve',
72129 value: function resolve(context) {
72130 if (this.name in context.results) {
72131 return context.results[this.name];
72132 }
72133
72134 return this.constructor(context, this.name, this.config);
72135 }
72136 }]);
72137
72138 return Definition;
72139}();
72140
72141// let the reference resoltion system do it's thing
72142// the "constructor" for a typedef just returns the resolved value
72143
72144
72145function createTypedef(context, typeName, value) {
72146 if (value instanceof Reference) {
72147 value = value.resolve(context);
72148 }
72149 context.results[typeName] = value;
72150 return value;
72151}
72152
72153function createConst(context, name, value) {
72154 context.results[name] = value;
72155 return value;
72156}
72157
72158var TypeBuilder = function () {
72159 function TypeBuilder(destination) {
72160 _classCallCheck(this, TypeBuilder);
72161
72162 this._destination = destination;
72163 this._definitions = {};
72164 }
72165
72166 _createClass(TypeBuilder, [{
72167 key: 'enum',
72168 value: function _enum(name, members) {
72169 var result = new Definition(XDRTypes.Enum.create, name, members);
72170 this.define(name, result);
72171 }
72172 }, {
72173 key: 'struct',
72174 value: function struct(name, members) {
72175 var result = new Definition(XDRTypes.Struct.create, name, members);
72176 this.define(name, result);
72177 }
72178 }, {
72179 key: 'union',
72180 value: function union(name, cfg) {
72181 var result = new Definition(XDRTypes.Union.create, name, cfg);
72182 this.define(name, result);
72183 }
72184 }, {
72185 key: 'typedef',
72186 value: function typedef(name, cfg) {
72187 var result = new Definition(createTypedef, name, cfg);
72188 this.define(name, result);
72189 }
72190 }, {
72191 key: 'const',
72192 value: function _const(name, cfg) {
72193 var result = new Definition(createConst, name, cfg);
72194 this.define(name, result);
72195 }
72196 }, {
72197 key: 'void',
72198 value: function _void() {
72199 return XDRTypes.Void;
72200 }
72201 }, {
72202 key: 'bool',
72203 value: function bool() {
72204 return XDRTypes.Bool;
72205 }
72206 }, {
72207 key: 'int',
72208 value: function int() {
72209 return XDRTypes.Int;
72210 }
72211 }, {
72212 key: 'hyper',
72213 value: function hyper() {
72214 return XDRTypes.Hyper;
72215 }
72216 }, {
72217 key: 'uint',
72218 value: function uint() {
72219 return XDRTypes.UnsignedInt;
72220 }
72221 }, {
72222 key: 'uhyper',
72223 value: function uhyper() {
72224 return XDRTypes.UnsignedHyper;
72225 }
72226 }, {
72227 key: 'float',
72228 value: function float() {
72229 return XDRTypes.Float;
72230 }
72231 }, {
72232 key: 'double',
72233 value: function double() {
72234 return XDRTypes.Double;
72235 }
72236 }, {
72237 key: 'quadruple',
72238 value: function quadruple() {
72239 return XDRTypes.Quadruple;
72240 }
72241 }, {
72242 key: 'string',
72243 value: function string(length) {
72244 return new SizedReference(XDRTypes.String, length);
72245 }
72246 }, {
72247 key: 'opaque',
72248 value: function opaque(length) {
72249 return new SizedReference(XDRTypes.Opaque, length);
72250 }
72251 }, {
72252 key: 'varOpaque',
72253 value: function varOpaque(length) {
72254 return new SizedReference(XDRTypes.VarOpaque, length);
72255 }
72256 }, {
72257 key: 'array',
72258 value: function array(childType, length) {
72259 return new ArrayReference(childType, length);
72260 }
72261 }, {
72262 key: 'varArray',
72263 value: function varArray(childType, maxLength) {
72264 return new ArrayReference(childType, maxLength, true);
72265 }
72266 }, {
72267 key: 'option',
72268 value: function option(childType) {
72269 return new OptionReference(childType);
72270 }
72271 }, {
72272 key: 'define',
72273 value: function define(name, definition) {
72274 if ((0, _isUndefined2.default)(this._destination[name])) {
72275 this._definitions[name] = definition;
72276 } else {
72277 throw new Error('XDRTypes Error:' + name + ' is already defined');
72278 }
72279 }
72280 }, {
72281 key: 'lookup',
72282 value: function lookup(name) {
72283 return new SimpleReference(name);
72284 }
72285 }, {
72286 key: 'resolve',
72287 value: function resolve() {
72288 var _this5 = this;
72289
72290 (0, _each2.default)(this._definitions, function (defn) {
72291 defn.resolve({
72292 definitions: _this5._definitions,
72293 results: _this5._destination
72294 });
72295 });
72296 }
72297 }]);
72298
72299 return TypeBuilder;
72300}();
72301},{"./types":418,"lodash/each":595,"lodash/isUndefined":621}],405:[function(require,module,exports){
72302(function (Buffer){
72303'use strict';
72304
72305Object.defineProperty(exports, "__esModule", {
72306 value: true
72307});
72308exports.Cursor = undefined;
72309
72310var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
72311
72312var _cursor = require('cursor');
72313
72314var _cursor2 = _interopRequireDefault(_cursor);
72315
72316var _util = require('./util');
72317
72318function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72319
72320function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72321
72322function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
72323
72324function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
72325
72326var Cursor = exports.Cursor = function (_BaseCursor) {
72327 _inherits(Cursor, _BaseCursor);
72328
72329 function Cursor() {
72330 _classCallCheck(this, Cursor);
72331
72332 return _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).apply(this, arguments));
72333 }
72334
72335 _createClass(Cursor, [{
72336 key: 'writeBufferPadded',
72337 value: function writeBufferPadded(buffer) {
72338 var padding = (0, _util.calculatePadding)(buffer.length);
72339 var paddingBuffer = Buffer.alloc(padding);
72340
72341 return this.copyFrom(new Cursor(buffer)).copyFrom(new Cursor(paddingBuffer));
72342 }
72343 }]);
72344
72345 return Cursor;
72346}(_cursor2.default);
72347}).call(this,require("buffer").Buffer)
72348},{"./util":422,"buffer":146,"cursor":244}],406:[function(require,module,exports){
72349'use strict';
72350
72351Object.defineProperty(exports, "__esModule", {
72352 value: true
72353});
72354exports.Double = undefined;
72355
72356var _isNumber = require('lodash/isNumber');
72357
72358var _isNumber2 = _interopRequireDefault(_isNumber);
72359
72360var _ioMixin = require('./io-mixin');
72361
72362var _ioMixin2 = _interopRequireDefault(_ioMixin);
72363
72364function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72365
72366var Double = exports.Double = {
72367 read: function read(io) {
72368 return io.readDoubleBE();
72369 },
72370 write: function write(value, io) {
72371 if (!(0, _isNumber2.default)(value)) {
72372 throw new Error('XDR Write Error: not a number');
72373 }
72374
72375 io.writeDoubleBE(value);
72376 },
72377 isValid: function isValid(value) {
72378 return (0, _isNumber2.default)(value);
72379 }
72380};
72381
72382(0, _ioMixin2.default)(Double);
72383},{"./io-mixin":412,"lodash/isNumber":614}],407:[function(require,module,exports){
72384'use strict';
72385
72386Object.defineProperty(exports, "__esModule", {
72387 value: true
72388});
72389exports.Enum = undefined;
72390
72391var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
72392
72393var _map = require('core-js/library/es6/map');
72394
72395var _map2 = _interopRequireDefault(_map);
72396
72397var _each = require('lodash/each');
72398
72399var _each2 = _interopRequireDefault(_each);
72400
72401var _values = require('lodash/values');
72402
72403var _values2 = _interopRequireDefault(_values);
72404
72405var _int = require('./int');
72406
72407var _ioMixin = require('./io-mixin');
72408
72409var _ioMixin2 = _interopRequireDefault(_ioMixin);
72410
72411function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72412
72413function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
72414
72415function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
72416
72417function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72418
72419var Enum = exports.Enum = function () {
72420 function Enum(name, value) {
72421 _classCallCheck(this, Enum);
72422
72423 this.name = name;
72424 this.value = value;
72425 }
72426
72427 _createClass(Enum, null, [{
72428 key: 'read',
72429 value: function read(io) {
72430 var intVal = _int.Int.read(io);
72431
72432 if (!this._byValue.has(intVal)) {
72433 throw new Error('XDR Read Error: Unknown ' + this.enumName + ' member for value ' + intVal);
72434 }
72435
72436 return this._byValue.get(intVal);
72437 }
72438 }, {
72439 key: 'write',
72440 value: function write(value, io) {
72441 if (!(value instanceof this)) {
72442 throw new Error('XDR Write Error: Unknown ' + value + ' is not a ' + this.enumName);
72443 }
72444
72445 _int.Int.write(value.value, io);
72446 }
72447 }, {
72448 key: 'isValid',
72449 value: function isValid(value) {
72450 return value instanceof this;
72451 }
72452 }, {
72453 key: 'members',
72454 value: function members() {
72455 return this._members;
72456 }
72457 }, {
72458 key: 'values',
72459 value: function values() {
72460 return (0, _values2.default)(this._members);
72461 }
72462 }, {
72463 key: 'fromName',
72464 value: function fromName(name) {
72465 var result = this._members[name];
72466
72467 if (!result) {
72468 throw new Error(name + ' is not a member of ' + this.enumName);
72469 }
72470
72471 return result;
72472 }
72473 }, {
72474 key: 'fromValue',
72475 value: function fromValue(value) {
72476 var result = this._byValue.get(value);
72477
72478 if (!result) {
72479 throw new Error(value + ' is not a value of any member of ' + this.enumName);
72480 }
72481
72482 return result;
72483 }
72484 }, {
72485 key: 'create',
72486 value: function create(context, name, members) {
72487 var ChildEnum = function (_Enum) {
72488 _inherits(ChildEnum, _Enum);
72489
72490 function ChildEnum() {
72491 _classCallCheck(this, ChildEnum);
72492
72493 return _possibleConstructorReturn(this, (ChildEnum.__proto__ || Object.getPrototypeOf(ChildEnum)).apply(this, arguments));
72494 }
72495
72496 return ChildEnum;
72497 }(Enum);
72498
72499 ChildEnum.enumName = name;
72500 context.results[name] = ChildEnum;
72501
72502 ChildEnum._members = {};
72503 ChildEnum._byValue = new _map2.default();
72504
72505 (0, _each2.default)(members, function (value, key) {
72506 var inst = new ChildEnum(key, value);
72507 ChildEnum._members[key] = inst;
72508 ChildEnum._byValue.set(value, inst);
72509 ChildEnum[key] = function () {
72510 return inst;
72511 };
72512 });
72513
72514 return ChildEnum;
72515 }
72516 }]);
72517
72518 return Enum;
72519}();
72520
72521(0, _ioMixin2.default)(Enum);
72522},{"./int":411,"./io-mixin":412,"core-js/library/es6/map":156,"lodash/each":595,"lodash/values":636}],408:[function(require,module,exports){
72523'use strict';
72524
72525Object.defineProperty(exports, "__esModule", {
72526 value: true
72527});
72528exports.Float = undefined;
72529
72530var _isNumber = require('lodash/isNumber');
72531
72532var _isNumber2 = _interopRequireDefault(_isNumber);
72533
72534var _ioMixin = require('./io-mixin');
72535
72536var _ioMixin2 = _interopRequireDefault(_ioMixin);
72537
72538function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72539
72540var Float = exports.Float = {
72541 read: function read(io) {
72542 return io.readFloatBE();
72543 },
72544 write: function write(value, io) {
72545 if (!(0, _isNumber2.default)(value)) {
72546 throw new Error('XDR Write Error: not a number');
72547 }
72548
72549 io.writeFloatBE(value);
72550 },
72551 isValid: function isValid(value) {
72552 return (0, _isNumber2.default)(value);
72553 }
72554};
72555
72556(0, _ioMixin2.default)(Float);
72557},{"./io-mixin":412,"lodash/isNumber":614}],409:[function(require,module,exports){
72558'use strict';
72559
72560Object.defineProperty(exports, "__esModule", {
72561 value: true
72562});
72563exports.Hyper = undefined;
72564
72565var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
72566
72567var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
72568
72569var _long = require('long');
72570
72571var _long2 = _interopRequireDefault(_long);
72572
72573var _ioMixin = require('./io-mixin');
72574
72575var _ioMixin2 = _interopRequireDefault(_ioMixin);
72576
72577function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72578
72579function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72580
72581function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
72582
72583function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
72584
72585var Hyper = exports.Hyper = function (_Long) {
72586 _inherits(Hyper, _Long);
72587
72588 _createClass(Hyper, null, [{
72589 key: 'read',
72590 value: function read(io) {
72591 var high = io.readInt32BE();
72592 var low = io.readInt32BE();
72593 return this.fromBits(low, high);
72594 }
72595 }, {
72596 key: 'write',
72597 value: function write(value, io) {
72598 if (!(value instanceof this)) {
72599 throw new Error('XDR Write Error: ' + value + ' is not a Hyper');
72600 }
72601
72602 io.writeInt32BE(value.high);
72603 io.writeInt32BE(value.low);
72604 }
72605 }, {
72606 key: 'fromString',
72607 value: function fromString(string) {
72608 if (!/^-?\d+$/.test(string)) {
72609 throw new Error('Invalid hyper string: ' + string);
72610 }
72611 var result = _get(Hyper.__proto__ || Object.getPrototypeOf(Hyper), 'fromString', this).call(this, string, false);
72612 return new this(result.low, result.high);
72613 }
72614 }, {
72615 key: 'fromBits',
72616 value: function fromBits(low, high) {
72617 var result = _get(Hyper.__proto__ || Object.getPrototypeOf(Hyper), 'fromBits', this).call(this, low, high, false);
72618 return new this(result.low, result.high);
72619 }
72620 }, {
72621 key: 'isValid',
72622 value: function isValid(value) {
72623 return value instanceof this;
72624 }
72625 }]);
72626
72627 function Hyper(low, high) {
72628 _classCallCheck(this, Hyper);
72629
72630 return _possibleConstructorReturn(this, (Hyper.__proto__ || Object.getPrototypeOf(Hyper)).call(this, low, high, false));
72631 }
72632
72633 return Hyper;
72634}(_long2.default);
72635
72636(0, _ioMixin2.default)(Hyper);
72637
72638Hyper.MAX_VALUE = new Hyper(_long2.default.MAX_VALUE.low, _long2.default.MAX_VALUE.high);
72639Hyper.MIN_VALUE = new Hyper(_long2.default.MIN_VALUE.low, _long2.default.MIN_VALUE.high);
72640},{"./io-mixin":412,"long":426}],410:[function(require,module,exports){
72641'use strict';
72642
72643Object.defineProperty(exports, "__esModule", {
72644 value: true
72645});
72646
72647var _types = require('./types');
72648
72649Object.keys(_types).forEach(function (key) {
72650 if (key === "default" || key === "__esModule") return;
72651 Object.defineProperty(exports, key, {
72652 enumerable: true,
72653 get: function get() {
72654 return _types[key];
72655 }
72656 });
72657});
72658
72659var _config = require('./config');
72660
72661Object.keys(_config).forEach(function (key) {
72662 if (key === "default" || key === "__esModule") return;
72663 Object.defineProperty(exports, key, {
72664 enumerable: true,
72665 get: function get() {
72666 return _config[key];
72667 }
72668 });
72669});
72670},{"./config":404,"./types":418}],411:[function(require,module,exports){
72671'use strict';
72672
72673Object.defineProperty(exports, "__esModule", {
72674 value: true
72675});
72676exports.Int = undefined;
72677
72678var _isNumber = require('lodash/isNumber');
72679
72680var _isNumber2 = _interopRequireDefault(_isNumber);
72681
72682var _ioMixin = require('./io-mixin');
72683
72684var _ioMixin2 = _interopRequireDefault(_ioMixin);
72685
72686function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72687
72688var Int = exports.Int = {
72689 read: function read(io) {
72690 return io.readInt32BE();
72691 },
72692 write: function write(value, io) {
72693 if (!(0, _isNumber2.default)(value)) {
72694 throw new Error('XDR Write Error: not a number');
72695 }
72696
72697 if (Math.floor(value) !== value) {
72698 throw new Error('XDR Write Error: not an integer');
72699 }
72700
72701 io.writeInt32BE(value);
72702 },
72703 isValid: function isValid(value) {
72704 if (!(0, _isNumber2.default)(value)) {
72705 return false;
72706 }
72707 if (Math.floor(value) !== value) {
72708 return false;
72709 }
72710
72711 return value >= Int.MIN_VALUE && value <= Int.MAX_VALUE;
72712 }
72713};
72714
72715Int.MAX_VALUE = Math.pow(2, 31) - 1;
72716Int.MIN_VALUE = -Math.pow(2, 31);
72717
72718(0, _ioMixin2.default)(Int);
72719},{"./io-mixin":412,"lodash/isNumber":614}],412:[function(require,module,exports){
72720(function (Buffer){
72721'use strict';
72722
72723Object.defineProperty(exports, "__esModule", {
72724 value: true
72725});
72726exports.default = includeIoMixin;
72727
72728var _extend = require('lodash/extend');
72729
72730var _extend2 = _interopRequireDefault(_extend);
72731
72732var _isFunction = require('lodash/isFunction');
72733
72734var _isFunction2 = _interopRequireDefault(_isFunction);
72735
72736var _cursor = require('./cursor');
72737
72738function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72739
72740// TODO: build a system to grow a buffer as we write to it
72741var BUFFER_SIZE = Math.pow(2, 16);
72742
72743var staticMethods = {
72744 toXDR: function toXDR(val) {
72745 var cursor = new _cursor.Cursor(BUFFER_SIZE);
72746 this.write(val, cursor);
72747 var bytesWritten = cursor.tell();
72748 cursor.rewind();
72749
72750 return cursor.slice(bytesWritten).buffer();
72751 },
72752 fromXDR: function fromXDR(input) {
72753 var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'raw';
72754
72755 var buffer = void 0;
72756 switch (format) {
72757 case 'raw':
72758 buffer = input;
72759 break;
72760 case 'hex':
72761 buffer = Buffer.from(input, 'hex');
72762 break;
72763 case 'base64':
72764 buffer = Buffer.from(input, 'base64');
72765 break;
72766 default:
72767 throw new Error('Invalid format ' + format + ', must be "raw", "hex", "base64"');
72768 }
72769
72770 var cursor = new _cursor.Cursor(buffer);
72771 var result = this.read(cursor);
72772
72773 // TODO: error out if the entire buffer isn't consumed
72774
72775 return result;
72776 }
72777};
72778
72779var instanceMethods = {
72780 toXDR: function toXDR() {
72781 var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'raw';
72782
72783 var buffer = this.constructor.toXDR(this);
72784 switch (format) {
72785 case 'raw':
72786 return buffer;
72787 case 'hex':
72788 return buffer.toString('hex');
72789 case 'base64':
72790 return buffer.toString('base64');
72791 default:
72792 throw new Error('Invalid format ' + format + ', must be "raw", "hex", "base64"');
72793 }
72794 }
72795};
72796
72797function includeIoMixin(obj) {
72798 (0, _extend2.default)(obj, staticMethods);
72799
72800 if ((0, _isFunction2.default)(obj)) {
72801 (0, _extend2.default)(obj.prototype, instanceMethods);
72802 }
72803}
72804}).call(this,require("buffer").Buffer)
72805},{"./cursor":405,"buffer":146,"lodash/extend":598,"lodash/isFunction":610}],413:[function(require,module,exports){
72806(function (Buffer){
72807'use strict';
72808
72809Object.defineProperty(exports, "__esModule", {
72810 value: true
72811});
72812exports.Opaque = undefined;
72813
72814var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
72815
72816var _util = require('./util');
72817
72818var _ioMixin = require('./io-mixin');
72819
72820var _ioMixin2 = _interopRequireDefault(_ioMixin);
72821
72822function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72823
72824function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72825
72826var Opaque = exports.Opaque = function () {
72827 function Opaque(length) {
72828 _classCallCheck(this, Opaque);
72829
72830 this._length = length;
72831 this._padding = (0, _util.calculatePadding)(length);
72832 }
72833
72834 _createClass(Opaque, [{
72835 key: 'read',
72836 value: function read(io) {
72837 var result = io.slice(this._length);
72838 (0, _util.slicePadding)(io, this._padding);
72839 return result.buffer();
72840 }
72841 }, {
72842 key: 'write',
72843 value: function write(value, io) {
72844 if (value.length !== this._length) {
72845 throw new Error('XDR Write Error: Got ' + value.length + ' bytes, expected ' + this._length);
72846 }
72847
72848 io.writeBufferPadded(value);
72849 }
72850 }, {
72851 key: 'isValid',
72852 value: function isValid(value) {
72853 return Buffer.isBuffer(value) && value.length === this._length;
72854 }
72855 }]);
72856
72857 return Opaque;
72858}();
72859
72860(0, _ioMixin2.default)(Opaque.prototype);
72861}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")})
72862},{"../../insert-module-globals/node_modules/is-buffer/index.js":397,"./io-mixin":412,"./util":422}],414:[function(require,module,exports){
72863'use strict';
72864
72865Object.defineProperty(exports, "__esModule", {
72866 value: true
72867});
72868exports.Option = undefined;
72869
72870var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
72871
72872var _isNull = require('lodash/isNull');
72873
72874var _isNull2 = _interopRequireDefault(_isNull);
72875
72876var _isUndefined = require('lodash/isUndefined');
72877
72878var _isUndefined2 = _interopRequireDefault(_isUndefined);
72879
72880var _bool = require('./bool');
72881
72882var _ioMixin = require('./io-mixin');
72883
72884var _ioMixin2 = _interopRequireDefault(_ioMixin);
72885
72886function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72887
72888function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72889
72890var Option = exports.Option = function () {
72891 function Option(childType) {
72892 _classCallCheck(this, Option);
72893
72894 this._childType = childType;
72895 }
72896
72897 _createClass(Option, [{
72898 key: 'read',
72899 value: function read(io) {
72900 if (_bool.Bool.read(io)) {
72901 return this._childType.read(io);
72902 }
72903
72904 return undefined;
72905 }
72906 }, {
72907 key: 'write',
72908 value: function write(value, io) {
72909 var isPresent = !((0, _isNull2.default)(value) || (0, _isUndefined2.default)(value));
72910
72911 _bool.Bool.write(isPresent, io);
72912
72913 if (isPresent) {
72914 this._childType.write(value, io);
72915 }
72916 }
72917 }, {
72918 key: 'isValid',
72919 value: function isValid(value) {
72920 if ((0, _isNull2.default)(value)) {
72921 return true;
72922 }
72923 if ((0, _isUndefined2.default)(value)) {
72924 return true;
72925 }
72926
72927 return this._childType.isValid(value);
72928 }
72929 }]);
72930
72931 return Option;
72932}();
72933
72934(0, _ioMixin2.default)(Option.prototype);
72935},{"./bool":403,"./io-mixin":412,"lodash/isNull":613,"lodash/isUndefined":621}],415:[function(require,module,exports){
72936'use strict';
72937
72938Object.defineProperty(exports, "__esModule", {
72939 value: true
72940});
72941exports.Quadruple = undefined;
72942
72943var _ioMixin = require('./io-mixin');
72944
72945var _ioMixin2 = _interopRequireDefault(_ioMixin);
72946
72947function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72948
72949var Quadruple = exports.Quadruple = {
72950 /* jshint unused: false */
72951
72952 read: function read() {
72953 throw new Error('XDR Read Error: quadruple not supported');
72954 },
72955 write: function write() {
72956 throw new Error('XDR Write Error: quadruple not supported');
72957 },
72958 isValid: function isValid() {
72959 return false;
72960 }
72961};
72962
72963(0, _ioMixin2.default)(Quadruple);
72964},{"./io-mixin":412}],416:[function(require,module,exports){
72965(function (Buffer){
72966'use strict';
72967
72968Object.defineProperty(exports, "__esModule", {
72969 value: true
72970});
72971exports.String = undefined;
72972
72973var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
72974
72975var _isString = require('lodash/isString');
72976
72977var _isString2 = _interopRequireDefault(_isString);
72978
72979var _isArray = require('lodash/isArray');
72980
72981var _isArray2 = _interopRequireDefault(_isArray);
72982
72983var _int = require('./int');
72984
72985var _unsignedInt = require('./unsigned-int');
72986
72987var _util = require('./util');
72988
72989var _ioMixin = require('./io-mixin');
72990
72991var _ioMixin2 = _interopRequireDefault(_ioMixin);
72992
72993function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72994
72995function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72996
72997var String = exports.String = function () {
72998 function String() {
72999 var maxLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _unsignedInt.UnsignedInt.MAX_VALUE;
73000
73001 _classCallCheck(this, String);
73002
73003 this._maxLength = maxLength;
73004 }
73005
73006 _createClass(String, [{
73007 key: 'read',
73008 value: function read(io) {
73009 var length = _int.Int.read(io);
73010
73011 if (length > this._maxLength) {
73012 throw new Error('XDR Read Error: Saw ' + length + ' length String,' + ('max allowed is ' + this._maxLength));
73013 }
73014 var padding = (0, _util.calculatePadding)(length);
73015 var result = io.slice(length);
73016 (0, _util.slicePadding)(io, padding);
73017 return result.buffer();
73018 }
73019 }, {
73020 key: 'readString',
73021 value: function readString(io) {
73022 return this.read(io).toString('utf8');
73023 }
73024 }, {
73025 key: 'write',
73026 value: function write(value, io) {
73027 if (value.length > this._maxLength) {
73028 throw new Error('XDR Write Error: Got ' + value.length + ' bytes,' + ('max allows is ' + this._maxLength));
73029 }
73030
73031 var buffer = void 0;
73032 if ((0, _isString2.default)(value)) {
73033 buffer = Buffer.from(value, 'utf8');
73034 } else {
73035 buffer = Buffer.from(value);
73036 }
73037
73038 _int.Int.write(buffer.length, io);
73039 io.writeBufferPadded(buffer);
73040 }
73041 }, {
73042 key: 'isValid',
73043 value: function isValid(value) {
73044 var buffer = void 0;
73045 if ((0, _isString2.default)(value)) {
73046 buffer = Buffer.from(value, 'utf8');
73047 } else if ((0, _isArray2.default)(value) || Buffer.isBuffer(value)) {
73048 buffer = Buffer.from(value);
73049 } else {
73050 return false;
73051 }
73052 return buffer.length <= this._maxLength;
73053 }
73054 }]);
73055
73056 return String;
73057}();
73058
73059(0, _ioMixin2.default)(String.prototype);
73060}).call(this,require("buffer").Buffer)
73061},{"./int":411,"./io-mixin":412,"./unsigned-int":421,"./util":422,"buffer":146,"lodash/isArray":605,"lodash/isString":618}],417:[function(require,module,exports){
73062'use strict';
73063
73064Object.defineProperty(exports, "__esModule", {
73065 value: true
73066});
73067exports.Struct = undefined;
73068
73069var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
73070
73071var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
73072
73073var _each = require('lodash/each');
73074
73075var _each2 = _interopRequireDefault(_each);
73076
73077var _map = require('lodash/map');
73078
73079var _map2 = _interopRequireDefault(_map);
73080
73081var _isUndefined = require('lodash/isUndefined');
73082
73083var _isUndefined2 = _interopRequireDefault(_isUndefined);
73084
73085var _fromPairs = require('lodash/fromPairs');
73086
73087var _fromPairs2 = _interopRequireDefault(_fromPairs);
73088
73089var _config = require('./config');
73090
73091var _ioMixin = require('./io-mixin');
73092
73093var _ioMixin2 = _interopRequireDefault(_ioMixin);
73094
73095function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73096
73097function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
73098
73099function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
73100
73101function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
73102
73103var Struct = exports.Struct = function () {
73104 function Struct(attributes) {
73105 _classCallCheck(this, Struct);
73106
73107 this._attributes = attributes || {};
73108 }
73109
73110 _createClass(Struct, null, [{
73111 key: 'read',
73112 value: function read(io) {
73113 var fields = (0, _map2.default)(this._fields, function (field) {
73114 var _field = _slicedToArray(field, 2),
73115 name = _field[0],
73116 type = _field[1];
73117
73118 var value = type.read(io);
73119 return [name, value];
73120 });
73121
73122 return new this((0, _fromPairs2.default)(fields));
73123 }
73124 }, {
73125 key: 'write',
73126 value: function write(value, io) {
73127 if (!(value instanceof this)) {
73128 throw new Error('XDR Write Error: ' + value + ' is not a ' + this.structName);
73129 }
73130 (0, _each2.default)(this._fields, function (field) {
73131 var _field2 = _slicedToArray(field, 2),
73132 name = _field2[0],
73133 type = _field2[1];
73134
73135 var attribute = value._attributes[name];
73136 type.write(attribute, io);
73137 });
73138 }
73139 }, {
73140 key: 'isValid',
73141 value: function isValid(value) {
73142 return value instanceof this;
73143 }
73144 }, {
73145 key: 'create',
73146 value: function create(context, name, fields) {
73147 var ChildStruct = function (_Struct) {
73148 _inherits(ChildStruct, _Struct);
73149
73150 function ChildStruct() {
73151 _classCallCheck(this, ChildStruct);
73152
73153 return _possibleConstructorReturn(this, (ChildStruct.__proto__ || Object.getPrototypeOf(ChildStruct)).apply(this, arguments));
73154 }
73155
73156 return ChildStruct;
73157 }(Struct);
73158
73159 ChildStruct.structName = name;
73160
73161 context.results[name] = ChildStruct;
73162
73163 ChildStruct._fields = fields.map(function (_ref) {
73164 var _ref2 = _slicedToArray(_ref, 2),
73165 fieldName = _ref2[0],
73166 field = _ref2[1];
73167
73168 if (field instanceof _config.Reference) {
73169 field = field.resolve(context);
73170 }
73171
73172 return [fieldName, field];
73173 });
73174
73175 (0, _each2.default)(ChildStruct._fields, function (field) {
73176 var _field3 = _slicedToArray(field, 1),
73177 fieldName = _field3[0];
73178
73179 ChildStruct.prototype[fieldName] = getReadOrWriteAttribute(fieldName);
73180 });
73181
73182 return ChildStruct;
73183 }
73184 }]);
73185
73186 return Struct;
73187}();
73188
73189(0, _ioMixin2.default)(Struct);
73190
73191function getReadOrWriteAttribute(name) {
73192 return function readOrWriteAttribute(value) {
73193 if (!(0, _isUndefined2.default)(value)) {
73194 this._attributes[name] = value;
73195 }
73196
73197 return this._attributes[name];
73198 };
73199}
73200},{"./config":404,"./io-mixin":412,"lodash/each":595,"lodash/fromPairs":600,"lodash/isUndefined":621,"lodash/map":624}],418:[function(require,module,exports){
73201'use strict';
73202
73203Object.defineProperty(exports, "__esModule", {
73204 value: true
73205});
73206
73207var _int = require('./int');
73208
73209Object.keys(_int).forEach(function (key) {
73210 if (key === "default" || key === "__esModule") return;
73211 Object.defineProperty(exports, key, {
73212 enumerable: true,
73213 get: function get() {
73214 return _int[key];
73215 }
73216 });
73217});
73218
73219var _hyper = require('./hyper');
73220
73221Object.keys(_hyper).forEach(function (key) {
73222 if (key === "default" || key === "__esModule") return;
73223 Object.defineProperty(exports, key, {
73224 enumerable: true,
73225 get: function get() {
73226 return _hyper[key];
73227 }
73228 });
73229});
73230
73231var _unsignedInt = require('./unsigned-int');
73232
73233Object.keys(_unsignedInt).forEach(function (key) {
73234 if (key === "default" || key === "__esModule") return;
73235 Object.defineProperty(exports, key, {
73236 enumerable: true,
73237 get: function get() {
73238 return _unsignedInt[key];
73239 }
73240 });
73241});
73242
73243var _unsignedHyper = require('./unsigned-hyper');
73244
73245Object.keys(_unsignedHyper).forEach(function (key) {
73246 if (key === "default" || key === "__esModule") return;
73247 Object.defineProperty(exports, key, {
73248 enumerable: true,
73249 get: function get() {
73250 return _unsignedHyper[key];
73251 }
73252 });
73253});
73254
73255var _float = require('./float');
73256
73257Object.keys(_float).forEach(function (key) {
73258 if (key === "default" || key === "__esModule") return;
73259 Object.defineProperty(exports, key, {
73260 enumerable: true,
73261 get: function get() {
73262 return _float[key];
73263 }
73264 });
73265});
73266
73267var _double = require('./double');
73268
73269Object.keys(_double).forEach(function (key) {
73270 if (key === "default" || key === "__esModule") return;
73271 Object.defineProperty(exports, key, {
73272 enumerable: true,
73273 get: function get() {
73274 return _double[key];
73275 }
73276 });
73277});
73278
73279var _quadruple = require('./quadruple');
73280
73281Object.keys(_quadruple).forEach(function (key) {
73282 if (key === "default" || key === "__esModule") return;
73283 Object.defineProperty(exports, key, {
73284 enumerable: true,
73285 get: function get() {
73286 return _quadruple[key];
73287 }
73288 });
73289});
73290
73291var _bool = require('./bool');
73292
73293Object.keys(_bool).forEach(function (key) {
73294 if (key === "default" || key === "__esModule") return;
73295 Object.defineProperty(exports, key, {
73296 enumerable: true,
73297 get: function get() {
73298 return _bool[key];
73299 }
73300 });
73301});
73302
73303var _string = require('./string');
73304
73305Object.keys(_string).forEach(function (key) {
73306 if (key === "default" || key === "__esModule") return;
73307 Object.defineProperty(exports, key, {
73308 enumerable: true,
73309 get: function get() {
73310 return _string[key];
73311 }
73312 });
73313});
73314
73315var _opaque = require('./opaque');
73316
73317Object.keys(_opaque).forEach(function (key) {
73318 if (key === "default" || key === "__esModule") return;
73319 Object.defineProperty(exports, key, {
73320 enumerable: true,
73321 get: function get() {
73322 return _opaque[key];
73323 }
73324 });
73325});
73326
73327var _varOpaque = require('./var-opaque');
73328
73329Object.keys(_varOpaque).forEach(function (key) {
73330 if (key === "default" || key === "__esModule") return;
73331 Object.defineProperty(exports, key, {
73332 enumerable: true,
73333 get: function get() {
73334 return _varOpaque[key];
73335 }
73336 });
73337});
73338
73339var _array = require('./array');
73340
73341Object.keys(_array).forEach(function (key) {
73342 if (key === "default" || key === "__esModule") return;
73343 Object.defineProperty(exports, key, {
73344 enumerable: true,
73345 get: function get() {
73346 return _array[key];
73347 }
73348 });
73349});
73350
73351var _varArray = require('./var-array');
73352
73353Object.keys(_varArray).forEach(function (key) {
73354 if (key === "default" || key === "__esModule") return;
73355 Object.defineProperty(exports, key, {
73356 enumerable: true,
73357 get: function get() {
73358 return _varArray[key];
73359 }
73360 });
73361});
73362
73363var _option = require('./option');
73364
73365Object.keys(_option).forEach(function (key) {
73366 if (key === "default" || key === "__esModule") return;
73367 Object.defineProperty(exports, key, {
73368 enumerable: true,
73369 get: function get() {
73370 return _option[key];
73371 }
73372 });
73373});
73374
73375var _void = require('./void');
73376
73377Object.keys(_void).forEach(function (key) {
73378 if (key === "default" || key === "__esModule") return;
73379 Object.defineProperty(exports, key, {
73380 enumerable: true,
73381 get: function get() {
73382 return _void[key];
73383 }
73384 });
73385});
73386
73387var _enum = require('./enum');
73388
73389Object.keys(_enum).forEach(function (key) {
73390 if (key === "default" || key === "__esModule") return;
73391 Object.defineProperty(exports, key, {
73392 enumerable: true,
73393 get: function get() {
73394 return _enum[key];
73395 }
73396 });
73397});
73398
73399var _struct = require('./struct');
73400
73401Object.keys(_struct).forEach(function (key) {
73402 if (key === "default" || key === "__esModule") return;
73403 Object.defineProperty(exports, key, {
73404 enumerable: true,
73405 get: function get() {
73406 return _struct[key];
73407 }
73408 });
73409});
73410
73411var _union = require('./union');
73412
73413Object.keys(_union).forEach(function (key) {
73414 if (key === "default" || key === "__esModule") return;
73415 Object.defineProperty(exports, key, {
73416 enumerable: true,
73417 get: function get() {
73418 return _union[key];
73419 }
73420 });
73421});
73422},{"./array":402,"./bool":403,"./double":406,"./enum":407,"./float":408,"./hyper":409,"./int":411,"./opaque":413,"./option":414,"./quadruple":415,"./string":416,"./struct":417,"./union":419,"./unsigned-hyper":420,"./unsigned-int":421,"./var-array":423,"./var-opaque":424,"./void":425}],419:[function(require,module,exports){
73423'use strict';
73424
73425Object.defineProperty(exports, "__esModule", {
73426 value: true
73427});
73428exports.Union = undefined;
73429
73430var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
73431
73432var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
73433
73434var _map = require('core-js/library/es6/map');
73435
73436var _map2 = _interopRequireDefault(_map);
73437
73438var _each = require('lodash/each');
73439
73440var _each2 = _interopRequireDefault(_each);
73441
73442var _isUndefined = require('lodash/isUndefined');
73443
73444var _isUndefined2 = _interopRequireDefault(_isUndefined);
73445
73446var _isString = require('lodash/isString');
73447
73448var _isString2 = _interopRequireDefault(_isString);
73449
73450var _void = require('./void');
73451
73452var _config = require('./config');
73453
73454var _ioMixin = require('./io-mixin');
73455
73456var _ioMixin2 = _interopRequireDefault(_ioMixin);
73457
73458function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73459
73460function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
73461
73462function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
73463
73464function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
73465
73466var Union = exports.Union = function () {
73467 function Union(aSwitch, value) {
73468 _classCallCheck(this, Union);
73469
73470 this.set(aSwitch, value);
73471 }
73472
73473 _createClass(Union, [{
73474 key: 'set',
73475 value: function set(aSwitch, value) {
73476 if ((0, _isString2.default)(aSwitch)) {
73477 aSwitch = this.constructor._switchOn.fromName(aSwitch);
73478 }
73479
73480 this._switch = aSwitch;
73481 this._arm = this.constructor.armForSwitch(this._switch);
73482 this._armType = this.constructor.armTypeForArm(this._arm);
73483 this._value = value;
73484 }
73485 }, {
73486 key: 'get',
73487 value: function get() {
73488 var armName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._arm;
73489
73490 if (this._arm !== _void.Void && this._arm !== armName) {
73491 throw new Error(armName + ' not set');
73492 }
73493 return this._value;
73494 }
73495 }, {
73496 key: 'switch',
73497 value: function _switch() {
73498 return this._switch;
73499 }
73500 }, {
73501 key: 'arm',
73502 value: function arm() {
73503 return this._arm;
73504 }
73505 }, {
73506 key: 'armType',
73507 value: function armType() {
73508 return this._armType;
73509 }
73510 }, {
73511 key: 'value',
73512 value: function value() {
73513 return this._value;
73514 }
73515 }], [{
73516 key: 'armForSwitch',
73517 value: function armForSwitch(aSwitch) {
73518 if (this._switches.has(aSwitch)) {
73519 return this._switches.get(aSwitch);
73520 }
73521 if (this._defaultArm) {
73522 return this._defaultArm;
73523 }
73524 throw new Error('Bad union switch: ' + aSwitch);
73525 }
73526 }, {
73527 key: 'armTypeForArm',
73528 value: function armTypeForArm(arm) {
73529 if (arm === _void.Void) {
73530 return _void.Void;
73531 }
73532 return this._arms[arm];
73533 }
73534 }, {
73535 key: 'read',
73536 value: function read(io) {
73537 var aSwitch = this._switchOn.read(io);
73538 var arm = this.armForSwitch(aSwitch);
73539 var armType = this.armTypeForArm(arm);
73540 var value = void 0;
73541 if (!(0, _isUndefined2.default)(armType)) {
73542 value = armType.read(io);
73543 } else {
73544 value = arm.read(io);
73545 }
73546 return new this(aSwitch, value);
73547 }
73548 }, {
73549 key: 'write',
73550 value: function write(value, io) {
73551 if (!(value instanceof this)) {
73552 throw new Error('XDR Write Error: ' + value + ' is not a ' + this.unionName);
73553 }
73554
73555 this._switchOn.write(value.switch(), io);
73556 value.armType().write(value.value(), io);
73557 }
73558 }, {
73559 key: 'isValid',
73560 value: function isValid(value) {
73561 return value instanceof this;
73562 }
73563 }, {
73564 key: 'create',
73565 value: function create(context, name, config) {
73566 var ChildUnion = function (_Union) {
73567 _inherits(ChildUnion, _Union);
73568
73569 function ChildUnion() {
73570 _classCallCheck(this, ChildUnion);
73571
73572 return _possibleConstructorReturn(this, (ChildUnion.__proto__ || Object.getPrototypeOf(ChildUnion)).apply(this, arguments));
73573 }
73574
73575 return ChildUnion;
73576 }(Union);
73577
73578 ChildUnion.unionName = name;
73579 context.results[name] = ChildUnion;
73580
73581 if (config.switchOn instanceof _config.Reference) {
73582 ChildUnion._switchOn = config.switchOn.resolve(context);
73583 } else {
73584 ChildUnion._switchOn = config.switchOn;
73585 }
73586
73587 ChildUnion._switches = new _map2.default();
73588 ChildUnion._arms = {};
73589
73590 (0, _each2.default)(config.arms, function (value, armsName) {
73591 if (value instanceof _config.Reference) {
73592 value = value.resolve(context);
73593 }
73594
73595 ChildUnion._arms[armsName] = value;
73596 });
73597
73598 // resolve default arm
73599 var defaultArm = config.defaultArm;
73600 if (defaultArm instanceof _config.Reference) {
73601 defaultArm = defaultArm.resolve(context);
73602 }
73603
73604 ChildUnion._defaultArm = defaultArm;
73605
73606 (0, _each2.default)(config.switches, function (_ref) {
73607 var _ref2 = _slicedToArray(_ref, 2),
73608 aSwitch = _ref2[0],
73609 armName = _ref2[1];
73610
73611 if ((0, _isString2.default)(aSwitch)) {
73612 aSwitch = ChildUnion._switchOn.fromName(aSwitch);
73613 }
73614
73615 ChildUnion._switches.set(aSwitch, armName);
73616 });
73617
73618 // add enum-based helpers
73619 // NOTE: we don't have good notation for "is a subclass of XDR.Enum",
73620 // and so we use the following check (does _switchOn have a `values`
73621 // attribute) to approximate the intent.
73622 if (!(0, _isUndefined2.default)(ChildUnion._switchOn.values)) {
73623 (0, _each2.default)(ChildUnion._switchOn.values(), function (aSwitch) {
73624 // Add enum-based constrocutors
73625 ChildUnion[aSwitch.name] = function (value) {
73626 return new ChildUnion(aSwitch, value);
73627 };
73628
73629 // Add enum-based "set" helpers
73630 // (note: normally I'd use an arrow function but the use of `this`
73631 // here might rely on it NOT being an arrow function. so just keep it.)
73632 ChildUnion.prototype[aSwitch.name] = function set(value) {
73633 return this.set(aSwitch, value);
73634 };
73635 });
73636 }
73637
73638 // Add arm accessor helpers
73639 (0, _each2.default)(ChildUnion._arms, function (type, armsName) {
73640 if (type === _void.Void) {
73641 return;
73642 }
73643
73644 ChildUnion.prototype[armsName] = function get() {
73645 return this.get(armsName);
73646 };
73647 });
73648
73649 return ChildUnion;
73650 }
73651 }]);
73652
73653 return Union;
73654}();
73655
73656(0, _ioMixin2.default)(Union);
73657},{"./config":404,"./io-mixin":412,"./void":425,"core-js/library/es6/map":156,"lodash/each":595,"lodash/isString":618,"lodash/isUndefined":621}],420:[function(require,module,exports){
73658'use strict';
73659
73660Object.defineProperty(exports, "__esModule", {
73661 value: true
73662});
73663exports.UnsignedHyper = undefined;
73664
73665var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
73666
73667var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
73668
73669var _long = require('long');
73670
73671var _long2 = _interopRequireDefault(_long);
73672
73673var _ioMixin = require('./io-mixin');
73674
73675var _ioMixin2 = _interopRequireDefault(_ioMixin);
73676
73677function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73678
73679function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
73680
73681function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
73682
73683function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
73684
73685var UnsignedHyper = exports.UnsignedHyper = function (_Long) {
73686 _inherits(UnsignedHyper, _Long);
73687
73688 _createClass(UnsignedHyper, null, [{
73689 key: 'read',
73690 value: function read(io) {
73691 var high = io.readInt32BE();
73692 var low = io.readInt32BE();
73693 return this.fromBits(low, high);
73694 }
73695 }, {
73696 key: 'write',
73697 value: function write(value, io) {
73698 if (!(value instanceof this)) {
73699 throw new Error('XDR Write Error: ' + value + ' is not an UnsignedHyper');
73700 }
73701
73702 io.writeInt32BE(value.high);
73703 io.writeInt32BE(value.low);
73704 }
73705 }, {
73706 key: 'fromString',
73707 value: function fromString(string) {
73708 if (!/^\d+$/.test(string)) {
73709 throw new Error('Invalid hyper string: ' + string);
73710 }
73711 var result = _get(UnsignedHyper.__proto__ || Object.getPrototypeOf(UnsignedHyper), 'fromString', this).call(this, string, true);
73712 return new this(result.low, result.high);
73713 }
73714 }, {
73715 key: 'fromBits',
73716 value: function fromBits(low, high) {
73717 var result = _get(UnsignedHyper.__proto__ || Object.getPrototypeOf(UnsignedHyper), 'fromBits', this).call(this, low, high, true);
73718 return new this(result.low, result.high);
73719 }
73720 }, {
73721 key: 'isValid',
73722 value: function isValid(value) {
73723 return value instanceof this;
73724 }
73725 }]);
73726
73727 function UnsignedHyper(low, high) {
73728 _classCallCheck(this, UnsignedHyper);
73729
73730 return _possibleConstructorReturn(this, (UnsignedHyper.__proto__ || Object.getPrototypeOf(UnsignedHyper)).call(this, low, high, true));
73731 }
73732
73733 return UnsignedHyper;
73734}(_long2.default);
73735
73736(0, _ioMixin2.default)(UnsignedHyper);
73737
73738UnsignedHyper.MAX_VALUE = new UnsignedHyper(_long2.default.MAX_UNSIGNED_VALUE.low, _long2.default.MAX_UNSIGNED_VALUE.high);
73739
73740UnsignedHyper.MIN_VALUE = new UnsignedHyper(_long2.default.MIN_VALUE.low, _long2.default.MIN_VALUE.high);
73741},{"./io-mixin":412,"long":426}],421:[function(require,module,exports){
73742'use strict';
73743
73744Object.defineProperty(exports, "__esModule", {
73745 value: true
73746});
73747exports.UnsignedInt = undefined;
73748
73749var _isNumber = require('lodash/isNumber');
73750
73751var _isNumber2 = _interopRequireDefault(_isNumber);
73752
73753var _ioMixin = require('./io-mixin');
73754
73755var _ioMixin2 = _interopRequireDefault(_ioMixin);
73756
73757function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73758
73759var UnsignedInt = exports.UnsignedInt = {
73760 read: function read(io) {
73761 return io.readUInt32BE();
73762 },
73763 write: function write(value, io) {
73764 if (!(0, _isNumber2.default)(value)) {
73765 throw new Error('XDR Write Error: not a number');
73766 }
73767
73768 if (Math.floor(value) !== value) {
73769 throw new Error('XDR Write Error: not an integer');
73770 }
73771
73772 if (value < 0) {
73773 throw new Error('XDR Write Error: negative number ' + value);
73774 }
73775
73776 io.writeUInt32BE(value);
73777 },
73778 isValid: function isValid(value) {
73779 if (!(0, _isNumber2.default)(value)) {
73780 return false;
73781 }
73782 if (Math.floor(value) !== value) {
73783 return false;
73784 }
73785
73786 return value >= UnsignedInt.MIN_VALUE && value <= UnsignedInt.MAX_VALUE;
73787 }
73788};
73789
73790UnsignedInt.MAX_VALUE = Math.pow(2, 32) - 1;
73791UnsignedInt.MIN_VALUE = 0;
73792
73793(0, _ioMixin2.default)(UnsignedInt);
73794},{"./io-mixin":412,"lodash/isNumber":614}],422:[function(require,module,exports){
73795'use strict';
73796
73797Object.defineProperty(exports, "__esModule", {
73798 value: true
73799});
73800exports.calculatePadding = calculatePadding;
73801exports.slicePadding = slicePadding;
73802
73803var _every = require('lodash/every');
73804
73805var _every2 = _interopRequireDefault(_every);
73806
73807function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73808
73809function calculatePadding(length) {
73810 switch (length % 4) {
73811 case 0:
73812 return 0;
73813 case 1:
73814 return 3;
73815 case 2:
73816 return 2;
73817 case 3:
73818 return 1;
73819 default:
73820 return null;
73821 }
73822}
73823function slicePadding(io, length) {
73824 var padding = io.slice(length);
73825 var allZero = (0, _every2.default)(padding.buffer(), function (byte) {
73826 return byte === 0;
73827 });
73828
73829 if (allZero !== true) {
73830 throw new Error('XDR Read Error: invalid padding');
73831 }
73832}
73833},{"lodash/every":597}],423:[function(require,module,exports){
73834'use strict';
73835
73836Object.defineProperty(exports, "__esModule", {
73837 value: true
73838});
73839exports.VarArray = undefined;
73840
73841var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
73842
73843var _every = require('lodash/every');
73844
73845var _every2 = _interopRequireDefault(_every);
73846
73847var _each = require('lodash/each');
73848
73849var _each2 = _interopRequireDefault(_each);
73850
73851var _times = require('lodash/times');
73852
73853var _times2 = _interopRequireDefault(_times);
73854
73855var _isArray = require('lodash/isArray');
73856
73857var _isArray2 = _interopRequireDefault(_isArray);
73858
73859var _unsignedInt = require('./unsigned-int');
73860
73861var _int = require('./int');
73862
73863var _ioMixin = require('./io-mixin');
73864
73865var _ioMixin2 = _interopRequireDefault(_ioMixin);
73866
73867function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73868
73869function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
73870
73871var VarArray = exports.VarArray = function () {
73872 function VarArray(childType) {
73873 var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _unsignedInt.UnsignedInt.MAX_VALUE;
73874
73875 _classCallCheck(this, VarArray);
73876
73877 this._childType = childType;
73878 this._maxLength = maxLength;
73879 }
73880
73881 _createClass(VarArray, [{
73882 key: 'read',
73883 value: function read(io) {
73884 var _this = this;
73885
73886 var length = _int.Int.read(io);
73887
73888 if (length > this._maxLength) {
73889 throw new Error('XDR Read Error: Saw ' + length + ' length VarArray,' + ('max allowed is ' + this._maxLength));
73890 }
73891
73892 return (0, _times2.default)(length, function () {
73893 return _this._childType.read(io);
73894 });
73895 }
73896 }, {
73897 key: 'write',
73898 value: function write(value, io) {
73899 var _this2 = this;
73900
73901 if (!(0, _isArray2.default)(value)) {
73902 throw new Error('XDR Write Error: value is not array');
73903 }
73904
73905 if (value.length > this._maxLength) {
73906 throw new Error('XDR Write Error: Got array of size ' + value.length + ',' + ('max allowed is ' + this._maxLength));
73907 }
73908
73909 _int.Int.write(value.length, io);
73910 (0, _each2.default)(value, function (child) {
73911 return _this2._childType.write(child, io);
73912 });
73913 }
73914 }, {
73915 key: 'isValid',
73916 value: function isValid(value) {
73917 var _this3 = this;
73918
73919 if (!(0, _isArray2.default)(value)) {
73920 return false;
73921 }
73922 if (value.length > this._maxLength) {
73923 return false;
73924 }
73925
73926 return (0, _every2.default)(value, function (child) {
73927 return _this3._childType.isValid(child);
73928 });
73929 }
73930 }]);
73931
73932 return VarArray;
73933}();
73934
73935(0, _ioMixin2.default)(VarArray.prototype);
73936},{"./int":411,"./io-mixin":412,"./unsigned-int":421,"lodash/each":595,"lodash/every":597,"lodash/isArray":605,"lodash/times":630}],424:[function(require,module,exports){
73937(function (Buffer){
73938'use strict';
73939
73940Object.defineProperty(exports, "__esModule", {
73941 value: true
73942});
73943exports.VarOpaque = undefined;
73944
73945var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
73946
73947var _int = require('./int');
73948
73949var _unsignedInt = require('./unsigned-int');
73950
73951var _util = require('./util');
73952
73953var _ioMixin = require('./io-mixin');
73954
73955var _ioMixin2 = _interopRequireDefault(_ioMixin);
73956
73957function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73958
73959function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
73960
73961var VarOpaque = exports.VarOpaque = function () {
73962 function VarOpaque() {
73963 var maxLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _unsignedInt.UnsignedInt.MAX_VALUE;
73964
73965 _classCallCheck(this, VarOpaque);
73966
73967 this._maxLength = maxLength;
73968 }
73969
73970 _createClass(VarOpaque, [{
73971 key: 'read',
73972 value: function read(io) {
73973 var length = _int.Int.read(io);
73974
73975 if (length > this._maxLength) {
73976 throw new Error('XDR Read Error: Saw ' + length + ' length VarOpaque,' + ('max allowed is ' + this._maxLength));
73977 }
73978 var padding = (0, _util.calculatePadding)(length);
73979 var result = io.slice(length);
73980 (0, _util.slicePadding)(io, padding);
73981 return result.buffer();
73982 }
73983 }, {
73984 key: 'write',
73985 value: function write(value, io) {
73986 if (value.length > this._maxLength) {
73987 throw new Error('XDR Write Error: Got ' + value.length + ' bytes,' + ('max allows is ' + this._maxLength));
73988 }
73989 _int.Int.write(value.length, io);
73990 io.writeBufferPadded(value);
73991 }
73992 }, {
73993 key: 'isValid',
73994 value: function isValid(value) {
73995 return Buffer.isBuffer(value) && value.length <= this._maxLength;
73996 }
73997 }]);
73998
73999 return VarOpaque;
74000}();
74001
74002(0, _ioMixin2.default)(VarOpaque.prototype);
74003}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")})
74004},{"../../insert-module-globals/node_modules/is-buffer/index.js":397,"./int":411,"./io-mixin":412,"./unsigned-int":421,"./util":422}],425:[function(require,module,exports){
74005'use strict';
74006
74007Object.defineProperty(exports, "__esModule", {
74008 value: true
74009});
74010exports.Void = undefined;
74011
74012var _isUndefined = require('lodash/isUndefined');
74013
74014var _isUndefined2 = _interopRequireDefault(_isUndefined);
74015
74016var _ioMixin = require('./io-mixin');
74017
74018var _ioMixin2 = _interopRequireDefault(_ioMixin);
74019
74020function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
74021
74022var Void = exports.Void = {
74023 /* jshint unused: false */
74024
74025 read: function read() {
74026 return undefined;
74027 },
74028 write: function write(value) {
74029 if (!(0, _isUndefined2.default)(value)) {
74030 throw new Error('XDR Write Error: trying to write value to a void slot');
74031 }
74032 },
74033 isValid: function isValid(value) {
74034 return (0, _isUndefined2.default)(value);
74035 }
74036};
74037
74038(0, _ioMixin2.default)(Void);
74039},{"./io-mixin":412,"lodash/isUndefined":621}],426:[function(require,module,exports){
74040/*\r
74041 Copyright 2013 Daniel Wirtz <dcode@dcode.io>\r
74042 Copyright 2009 The Closure Library Authors. All Rights Reserved.\r
74043\r
74044 Licensed under the Apache License, Version 2.0 (the "License");\r
74045 you may not use this file except in compliance with the License.\r
74046 You may obtain a copy of the License at\r
74047\r
74048 http://www.apache.org/licenses/LICENSE-2.0\r
74049\r
74050 Unless required by applicable law or agreed to in writing, software\r
74051 distributed under the License is distributed on an "AS-IS" BASIS,\r
74052 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
74053 See the License for the specific language governing permissions and\r
74054 limitations under the License.\r
74055 */\r
74056\r
74057/**\r
74058 * @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>\r
74059 * Released under the Apache License, Version 2.0\r
74060 * see: https://github.com/dcodeIO/Long.js for details\r
74061 */\r
74062(function(global, factory) {\r
74063\r
74064 /* AMD */ if (typeof define === 'function' && define["amd"])\r
74065 define([], factory);\r
74066 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])\r
74067 module["exports"] = factory();\r
74068 /* Global */ else\r
74069 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();\r
74070\r
74071})(this, function() {\r
74072 "use strict";\r
74073\r
74074 /**\r
74075 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r
74076 * See the from* functions below for more convenient ways of constructing Longs.\r
74077 * @exports Long\r
74078 * @class A Long class for representing a 64 bit two's-complement integer value.\r
74079 * @param {number} low The low (signed) 32 bits of the long\r
74080 * @param {number} high The high (signed) 32 bits of the long\r
74081 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r
74082 * @constructor\r
74083 */\r
74084 function Long(low, high, unsigned) {\r
74085\r
74086 /**\r
74087 * The low 32 bits as a signed value.\r
74088 * @type {number}\r
74089 * @expose\r
74090 */\r
74091 this.low = low|0;\r
74092\r
74093 /**\r
74094 * The high 32 bits as a signed value.\r
74095 * @type {number}\r
74096 * @expose\r
74097 */\r
74098 this.high = high|0;\r
74099\r
74100 /**\r
74101 * Whether unsigned or not.\r
74102 * @type {boolean}\r
74103 * @expose\r
74104 */\r
74105 this.unsigned = !!unsigned;\r
74106 }\r
74107\r
74108 // The internal representation of a long is the two given signed, 32-bit values.\r
74109 // We use 32-bit pieces because these are the size of integers on which\r
74110 // Javascript performs bit-operations. For operations like addition and\r
74111 // multiplication, we split each number into 16 bit pieces, which can easily be\r
74112 // multiplied within Javascript's floating-point representation without overflow\r
74113 // or change in sign.\r
74114 //\r
74115 // In the algorithms below, we frequently reduce the negative case to the\r
74116 // positive case by negating the input(s) and then post-processing the result.\r
74117 // Note that we must ALWAYS check specially whether those values are MIN_VALUE\r
74118 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r
74119 // a positive number, it overflows back into a negative). Not handling this\r
74120 // case would often result in infinite recursion.\r
74121 //\r
74122 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r
74123 // methods on which they depend.\r
74124\r
74125 /**\r
74126 * An indicator used to reliably determine if an object is a Long or not.\r
74127 * @type {boolean}\r
74128 * @const\r
74129 * @expose\r
74130 * @private\r
74131 */\r
74132 Long.__isLong__;\r
74133\r
74134 Object.defineProperty(Long.prototype, "__isLong__", {\r
74135 value: true,\r
74136 enumerable: false,\r
74137 configurable: false\r
74138 });\r
74139\r
74140 /**\r
74141 * Tests if the specified object is a Long.\r
74142 * @param {*} obj Object\r
74143 * @returns {boolean}\r
74144 * @expose\r
74145 */\r
74146 Long.isLong = function isLong(obj) {\r
74147 return (obj && obj["__isLong__"]) === true;\r
74148 };\r
74149\r
74150 /**\r
74151 * A cache of the Long representations of small integer values.\r
74152 * @type {!Object}\r
74153 * @inner\r
74154 */\r
74155 var INT_CACHE = {};\r
74156\r
74157 /**\r
74158 * A cache of the Long representations of small unsigned integer values.\r
74159 * @type {!Object}\r
74160 * @inner\r
74161 */\r
74162 var UINT_CACHE = {};\r
74163\r
74164 /**\r
74165 * Returns a Long representing the given 32 bit integer value.\r
74166 * @param {number} value The 32 bit integer in question\r
74167 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r
74168 * @returns {!Long} The corresponding Long value\r
74169 * @expose\r
74170 */\r
74171 Long.fromInt = function fromInt(value, unsigned) {\r
74172 var obj, cachedObj;\r
74173 if (!unsigned) {\r
74174 value = value | 0;\r
74175 if (-128 <= value && value < 128) {\r
74176 cachedObj = INT_CACHE[value];\r
74177 if (cachedObj)\r
74178 return cachedObj;\r
74179 }\r
74180 obj = new Long(value, value < 0 ? -1 : 0, false);\r
74181 if (-128 <= value && value < 128)\r
74182 INT_CACHE[value] = obj;\r
74183 return obj;\r
74184 } else {\r
74185 value = value >>> 0;\r
74186 if (0 <= value && value < 256) {\r
74187 cachedObj = UINT_CACHE[value];\r
74188 if (cachedObj)\r
74189 return cachedObj;\r
74190 }\r
74191 obj = new Long(value, (value | 0) < 0 ? -1 : 0, true);\r
74192 if (0 <= value && value < 256)\r
74193 UINT_CACHE[value] = obj;\r
74194 return obj;\r
74195 }\r
74196 };\r
74197\r
74198 /**\r
74199 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r
74200 * @param {number} value The number in question\r
74201 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r
74202 * @returns {!Long} The corresponding Long value\r
74203 * @expose\r
74204 */\r
74205 Long.fromNumber = function fromNumber(value, unsigned) {\r
74206 unsigned = !!unsigned;\r
74207 if (isNaN(value) || !isFinite(value))\r
74208 return Long.ZERO;\r
74209 if (!unsigned && value <= -TWO_PWR_63_DBL)\r
74210 return Long.MIN_VALUE;\r
74211 if (!unsigned && value + 1 >= TWO_PWR_63_DBL)\r
74212 return Long.MAX_VALUE;\r
74213 if (unsigned && value >= TWO_PWR_64_DBL)\r
74214 return Long.MAX_UNSIGNED_VALUE;\r
74215 if (value < 0)\r
74216 return Long.fromNumber(-value, unsigned).negate();\r
74217 return new Long((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r
74218 };\r
74219\r
74220 /**\r
74221 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r
74222 * assumed to use 32 bits.\r
74223 * @param {number} lowBits The low 32 bits\r
74224 * @param {number} highBits The high 32 bits\r
74225 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r
74226 * @returns {!Long} The corresponding Long value\r
74227 * @expose\r
74228 */\r
74229 Long.fromBits = function fromBits(lowBits, highBits, unsigned) {\r
74230 return new Long(lowBits, highBits, unsigned);\r
74231 };\r
74232\r
74233 /**\r
74234 * Returns a Long representation of the given string, written using the specified radix.\r
74235 * @param {string} str The textual representation of the Long\r
74236 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed\r
74237 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r
74238 * @returns {!Long} The corresponding Long value\r
74239 * @expose\r
74240 */\r
74241 Long.fromString = function fromString(str, unsigned, radix) {\r
74242 if (str.length === 0)\r
74243 throw Error('number format error: empty string');\r
74244 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")\r
74245 return Long.ZERO;\r
74246 if (typeof unsigned === 'number') // For goog.math.long compatibility\r
74247 radix = unsigned,\r
74248 unsigned = false;\r
74249 radix = radix || 10;\r
74250 if (radix < 2 || 36 < radix)\r
74251 throw Error('radix out of range: ' + radix);\r
74252\r
74253 var p;\r
74254 if ((p = str.indexOf('-')) > 0)\r
74255 throw Error('number format error: interior "-" character: ' + str);\r
74256 else if (p === 0)\r
74257 return Long.fromString(str.substring(1), unsigned, radix).negate();\r
74258\r
74259 // Do several (8) digits each time through the loop, so as to\r
74260 // minimize the calls to the very expensive emulated div.\r
74261 var radixToPower = Long.fromNumber(Math.pow(radix, 8));\r
74262\r
74263 var result = Long.ZERO;\r
74264 for (var i = 0; i < str.length; i += 8) {\r
74265 var size = Math.min(8, str.length - i);\r
74266 var value = parseInt(str.substring(i, i + size), radix);\r
74267 if (size < 8) {\r
74268 var power = Long.fromNumber(Math.pow(radix, size));\r
74269 result = result.multiply(power).add(Long.fromNumber(value));\r
74270 } else {\r
74271 result = result.multiply(radixToPower);\r
74272 result = result.add(Long.fromNumber(value));\r
74273 }\r
74274 }\r
74275 result.unsigned = unsigned;\r
74276 return result;\r
74277 };\r
74278\r
74279 /**\r
74280 * Converts the specified value to a Long.\r
74281 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r
74282 * @returns {!Long}\r
74283 * @expose\r
74284 */\r
74285 Long.fromValue = function fromValue(val) {\r
74286 if (val /* is compatible */ instanceof Long)\r
74287 return val;\r
74288 if (typeof val === 'number')\r
74289 return Long.fromNumber(val);\r
74290 if (typeof val === 'string')\r
74291 return Long.fromString(val);\r
74292 // Throws for non-objects, converts non-instanceof Long:\r
74293 return new Long(val.low, val.high, val.unsigned);\r
74294 };\r
74295\r
74296 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r
74297 // no runtime penalty for these.\r
74298\r
74299 /**\r
74300 * @type {number}\r
74301 * @const\r
74302 * @inner\r
74303 */\r
74304 var TWO_PWR_16_DBL = 1 << 16;\r
74305\r
74306 /**\r
74307 * @type {number}\r
74308 * @const\r
74309 * @inner\r
74310 */\r
74311 var TWO_PWR_24_DBL = 1 << 24;\r
74312\r
74313 /**\r
74314 * @type {number}\r
74315 * @const\r
74316 * @inner\r
74317 */\r
74318 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r
74319\r
74320 /**\r
74321 * @type {number}\r
74322 * @const\r
74323 * @inner\r
74324 */\r
74325 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r
74326\r
74327 /**\r
74328 * @type {number}\r
74329 * @const\r
74330 * @inner\r
74331 */\r
74332 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r
74333\r
74334 /**\r
74335 * @type {!Long}\r
74336 * @const\r
74337 * @inner\r
74338 */\r
74339 var TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);\r
74340\r
74341 /**\r
74342 * Signed zero.\r
74343 * @type {!Long}\r
74344 * @expose\r
74345 */\r
74346 Long.ZERO = Long.fromInt(0);\r
74347\r
74348 /**\r
74349 * Unsigned zero.\r
74350 * @type {!Long}\r
74351 * @expose\r
74352 */\r
74353 Long.UZERO = Long.fromInt(0, true);\r
74354\r
74355 /**\r
74356 * Signed one.\r
74357 * @type {!Long}\r
74358 * @expose\r
74359 */\r
74360 Long.ONE = Long.fromInt(1);\r
74361\r
74362 /**\r
74363 * Unsigned one.\r
74364 * @type {!Long}\r
74365 * @expose\r
74366 */\r
74367 Long.UONE = Long.fromInt(1, true);\r
74368\r
74369 /**\r
74370 * Signed negative one.\r
74371 * @type {!Long}\r
74372 * @expose\r
74373 */\r
74374 Long.NEG_ONE = Long.fromInt(-1);\r
74375\r
74376 /**\r
74377 * Maximum signed value.\r
74378 * @type {!Long}\r
74379 * @expose\r
74380 */\r
74381 Long.MAX_VALUE = Long.fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r
74382\r
74383 /**\r
74384 * Maximum unsigned value.\r
74385 * @type {!Long}\r
74386 * @expose\r
74387 */\r
74388 Long.MAX_UNSIGNED_VALUE = Long.fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r
74389\r
74390 /**\r
74391 * Minimum signed value.\r
74392 * @type {!Long}\r
74393 * @expose\r
74394 */\r
74395 Long.MIN_VALUE = Long.fromBits(0, 0x80000000|0, false);\r
74396\r
74397 /**\r
74398 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r
74399 * @returns {number}\r
74400 * @expose\r
74401 */\r
74402 Long.prototype.toInt = function toInt() {\r
74403 return this.unsigned ? this.low >>> 0 : this.low;\r
74404 };\r
74405\r
74406 /**\r
74407 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r
74408 * @returns {number}\r
74409 * @expose\r
74410 */\r
74411 Long.prototype.toNumber = function toNumber() {\r
74412 if (this.unsigned) {\r
74413 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r
74414 }\r
74415 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r
74416 };\r
74417\r
74418 /**\r
74419 * Converts the Long to a string written in the specified radix.\r
74420 * @param {number=} radix Radix (2-36), defaults to 10\r
74421 * @returns {string}\r
74422 * @override\r
74423 * @throws {RangeError} If `radix` is out of range\r
74424 * @expose\r
74425 */\r
74426 Long.prototype.toString = function toString(radix) {\r
74427 radix = radix || 10;\r
74428 if (radix < 2 || 36 < radix)\r
74429 throw RangeError('radix out of range: ' + radix);\r
74430 if (this.isZero())\r
74431 return '0';\r
74432 var rem;\r
74433 if (this.isNegative()) { // Unsigned Longs are never negative\r
74434 if (this.equals(Long.MIN_VALUE)) {\r
74435 // We need to change the Long value before it can be negated, so we remove\r
74436 // the bottom-most digit in this base and then recurse to do the rest.\r
74437 var radixLong = Long.fromNumber(radix);\r
74438 var div = this.divide(radixLong);\r
74439 rem = div.multiply(radixLong).subtract(this);\r
74440 return div.toString(radix) + rem.toInt().toString(radix);\r
74441 } else\r
74442 return '-' + this.negate().toString(radix);\r
74443 }\r
74444\r
74445 // Do several (6) digits each time through the loop, so as to\r
74446 // minimize the calls to the very expensive emulated div.\r
74447 var radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);\r
74448 rem = this;\r
74449 var result = '';\r
74450 while (true) {\r
74451 var remDiv = rem.divide(radixToPower),\r
74452 intval = rem.subtract(remDiv.multiply(radixToPower)).toInt() >>> 0,\r
74453 digits = intval.toString(radix);\r
74454 rem = remDiv;\r
74455 if (rem.isZero())\r
74456 return digits + result;\r
74457 else {\r
74458 while (digits.length < 6)\r
74459 digits = '0' + digits;\r
74460 result = '' + digits + result;\r
74461 }\r
74462 }\r
74463 };\r
74464\r
74465 /**\r
74466 * Gets the high 32 bits as a signed integer.\r
74467 * @returns {number} Signed high bits\r
74468 * @expose\r
74469 */\r
74470 Long.prototype.getHighBits = function getHighBits() {\r
74471 return this.high;\r
74472 };\r
74473\r
74474 /**\r
74475 * Gets the high 32 bits as an unsigned integer.\r
74476 * @returns {number} Unsigned high bits\r
74477 * @expose\r
74478 */\r
74479 Long.prototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r
74480 return this.high >>> 0;\r
74481 };\r
74482\r
74483 /**\r
74484 * Gets the low 32 bits as a signed integer.\r
74485 * @returns {number} Signed low bits\r
74486 * @expose\r
74487 */\r
74488 Long.prototype.getLowBits = function getLowBits() {\r
74489 return this.low;\r
74490 };\r
74491\r
74492 /**\r
74493 * Gets the low 32 bits as an unsigned integer.\r
74494 * @returns {number} Unsigned low bits\r
74495 * @expose\r
74496 */\r
74497 Long.prototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r
74498 return this.low >>> 0;\r
74499 };\r
74500\r
74501 /**\r
74502 * Gets the number of bits needed to represent the absolute value of this Long.\r
74503 * @returns {number}\r
74504 * @expose\r
74505 */\r
74506 Long.prototype.getNumBitsAbs = function getNumBitsAbs() {\r
74507 if (this.isNegative()) // Unsigned Longs are never negative\r
74508 return this.equals(Long.MIN_VALUE) ? 64 : this.negate().getNumBitsAbs();\r
74509 var val = this.high != 0 ? this.high : this.low;\r
74510 for (var bit = 31; bit > 0; bit--)\r
74511 if ((val & (1 << bit)) != 0)\r
74512 break;\r
74513 return this.high != 0 ? bit + 33 : bit + 1;\r
74514 };\r
74515\r
74516 /**\r
74517 * Tests if this Long's value equals zero.\r
74518 * @returns {boolean}\r
74519 * @expose\r
74520 */\r
74521 Long.prototype.isZero = function isZero() {\r
74522 return this.high === 0 && this.low === 0;\r
74523 };\r
74524\r
74525 /**\r
74526 * Tests if this Long's value is negative.\r
74527 * @returns {boolean}\r
74528 * @expose\r
74529 */\r
74530 Long.prototype.isNegative = function isNegative() {\r
74531 return !this.unsigned && this.high < 0;\r
74532 };\r
74533\r
74534 /**\r
74535 * Tests if this Long's value is positive.\r
74536 * @returns {boolean}\r
74537 * @expose\r
74538 */\r
74539 Long.prototype.isPositive = function isPositive() {\r
74540 return this.unsigned || this.high >= 0;\r
74541 };\r
74542\r
74543 /**\r
74544 * Tests if this Long's value is odd.\r
74545 * @returns {boolean}\r
74546 * @expose\r
74547 */\r
74548 Long.prototype.isOdd = function isOdd() {\r
74549 return (this.low & 1) === 1;\r
74550 };\r
74551\r
74552 /**\r
74553 * Tests if this Long's value is even.\r
74554 * @returns {boolean}\r
74555 * @expose\r
74556 */\r
74557 Long.prototype.isEven = function isEven() {\r
74558 return (this.low & 1) === 0;\r
74559 };\r
74560\r
74561 /**\r
74562 * Tests if this Long's value equals the specified's.\r
74563 * @param {!Long|number|string} other Other value\r
74564 * @returns {boolean}\r
74565 * @expose\r
74566 */\r
74567 Long.prototype.equals = function equals(other) {\r
74568 if (!Long.isLong(other))\r
74569 other = Long.fromValue(other);\r
74570 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r
74571 return false;\r
74572 return this.high === other.high && this.low === other.low;\r
74573 };\r
74574\r
74575 /**\r
74576 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r
74577 * @function\r
74578 * @param {!Long|number|string} other Other value\r
74579 * @returns {boolean}\r
74580 * @expose\r
74581 */\r
74582 Long.eq = Long.prototype.equals;\r
74583\r
74584 /**\r
74585 * Tests if this Long's value differs from the specified's.\r
74586 * @param {!Long|number|string} other Other value\r
74587 * @returns {boolean}\r
74588 * @expose\r
74589 */\r
74590 Long.prototype.notEquals = function notEquals(other) {\r
74591 return !this.equals(/* validates */ other);\r
74592 };\r
74593\r
74594 /**\r
74595 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r
74596 * @function\r
74597 * @param {!Long|number|string} other Other value\r
74598 * @returns {boolean}\r
74599 * @expose\r
74600 */\r
74601 Long.neq = Long.prototype.notEquals;\r
74602\r
74603 /**\r
74604 * Tests if this Long's value is less than the specified's.\r
74605 * @param {!Long|number|string} other Other value\r
74606 * @returns {boolean}\r
74607 * @expose\r
74608 */\r
74609 Long.prototype.lessThan = function lessThan(other) {\r
74610 return this.compare(/* validates */ other) < 0;\r
74611 };\r
74612\r
74613 /**\r
74614 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r
74615 * @function\r
74616 * @param {!Long|number|string} other Other value\r
74617 * @returns {boolean}\r
74618 * @expose\r
74619 */\r
74620 Long.prototype.lt = Long.prototype.lessThan;\r
74621\r
74622 /**\r
74623 * Tests if this Long's value is less than or equal the specified's.\r
74624 * @param {!Long|number|string} other Other value\r
74625 * @returns {boolean}\r
74626 * @expose\r
74627 */\r
74628 Long.prototype.lessThanOrEqual = function lessThanOrEqual(other) {\r
74629 return this.compare(/* validates */ other) <= 0;\r
74630 };\r
74631\r
74632 /**\r
74633 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r
74634 * @function\r
74635 * @param {!Long|number|string} other Other value\r
74636 * @returns {boolean}\r
74637 * @expose\r
74638 */\r
74639 Long.prototype.lte = Long.prototype.lessThanOrEqual;\r
74640\r
74641 /**\r
74642 * Tests if this Long's value is greater than the specified's.\r
74643 * @param {!Long|number|string} other Other value\r
74644 * @returns {boolean}\r
74645 * @expose\r
74646 */\r
74647 Long.prototype.greaterThan = function greaterThan(other) {\r
74648 return this.compare(/* validates */ other) > 0;\r
74649 };\r
74650\r
74651 /**\r
74652 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r
74653 * @function\r
74654 * @param {!Long|number|string} other Other value\r
74655 * @returns {boolean}\r
74656 * @expose\r
74657 */\r
74658 Long.prototype.gt = Long.prototype.greaterThan;\r
74659\r
74660 /**\r
74661 * Tests if this Long's value is greater than or equal the specified's.\r
74662 * @param {!Long|number|string} other Other value\r
74663 * @returns {boolean}\r
74664 * @expose\r
74665 */\r
74666 Long.prototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r
74667 return this.compare(/* validates */ other) >= 0;\r
74668 };\r
74669\r
74670 /**\r
74671 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r
74672 * @function\r
74673 * @param {!Long|number|string} other Other value\r
74674 * @returns {boolean}\r
74675 * @expose\r
74676 */\r
74677 Long.prototype.gte = Long.prototype.greaterThanOrEqual;\r
74678\r
74679 /**\r
74680 * Compares this Long's value with the specified's.\r
74681 * @param {!Long|number|string} other Other value\r
74682 * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r
74683 * if the given one is greater\r
74684 * @expose\r
74685 */\r
74686 Long.prototype.compare = function compare(other) {\r
74687 if (!Long.isLong(other))\r
74688 other = Long.fromValue(other);\r
74689 if (this.equals(other))\r
74690 return 0;\r
74691 var thisNeg = this.isNegative(),\r
74692 otherNeg = other.isNegative();\r
74693 if (thisNeg && !otherNeg)\r
74694 return -1;\r
74695 if (!thisNeg && otherNeg)\r
74696 return 1;\r
74697 // At this point the sign bits are the same\r
74698 if (!this.unsigned)\r
74699 return this.subtract(other).isNegative() ? -1 : 1;\r
74700 // Both are positive if at least one is unsigned\r
74701 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r
74702 };\r
74703\r
74704 /**\r
74705 * Negates this Long's value.\r
74706 * @returns {!Long} Negated Long\r
74707 * @expose\r
74708 */\r
74709 Long.prototype.negate = function negate() {\r
74710 if (!this.unsigned && this.equals(Long.MIN_VALUE))\r
74711 return Long.MIN_VALUE;\r
74712 return this.not().add(Long.ONE);\r
74713 };\r
74714\r
74715 /**\r
74716 * Negates this Long's value. This is an alias of {@link Long#negate}.\r
74717 * @function\r
74718 * @returns {!Long} Negated Long\r
74719 * @expose\r
74720 */\r
74721 Long.prototype.neg = Long.prototype.negate;\r
74722\r
74723 /**\r
74724 * Returns the sum of this and the specified Long.\r
74725 * @param {!Long|number|string} addend Addend\r
74726 * @returns {!Long} Sum\r
74727 * @expose\r
74728 */\r
74729 Long.prototype.add = function add(addend) {\r
74730 if (!Long.isLong(addend))\r
74731 addend = Long.fromValue(addend);\r
74732\r
74733 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r
74734\r
74735 var a48 = this.high >>> 16;\r
74736 var a32 = this.high & 0xFFFF;\r
74737 var a16 = this.low >>> 16;\r
74738 var a00 = this.low & 0xFFFF;\r
74739\r
74740 var b48 = addend.high >>> 16;\r
74741 var b32 = addend.high & 0xFFFF;\r
74742 var b16 = addend.low >>> 16;\r
74743 var b00 = addend.low & 0xFFFF;\r
74744\r
74745 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r
74746 c00 += a00 + b00;\r
74747 c16 += c00 >>> 16;\r
74748 c00 &= 0xFFFF;\r
74749 c16 += a16 + b16;\r
74750 c32 += c16 >>> 16;\r
74751 c16 &= 0xFFFF;\r
74752 c32 += a32 + b32;\r
74753 c48 += c32 >>> 16;\r
74754 c32 &= 0xFFFF;\r
74755 c48 += a48 + b48;\r
74756 c48 &= 0xFFFF;\r
74757 return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r
74758 };\r
74759\r
74760 /**\r
74761 * Returns the difference of this and the specified Long.\r
74762 * @param {!Long|number|string} subtrahend Subtrahend\r
74763 * @returns {!Long} Difference\r
74764 * @expose\r
74765 */\r
74766 Long.prototype.subtract = function subtract(subtrahend) {\r
74767 if (!Long.isLong(subtrahend))\r
74768 subtrahend = Long.fromValue(subtrahend);\r
74769 return this.add(subtrahend.negate());\r
74770 };\r
74771\r
74772 /**\r
74773 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r
74774 * @function\r
74775 * @param {!Long|number|string} subtrahend Subtrahend\r
74776 * @returns {!Long} Difference\r
74777 * @expose\r
74778 */\r
74779 Long.prototype.sub = Long.prototype.subtract;\r
74780\r
74781 /**\r
74782 * Returns the product of this and the specified Long.\r
74783 * @param {!Long|number|string} multiplier Multiplier\r
74784 * @returns {!Long} Product\r
74785 * @expose\r
74786 */\r
74787 Long.prototype.multiply = function multiply(multiplier) {\r
74788 if (this.isZero())\r
74789 return Long.ZERO;\r
74790 if (!Long.isLong(multiplier))\r
74791 multiplier = Long.fromValue(multiplier);\r
74792 if (multiplier.isZero())\r
74793 return Long.ZERO;\r
74794 if (this.equals(Long.MIN_VALUE))\r
74795 return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;\r
74796 if (multiplier.equals(Long.MIN_VALUE))\r
74797 return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\r
74798\r
74799 if (this.isNegative()) {\r
74800 if (multiplier.isNegative())\r
74801 return this.negate().multiply(multiplier.negate());\r
74802 else\r
74803 return this.negate().multiply(multiplier).negate();\r
74804 } else if (multiplier.isNegative())\r
74805 return this.multiply(multiplier.negate()).negate();\r
74806\r
74807 // If both longs are small, use float multiplication\r
74808 if (this.lessThan(TWO_PWR_24) && multiplier.lessThan(TWO_PWR_24))\r
74809 return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r
74810\r
74811 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r
74812 // We can skip products that would overflow.\r
74813\r
74814 var a48 = this.high >>> 16;\r
74815 var a32 = this.high & 0xFFFF;\r
74816 var a16 = this.low >>> 16;\r
74817 var a00 = this.low & 0xFFFF;\r
74818\r
74819 var b48 = multiplier.high >>> 16;\r
74820 var b32 = multiplier.high & 0xFFFF;\r
74821 var b16 = multiplier.low >>> 16;\r
74822 var b00 = multiplier.low & 0xFFFF;\r
74823\r
74824 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r
74825 c00 += a00 * b00;\r
74826 c16 += c00 >>> 16;\r
74827 c00 &= 0xFFFF;\r
74828 c16 += a16 * b00;\r
74829 c32 += c16 >>> 16;\r
74830 c16 &= 0xFFFF;\r
74831 c16 += a00 * b16;\r
74832 c32 += c16 >>> 16;\r
74833 c16 &= 0xFFFF;\r
74834 c32 += a32 * b00;\r
74835 c48 += c32 >>> 16;\r
74836 c32 &= 0xFFFF;\r
74837 c32 += a16 * b16;\r
74838 c48 += c32 >>> 16;\r
74839 c32 &= 0xFFFF;\r
74840 c32 += a00 * b32;\r
74841 c48 += c32 >>> 16;\r
74842 c32 &= 0xFFFF;\r
74843 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r
74844 c48 &= 0xFFFF;\r
74845 return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r
74846 };\r
74847\r
74848 /**\r
74849 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r
74850 * @function\r
74851 * @param {!Long|number|string} multiplier Multiplier\r
74852 * @returns {!Long} Product\r
74853 * @expose\r
74854 */\r
74855 Long.prototype.mul = Long.prototype.multiply;\r
74856\r
74857 /**\r
74858 * Returns this Long divided by the specified.\r
74859 * @param {!Long|number|string} divisor Divisor\r
74860 * @returns {!Long} Quotient\r
74861 * @expose\r
74862 */\r
74863 Long.prototype.divide = function divide(divisor) {\r
74864 if (!Long.isLong(divisor))\r
74865 divisor = Long.fromValue(divisor);\r
74866 if (divisor.isZero())\r
74867 throw(new Error('division by zero'));\r
74868 if (this.isZero())\r
74869 return this.unsigned ? Long.UZERO : Long.ZERO;\r
74870 var approx, rem, res;\r
74871 if (this.equals(Long.MIN_VALUE)) {\r
74872 if (divisor.equals(Long.ONE) || divisor.equals(Long.NEG_ONE))\r
74873 return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r
74874 else if (divisor.equals(Long.MIN_VALUE))\r
74875 return Long.ONE;\r
74876 else {\r
74877 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r
74878 var halfThis = this.shiftRight(1);\r
74879 approx = halfThis.divide(divisor).shiftLeft(1);\r
74880 if (approx.equals(Long.ZERO)) {\r
74881 return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;\r
74882 } else {\r
74883 rem = this.subtract(divisor.multiply(approx));\r
74884 res = approx.add(rem.divide(divisor));\r
74885 return res;\r
74886 }\r
74887 }\r
74888 } else if (divisor.equals(Long.MIN_VALUE))\r
74889 return this.unsigned ? Long.UZERO : Long.ZERO;\r
74890 if (this.isNegative()) {\r
74891 if (divisor.isNegative())\r
74892 return this.negate().divide(divisor.negate());\r
74893 return this.negate().divide(divisor).negate();\r
74894 } else if (divisor.isNegative())\r
74895 return this.divide(divisor.negate()).negate();\r
74896\r
74897 // Repeat the following until the remainder is less than other: find a\r
74898 // floating-point that approximates remainder / other *from below*, add this\r
74899 // into the result, and subtract it from the remainder. It is critical that\r
74900 // the approximate value is less than or equal to the real value so that the\r
74901 // remainder never becomes negative.\r
74902 res = Long.ZERO;\r
74903 rem = this;\r
74904 while (rem.greaterThanOrEqual(divisor)) {\r
74905 // Approximate the result of division. This may be a little greater or\r
74906 // smaller than the actual value.\r
74907 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r
74908\r
74909 // We will tweak the approximate result by changing it in the 48-th digit or\r
74910 // the smallest non-fractional digit, whichever is larger.\r
74911 var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r
74912 delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48),\r
74913\r
74914 // Decrease the approximation until it is smaller than the remainder. Note\r
74915 // that if it is too large, the product overflows and is negative.\r
74916 approxRes = Long.fromNumber(approx),\r
74917 approxRem = approxRes.multiply(divisor);\r
74918 while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\r
74919 approx -= delta;\r
74920 approxRes = Long.fromNumber(approx, this.unsigned);\r
74921 approxRem = approxRes.multiply(divisor);\r
74922 }\r
74923\r
74924 // We know the answer can't be zero... and actually, zero would cause\r
74925 // infinite recursion since we would make no progress.\r
74926 if (approxRes.isZero())\r
74927 approxRes = Long.ONE;\r
74928\r
74929 res = res.add(approxRes);\r
74930 rem = rem.subtract(approxRem);\r
74931 }\r
74932 return res;\r
74933 };\r
74934\r
74935 /**\r
74936 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r
74937 * @function\r
74938 * @param {!Long|number|string} divisor Divisor\r
74939 * @returns {!Long} Quotient\r
74940 * @expose\r
74941 */\r
74942 Long.prototype.div = Long.prototype.divide;\r
74943\r
74944 /**\r
74945 * Returns this Long modulo the specified.\r
74946 * @param {!Long|number|string} divisor Divisor\r
74947 * @returns {!Long} Remainder\r
74948 * @expose\r
74949 */\r
74950 Long.prototype.modulo = function modulo(divisor) {\r
74951 if (!Long.isLong(divisor))\r
74952 divisor = Long.fromValue(divisor);\r
74953 return this.subtract(this.divide(divisor).multiply(divisor));\r
74954 };\r
74955\r
74956 /**\r
74957 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r
74958 * @function\r
74959 * @param {!Long|number|string} divisor Divisor\r
74960 * @returns {!Long} Remainder\r
74961 * @expose\r
74962 */\r
74963 Long.prototype.mod = Long.prototype.modulo;\r
74964\r
74965 /**\r
74966 * Returns the bitwise NOT of this Long.\r
74967 * @returns {!Long}\r
74968 * @expose\r
74969 */\r
74970 Long.prototype.not = function not() {\r
74971 return Long.fromBits(~this.low, ~this.high, this.unsigned);\r
74972 };\r
74973\r
74974 /**\r
74975 * Returns the bitwise AND of this Long and the specified.\r
74976 * @param {!Long|number|string} other Other Long\r
74977 * @returns {!Long}\r
74978 * @expose\r
74979 */\r
74980 Long.prototype.and = function and(other) {\r
74981 if (!Long.isLong(other))\r
74982 other = Long.fromValue(other);\r
74983 return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r
74984 };\r
74985\r
74986 /**\r
74987 * Returns the bitwise OR of this Long and the specified.\r
74988 * @param {!Long|number|string} other Other Long\r
74989 * @returns {!Long}\r
74990 * @expose\r
74991 */\r
74992 Long.prototype.or = function or(other) {\r
74993 if (!Long.isLong(other))\r
74994 other = Long.fromValue(other);\r
74995 return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r
74996 };\r
74997\r
74998 /**\r
74999 * Returns the bitwise XOR of this Long and the given one.\r
75000 * @param {!Long|number|string} other Other Long\r
75001 * @returns {!Long}\r
75002 * @expose\r
75003 */\r
75004 Long.prototype.xor = function xor(other) {\r
75005 if (!Long.isLong(other))\r
75006 other = Long.fromValue(other);\r
75007 return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r
75008 };\r
75009\r
75010 /**\r
75011 * Returns this Long with bits shifted to the left by the given amount.\r
75012 * @param {number|!Long} numBits Number of bits\r
75013 * @returns {!Long} Shifted Long\r
75014 * @expose\r
75015 */\r
75016 Long.prototype.shiftLeft = function shiftLeft(numBits) {\r
75017 if (Long.isLong(numBits))\r
75018 numBits = numBits.toInt();\r
75019 if ((numBits &= 63) === 0)\r
75020 return this;\r
75021 else if (numBits < 32)\r
75022 return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r
75023 else\r
75024 return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);\r
75025 };\r
75026\r
75027 /**\r
75028 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r
75029 * @function\r
75030 * @param {number|!Long} numBits Number of bits\r
75031 * @returns {!Long} Shifted Long\r
75032 * @expose\r
75033 */\r
75034 Long.prototype.shl = Long.prototype.shiftLeft;\r
75035\r
75036 /**\r
75037 * Returns this Long with bits arithmetically shifted to the right by the given amount.\r
75038 * @param {number|!Long} numBits Number of bits\r
75039 * @returns {!Long} Shifted Long\r
75040 * @expose\r
75041 */\r
75042 Long.prototype.shiftRight = function shiftRight(numBits) {\r
75043 if (Long.isLong(numBits))\r
75044 numBits = numBits.toInt();\r
75045 if ((numBits &= 63) === 0)\r
75046 return this;\r
75047 else if (numBits < 32)\r
75048 return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r
75049 else\r
75050 return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r
75051 };\r
75052\r
75053 /**\r
75054 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r
75055 * @function\r
75056 * @param {number|!Long} numBits Number of bits\r
75057 * @returns {!Long} Shifted Long\r
75058 * @expose\r
75059 */\r
75060 Long.prototype.shr = Long.prototype.shiftRight;\r
75061\r
75062 /**\r
75063 * Returns this Long with bits logically shifted to the right by the given amount.\r
75064 * @param {number|!Long} numBits Number of bits\r
75065 * @returns {!Long} Shifted Long\r
75066 * @expose\r
75067 */\r
75068 Long.prototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r
75069 if (Long.isLong(numBits))\r
75070 numBits = numBits.toInt();\r
75071 numBits &= 63;\r
75072 if (numBits === 0)\r
75073 return this;\r
75074 else {\r
75075 var high = this.high;\r
75076 if (numBits < 32) {\r
75077 var low = this.low;\r
75078 return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r
75079 } else if (numBits === 32)\r
75080 return Long.fromBits(high, 0, this.unsigned);\r
75081 else\r
75082 return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);\r
75083 }\r
75084 };\r
75085\r
75086 /**\r
75087 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r
75088 * @function\r
75089 * @param {number|!Long} numBits Number of bits\r
75090 * @returns {!Long} Shifted Long\r
75091 * @expose\r
75092 */\r
75093 Long.prototype.shru = Long.prototype.shiftRightUnsigned;\r
75094\r
75095 /**\r
75096 * Converts this Long to signed.\r
75097 * @returns {!Long} Signed long\r
75098 * @expose\r
75099 */\r
75100 Long.prototype.toSigned = function toSigned() {\r
75101 if (!this.unsigned)\r
75102 return this;\r
75103 return new Long(this.low, this.high, false);\r
75104 };\r
75105\r
75106 /**\r
75107 * Converts this Long to unsigned.\r
75108 * @returns {!Long} Unsigned long\r
75109 * @expose\r
75110 */\r
75111 Long.prototype.toUnsigned = function toUnsigned() {\r
75112 if (this.unsigned)\r
75113 return this;\r
75114 return new Long(this.low, this.high, true);\r
75115 };\r
75116\r
75117 return Long;\r
75118});\r
75119
75120},{}],427:[function(require,module,exports){
75121(function (Buffer){
75122
75123var navigator = {};
75124navigator.userAgent = false;
75125
75126var window = {};
75127/*
75128 * jsrsasign(all) 8.0.12 (2018-04-22) (c) 2010-2018 Kenji Urushima | kjur.github.com/jsrsasign/license
75129 */
75130
75131/*!
75132Copyright (c) 2011, Yahoo! Inc. All rights reserved.
75133Code licensed under the BSD License:
75134http://developer.yahoo.com/yui/license.html
75135version: 2.9.0
75136*/
75137if(YAHOO===undefined){var YAHOO={}}YAHOO.lang={extend:function(g,h,f){if(!h||!g){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.")}var d=function(){};d.prototype=h.prototype;g.prototype=new d();g.prototype.constructor=g;g.superclass=h.prototype;if(h.prototype.constructor==Object.prototype.constructor){h.prototype.constructor=h}if(f){var b;for(b in f){g.prototype[b]=f[b]}var e=function(){},c=["toString","valueOf"];try{if(/MSIE/.test(navigator.userAgent)){e=function(j,i){for(b=0;b<c.length;b=b+1){var l=c[b],k=i[l];if(typeof k==="function"&&k!=Object.prototype[l]){j[l]=k}}}}}catch(a){}e(g.prototype,f)}}};
75138
75139/*! CryptoJS v3.1.2 core-fix.js
75140 * code.google.com/p/crypto-js
75141 * (c) 2009-2013 by Jeff Mott. All rights reserved.
75142 * code.google.com/p/crypto-js/wiki/License
75143 * THIS IS FIX of 'core.js' to fix Hmac issue.
75144 * https://code.google.com/p/crypto-js/issues/detail?id=84
75145 * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
75146 */
75147var CryptoJS=CryptoJS||(function(e,g){var a={};var b=a.lib={};var j=b.Base=(function(){function n(){}return{extend:function(p){n.prototype=this;var o=new n();if(p){o.mixIn(p)}if(!o.hasOwnProperty("init")){o.init=function(){o.$super.init.apply(this,arguments)}}o.init.prototype=o;o.$super=this;return o},create:function(){var o=this.extend();o.init.apply(o,arguments);return o},init:function(){},mixIn:function(p){for(var o in p){if(p.hasOwnProperty(o)){this[o]=p[o]}}if(p.hasOwnProperty("toString")){this.toString=p.toString}},clone:function(){return this.init.prototype.extend(this)}}}());var l=b.WordArray=j.extend({init:function(o,n){o=this.words=o||[];if(n!=g){this.sigBytes=n}else{this.sigBytes=o.length*4}},toString:function(n){return(n||h).stringify(this)},concat:function(t){var q=this.words;var p=t.words;var n=this.sigBytes;var s=t.sigBytes;this.clamp();if(n%4){for(var r=0;r<s;r++){var o=(p[r>>>2]>>>(24-(r%4)*8))&255;q[(n+r)>>>2]|=o<<(24-((n+r)%4)*8)}}else{for(var r=0;r<s;r+=4){q[(n+r)>>>2]=p[r>>>2]}}this.sigBytes+=s;return this},clamp:function(){var o=this.words;var n=this.sigBytes;o[n>>>2]&=4294967295<<(32-(n%4)*8);o.length=e.ceil(n/4)},clone:function(){var n=j.clone.call(this);n.words=this.words.slice(0);return n},random:function(p){var o=[];for(var n=0;n<p;n+=4){o.push((e.random()*4294967296)|0)}return new l.init(o,p)}});var m=a.enc={};var h=m.Hex={stringify:function(p){var r=p.words;var o=p.sigBytes;var q=[];for(var n=0;n<o;n++){var s=(r[n>>>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o<n;o+=2){q[o>>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o<p;o++){var s=(r[o>>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o<n;o++){q[o>>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p<s;p+=t){this._doProcessBlock(x,p)}var o=x.splice(0,s);q.sigBytes-=r}return new l.init(o,r)},clone:function(){var n=j.clone.call(this);n._data=this._data.clone();return n},_minBufferSize:0});var f=b.Hasher=i.extend({cfg:j.extend(),init:function(n){this.cfg=this.cfg.extend(n);this.reset()},reset:function(){i.reset.call(this);this._doReset()},update:function(n){this._append(n);this._process();return this},finalize:function(n){if(n){this._append(n)}var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(n){return function(p,o){return new n.init(o).finalize(p)}},_createHmacHelper:function(n){return function(p,o){return new k.HMAC.init(n,o).finalize(p)}}});var k=a.algo={};return a}(Math));
75148/*
75149CryptoJS v3.1.2 x64-core-min.js
75150code.google.com/p/crypto-js
75151(c) 2009-2013 by Jeff Mott. All rights reserved.
75152code.google.com/p/crypto-js/wiki/License
75153*/
75154(function(g){var a=CryptoJS,f=a.lib,e=f.Base,h=f.WordArray,a=a.x64={};a.Word=e.extend({init:function(b,c){this.high=b;this.low=c}});a.WordArray=e.extend({init:function(b,c){b=this.words=b||[];this.sigBytes=c!=g?c:8*b.length},toX32:function(){for(var b=this.words,c=b.length,a=[],d=0;d<c;d++){var e=b[d];a.push(e.high);a.push(e.low)}return h.create(a,this.sigBytes)},clone:function(){for(var b=e.clone.call(this),c=b.words=this.words.slice(0),a=c.length,d=0;d<a;d++)c[d]=c[d].clone();return b}})})();
75155
75156/*
75157CryptoJS v3.1.2 cipher-core.js
75158code.google.com/p/crypto-js
75159(c) 2009-2013 by Jeff Mott. All rights reserved.
75160code.google.com/p/crypto-js/wiki/License
75161*/
75162CryptoJS.lib.Cipher||function(u){var g=CryptoJS,f=g.lib,k=f.Base,l=f.WordArray,q=f.BufferedBlockAlgorithm,r=g.enc.Base64,v=g.algo.EvpKDF,n=f.Cipher=q.extend({cfg:k.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c);this._xformMode=a;this._key=b;this.reset()},reset:function(){q.reset.call(this);this._doReset()},process:function(a){this._append(a);
75163return this._process()},finalize:function(a){a&&this._append(a);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(a){return{encrypt:function(b,c,d){return("string"==typeof c?s:j).encrypt(a,b,c,d)},decrypt:function(b,c,d){return("string"==typeof c?s:j).decrypt(a,b,c,d)}}}});f.StreamCipher=n.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=g.mode={},t=function(a,b,c){var d=this._iv;d?this._iv=u:d=this._prevBlock;for(var e=
751640;e<c;e++)a[b+e]^=d[e]},h=(f.BlockCipherMode=k.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a;this._iv=b}})).extend();h.Encryptor=h.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize;t.call(this,a,b,d);c.encryptBlock(a,b);this._prevBlock=a.slice(b,b+d)}});h.Decryptor=h.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=a.slice(b,b+d);c.decryptBlock(a,
75165b);t.call(this,a,b,d);this._prevBlock=e}});m=m.CBC=h;h=(g.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,e=[],f=0;f<c;f+=4)e.push(d);c=l.create(e,c);a.concat(c)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;
75166this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;
75167return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,
75168blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a,
75169b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}();
75170
75171/*
75172CryptoJS v3.1.2 aes.js
75173code.google.com/p/crypto-js
75174(c) 2009-2013 by Jeff Mott. All rights reserved.
75175code.google.com/p/crypto-js/wiki/License
75176*/
75177(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8,
7517816,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h<c;h++)if(h<a)b[h]=e[h];else{var d=b[h-1];h%a?6<a&&4==h%a&&(d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;a<c;a++)h=c-a,d=a%4?b[h]:b[h-4],e[a]=4>a||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>>
751798&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t<n;t++)var q=b[f>>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s=
75180b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})();
75181
75182/*
75183CryptoJS v3.1.2 tripledes-min.js
75184code.google.com/p/crypto-js
75185(c) 2009-2013 by Jeff Mott. All rights reserved.
75186code.google.com/p/crypto-js/wiki/License
75187*/
75188(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<<b}function l(b,c){var a=(this._rBlock>>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<<b}var h=CryptoJS,e=h.lib,n=e.WordArray,e=e.BlockCipher,g=h.algo,q=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,
7518955,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],r=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],s=[{"0":8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,
751902281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,
751911744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{"0":1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,
7519275497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,
75193276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{"0":260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,
7519414680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,
7519517301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{"0":2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,
7519698304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,
751971146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{"0":128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,
7519810240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,
7519983968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{"0":268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,
752002688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{"0":1048576,
7520116:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,
75202496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{"0":134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,
752032147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,
752042147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],t=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],m=g.DES=e.extend({_doReset:function(){for(var b=this._key.words,c=[],a=0;56>a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>=
752054*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^
75206d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3=
75207m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})();
75208
75209/*
75210CryptoJS v3.1.2 enc-base64.js
75211code.google.com/p/crypto-js
75212(c) 2009-2013 by Jeff Mott. All rights reserved.
75213code.google.com/p/crypto-js/wiki/License
75214*/
75215(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d<
75216e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
75217
75218/*
75219CryptoJS v3.1.2 md5.js
75220code.google.com/p/crypto-js
75221(c) 2009-2013 by Jeff Mott. All rights reserved.
75222code.google.com/p/crypto-js/wiki/License
75223*/
75224(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<<h|a>>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<<h|a>>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<<k|a>>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<<k|a>>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])},
75225_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]),
75226b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b,
75227c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c,
75228C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/
752294294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math);
75230
75231/*
75232CryptoJS v3.1.2 sha1-min.js
75233code.google.com/p/crypto-js
75234(c) 2009-2013 by Jeff Mott. All rights reserved.
75235code.google.com/p/crypto-js/wiki/License
75236*/
75237(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^
75238j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})();
75239
75240/*
75241CryptoJS v3.1.2 sha256-min.js
75242code.google.com/p/crypto-js
75243(c) 2009-2013 by Jeff Mott. All rights reserved.
75244code.google.com/p/crypto-js/wiki/License
75245*/
75246(function(k){for(var g=CryptoJS,h=g.lib,v=h.WordArray,j=h.Hasher,h=g.algo,s=[],t=[],u=function(q){return 4294967296*(q-(q|0))|0},l=2,b=0;64>b;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]=
75247q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes;
75248b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math);
75249
75250/*
75251CryptoJS v3.1.2 sha224-min.js
75252code.google.com/p/crypto-js
75253(c) 2009-2013 by Jeff Mott. All rights reserved.
75254code.google.com/p/crypto-js/wiki/License
75255*/
75256(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})();
75257
75258/*
75259CryptoJS v3.1.2 sha512-min.js
75260code.google.com/p/crypto-js
75261(c) 2009-2013 by Jeff Mott. All rights reserved.
75262code.google.com/p/crypto-js/wiki/License
75263*/
75264(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),
75265a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,
752662643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),
75267a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,
752683409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words,
75269F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<<
752703|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0<p>>>0?1:0),b=b+c,j=j+u+(b>>>0<c>>>0?1:0),b=b+t,j=j+q+(b>>>0<t>>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0<E>>>0?1:
752710),c=c+t,q=q+W+(c>>>0<t>>>0?1:0),c=c+da,q=q+fa+(c>>>0<da>>>0?1:0),c=c+b,q=q+j+(c>>>0<b>>>0?1:0),b=u+T,s=p+s+(b>>>0<u>>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0<B>>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0<c>>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0<g>>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0<x>>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0<y>>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0<B>>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0<h>>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0<C>>>0?1:0);P=I.low=P+D;
75272I.high=ba+S+(P>>>0<D>>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0<E>>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})();
75273
75274/*
75275CryptoJS v3.1.2 sha384-min.js
75276code.google.com/p/crypto-js
75277(c) 2009-2013 by Jeff Mott. All rights reserved.
75278code.google.com/p/crypto-js/wiki/License
75279*/
75280(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384=
75281d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})();
75282
75283/*
75284CryptoJS v3.1.2 ripemd160-min.js
75285code.google.com/p/crypto-js
75286(c) 2009-2013 by Jeff Mott. All rights reserved.
75287code.google.com/p/crypto-js/wiki/License
75288*/
75289/*
75290
75291(c) 2012 by Cedric Mesnil. All rights reserved.
75292
75293Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
75294
75295 - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
75296 - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
75297
75298THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75299*/
75300(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12,
753015,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691,
753022053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b?
75303a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<<p[b]|a>>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<<w[b]|a>>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes;
75304d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math);
75305
75306/*
75307CryptoJS v3.1.2 hmac.js
75308code.google.com/p/crypto-js
75309(c) 2009-2013 by Jeff Mott. All rights reserved.
75310code.google.com/p/crypto-js/wiki/License
75311*/
75312(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d<c;d++)h[d]^=1549556828,j[d]^=909522486;f.sigBytes=g.sigBytes=e;this.reset()},reset:function(){var a=this._hasher;a.reset();a.update(this._iKey)},update:function(a){this._hasher.update(a);return this},finalize:function(a){var b=
75313this._hasher;a=b.finalize(a);b.reset();return b.finalize(this._oKey.clone().concat(a))}})})();
75314
75315/*
75316CryptoJS v3.1.2 pbkdf2-min.js
75317code.google.com/p/crypto-js
75318(c) 2009-2013 by Jeff Mott. All rights reserved.
75319code.google.com/p/crypto-js/wiki/License
75320*/
75321(function(){var b=CryptoJS,a=b.lib,d=a.Base,m=a.WordArray,a=b.algo,q=a.HMAC,l=a.PBKDF2=d.extend({cfg:d.extend({keySize:4,hasher:a.SHA1,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,f=q.create(c.hasher,a),g=m.create(),d=m.create([1]),l=g.words,r=d.words,n=c.keySize,c=c.iterations;l.length<n;){var h=f.update(b).finalize(d);f.reset();for(var j=h.words,s=j.length,k=h,p=1;p<c;p++){k=f.finalize(k);f.reset();for(var t=k.words,e=0;e<s;e++)j[e]^=t[e]}g.concat(h);
75322r[0]++}g.sigBytes=4*n;return g}});b.PBKDF2=function(a,b,c){return l.create(c).compute(a,b)}})();
75323
75324/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75325 */
75326var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64pad="=";function hex2b64(d){var b;var e;var a="";for(b=0;b+3<=d.length;b+=3){e=parseInt(d.substring(b,b+3),16);a+=b64map.charAt(e>>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e<f.length;++e){if(f.charAt(e)==b64pad){break}a=b64map.indexOf(f.charAt(e));if(a<0){continue}if(b==0){d+=int2char(a>>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c<d.length;++c){b[c]=parseInt(d.substring(2*c,2*c+2),16)}return b};
75327/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75328 */
75329var dbits;var canary=244837814094590;var j_lm=((canary&16777215)==15715070);function BigInteger(e,d,f){if(e!=null){if("number"==typeof e){this.fromNumber(e,d,f)}else{if(d==null&&"string"!=typeof e){this.fromString(e,256)}else{this.fromString(e,d)}}}}function nbi(){return new BigInteger(null)}function am1(f,a,b,e,h,g){while(--g>=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<<dbits)-1);BigInteger.prototype.DV=(1<<dbits);var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";var BI_RC=new Array();var rr,vv;rr="0".charCodeAt(0);for(vv=0;vv<=9;++vv){BI_RC[rr++]=vv}rr="a".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}rr="A".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}function int2char(a){return BI_RM.charAt(a)}function intAt(b,a){var d=BI_RC[b.charCodeAt(a)];return(d==null)?-1:d}function bnpCopyTo(b){for(var a=this.t-1;a>=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<<f;this[this.t++]=(a>>(this.DB-f))}else{this[this.t-1]|=a<<f}}f+=e;if(f>=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<<f}}this.clamp();if(d){BigInteger.ZERO.subTo(this,this)}}function bnpClamp(){var a=this.s&this.DM;while(this.t>0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<<e)-1,l,a=false,h="",f=this.t;var j=this.DB-(f*this.DB)%e;if(f-->0){if(j<this.DB&&(l=this[f]>>j)>0){a=true;h=int2char(l)}while(f>=0){if(j<e){l=(this[f]&((1<<j)-1))<<(e-j);l|=this[--f]>>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a<this.t;++a){b[a-c]=this[a]}b.t=Math.max(this.t-c,0);b.s=this.s}function bnpLShiftTo(j,e){var b=j%this.DB;var a=this.DB-b;var g=(1<<a)-1;var f=Math.floor(j/this.DB),h=(this.s<<b)&this.DM,d;for(d=this.t-1;d>=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<<b}for(d=f-1;d>=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<<b)-1;d[0]=this[e]>>b;for(var c=e+1;c<this.t;++c){d[c-e-1]|=(this[c]&f)<<a;d[c-e]=this[c]>>b}if(b>0){d[this.t-e-1]|=(this.s&f)<<a}d.t=this.t-e;d.clamp()}function bnpSubTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e<b){g+=this[e]-d[e];f[e++]=g&this.DM;g>>=this.DB}if(d.t<this.t){g-=d.s;while(e<this.t){g+=this[e];f[e++]=g&this.DM;g>>=this.DB}g+=this.s}else{g+=this.s;while(e<d.t){g-=d[e];f[e++]=g&this.DM;g>>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d<f.t;++d){e[d+b.t]=b.am(0,f[d],e,d,0,b.t)}e.s=0;e.clamp();if(this.s!=c.s){BigInteger.ZERO.subTo(e,e)}}function bnpSquareTo(d){var a=this.abs();var b=d.t=2*a.t;while(--b>=0){d[b]=0}for(b=0;b<a.t-1;++b){var e=a.am(b,a[b],d,2*b,0,1);if((d[b+a.t]+=a.am(b+1,2*a[b],d,2*b+1,e,a.t-b-1))>=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t<w.t){if(h!=null){h.fromInt(0)}if(g!=null){this.copyTo(g)}return}if(g==null){g=nbi()}var d=nbi(),a=this.s,l=n.s;var v=this.DB-nbits(w[w.t-1]);if(v>0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<<this.F1)+((p>1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<<this.F1)/o,x=1<<this.F2;var u=g.t,s=u-p,f=(h==null)?nbi():h;d.dlShiftTo(s,f);if(g.compareTo(f)>=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t<p){d[d.t++]=0}while(--s>=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))<c){d.dlShiftTo(s,f);g.subTo(f,g);while(g[u]<--c){g.subTo(f,g)}}}if(h!=null){g.drShiftTo(p,h);if(a!=l){BigInteger.ZERO.subTo(h,h)}}g.t=p;g.clamp();if(v>0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c<this.m.t;++c){var b=a[c]&32767;var d=(b*this.mpl+(((b*this.mph+(a[c]>>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<<c))>0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);
75330/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75331 */
75332function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]}function bnByteValue(){return(this.t==0)?this.s:(this[0]<<24)>>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c<m.length;++c){var k=intAt(m,c);if(k<0){if(m.charAt(c)=="-"&&this.signum()==0){e=true}continue}l=h*l+k;if(++a>=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<<g)-1)}else{d[0]=0}this.fromString(d,256)}}function bnToByteArray(){var b=this.t,c=new Array();c[0]=this.s;var e=this.DB-(b*this.DB)%8,f,a=0;if(b-->0){if(e<this.DB&&(f=this[b]>>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<<e)-1))<<(8-e);f|=this[--b]>>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d<b;++d){e[d]=h(this[d],c[d])}if(c.t<this.t){g=c.s&this.DM;for(d=b;d<this.t;++d){e[d]=h(this[d],g)}e.t=this.t}else{g=this.s&this.DM;for(d=b;d<c.t;++d){e[d]=h(g,c[d])}e.t=c.t}e.s=h(this.s,c.s);e.clamp()}function op_and(a,b){return a&b}function bnAnd(b){var c=nbi();this.bitwiseTo(b,op_and,c);return c}function op_or(a,b){return a|b}function bnOr(b){var c=nbi();this.bitwiseTo(b,op_or,c);return c}function op_xor(a,b){return a^b}function bnXor(b){var c=nbi();this.bitwiseTo(b,op_xor,c);return c}function op_andnot(a,b){return a&~b}function bnAndNot(b){var c=nbi();this.bitwiseTo(b,op_andnot,c);return c}function bnNot(){var b=nbi();for(var a=0;a<this.t;++a){b[a]=this.DM&~this[a]}b.t=this.t;b.s=~this.s;return b}function bnShiftLeft(b){var a=nbi();if(b<0){this.rShiftTo(-b,a)}else{this.lShiftTo(b,a)}return a}function bnShiftRight(b){var a=nbi();if(b<0){this.lShiftTo(-b,a)}else{this.rShiftTo(b,a)}return a}function lbit(a){if(a==0){return -1}var b=0;if((a&65535)==0){a>>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a<this.t;++a){if(this[a]!=0){return a*this.DB+lbit(this[a])}}if(this.s<0){return this.t*this.DB}return -1}function cbit(a){var b=0;while(a!=0){a&=a-1;++b}return b}function bnBitCount(){var c=0,a=this.s&this.DM;for(var b=0;b<this.t;++b){c+=cbit(this[b]^a)}return c}function bnTestBit(b){var a=Math.floor(b/this.DB);if(a>=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e<b){g+=this[e]+d[e];f[e++]=g&this.DM;g>>=this.DB}if(d.t<this.t){g+=d.s;while(e<this.t){g+=this[e];f[e++]=g&this.DM;g>>=this.DB}g+=this.s}else{g+=this.s;while(e<d.t){g+=d[e];f[e++]=g&this.DM;g>>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d<c;++d){e[d+this.t]=this.am(0,b[d],e,d,0,this.t)}for(c=Math.min(b.t,f);d<c;++d){this.am(0,b[d],e,d,0,f-d)}e.clamp()}function bnpMultiplyUpperTo(b,e,d){--e;var c=d.t=this.t+b.t-e;d.s=0;while(--c>=0){d[c]=0}for(c=Math.max(e-this.t,0);c<b.t;++c){d[this.t+c-e]=this.am(e-c,b[c],d,0,0,this.t+c-e)}d.clamp();d.drShiftTo(1,d)}function Barrett(a){this.r2=nbi();this.q3=nbi();BigInteger.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function barrettConvert(a){if(a.s<0||a.t>2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<<h)-1;p[1]=v.convert(this);if(h>1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<<o))==0){v.sqrTo(b,c);y=b;b=c;c=y;if(--o<0){o=this.DB-1;--l}}}return v.revert(b)}function bnGCD(c){var b=(this.s<0)?this.negate():this.clone();var h=(c.s<0)?c.negate():c.clone();if(b.compareTo(h)<0){var e=b;b=h;h=e}var d=b.getLowestSetBit(),f=h.getLowestSetBit();if(f<0){return b}if(d<f){f=d}if(f>0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d<lowprimes.length;++d){if(b[0]==lowprimes[d]){return true}}return false}if(b.isEven()){return false}d=1;while(d<lowprimes.length){var a=lowprimes[d],c=d+1;while(c<lowprimes.length&&a<lplim){a*=lowprimes[c++]}a=b.modInt(a);while(d<c){if(a%lowprimes[d++]==0){return false}}}return b.millerRabin(e)}function bnpMillerRabin(f){var g=this.subtract(BigInteger.ONE);var c=g.getLowestSetBit();if(c<=0){return false}var h=g.shiftRight(c);f=(f+1)>>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e<f;++e){b.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var l=b.modPow(h,this);if(l.compareTo(BigInteger.ONE)!=0&&l.compareTo(g)!=0){var d=1;while(d++<c&&l.compareTo(g)!=0){l=l.modPowInt(2,this);if(l.compareTo(BigInteger.ONE)==0){return false}}if(l.compareTo(g)!=0){return false}}}return true}BigInteger.prototype.chunkSize=bnpChunkSize;BigInteger.prototype.toRadix=bnpToRadix;BigInteger.prototype.fromRadix=bnpFromRadix;BigInteger.prototype.fromNumber=bnpFromNumber;BigInteger.prototype.bitwiseTo=bnpBitwiseTo;BigInteger.prototype.changeBit=bnpChangeBit;BigInteger.prototype.addTo=bnpAddTo;BigInteger.prototype.dMultiply=bnpDMultiply;BigInteger.prototype.dAddOffset=bnpDAddOffset;BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo;BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo;BigInteger.prototype.modInt=bnpModInt;BigInteger.prototype.millerRabin=bnpMillerRabin;BigInteger.prototype.clone=bnClone;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.byteValue=bnByteValue;BigInteger.prototype.shortValue=bnShortValue;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.toByteArray=bnToByteArray;BigInteger.prototype.equals=bnEquals;BigInteger.prototype.min=bnMin;BigInteger.prototype.max=bnMax;BigInteger.prototype.and=bnAnd;BigInteger.prototype.or=bnOr;BigInteger.prototype.xor=bnXor;BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract;BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;BigInteger.prototype.square=bnSquare;
75333/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75334 */
75335function Arcfour(){this.i=0;this.j=0;this.S=new Array()}function ARC4init(d){var c,a,b;for(c=0;c<256;++c){this.S[c]=c}a=0;for(c=0;c<256;++c){a=(a+this.S[c]+d[c%d.length])&255;b=this.S[c];this.S[c]=this.S[a];this.S[a]=b}this.i=0;this.j=0}function ARC4next(){var a;this.i=(this.i+1)&255;this.j=(this.j+this.S[this.i])&255;a=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=a;return this.S[(a+this.S[this.i])&255]}Arcfour.prototype.init=ARC4init;Arcfour.prototype.next=ARC4next;function prng_newstate(){return new Arcfour()}var rng_psize=256;
75336/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75337 */
75338var rng_state;var rng_pool;var rng_pptr;function rng_seed_int(a){rng_pool[rng_pptr++]^=a&255;rng_pool[rng_pptr++]^=(a>>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t<z.length;++t){rng_pool[rng_pptr++]=z.charCodeAt(t)&255}}}}while(rng_pptr<rng_psize){t=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=t>>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr){rng_pool[rng_pptr]=0}rng_pptr=0}return rng_state.next()}function rng_get_bytes(b){var a;for(a=0;a<b.length;++a){b[a]=rng_get_byte()}}function SecureRandom(){}SecureRandom.prototype.nextBytes=rng_get_bytes;
75339/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75340 */
75341function parseBigInt(b,a){return new BigInteger(b,a)}function linebrk(c,d){var a="";var b=0;while(b+d<c.length){a+=c.substring(b,b+d)+"\n";b+=d}return a+c.substring(b,c.length)}function byte2Hex(a){if(a<16){return"0"+a.toString(16)}else{return a.toString(16)}}function pkcs1pad2(e,h){if(h<e.length+11){throw"Message too long for RSA";return null}var g=new Array();var d=e.length-1;while(d>=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length<a){b+=e(String.fromCharCode.apply(String,c.concat([(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashHex(rstrtohex(i),b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e<a-q.length-2*l-2;e+=1){k+="\x00"}var h=f("")+k+"\x01"+q;var g=new Array(l);new SecureRandom().nextBytes(g);var j=oaep_mgf1_arr(g,h.length,f);var p=[];for(e=0;e<h.length;e+=1){p[e]=h.charCodeAt(e)^j.charCodeAt(e)}var m=oaep_mgf1_arr(p,g.length,f);var d=[0];for(e=0;e<g.length;e+=1){d[e+1]=g[e]^m.charCodeAt(e)}return new BigInteger(d.concat(p))}function RSAKey(){this.n=null;this.e=0;this.d=null;this.p=null;this.q=null;this.dmp1=null;this.dmq1=null;this.coeff=null}function RSASetPublic(b,a){this.isPublic=true;this.isPrivate=false;if(typeof b!=="string"){this.n=b;this.e=a}else{if(b!=null&&a!=null&&b.length>0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA";
75342/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75343 */
75344function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f<a.length&&a[f]==0){++f}if(a.length-f!=j-1||a[f]!=2){return null}++f;while(a[f]!=0){if(++f>=a.length){return null}}var e="";while(++f<a.length){var h=a[f]&255;if(h<128){e+=String.fromCharCode(h)}else{if((h>191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length<a){b+=e(c+String.fromCharCode.apply(String,[(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashHex(rstrtohex(d),c))}}o=o.toByteArray();var h;for(h=0;h<o.length;h+=1){o[h]&=255}while(o.length<b){o.unshift(0)}o=String.fromCharCode.apply(String,o);if(o.length<2*p+2){throw"Cipher too short"}var f=o.substr(1,p);var s=o.substr(p+1);var q=oaep_mgf1_str(s,p,g);var k=[],h;for(h=0;h<f.length;h+=1){k[h]=f.charCodeAt(h)^q.charCodeAt(h)}var l=oaep_mgf1_str(String.fromCharCode.apply(String,k),o.length-p,g);var j=[];for(h=0;h<s.length;h+=1){j[h]=s.charCodeAt(h)^l.charCodeAt(h)}j=String.fromCharCode.apply(String,j);if(j.substr(0,p)!==g("")){throw"Hash mismatch"}j=j.substr(p);var a=j.indexOf("\x01");var m=(a!=-1)?j.substr(0,a).lastIndexOf("\x00"):-1;if(m+1!=a){throw"Malformed data"}return j.substr(a+1)}function RSASetPrivate(c,a,b){this.isPrivate=true;if(typeof c!=="string"){this.n=c;this.e=a;this.d=b}else{if(c!=null&&a!=null&&c.length>0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{throw"Invalid RSA private key"}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{throw"Invalid RSA private key in RSASetPrivateEx"}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP;
75345/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
75346 */
75347function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex;
75348/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
75349 */
75350ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(f<g.length){g=g.slice(g.length-f)}else{while(f>g.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true};
75351/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
75352 */
75353var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o<m;++o){v=p[o];var w;switch(v.charCodeAt(0)){default:w=r[0];w[t||w.length]=+(v);t=void 0;break;case 34:v=v.substring(1,v.length-1);if(v.indexOf(a)!==-1){v=v.replace(k,h)}w=r[0];if(!t){if(w instanceof Array){t=w.length}else{t=v||c;break}}w[t]=v;t=void 0;break;case 91:w=r[0];r.unshift(w[t||w.length]=[]);t=void 0;break;case 93:r.shift();break;case 102:w=r[0];w[t||w.length]=false;t=void 0;break;case 110:w=r[0];w[t||w.length]=null;t=void 0;break;case 116:w=r[0];w[t||w.length]=true;t=void 0;break;case 123:w=r[0];r.unshift(w[t||w.length]={});t=void 0;break;case 125:r.shift();break}}if(l){if(r.length!==1){throw new Error()}x=x[0]}else{if(r.length){throw new Error()}}if(q){var s=function(C,B){var D=C[B];if(D&&typeof D==="object"){var n=null;for(var z in D){if(b.call(D,z)&&D!==C){var y=s(D,z);if(y!==void 0){D[z]=y}else{if(!n){n=[]}n.push(z)}}}if(n){for(var A=n.length;--A>=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})();
75354if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d<e;d++){g+="f"}var c=new BigInteger(g,16);var b=c.xor(j).add(BigInteger.ONE);f=b.toString(16).replace(/^-/,"")}return f};this.getPEMStringFromHex=function(a,b){return hextopem(a,b)};this.newObject=function(k){var D=KJUR,n=D.asn1,z=n.DERBoolean,e=n.DERInteger,s=n.DERBitString,h=n.DEROctetString,v=n.DERNull,w=n.DERObjectIdentifier,l=n.DEREnumerated,g=n.DERUTF8String,f=n.DERNumericString,y=n.DERPrintableString,u=n.DERTeletexString,p=n.DERIA5String,C=n.DERUTCTime,j=n.DERGeneralizedTime,m=n.DERSequence,c=n.DERSet,r=n.DERTaggedObject,o=n.ASN1Util.newObject;var t=Object.keys(k);if(t.length!=1){throw"key of param shall be only one."}var F=t[0];if(":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+F+":")==-1){throw"undefined key: "+F}if(F=="bool"){return new z(k[F])}if(F=="int"){return new e(k[F])}if(F=="bitstr"){return new s(k[F])}if(F=="octstr"){return new h(k[F])}if(F=="null"){return new v(k[F])}if(F=="oid"){return new w(k[F])}if(F=="enum"){return new l(k[F])}if(F=="utf8str"){return new g(k[F])}if(F=="numstr"){return new f(k[F])}if(F=="prnstr"){return new y(k[F])}if(F=="telstr"){return new u(k[F])}if(F=="ia5str"){return new p(k[F])}if(F=="utctime"){return new C(k[F])}if(F=="gentime"){return new j(k[F])}if(F=="seq"){var d=k[F];var E=[];for(var x=0;x<d.length;x++){var B=o(d[x]);E.push(B)}return new m({array:E})}if(F=="set"){var d=k[F];var E=[];for(var x=0;x<d.length;x++){var B=o(d[x]);E.push(B)}return new c({array:E})}if(F=="tag"){var A=k[F];if(Object.prototype.toString.call(A)==="[object Array]"&&A.length==3){var q=o(A[2]);return new r({tag:A[0],explicit:A[1],obj:q})}else{var b={};if(A.explicit!==undefined){b.explicit=A.explicit}if(A.tag!==undefined){b.tag=A.tag}if(A.obj===undefined){throw"obj shall be specified for 'tag'."}b.obj=o(A.obj);return new r(b)}}};this.jsonToASN1HEX=function(b){var a=this.newObject(b);return a.getEncodedHex()}};KJUR.asn1.ASN1Util.oidHexToInt=function(a){var j="";var k=parseInt(a.substr(0,2),16);var d=Math.floor(k/40);var c=k%40;var j=d+"."+c;var e="";for(var f=2;f<a.length;f+=2){var g=parseInt(a.substr(f,2),16);var h=("00000000"+g.toString(2)).slice(-8);e=e+h.substr(1,7);if(h.substr(0,1)=="0"){var b=new BigInteger(e,2);j=j+"."+b.toString(10);e=""}}return j};KJUR.asn1.ASN1Util.oidIntToHex=function(f){var e=function(a){var k=a.toString(16);if(k.length==1){k="0"+k}return k};var d=function(o){var n="";var k=new BigInteger(o,10);var a=k.toString(2);var l=7-a.length%7;if(l==7){l=0}var q="";for(var m=0;m<l;m++){q+="0"}a=q+a;for(var m=0;m<a.length-1;m+=7){var p=a.substr(m,7);if(m!=a.length-7){p="1"+p}n+=e(parseInt(p,2))}return n};if(!f.match(/^[0-9.]+$/)){throw"malformed oid string: "+f}var g="";var b=f.split(".");var j=parseInt(b[0])*40+parseInt(b[1]);g+=e(j);b.splice(0,2);for(var c=0;c<b.length;c++){g+=d(b[c])}return g};KJUR.asn1.ASN1Object=function(){var c=true;var b=null;var d="00";var e="00";var a="";this.getLengthHexFromValue=function(){if(typeof this.hV=="undefined"||this.hV==null){throw"this.hV is null or undefined."}if(this.hV.length%2==1){throw"value hex must be even length: n="+a.length+",v="+this.hV}var i=this.hV.length/2;var h=i.toString(16);if(h.length%2==1){h="0"+h}if(i<128){return h}else{var g=h.length/2;if(g>15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=utf8tohex(this.s).toLowerCase()};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7<c){throw"unused bits shall be from 0 to 7: u = "+c}var d="0"+c;this.hTLV=null;this.isModified=true;this.hV=d+e};this.setByBinaryString=function(e){e=e.replace(/0+$/,"");var f=8-e.length%8;if(f==8){f=0}for(var g=0;g<=f;g++){e+="0"}var j="";for(var g=0;g<e.length-1;g+=8){var d=e.substr(g,8);var c=parseInt(d,2).toString(16);if(c.length==1){c="0"+c}j+=c}this.hTLV=null;this.isModified=true;this.hV="0"+f+j};this.setByBooleanArray=function(e){var d="";for(var c=0;c<e.length;c++){if(e[c]==true){d+="1"}else{d+="0"}}this.setByBinaryString(d)};this.newFalseArray=function(e){var c=new Array(e);for(var d=0;d<e;d++){c[d]=false}return c};this.getFreshValueHex=function(){return this.hV};if(typeof b!="undefined"){if(typeof b=="string"&&b.toLowerCase().match(/^[0-9a-f]+$/)){this.setHexValueIncludingUnusedBits(b)}else{if(typeof b.hex!="undefined"){this.setHexValueIncludingUnusedBits(b.hex)}else{if(typeof b.bin!="undefined"){this.setByBinaryString(b.bin)}else{if(typeof b.array!="undefined"){this.setByBooleanArray(b.array)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object);KJUR.asn1.DEROctetString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex=a.getEncodedHex()}KJUR.asn1.DEROctetString.superclass.constructor.call(this,b);this.hT="04"};YAHOO.lang.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this);this.hT="05";this.hTLV="0500"};YAHOO.lang.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object);KJUR.asn1.DERObjectIdentifier=function(c){var b=function(d){var e=d.toString(16);if(e.length==1){e="0"+e}return e};var a=function(k){var j="";var e=new BigInteger(k,10);var d=e.toString(2);var f=7-d.length%7;if(f==7){f=0}var m="";for(var g=0;g<f;g++){m+="0"}d=m+d;for(var g=0;g<d.length-1;g+=7){var l=d.substr(g,7);if(g!=d.length-7){l="1"+l}j+=b(parseInt(l,2))}return j};KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);this.hT="06";this.setValueHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.setValueOidString=function(f){if(!f.match(/^[0-9.]+$/)){throw"malformed oid string: "+f}var g="";var d=f.split(".");var j=parseInt(d[0])*40+parseInt(d[1]);g+=b(j);d.splice(0,2);for(var e=0;e<d.length;e++){g+=a(d[e])}this.hTLV=null;this.isModified=true;this.s=null;this.hV=g};this.setValueName=function(e){var d=KJUR.asn1.x509.OID.name2oid(e);if(d!==""){this.setValueOidString(d)}else{throw"DERObjectIdentifier oidName undefined: "+e}};this.getFreshValueHex=function(){return this.hV};if(c!==undefined){if(typeof c==="string"){if(c.match(/^[0-2].[0-9.]+$/)){this.setValueOidString(c)}else{this.setValueName(c)}}else{if(c.oid!==undefined){this.setValueOidString(c.oid)}else{if(c.hex!==undefined){this.setValueHex(c.hex)}else{if(c.name!==undefined){this.setValueName(c.name)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.DEREnumerated=function(a){KJUR.asn1.DEREnumerated.superclass.constructor.call(this);this.hT="0a";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DEREnumerated,KJUR.asn1.ASN1Object);KJUR.asn1.DERUTF8String=function(a){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,a);this.hT="0c"};YAHOO.lang.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString);KJUR.asn1.DERNumericString=function(a){KJUR.asn1.DERNumericString.superclass.constructor.call(this,a);this.hT="12"};YAHOO.lang.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERPrintableString=function(a){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,a);this.hT="13"};YAHOO.lang.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERTeletexString=function(a){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,a);this.hT="14"};YAHOO.lang.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERIA5String=function(a){KJUR.asn1.DERIA5String.superclass.constructor.call(this,a);this.hT="16"};YAHOO.lang.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString);KJUR.asn1.DERUTCTime=function(a){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,a);this.hT="17";this.setByDate=function(b){this.hTLV=null;this.isModified=true;this.date=b;this.s=this.formatDate(this.date,"utc");this.hV=stohex(this.s)};this.getFreshValueHex=function(){if(typeof this.date=="undefined"&&typeof this.s=="undefined"){this.date=new Date();this.s=this.formatDate(this.date,"utc");this.hV=stohex(this.s)}return this.hV};if(a!==undefined){if(a.str!==undefined){this.setString(a.str)}else{if(typeof a=="string"&&a.match(/^[0-9]{12}Z$/)){this.setString(a)}else{if(a.hex!==undefined){this.setStringHex(a.hex)}else{if(a.date!==undefined){this.setByDate(a.date)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime);KJUR.asn1.DERGeneralizedTime=function(a){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,a);this.hT="18";this.withMillis=false;this.setByDate=function(b){this.hTLV=null;this.isModified=true;this.date=b;this.s=this.formatDate(this.date,"gen",this.withMillis);this.hV=stohex(this.s)};this.getFreshValueHex=function(){if(this.date===undefined&&this.s===undefined){this.date=new Date();this.s=this.formatDate(this.date,"gen",this.withMillis);this.hV=stohex(this.s)}return this.hV};if(a!==undefined){if(a.str!==undefined){this.setString(a.str)}else{if(typeof a=="string"&&a.match(/^[0-9]{14}Z$/)){this.setString(a)}else{if(a.hex!==undefined){this.setStringHex(a.hex)}else{if(a.date!==undefined){this.setByDate(a.date)}}}}if(a.millis===true){this.withMillis=true}}};YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime,KJUR.asn1.DERAbstractTime);KJUR.asn1.DERSequence=function(a){KJUR.asn1.DERSequence.superclass.constructor.call(this,a);this.hT="30";this.getFreshValueHex=function(){var c="";for(var b=0;b<this.asn1Array.length;b++){var d=this.asn1Array[b];c+=d.getEncodedHex()}this.hV=c;return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERSequence,KJUR.asn1.DERAbstractStructured);KJUR.asn1.DERSet=function(a){KJUR.asn1.DERSet.superclass.constructor.call(this,a);this.hT="31";this.sortFlag=true;this.getFreshValueHex=function(){var b=new Array();for(var c=0;c<this.asn1Array.length;c++){var d=this.asn1Array[c];b.push(d.getEncodedHex())}if(this.sortFlag==true){b.sort()}this.hV=b.join("");return this.hV};if(typeof a!="undefined"){if(typeof a.sortflag!="undefined"&&a.sortflag==false){this.sortFlag=false}}};YAHOO.lang.extend(KJUR.asn1.DERSet,KJUR.asn1.DERAbstractStructured);KJUR.asn1.DERTaggedObject=function(a){KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);this.hT="a0";this.hV="";this.isExplicit=true;this.asn1Object=null;this.setASN1Object=function(b,c,d){this.hT=c;this.isExplicit=b;this.asn1Object=d;if(this.isExplicit){this.hV=this.asn1Object.getEncodedHex();this.hTLV=null;this.isModified=true}else{this.hV=null;this.hTLV=d.getEncodedHex();this.hTLV=this.hTLV.replace(/^../,c);this.isModified=false}};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.tag!="undefined"){this.hT=a.tag}if(typeof a.explicit!="undefined"){this.isExplicit=a.explicit}if(typeof a.obj!="undefined"){this.asn1Object=a.obj;this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)}}};YAHOO.lang.extend(KJUR.asn1.DERTaggedObject,KJUR.asn1.ASN1Object);
75355var ASN1HEX=new function(){};ASN1HEX.getLblen=function(c,a){if(c.substr(a+2,1)!="8"){return 1}var b=parseInt(c.substr(a+3,1));if(b==0){return -1}if(0<b&&b<10){return b+1}return -2};ASN1HEX.getL=function(c,b){var a=ASN1HEX.getLblen(c,b);if(a<1){return""}return c.substr(b+2,a*2)};ASN1HEX.getVblen=function(d,a){var c,b;c=ASN1HEX.getL(d,a);if(c==""){return -1}if(c.substr(0,1)==="8"){b=new BigInteger(c.substr(2),16)}else{b=new BigInteger(c,16)}return b.intValue()};ASN1HEX.getVidx=function(c,b){var a=ASN1HEX.getLblen(c,b);if(a<0){return a}return b+(a+1)*2};ASN1HEX.getV=function(d,a){var c=ASN1HEX.getVidx(d,a);var b=ASN1HEX.getVblen(d,a);return d.substr(c,b*2)};ASN1HEX.getTLV=function(b,a){return b.substr(a,2)+ASN1HEX.getL(b,a)+ASN1HEX.getV(b,a)};ASN1HEX.getNextSiblingIdx=function(d,a){var c=ASN1HEX.getVidx(d,a);var b=ASN1HEX.getVblen(d,a);return c+b*2};ASN1HEX.getChildIdx=function(e,f){var j=ASN1HEX;var g=new Array();var i=j.getVidx(e,f);if(e.substr(f,2)=="03"){g.push(i+2)}else{g.push(i)}var l=j.getVblen(e,f);var c=i;var d=0;while(1){var b=j.getNextSiblingIdx(e,c);if(b==null||(b-i>=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g<m.length/2;g++){k.push(parseInt(m.substr(g*2,2),16))}var j=[];var d="";for(var g=0;g<k.length;g++){if(k[g]&128){d=d+h((k[g]&127).toString(2),7)}else{d=d+h((k[g]&127).toString(2),7);j.push(new String(parseInt(d,2)));d=""}}var n=l.join(".");if(j.length>0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u<d.length;u++){k=k+y(e,f,d[u],g+" ")}return k}if(e.substr(l,2)=="31"){var k=g+"SET\n";var d=w(e,l);for(var u=0;u<d.length;u++){k=k+y(e,c,d[u],g+" ")}return k}var z=parseInt(e.substr(l,2),16);if((z&128)!=0){var n=z&31;if((z&32)!=0){var k=g+"["+n+"]\n";var d=w(e,l);for(var u=0;u<d.length;u++){k=k+y(e,c,d[u],g+" ")}return k}else{var h=j(e,l);if(h.substr(0,8)=="68747470"){h=hextoutf8(h)}if(c.x509ExtName==="subjectAltName"&&n==2){h=hextoutf8(h)}var k=g+"["+n+"] "+h+"\n";return k}}return g+"UNKNOWN("+e.substr(l,2)+") "+j(e,l)+"\n"};ASN1HEX.isASN1HEX=function(e){var d=ASN1HEX;if(e.length%2==1){return false}var c=d.getVblen(e,0);var b=e.substr(0,2);var f=d.getL(e,0);var a=e.length-b.length-f.length;if(a==c*2){return true}return false};ASN1HEX.oidname=function(a){var c=KJUR.asn1;if(KJUR.lang.String.isHex(a)){a=c.ASN1Util.oidHexToInt(a)}var b=c.x509.OID.oid2name(a);if(b===""){b=a}return b};
75356if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509){KJUR.asn1.x509={}}KJUR.asn1.x509.Certificate=function(e){KJUR.asn1.x509.Certificate.superclass.constructor.call(this);var a=null,j=null,h=null,k=null,i=null,b=KJUR,f=b.crypto,g=b.asn1,d=g.DERSequence,c=g.DERBitString;this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;var m=new KJUR.crypto.Signature({alg:this.asn1SignatureAlg.nameAlg});m.init(this.prvKey);m.updateHex(this.asn1TBSCert.getEncodedHex());this.hexSig=m.sign();this.asn1Sig=new c({hex:"00"+this.hexSig});var l=new d({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=l.getEncodedHex();this.isModified=false};this.setSignatureHex=function(l){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;this.hexSig=l;this.asn1Sig=new c({hex:"00"+this.hexSig});var m=new d({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=m.getEncodedHex();this.isModified=false};this.getEncodedHex=function(){if(this.isModified==false&&this.hTLV!=null){return this.hTLV}throw"not signed yet"};this.getPEMString=function(){var l=hextob64nl(this.getEncodedHex());return"-----BEGIN CERTIFICATE-----\r\n"+l+"\r\n-----END CERTIFICATE-----\r\n"};if(e!==undefined){if(e.tbscertobj!==undefined){this.asn1TBSCert=e.tbscertobj}if(e.prvkeyobj!==undefined){this.prvKey=e.prvkeyobj}}};YAHOO.lang.extend(KJUR.asn1.x509.Certificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.TBSCertificate=function(e){KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this);var b=KJUR,i=b.asn1,f=i.DERSequence,h=i.DERInteger,c=i.DERTaggedObject,d=i.x509,g=d.Time,a=d.X500Name,j=d.SubjectPublicKeyInfo;this._initialize=function(){this.asn1Array=new Array();this.asn1Version=new c({obj:new h({"int":2})});this.asn1SerialNumber=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1NotBefore=null;this.asn1NotAfter=null;this.asn1Subject=null;this.asn1SubjPKey=null;this.extensionsArray=new Array()};this.setSerialNumberByParam=function(k){this.asn1SerialNumber=new h(k)};this.setSignatureAlgByParam=function(k){this.asn1SignatureAlg=new d.AlgorithmIdentifier(k)};this.setIssuerByParam=function(k){this.asn1Issuer=new a(k)};this.setNotBeforeByParam=function(k){this.asn1NotBefore=new g(k)};this.setNotAfterByParam=function(k){this.asn1NotAfter=new g(k)};this.setSubjectByParam=function(k){this.asn1Subject=new a(k)};this.setSubjectPublicKey=function(k){this.asn1SubjPKey=new j(k)};this.setSubjectPublicKeyByGetKey=function(l){var k=KEYUTIL.getKey(l);this.asn1SubjPKey=new j(k)};this.appendExtension=function(k){this.extensionsArray.push(k)};this.appendExtensionByName=function(l,k){KJUR.asn1.x509.Extension.appendByNameToArray(l,k,this.extensionsArray)};this.getEncodedHex=function(){if(this.asn1NotBefore==null||this.asn1NotAfter==null){throw"notBefore and/or notAfter not set"}var l=new f({array:[this.asn1NotBefore,this.asn1NotAfter]});this.asn1Array=new Array();this.asn1Array.push(this.asn1Version);this.asn1Array.push(this.asn1SerialNumber);this.asn1Array.push(this.asn1SignatureAlg);this.asn1Array.push(this.asn1Issuer);this.asn1Array.push(l);this.asn1Array.push(this.asn1Subject);this.asn1Array.push(this.asn1SubjPKey);if(this.extensionsArray.length>0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(d!==undefined){if(d.critical!==undefined){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(f){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,f);var a=X509.KEYUSAGE_NAME;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(f!==undefined){if(f.bin!==undefined){this.asn1ExtnValue=new KJUR.asn1.DERBitString(f)}if(f.names!==undefined&&f.names.length!==undefined){var e=f.names;var d="000000000";for(var c=0;c<e.length;c++){for(var b=0;b<a.length;b++){if(e[c]===a[b]){d=d.substring(0,b)+"1"+d.substring(b+1,d.length)}}}this.asn1ExtnValue=new KJUR.asn1.DERBitString({bin:d})}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(c!==undefined){if(c.cA!==undefined){this.cA=c.cA}if(c.pathLen!==undefined){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(d!==undefined){if(d.array!==undefined){this.setByDPArray(d.array)}else{if(d.uri!==undefined){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e<d.length;e++){var f=new a.DERObjectIdentifier(d[e]);this.asn1ExtnValue.appendASN1Object(f)}};this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.37";if(c!==undefined){if(c.array!==undefined){this.setPurposeArray(c.array)}}};YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.AuthorityKeyIdentifier=function(d){KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.DERTaggedObject;this.asn1KID=null;this.asn1CertIssuer=null;this.asn1CertSN=null;this.getExtnValueHex=function(){var f=new Array();if(this.asn1KID){f.push(new c({explicit:false,tag:"80",obj:this.asn1KID}))}if(this.asn1CertIssuer){f.push(new c({explicit:false,tag:"a1",obj:this.asn1CertIssuer}))}if(this.asn1CertSN){f.push(new c({explicit:false,tag:"82",obj:this.asn1CertSN}))}var e=new a.DERSequence({array:f});this.asn1ExtnValue=e;return this.asn1ExtnValue.getEncodedHex()};this.setKIDByParam=function(e){this.asn1KID=new KJUR.asn1.DEROctetString(e)};this.setCertIssuerByParam=function(e){this.asn1CertIssuer=new KJUR.asn1.x509.X500Name(e)};this.setCertSNByParam=function(e){this.asn1CertSN=new KJUR.asn1.DERInteger(e)};this.oid="2.5.29.35";if(d!==undefined){if(d.kid!==undefined){this.setKIDByParam(d.kid)}if(d.issuer!==undefined){this.setCertIssuerByParam(d.issuer)}if(d.sn!==undefined){this.setCertSNByParam(d.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier,KJUR.asn1.x509.Extension);KJUR.asn1.x509.AuthorityInfoAccess=function(a){KJUR.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,a);this.setAccessDescriptionArray=function(k){var j=new Array(),b=KJUR,g=b.asn1,d=g.DERSequence;for(var f=0;f<k.length;f++){var c=new g.DERObjectIdentifier(k[f].accessMethod);var e=new g.x509.GeneralName(k[f].accessLocation);var h=new d({array:[c,e]});j.push(h)}this.asn1ExtnValue=new d({array:j})};this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="1.3.6.1.5.5.7.1.1";if(a!==undefined){if(a.array!==undefined){this.setAccessDescriptionArray(a.array)}}};YAHOO.lang.extend(KJUR.asn1.x509.AuthorityInfoAccess,KJUR.asn1.x509.Extension);KJUR.asn1.x509.SubjectAltName=function(a){KJUR.asn1.x509.SubjectAltName.superclass.constructor.call(this,a);this.setNameArray=function(b){this.asn1ExtnValue=new KJUR.asn1.x509.GeneralNames(b)};this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.17";if(a!==undefined){if(a.array!==undefined){this.setNameArray(a.array)}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectAltName,KJUR.asn1.x509.Extension);KJUR.asn1.x509.IssuerAltName=function(a){KJUR.asn1.x509.IssuerAltName.superclass.constructor.call(this,a);this.setNameArray=function(b){this.asn1ExtnValue=new KJUR.asn1.x509.GeneralNames(b)};this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.18";if(a!==undefined){if(a.array!==undefined){this.setNameArray(a.array)}}};YAHOO.lang.extend(KJUR.asn1.x509.IssuerAltName,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRL=function(f){KJUR.asn1.x509.CRL.superclass.constructor.call(this);var b=null,d=null,e=null,c=null,a=null;this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCertList.asn1SignatureAlg;sig=new KJUR.crypto.Signature({alg:"SHA1withRSA",prov:"cryptojs/jsrsa"});sig.init(this.prvKey);sig.updateHex(this.asn1TBSCertList.getEncodedHex());this.hexSig=sig.sign();this.asn1Sig=new KJUR.asn1.DERBitString({hex:"00"+this.hexSig});var g=new KJUR.asn1.DERSequence({array:[this.asn1TBSCertList,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=g.getEncodedHex();this.isModified=false};this.getEncodedHex=function(){if(this.isModified==false&&this.hTLV!=null){return this.hTLV}throw"not signed yet"};this.getPEMString=function(){var g=hextob64nl(this.getEncodedHex());return"-----BEGIN X509 CRL-----\r\n"+g+"\r\n-----END X509 CRL-----\r\n"};if(f!==undefined){if(f.tbsobj!==undefined){this.asn1TBSCertList=f.tbsobj}if(f.prvkeyobj!==undefined){this.prvKey=f.prvkeyobj}}};YAHOO.lang.extend(KJUR.asn1.x509.CRL,KJUR.asn1.ASN1Object);KJUR.asn1.x509.TBSCertList=function(g){KJUR.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=null,d=KJUR,c=d.asn1,b=c.DERSequence,f=c.x509,a=f.Time;this.setSignatureAlgByParam=function(h){this.asn1SignatureAlg=new f.AlgorithmIdentifier(h)};this.setIssuerByParam=function(h){this.asn1Issuer=new f.X500Name(h)};this.setThisUpdateByParam=function(h){this.asn1ThisUpdate=new a(h)};this.setNextUpdateByParam=function(h){this.asn1NextUpdate=new a(h)};this.addRevokedCert=function(h,i){var k={};if(h!=undefined&&h!=null){k.sn=h}if(i!=undefined&&i!=null){k.time=i}var j=new f.CRLEntry(k);this.aRevokedCert.push(j)};this.getEncodedHex=function(){this.asn1Array=new Array();if(this.asn1Version!=null){this.asn1Array.push(this.asn1Version)}this.asn1Array.push(this.asn1SignatureAlg);this.asn1Array.push(this.asn1Issuer);this.asn1Array.push(this.asn1ThisUpdate);if(this.asn1NextUpdate!=null){this.asn1Array.push(this.asn1NextUpdate)}if(this.aRevokedCert.length>0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var k=g.split("/");k.shift();var j=[];for(var l=0;l<k.length;l++){if(k[l].match(/^[^=]+=.+$/)){j.push(k[l])}else{var h=j.length-1;j[h]=j[h]+"/"+k[l]}}for(var l=0;l<j.length;l++){this.asn1Array.push(new e.RDN({str:j[l]}))}};this.setByLdapString=function(g){var h=e.X500Name.ldapToOneline(g);this.setByString(h)};this.setByObject=function(i){for(var g in i){if(i.hasOwnProperty(g)){var h=new KJUR.asn1.x509.RDN({str:g+"="+i[g]});this.asn1Array?this.asn1Array.push(h):this.asn1Array=[h]}}};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var g=new c.DERSequence({array:this.asn1Array});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.str!==undefined){this.setByString(f.str)}else{if(f.ldapstr!==undefined){this.setByLdapString(f.ldapstr)}else{if(typeof f==="object"){this.setByObject(f)}}}if(f.certissuer!==undefined){var a=new X509();a.hex=b(f.certissuer);this.hTLV=a.getIssuerHex()}if(f.certsubject!==undefined){var a=new X509();a.hex=b(f.certsubject);this.hTLV=a.getSubjectHex()}}};YAHOO.lang.extend(KJUR.asn1.x509.X500Name,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name.onelineToLDAP=function(d){if(d.substr(0,1)!=="/"){throw"malformed input"}var b="";d=d.substr(1);var c=d.split("/");c.reverse();c=c.map(function(a){return a.replace(/,/,"\\,")});return c.join(",")};KJUR.asn1.x509.X500Name.ldapToOneline=function(g){var c=g.split(",");var e=false;var b=[];for(var f=0;c.length>0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c<b.length;c++){this.addByString(b[c])}};this.getEncodedHex=function(){var b=new KJUR.asn1.DERSet({array:this.asn1Array});this.TLV=b.getEncodedHex();return this.TLV};if(a!==undefined){if(a.str!==undefined){this.addByMultiValuedString(a.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.RDN,KJUR.asn1.ASN1Object);KJUR.asn1.x509.RDN.parseString=function(m){var j=m.split(/\+/);var h=false;var c=[];for(var g=0;j.length>0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(d!==undefined){if(d.str!==undefined){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var m=null,i=null,k={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},b=KJUR,g=b.asn1,f=g.DERSequence,j=g.DEROctetString,d=g.DERIA5String,c=g.DERTaggedObject,l=g.ASN1Object,a=g.x509.X500Name,h=pemtohex;this.explicit=false;this.setByParam=function(p){var r=null;var u=null;if(p===undefined){return}if(p.rfc822!==undefined){this.type="rfc822";u=new d({str:p[this.type]})}if(p.dns!==undefined){this.type="dns";u=new d({str:p[this.type]})}if(p.uri!==undefined){this.type="uri";u=new d({str:p[this.type]})}if(p.dn!==undefined){this.type="dn";this.explicit=true;u=new a({str:p.dn})}if(p.ldapdn!==undefined){this.type="dn";this.explicit=true;u=new a({ldapstr:p.ldapdn})}if(p.certissuer!==undefined){this.type="dn";this.explicit=true;var o=p.certissuer;var w=null;if(o.match(/^[0-9A-Fa-f]+$/)){w==o}if(o.indexOf("-----BEGIN ")!=-1){w=h(o)}if(w==null){throw"certissuer param not cert"}var t=new X509();t.hex=w;var y=t.getIssuerHex();u=new l();u.hTLV=y}if(p.certsubj!==undefined){this.type="dn";this.explicit=true;var o=p.certsubj;var w=null;if(o.match(/^[0-9A-Fa-f]+$/)){w==o}if(o.indexOf("-----BEGIN ")!=-1){w=h(o)}if(w==null){throw"certsubj param not cert"}var t=new X509();t.hex=w;var y=t.getSubjectHex();u=new l();u.hTLV=y}if(p.ip!==undefined){this.type="ip";this.explicit=false;var q=p.ip;var s;var n="malformed IP address";if(q.match(/^[0-9.]+[.][0-9.]+$/)){s=intarystrtohex("["+q.split(".").join(",")+"]");if(s.length!==8){throw n}}else{if(q.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/)){s=ipv6tohex(q)}else{if(q.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/)){s=q}else{throw n}}}u=new j({hex:s})}if(this.type==null){throw"unsupported type in params="+p}this.asn1Obj=new c({explicit:this.explicit,tag:k[this.type],obj:u})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e<g.length;e++){var f=new b.x509.GeneralName(g[e]);this.asn1Array.push(f)}};this.getEncodedHex=function(){var e=new b.DERSequence({array:this.asn1Array});return e.getEncodedHex()};this.asn1Array=new Array();if(typeof d!="undefined"){this.setByParamArray(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralNames,KJUR.asn1.ASN1Object);KJUR.asn1.x509.DistributionPointName=function(b){KJUR.asn1.x509.DistributionPointName.superclass.constructor.call(this);var h=null,e=null,a=null,g=null,d=KJUR,c=d.asn1,f=c.DERTaggedObject;this.getEncodedHex=function(){if(this.type!="full"){throw"currently type shall be 'full': "+this.type}this.asn1Obj=new f({explicit:false,tag:this.tag,obj:this.asn1V});this.hTLV=this.asn1Obj.getEncodedHex();return this.hTLV};if(b!==undefined){if(c.x509.GeneralNames.prototype.isPrototypeOf(b)){this.type="full";this.tag="a0";this.asn1V=b}else{throw"This class supports GeneralNames only as argument"}}};YAHOO.lang.extend(KJUR.asn1.x509.DistributionPointName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.DistributionPoint=function(d){KJUR.asn1.x509.DistributionPoint.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.getEncodedHex=function(){var e=new b.DERSequence();if(this.asn1DP!=null){var f=new b.DERTaggedObject({explicit:true,tag:"a0",obj:this.asn1DP});e.appendASN1Object(f)}this.hTLV=e.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.dpobj!==undefined){this.asn1DP=d.dpobj}}};YAHOO.lang.extend(KJUR.asn1.x509.DistributionPoint,KJUR.asn1.ASN1Object);KJUR.asn1.x509.OID=new function(a){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"};this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",ecPublicKey:"1.2.840.10045.2.1",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",extensionRequest:"1.2.840.113549.1.9.14",};this.objCache={};this.name2obj=function(b){if(typeof this.objCache[b]!="undefined"){return this.objCache[b]}if(typeof this.name2oidList[b]=="undefined"){throw"Name of ObjectIdentifier not defined: "+b}var c=this.name2oidList[b];var d=new KJUR.asn1.DERObjectIdentifier({oid:c});this.objCache[b]=d;return d};this.atype2obj=function(b){if(typeof this.objCache[b]!="undefined"){return this.objCache[b]}if(typeof this.atype2oidList[b]=="undefined"){throw"AttributeType name undefined: "+b}var c=this.atype2oidList[b];var d=new KJUR.asn1.DERObjectIdentifier({oid:c});this.objCache[b]=d;return d}};KJUR.asn1.x509.OID.oid2name=function(b){var c=KJUR.asn1.x509.OID.name2oidList;for(var a in c){if(c[a]==b){return a}}return""};KJUR.asn1.x509.OID.oid2atype=function(b){var c=KJUR.asn1.x509.OID.atype2oidList;for(var a in c){if(c[a]==b){return a}}return b};KJUR.asn1.x509.OID.name2oid=function(a){var b=KJUR.asn1.x509.OID.name2oidList;if(b[a]===undefined){return""}return b[a]};KJUR.asn1.x509.X509Util={};KJUR.asn1.x509.X509Util.newCertPEM=function(h){var g=KJUR.asn1.x509,b=g.TBSCertificate,a=g.Certificate;var f=new b();if(h.serial!==undefined){f.setSerialNumberByParam(h.serial)}else{throw"serial number undefined."}if(typeof h.sigalg.name==="string"){f.setSignatureAlgByParam(h.sigalg)}else{throw"unproper signature algorithm name"}if(h.issuer!==undefined){f.setIssuerByParam(h.issuer)}else{throw"issuer name undefined."}if(h.notbefore!==undefined){f.setNotBeforeByParam(h.notbefore)}else{throw"notbefore undefined."}if(h.notafter!==undefined){f.setNotAfterByParam(h.notafter)}else{throw"notafter undefined."}if(h.subject!==undefined){f.setSubjectByParam(h.subject)}else{throw"subject name undefined."}if(h.sbjpubkey!==undefined){f.setSubjectPublicKeyByGetKey(h.sbjpubkey)}else{throw"subject public key undefined."}if(h.ext!==undefined&&h.ext.length!==undefined){for(var d=0;d<h.ext.length;d++){for(key in h.ext[d]){f.appendExtensionByName(key,h.ext[d][key])}}}if(h.cakey===undefined&&h.sighex===undefined){throw"param cakey and sighex undefined."}var e=null;var c=null;if(h.cakey){if(h.cakey.isPrivate===true){e=h.cakey}else{e=KEYUTIL.getKey.apply(null,h.cakey)}c=new a({tbscertobj:f,prvkeyobj:e});c.sign()}if(h.sighex){c=new a({tbscertobj:f});c.setSignatureHex(h.sighex)}return c.getPEMString()};
75357if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.cms=="undefined"||!KJUR.asn1.cms){KJUR.asn1.cms={}}KJUR.asn1.cms.Attribute=function(d){var a=[],c=KJUR,b=c.asn1;b.cms.Attribute.superclass.constructor.call(this);this.getEncodedHex=function(){var h,g,e;h=new b.DERObjectIdentifier({oid:this.attrTypeOid});g=new b.DERSet({array:this.valueList});try{g.getEncodedHex()}catch(f){throw"fail valueSet.getEncodedHex in Attribute(1)/"+f}e=new b.DERSequence({array:[h,g]});try{this.hTLV=e.getEncodedHex()}catch(f){throw"failed seq.getEncodedHex in Attribute(2)/"+f}return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.Attribute,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentType=function(d){var c=KJUR,b=c.asn1;b.cms.ContentType.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.3";var a=null;if(typeof d!="undefined"){var a=new b.DERObjectIdentifier(d);this.valueList=[a]}};YAHOO.lang.extend(KJUR.asn1.cms.ContentType,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.MessageDigest=function(d){var b=KJUR,e=b.asn1,g=e.DEROctetString,i=e.cms;i.MessageDigest.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.4";if(d!==undefined){if(d.eciObj instanceof i.EncapsulatedContentInfo&&typeof d.hashAlg==="string"){var h=d.eciObj.eContentValueHex;var c=d.hashAlg;var a=b.crypto.Util.hashHex(h,c);var f=new g({hex:a});f.getEncodedHex();this.valueList=[f]}else{var f=new g(d);f.getEncodedHex();this.valueList=[f]}}};YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningTime=function(e){var d=KJUR,c=d.asn1;c.cms.SigningTime.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.5";if(e!==undefined){var a=new c.x509.Time(e);try{a.getEncodedHex()}catch(b){throw"SigningTime.getEncodedHex() failed/"+b}this.valueList=[a]}};YAHOO.lang.extend(KJUR.asn1.cms.SigningTime,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningCertificate=function(f){var c=KJUR,b=c.asn1,a=b.DERSequence,e=b.cms,d=c.crypto;e.SigningCertificate.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.12";this.setCerts=function(n){var l=[];for(var k=0;k<n.length;k++){var h=pemtohex(n[k]);var g=c.crypto.Util.hashHex(h,"sha1");var o=new b.DEROctetString({hex:g});o.getEncodedHex();var m=new e.IssuerAndSerialNumber({cert:n[k]});m.getEncodedHex();var p=new a({array:[o,m]});p.getEncodedHex();l.push(p)}var j=new a({array:l});j.getEncodedHex();this.valueList=[j]};if(f!==undefined){if(typeof f.array=="object"){this.setCerts(f.array)}}};YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificate,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningCertificateV2=function(h){var d=KJUR,c=d.asn1,b=c.DERSequence,g=c.x509,f=c.cms,e=d.crypto;f.SigningCertificateV2.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.47";this.setCerts=function(r,k){var p=[];for(var n=0;n<r.length;n++){var l=pemtohex(r[n]);var t=[];if(k!=="sha256"){t.push(new g.AlgorithmIdentifier({name:k}))}var j=e.Util.hashHex(l,k);var s=new c.DEROctetString({hex:j});s.getEncodedHex();t.push(s);var o=new f.IssuerAndSerialNumber({cert:r[n]});o.getEncodedHex();t.push(o);var q=new b({array:t});q.getEncodedHex();p.push(q)}var m=new b({array:p});m.getEncodedHex();this.valueList=[m]};if(h!==undefined){if(typeof h.array=="object"){var a="sha256";if(typeof h.hashAlg=="string"){a=h.hashAlg}this.setCerts(h.array,a)}}};YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.IssuerAndSerialNumber=function(e){var b=KJUR,g=b.asn1,f=g.DERInteger,i=g.cms,d=g.x509,a=d.X500Name,c=X509;i.IssuerAndSerialNumber.superclass.constructor.call(this);var j=null;var h=null;this.setByCertPEM=function(n){var l=pemtohex(n);var k=new c();k.hex=l;var o=k.getIssuerHex();this.dIssuer=new a();this.dIssuer.hTLV=o;var m=k.getSerialNumberHex();this.dSerial=new f({hex:m})};this.getEncodedHex=function(){var k=new g.DERSequence({array:[this.dIssuer,this.dSerial]});this.hTLV=k.getEncodedHex();return this.hTLV};if(e!==undefined){if(typeof e=="string"&&e.indexOf("-----BEGIN ")!=-1){this.setByCertPEM(e)}if(e.issuer&&e.serial){if(e.issuer instanceof a){this.dIssuer=e.issuer}else{this.dIssuer=new a(e.issuer)}if(e.serial instanceof f){this.dSerial=e.serial}else{this.dSerial=new f(e.serial)}}if(typeof e.cert=="string"){this.setByCertPEM(e.cert)}}};YAHOO.lang.extend(KJUR.asn1.cms.IssuerAndSerialNumber,KJUR.asn1.ASN1Object);KJUR.asn1.cms.AttributeList=function(d){var b=KJUR,a=b.asn1,c=a.cms;c.AttributeList.superclass.constructor.call(this);this.list=new Array();this.sortFlag=true;this.add=function(e){if(e instanceof c.Attribute){this.list.push(e)}};this.length=function(){return this.list.length};this.clear=function(){this.list=new Array();this.hTLV=null;this.hV=null};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var e=new a.DERSet({array:this.list,sortflag:this.sortFlag});this.hTLV=e.getEncodedHex();return this.hTLV};if(d!==undefined){if(typeof d.sortflag!="undefined"&&d.sortflag==false){this.sortFlag=false}}};YAHOO.lang.extend(KJUR.asn1.cms.AttributeList,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignerInfo=function(e){var a=KJUR,h=a.asn1,b=h.DERTaggedObject,n=h.cms,j=n.AttributeList,g=n.ContentType,k=n.EncapsulatedContentInfo,c=n.MessageDigest,l=n.SignedData,d=h.x509,m=d.AlgorithmIdentifier,f=a.crypto,i=KEYUTIL;n.SignerInfo.superclass.constructor.call(this);this.dCMSVersion=new h.DERInteger({"int":1});this.dSignerIdentifier=null;this.dDigestAlgorithm=null;this.dSignedAttrs=new j();this.dSigAlg=null;this.dSig=null;this.dUnsignedAttrs=new j();this.setSignerIdentifier=function(p){if(typeof p=="string"&&p.indexOf("CERTIFICATE")!=-1&&p.indexOf("BEGIN")!=-1&&p.indexOf("END")!=-1){var o=p;this.dSignerIdentifier=new n.IssuerAndSerialNumber({cert:p})}};this.setForContentAndHash=function(o){if(o!==undefined){if(o.eciObj instanceof k){this.dSignedAttrs.add(new g({oid:"1.2.840.113549.1.7.1"}));this.dSignedAttrs.add(new c({eciObj:o.eciObj,hashAlg:o.hashAlg}))}if(o.sdObj!==undefined&&o.sdObj instanceof l){if(o.sdObj.digestAlgNameList.join(":").indexOf(o.hashAlg)==-1){o.sdObj.digestAlgNameList.push(o.hashAlg)}}if(typeof o.hashAlg=="string"){this.dDigestAlgorithm=new m({name:o.hashAlg})}}};this.sign=function(t,p){this.dSigAlg=new m({name:p});var q=this.dSignedAttrs.getEncodedHex();var o=i.getKey(t);var s=new f.Signature({alg:p});s.init(o);s.updateHex(q);var r=s.sign();this.dSig=new h.DEROctetString({hex:r})};this.addUnsigned=function(o){this.hTLV=null;this.dUnsignedAttrs.hTLV=null;this.dUnsignedAttrs.add(o)};this.getEncodedHex=function(){if(this.dSignedAttrs instanceof j&&this.dSignedAttrs.length()==0){throw"SignedAttrs length = 0 (empty)"}var o=new b({obj:this.dSignedAttrs,tag:"a0",explicit:false});var r=null;if(this.dUnsignedAttrs.length()>0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t<this.digestAlgNameList.length;t++){var s=this.digestAlgNameList[t];var w=new k({name:s});u.push(w)}this.dDigestAlgs=new m({array:u})}var p=[this.dCMSVersion,this.dDigestAlgs,this.dEncapContentInfo];if(this.dCerts==null){if(this.certificateList.length>0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h<d.certs.length;h++){m.addCertificatesByPEM(d.certs[h])}}m.signerInfoList=[];for(var h=0;h<d.signerInfos.length;h++){var k=d.signerInfos[h];var g=new f();g.setSignerIdentifier(k.signerCert);g.setForContentAndHash({sdObj:m,eciObj:m.dEncapContentInfo,hashAlg:k.hashAlg});for(attrName in k.sAttr){var r=k.sAttr[attrName];if(attrName=="SigningTime"){var l=new o(r);g.dSignedAttrs.add(l)}if(attrName=="SigningCertificate"){var l=new a(r);g.dSignedAttrs.add(l)}if(attrName=="SigningCertificateV2"){var l=new p(r);g.dSignedAttrs.add(l)}if(attrName=="SignaturePolicyIdentifier"){var l=new e(r);g.dSignedAttrs.add(l)}}g.sign(k.signerPrvKey,k.sigAlg);m.signerInfoList.push(g)}return m};KJUR.asn1.cms.CMSUtil.verifySignedData=function(n){var C=KJUR,p=C.asn1,s=p.cms,D=s.SignerInfo,q=s.SignedData,y=s.SigningTime,b=s.SigningCertificate,d=s.SigningCertificateV2,A=p.cades,u=A.SignaturePolicyIdentifier,i=C.lang.String.isHex,v=ASN1HEX,h=v.getVbyList,a=v.getTLVbyList,t=v.getIdxbyList,z=v.getChildIdx,c=v.getTLV,B=v.oidname,j=C.crypto.Util.hashHex;if(n.cms===undefined&&!i(n.cms)){}var E=n.cms;var g=function(J,H){var G;for(var I=3;I<6;I++){G=t(J,0,[1,0,I]);if(G!==undefined){var F=J.substr(G,2);if(F==="a0"){H.certsIdx=G}if(F==="a1"){H.revinfosIdx=G}if(F==="31"){H.signerinfosIdx=G}}}};var l=function(I,F){var H=F.signerinfosIdx;if(H===undefined){return}var L=z(I,H);F.signerInfoIdxList=L;for(var G=0;G<L.length;G++){var K=L[G];var J={idx:K};k(I,J);F.signerInfos.push(J)}};var k=function(I,J){var F=J.idx;J.signerid_issuer1=a(I,F,[1,0],"30");J.signerid_serial1=h(I,F,[1,1],"02");J.hashalg=B(h(I,F,[2,0],"06"));var H=t(I,F,[3],"a0");J.idxSignedAttrs=H;f(I,J,H);var G=z(I,F);var K=G.length;if(K<6){throw"malformed SignerInfo"}J.sigalg=B(h(I,F,[K-2,0],"06"));J.sigval=h(I,F,[K-1],"04")};var f=function(L,M,F){var J=z(L,F);M.signedAttrIdxList=J;for(var K=0;K<J.length;K++){var I=J[K];var G=h(L,I,[0],"06");var H;if(G==="2a864886f70d010905"){H=hextoutf8(h(L,I,[1,0]));M.saSigningTime=H}else{if(G==="2a864886f70d010904"){H=h(L,I,[1,0],"04");M.saMessageDigest=H}}}};var w=function(G,F){if(h(G,0,[0],"06")!=="2a864886f70d010702"){return F}F.cmsType="signedData";F.econtent=h(G,0,[1,0,2,1,0]);g(G,F);F.signerInfos=[];l(G,F)};var o=function(J,F){var G=F.parse.signerInfos;var L=G.length;var K=true;for(var I=0;I<L;I++){var H=G[I];e(J,F,H,I);if(!H.isValid){K=false}}F.isValid=K};var x=function(F,Q,J,P){var N=Q.parse.certsIdx;var H;if(Q.certs===undefined){H=[];Q.certkeys=[];var K=z(F,N);for(var I=0;I<K.length;I++){var M=c(F,K[I]);var O=new X509();O.readCertHex(M);H[I]=O;Q.certkeys[I]=O.getPublicKey()}Q.certs=H}else{H=Q.certs}Q.cccc=H.length;Q.cccci=K.length;for(var I=0;I<H.length;I++){var L=O.getIssuerHex();var G=O.getSerialNumberHex();if(J.signerid_issuer1===L&&J.signerid_serial1===G){J.certkey_idx=I}}};var e=function(F,R,I,N){I.verifyDetail={};var Q=I.verifyDetail;var K=R.parse.econtent;var G=I.hashalg;var L=I.saMessageDigest;Q.validMessageDigest=false;if(j(K,G)===L){Q.validMessageDigest=true}x(F,R,I,N);Q.validSignatureValue=false;var H=I.sigalg;var M="31"+c(F,I.idxSignedAttrs).substr(2);I.signedattrshex=M;var J=R.certs[I.certkey_idx].getPublicKey();var P=new KJUR.crypto.Signature({alg:H});P.init(J);P.updateHex(M);var O=P.verify(I.sigval);Q.validSignatureValue_isValid=O;if(O===true){Q.validSignatureValue=true}I.isValid=false;if(Q.validMessageDigest&&Q.validSignatureValue){I.isValid=true}};var m=function(){};var r={isValid:false,parse:{}};w(E,r.parse);o(E,r);return r};
75358if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.tsp=="undefined"||!KJUR.asn1.tsp){KJUR.asn1.tsp={}}KJUR.asn1.tsp.Accuracy=function(f){var c=KJUR,b=c.asn1,e=b.DERInteger,a=b.DERSequence,d=b.DERTaggedObject;b.tsp.Accuracy.superclass.constructor.call(this);this.seconds=null;this.millis=null;this.micros=null;this.getEncodedHex=function(){var i=null;var k=null;var m=null;var g=[];if(this.seconds!=null){i=new e({"int":this.seconds});g.push(i)}if(this.millis!=null){var l=new e({"int":this.millis});k=new d({obj:l,tag:"80",explicit:false});g.push(k)}if(this.micros!=null){var j=new e({"int":this.micros});m=new d({obj:j,tag:"81",explicit:false});g.push(m)}var h=new a({array:g});this.hTLV=h.getEncodedHex();return this.hTLV};if(f!==undefined){if(typeof f.seconds=="number"){this.seconds=f.seconds}if(typeof f.millis=="number"){this.millis=f.millis}if(typeof f.micros=="number"){this.micros=f.micros}}};YAHOO.lang.extend(KJUR.asn1.tsp.Accuracy,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.MessageImprint=function(g){var c=KJUR,b=c.asn1,a=b.DERSequence,d=b.DEROctetString,f=b.x509,e=f.AlgorithmIdentifier;b.tsp.MessageImprint.superclass.constructor.call(this);this.dHashAlg=null;this.dHashValue=null;this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var h=new a({array:[this.dHashAlg,this.dHashValue]});return h.getEncodedHex()};if(g!==undefined){if(typeof g.hashAlg=="string"){this.dHashAlg=new e({name:g.hashAlg})}if(typeof g.hashValue=="string"){this.dHashValue=new d({hex:g.hashValue})}}};YAHOO.lang.extend(KJUR.asn1.tsp.MessageImprint,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TimeStampReq=function(c){var a=KJUR,f=a.asn1,d=f.DERSequence,e=f.DERInteger,g=f.DERBoolean,i=f.DERObjectIdentifier,h=f.tsp,b=h.MessageImprint;h.TimeStampReq.superclass.constructor.call(this);this.dVersion=new e({"int":1});this.dMessageImprint=null;this.dPolicy=null;this.dNonce=null;this.certReq=true;this.setMessageImprint=function(j){if(j instanceof b){this.dMessageImprint=j;return}if(typeof j=="object"){this.dMessageImprint=new b(j)}};this.getEncodedHex=function(){if(this.dMessageImprint==null){throw"messageImprint shall be specified"}var j=[this.dVersion,this.dMessageImprint];if(this.dPolicy!=null){j.push(this.dPolicy)}if(this.dNonce!=null){j.push(this.dNonce)}if(this.certReq){j.push(new g())}var k=new d({array:j});this.hTLV=k.getEncodedHex();return this.hTLV};if(c!==undefined){if(typeof c.mi=="object"){this.setMessageImprint(c.mi)}if(typeof c.policy=="object"){this.dPolicy=new i(c.policy)}if(typeof c.nonce=="object"){this.dNonce=new e(c.nonce)}if(typeof c.certreq=="boolean"){this.certReq=c.certreq}}};YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampReq,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TSTInfo=function(e){var c=KJUR,i=c.asn1,f=i.DERSequence,h=i.DERInteger,k=i.DERBoolean,g=i.DERGeneralizedTime,l=i.DERObjectIdentifier,j=i.tsp,d=j.MessageImprint,b=j.Accuracy,a=i.x509.X500Name;j.TSTInfo.superclass.constructor.call(this);this.dVersion=new h({"int":1});this.dPolicy=null;this.dMessageImprint=null;this.dSerialNumber=null;this.dGenTime=null;this.dAccuracy=null;this.dOrdering=null;this.dNonce=null;this.dTsa=null;this.getEncodedHex=function(){var m=[this.dVersion];if(this.dPolicy==null){throw"policy shall be specified."}m.push(this.dPolicy);if(this.dMessageImprint==null){throw"messageImprint shall be specified."}m.push(this.dMessageImprint);if(this.dSerialNumber==null){throw"serialNumber shall be specified."}m.push(this.dSerialNumber);if(this.dGenTime==null){throw"genTime shall be specified."}m.push(this.dGenTime);if(this.dAccuracy!=null){m.push(this.dAccuracy)}if(this.dOrdering!=null){m.push(this.dOrdering)}if(this.dNonce!=null){m.push(this.dNonce)}if(this.dTsa!=null){m.push(this.dTsa)}var n=new f({array:m});this.hTLV=n.getEncodedHex();return this.hTLV};if(e!==undefined){if(typeof e.policy=="string"){if(!e.policy.match(/^[0-9.]+$/)){throw"policy shall be oid like 0.1.4.134"}this.dPolicy=new l({oid:e.policy})}if(e.messageImprint!==undefined){this.dMessageImprint=new d(e.messageImprint)}if(e.serialNumber!==undefined){this.dSerialNumber=new h(e.serialNumber)}if(e.genTime!==undefined){this.dGenTime=new g(e.genTime)}if(e.accuracy!==undefined){this.dAccuracy=new b(e.accuracy)}if(e.ordering!==undefined&&e.ordering==true){this.dOrdering=new k()}if(e.nonce!==undefined){this.dNonce=new h(e.nonce)}if(e.tsa!==undefined){this.dTsa=new a(e.tsa)}}};YAHOO.lang.extend(KJUR.asn1.tsp.TSTInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TimeStampResp=function(g){var e=KJUR,d=e.asn1,c=d.DERSequence,f=d.ASN1Object,a=d.tsp,b=a.PKIStatusInfo;a.TimeStampResp.superclass.constructor.call(this);this.dStatus=null;this.dTST=null;this.getEncodedHex=function(){if(this.dStatus==null){throw"status shall be specified"}var h=[this.dStatus];if(this.dTST!=null){h.push(this.dTST)}var i=new c({array:h});this.hTLV=i.getEncodedHex();return this.hTLV};if(g!==undefined){if(typeof g.status=="object"){this.dStatus=new b(g.status)}if(g.tst!==undefined&&g.tst instanceof f){this.dTST=g.tst.getContentInfo()}}};YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampResp,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatusInfo=function(h){var g=KJUR,f=g.asn1,e=f.DERSequence,a=f.tsp,d=a.PKIStatus,c=a.PKIFreeText,b=a.PKIFailureInfo;a.PKIStatusInfo.superclass.constructor.call(this);this.dStatus=null;this.dStatusString=null;this.dFailureInfo=null;this.getEncodedHex=function(){if(this.dStatus==null){throw"status shall be specified"}var i=[this.dStatus];if(this.dStatusString!=null){i.push(this.dStatusString)}if(this.dFailureInfo!=null){i.push(this.dFailureInfo)}var j=new e({array:i});this.hTLV=j.getEncodedHex();return this.hTLV};if(h!==undefined){if(typeof h.status=="object"){this.dStatus=new d(h.status)}if(typeof h.statstr=="object"){this.dStatusString=new c({array:h.statstr})}if(typeof h.failinfo=="object"){this.dFailureInfo=new b(h.failinfo)}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatusInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatus=function(h){var d=KJUR,c=d.asn1,g=c.DERInteger,a=c.tsp,b=a.PKIStatus;a.PKIStatus.superclass.constructor.call(this);var f=null;this.getEncodedHex=function(){this.hTLV=this.dStatus.getEncodedHex();return this.hTLV};if(h!==undefined){if(h.name!==undefined){var e=b.valueList;if(e[h.name]===undefined){throw"name undefined: "+h.name}this.dStatus=new g({"int":e[h.name]})}else{this.dStatus=new g(h)}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatus,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatus.valueList={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};KJUR.asn1.tsp.PKIFreeText=function(f){var e=KJUR,d=e.asn1,b=d.DERSequence,c=d.DERUTF8String,a=d.tsp;a.PKIFreeText.superclass.constructor.call(this);this.textList=[];this.getEncodedHex=function(){var g=[];for(var j=0;j<this.textList.length;j++){g.push(new c({str:this.textList[j]}))}var h=new b({array:g});this.hTLV=h.getEncodedHex();return this.hTLV};if(f!==undefined){if(typeof f.array=="object"){this.textList=f.array}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIFreeText,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIFailureInfo=function(g){var d=KJUR,c=d.asn1,f=c.DERBitString,a=c.tsp,b=a.PKIFailureInfo;b.superclass.constructor.call(this);this.value=null;this.getEncodedHex=function(){if(this.value==null){throw"value shall be specified"}var h=new Number(this.value).toString(2);var i=new f();i.setByBinaryString(h);this.hTLV=i.getEncodedHex();return this.hTLV};if(g!==undefined){if(typeof g.name=="string"){var e=b.valueList;if(e[g.name]===undefined){throw"name undefined: "+g.name}this.value=e[g.name]}else{if(typeof g["int"]=="number"){this.value=g["int"]}}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIFailureInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIFailureInfo.valueList={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};KJUR.asn1.tsp.AbstractTSAAdapter=function(a){this.getTSTHex=function(c,b){throw"not implemented yet"}};KJUR.asn1.tsp.SimpleTSAAdapter=function(e){var d=KJUR,c=d.asn1,a=c.tsp,b=d.crypto.Util.hashHex;a.SimpleTSAAdapter.superclass.constructor.call(this);this.params=null;this.serial=0;this.getTSTHex=function(g,f){var i=b(g,f);this.params.tstInfo.messageImprint={hashAlg:f,hashValue:i};this.params.tstInfo.serialNumber={"int":this.serial++};var h=Math.floor(Math.random()*1000000000);this.params.tstInfo.nonce={"int":h};var j=a.TSPUtil.newTimeStampToken(this.params);return j.getContentInfoEncodedHex()};if(e!==undefined){this.params=e}};YAHOO.lang.extend(KJUR.asn1.tsp.SimpleTSAAdapter,KJUR.asn1.tsp.AbstractTSAAdapter);KJUR.asn1.tsp.FixedTSAAdapter=function(e){var d=KJUR,c=d.asn1,a=c.tsp,b=d.crypto.Util.hashHex;a.FixedTSAAdapter.superclass.constructor.call(this);this.params=null;this.getTSTHex=function(g,f){var h=b(g,f);this.params.tstInfo.messageImprint={hashAlg:f,hashValue:h};var i=a.TSPUtil.newTimeStampToken(this.params);return i.getContentInfoEncodedHex()};if(e!==undefined){this.params=e}};YAHOO.lang.extend(KJUR.asn1.tsp.FixedTSAAdapter,KJUR.asn1.tsp.AbstractTSAAdapter);KJUR.asn1.tsp.TSPUtil=new function(){};KJUR.asn1.tsp.TSPUtil.newTimeStampToken=function(c){var b=KJUR,h=b.asn1,m=h.cms,k=h.tsp,a=h.tsp.TSTInfo;var j=new m.SignedData();var g=new a(c.tstInfo);var f=g.getEncodedHex();j.dEncapContentInfo.setContentValue({hex:f});j.dEncapContentInfo.setContentType("tstinfo");if(typeof c.certs=="object"){for(var e=0;e<c.certs.length;e++){j.addCertificatesByPEM(c.certs[e])}}var d=j.signerInfoList[0];d.setSignerIdentifier(c.signerCert);d.setForContentAndHash({sdObj:j,eciObj:j.dEncapContentInfo,hashAlg:c.hashAlg});var l=new m.SigningCertificate({array:[c.signerCert]});d.dSignedAttrs.add(l);d.sign(c.signerPrvKey,c.sigAlg);return j};KJUR.asn1.tsp.TSPUtil.parseTimeStampReq=function(m){var l=ASN1HEX;var h=l.getChildIdx;var f=l.getV;var b=l.getTLV;var j={};j.certreq=false;var a=h(m,0);if(a.length<2){throw"TimeStampReq must have at least 2 items"}var e=b(m,a[1]);j.mi=KJUR.asn1.tsp.TSPUtil.parseMessageImprint(e);for(var d=2;d<a.length;d++){var g=a[d];var k=m.substr(g,2);if(k=="06"){var c=f(m,g);j.policy=l.hextooidstr(c)}if(k=="02"){j.nonce=f(m,g)}if(k=="01"){j.certreq=true}}return j};KJUR.asn1.tsp.TSPUtil.parseMessageImprint=function(c){var m=ASN1HEX;var j=m.getChildIdx;var i=m.getV;var g=m.getIdxbyList;var k={};if(c.substr(0,2)!="30"){throw"head of messageImprint hex shall be '30'"}var a=j(c,0);var l=g(c,0,[0,0]);var e=i(c,l);var d=m.hextooidstr(e);var h=KJUR.asn1.x509.OID.oid2name(d);if(h==""){throw"hashAlg name undefined: "+d}var b=h;var f=g(c,0,[1]);k.hashAlg=b;k.hashValue=i(c,f);return k};
75359if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.cades=="undefined"||!KJUR.asn1.cades){KJUR.asn1.cades={}}KJUR.asn1.cades.SignaturePolicyIdentifier=function(f){var b=KJUR,h=b.asn1,i=h.DERObjectIdentifier,g=h.DERSequence,e=h.cades,c=e.OtherHashAlgAndValue;e.SignaturePolicyIdentifier.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.15";if(f!==undefined){if(typeof f.oid=="string"&&typeof f.hash=="object"){var d=new i({oid:f.oid});var a=new c(f.hash);var j=new g({array:[d,a]});this.valueList=[j]}}};YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.OtherHashAlgAndValue=function(e){var a=KJUR,g=a.asn1,f=g.DERSequence,h=g.DEROctetString,d=g.x509,i=d.AlgorithmIdentifier,c=g.cades,b=c.OtherHashAlgAndValue;b.superclass.constructor.call(this);this.dAlg=null;this.dHash=null;this.getEncodedHex=function(){var j=new f({array:[this.dAlg,this.dHash]});this.hTLV=j.getEncodedHex();return this.hTLV};if(e!==undefined){if(typeof e.alg=="string"&&typeof e.hash=="string"){this.dAlg=new i({name:e.alg});this.dHash=new h({hex:e.hash})}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.cades.SignatureTimeStamp=function(h){var c=KJUR,b=c.asn1,e=b.ASN1Object,g=b.x509,a=b.cades;a.SignatureTimeStamp.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.14";this.tstHex=null;if(h!==undefined){if(h.res!==undefined){if(typeof h.res=="string"&&h.res.match(/^[0-9A-Fa-f]+$/)){}else{if(h.res instanceof e){}else{throw"res param shall be ASN1Object or hex string"}}}if(h.tst!==undefined){if(typeof h.tst=="string"&&h.tst.match(/^[0-9A-Fa-f]+$/)){var f=new e();this.tstHex=h.tst;f.hTLV=this.tstHex;f.getEncodedHex();this.valueList=[f]}else{if(h.tst instanceof e){}else{throw"tst param shall be ASN1Object or hex string"}}}}};YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.CompleteCertificateRefs=function(d){var c=KJUR,b=c.asn1,a=b.cades;a.CompleteCertificateRefs.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.21";this.setByArray=function(e){this.valueList=[];for(var f=0;f<e.length;f++){var g=new a.OtherCertID(e[f]);this.valueList.push(g)}};if(d!==undefined){if(typeof d=="object"&&typeof d.length=="number"){this.setByArray(d)}}};YAHOO.lang.extend(KJUR.asn1.cades.CompleteCertificateRefs,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.OtherCertID=function(e){var c=KJUR,b=c.asn1,d=b.cms,a=b.cades;a.OtherCertID.superclass.constructor.call(this);this.hasIssuerSerial=true;this.dOtherCertHash=null;this.dIssuerSerial=null;this.setByCertPEM=function(f){this.dOtherCertHash=new a.OtherHash(f);if(this.hasIssuerSerial){this.dIssuerSerial=new d.IssuerAndSerialNumber(f)}};this.getEncodedHex=function(){if(this.hTLV!=null){return this.hTLV}if(this.dOtherCertHash==null){throw"otherCertHash not set"}var f=[this.dOtherCertHash];if(this.dIssuerSerial!=null){f.push(this.dIssuerSerial)}var g=new b.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(e!==undefined){if(typeof e=="string"&&e.indexOf("-----BEGIN ")!=-1){this.setByCertPEM(e)}if(typeof e=="object"){if(e.hasis===false){this.hasIssuerSerial=false}if(typeof e.cert=="string"){this.setByCertPEM(e.cert)}}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherCertID,KJUR.asn1.ASN1Object);KJUR.asn1.cades.OtherHash=function(f){var d=KJUR,c=d.asn1,e=c.cms,b=c.cades,g=b.OtherHashAlgAndValue,a=d.crypto.Util.hashHex;b.OtherHash.superclass.constructor.call(this);this.alg="sha256";this.dOtherHash=null;this.setByCertPEM=function(h){if(h.indexOf("-----BEGIN ")==-1){throw"certPEM not to seem PEM format"}var i=pemtohex(h);var j=a(i,this.alg);this.dOtherHash=new g({alg:this.alg,hash:j})};this.getEncodedHex=function(){if(this.dOtherHash==null){throw"OtherHash not set"}return this.dOtherHash.getEncodedHex()};if(f!==undefined){if(typeof f=="string"){if(f.indexOf("-----BEGIN ")!=-1){this.setByCertPEM(f)}else{if(f.match(/^[0-9A-Fa-f]+$/)){this.dOtherHash=new c.DEROctetString({hex:f})}else{throw"unsupported string value for params"}}}else{if(typeof f=="object"){if(typeof f.cert=="string"){if(typeof f.alg=="string"){this.alg=f.alg}this.setByCertPEM(f.cert)}else{this.dOtherHash=new g(f)}}}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherHash,KJUR.asn1.ASN1Object);KJUR.asn1.cades.CAdESUtil=new function(){};KJUR.asn1.cades.CAdESUtil.addSigTS=function(c,b,a){};KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){var p=ASN1HEX,u=p.getChildIdx,b=p.getTLV,a=p.getTLVbyList,k=p.getIdxbyList,A=KJUR,g=A.asn1,l=g.ASN1Object,j=g.cms,h=j.SignedData,v=g.cades,z=v.CAdESUtil;var m={};if(a(e,0,[0])!="06092a864886f70d010702"){throw"hex is not CMS SignedData"}var y=k(e,0,[1,0]);var B=u(e,y);if(B.length<4){throw"num of SignedData elem shall be 4 at least"}var d=B.shift();m.version=b(e,d);var w=B.shift();m.algs=b(e,w);var c=B.shift();m.encapcontent=b(e,c);m.certs=null;m.revs=null;m.si=[];var o=B.shift();if(e.substr(o,2)=="a0"){m.certs=b(e,o);o=B.shift()}if(e.substr(o,2)=="a1"){m.revs=b(e,o);o=B.shift()}var t=o;if(e.substr(t,2)!="31"){throw"Can't find signerInfos"}var f=u(e,t);for(var q=0;q<f.length;q++){var s=f[q];var n=z.parseSignerInfoForAddingUnsigned(e,s,q);m.si[q]=n}var x=null;m.obj=new h();x=new l();x.hTLV=m.version;m.obj.dCMSVersion=x;x=new l();x.hTLV=m.algs;m.obj.dDigestAlgs=x;x=new l();x.hTLV=m.encapcontent;m.obj.dEncapContentInfo=x;x=new l();x.hTLV=m.certs;m.obj.dCerts=x;m.obj.signerInfoList=[];for(var q=0;q<m.si.length;q++){m.obj.signerInfoList.push(m.si[q].obj)}return m};KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(g,q,c){var p=ASN1HEX,s=p.getChildIdx,a=p.getTLV,l=p.getV,v=KJUR,h=v.asn1,n=h.ASN1Object,j=h.cms,k=j.AttributeList,w=j.SignerInfo;var o={};var t=s(g,q);if(t.length!=6){throw"not supported items for SignerInfo (!=6)"}var d=t.shift();o.version=a(g,d);var e=t.shift();o.si=a(g,e);var m=t.shift();o.digalg=a(g,m);var f=t.shift();o.sattrs=a(g,f);var i=t.shift();o.sigalg=a(g,i);var b=t.shift();o.sig=a(g,b);o.sigval=l(g,b);var u=null;o.obj=new w();u=new n();u.hTLV=o.version;o.obj.dCMSVersion=u;u=new n();u.hTLV=o.si;o.obj.dSignerIdentifier=u;u=new n();u.hTLV=o.digalg;o.obj.dDigestAlgorithm=u;u=new n();u.hTLV=o.sattrs;o.obj.dSignedAttrs=u;u=new n();u.hTLV=o.sigalg;o.obj.dSigAlg=u;u=new n();u.hTLV=o.sig;o.obj.dSig=u;o.obj.dUnsignedAttrs=new k();return o};
75360if(typeof KJUR.asn1.csr=="undefined"||!KJUR.asn1.csr){KJUR.asn1.csr={}}KJUR.asn1.csr.CertificationRequest=function(d){var a=KJUR,f=a.asn1,b=f.DERBitString,e=f.DERSequence,k=f.csr,c=f.x509;k.CertificationRequest.superclass.constructor.call(this);var l=null;var j=null;var h=null;var i=null;var g=null;this.sign=function(o,n){if(this.prvKey==null){this.prvKey=n}this.asn1SignatureAlg=new c.AlgorithmIdentifier({name:o});sig=new a.crypto.Signature({alg:o});sig.init(this.prvKey);sig.updateHex(this.asn1CSRInfo.getEncodedHex());this.hexSig=sig.sign();this.asn1Sig=new b({hex:"00"+this.hexSig});var m=new e({array:[this.asn1CSRInfo,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=m.getEncodedHex();this.isModified=false};this.getPEMString=function(){return hextopem(this.getEncodedHex(),"CERTIFICATE REQUEST")};this.getEncodedHex=function(){if(this.isModified==false&&this.hTLV!=null){return this.hTLV}throw"not signed yet"};if(d!==undefined&&d.csrinfo!==undefined){this.asn1CSRInfo=d.csrinfo}};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequest,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CertificationRequestInfo=function(e){var b=KJUR,h=b.asn1,g=h.DERInteger,f=h.DERSequence,m=h.DERSet,j=h.DERNull,c=h.DERTaggedObject,k=h.DERObjectIdentifier,l=h.csr,d=h.x509,a=d.X500Name,n=d.Extension,i=KEYUTIL;l.CertificationRequestInfo.superclass.constructor.call(this);this._initialize=function(){this.asn1Array=new Array();this.asn1Version=new g({"int":0});this.asn1Subject=null;this.asn1SubjPKey=null;this.extensionsArray=new Array()};this.setSubjectByParam=function(o){this.asn1Subject=new a(o)};this.setSubjectPublicKeyByGetKey=function(p){var o=i.getKey(p);this.asn1SubjPKey=new d.SubjectPublicKeyInfo(o)};this.appendExtensionByName=function(p,o){n.appendByNameToArray(p,o,this.extensionsArray)};this.getEncodedHex=function(){this.asn1Array=new Array();this.asn1Array.push(this.asn1Version);this.asn1Array.push(this.asn1Subject);this.asn1Array.push(this.asn1SubjPKey);if(this.extensionsArray.length>0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e<h.ext.length;e++){for(key in h.ext[e]){d.appendExtensionByName(key,h.ext[e][key])}}}var f=new b.CertificationRequest({csrinfo:d});var a=c.getKey(h.sbjprvkey);f.sign(h.sigalg,a);var g=f.getPEMString();return g};KJUR.asn1.csr.CSRUtil.getInfo=function(b){var d=ASN1HEX;var e=d.getTLVbyList;var a={};a.subject={};a.pubkey={};if(b.indexOf("-----BEGIN CERTIFICATE REQUEST")==-1){throw"argument is not PEM file"}var c=pemtohex(b,"CERTIFICATE REQUEST");a.subject.hex=e(c,0,[0,1]);a.subject.name=X509.hex2dn(a.subject.hex);a.pubkey.hex=e(c,0,[0,2]);a.pubkey.obj=KEYUTIL.getKey(a.pubkey.hex,null,"pkcs8pub");return a};
75361if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.ocsp=="undefined"||!KJUR.asn1.ocsp){KJUR.asn1.ocsp={}}KJUR.asn1.ocsp.DEFAULT_HASH="sha1";KJUR.asn1.ocsp.CertID=function(g){var d=KJUR,k=d.asn1,m=k.DEROctetString,j=k.DERInteger,h=k.DERSequence,f=k.x509,n=f.AlgorithmIdentifier,o=k.ocsp,l=o.DEFAULT_HASH,i=d.crypto,e=i.Util.hashHex,c=X509,q=ASN1HEX;o.CertID.superclass.constructor.call(this);this.dHashAlg=null;this.dIssuerNameHash=null;this.dIssuerKeyHash=null;this.dSerialNumber=null;this.setByValue=function(t,s,p,r){if(r===undefined){r=l}this.dHashAlg=new n({name:r});this.dIssuerNameHash=new m({hex:t});this.dIssuerKeyHash=new m({hex:s});this.dSerialNumber=new j({hex:p})};this.setByCert=function(x,t,v){if(v===undefined){v=l}var p=new c();p.readCertPEM(t);var y=new c();y.readCertPEM(x);var z=y.getPublicKeyHex();var w=q.getTLVbyList(z,0,[1,0],"30");var r=p.getSerialNumberHex();var s=e(y.getSubjectHex(),v);var u=e(w,v);this.setByValue(s,u,r,v);this.hoge=p.getSerialNumberHex()};this.getEncodedHex=function(){if(this.dHashAlg===null&&this.dIssuerNameHash===null&&this.dIssuerKeyHash===null&&this.dSerialNumber===null){throw"not yet set values"}var p=[this.dHashAlg,this.dIssuerNameHash,this.dIssuerKeyHash,this.dSerialNumber];var r=new h({array:p});this.hTLV=r.getEncodedHex();return this.hTLV};if(g!==undefined){var b=g;if(b.issuerCert!==undefined&&b.subjectCert!==undefined){var a=l;if(b.alg===undefined){a=undefined}this.setByCert(b.issuerCert,b.subjectCert,a)}else{if(b.namehash!==undefined&&b.keyhash!==undefined&&b.serial!==undefined){var a=l;if(b.alg===undefined){a=undefined}this.setByValue(b.namehash,b.keyhash,b.serial,a)}else{throw"invalid constructor arguments"}}}};YAHOO.lang.extend(KJUR.asn1.ocsp.CertID,KJUR.asn1.ASN1Object);KJUR.asn1.ocsp.Request=function(f){var c=KJUR,b=c.asn1,a=b.DERSequence,d=b.ocsp;d.Request.superclass.constructor.call(this);this.dReqCert=null;this.dExt=null;this.getEncodedHex=function(){var g=[];if(this.dReqCert===null){throw"reqCert not set"}g.push(this.dReqCert);var h=new a({array:g});this.hTLV=h.getEncodedHex();return this.hTLV};if(typeof f!=="undefined"){var e=new d.CertID(f);this.dReqCert=e}};YAHOO.lang.extend(KJUR.asn1.ocsp.Request,KJUR.asn1.ASN1Object);KJUR.asn1.ocsp.TBSRequest=function(e){var c=KJUR,b=c.asn1,a=b.DERSequence,d=b.ocsp;d.TBSRequest.superclass.constructor.call(this);this.version=0;this.dRequestorName=null;this.dRequestList=[];this.dRequestExt=null;this.setRequestListByParam=function(h){var f=[];for(var g=0;g<h.length;g++){var j=new d.Request(h[0]);f.push(j)}this.dRequestList=f};this.getEncodedHex=function(){var f=[];if(this.version!==0){throw"not supported version: "+this.version}if(this.dRequestorName!==null){throw"requestorName not supported"}var h=new a({array:this.dRequestList});f.push(h);if(this.dRequestExt!==null){throw"requestExtensions not supported"}var g=new a({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(e!==undefined){if(e.reqList!==undefined){this.setRequestListByParam(e.reqList)}}};YAHOO.lang.extend(KJUR.asn1.ocsp.TBSRequest,KJUR.asn1.ASN1Object);KJUR.asn1.ocsp.OCSPRequest=function(f){var c=KJUR,b=c.asn1,a=b.DERSequence,d=b.ocsp;d.OCSPRequest.superclass.constructor.call(this);this.dTbsRequest=null;this.dOptionalSignature=null;this.getEncodedHex=function(){var g=[];if(this.dTbsRequest!==null){g.push(this.dTbsRequest)}else{throw"tbsRequest not set"}if(this.dOptionalSignature!==null){throw"optionalSignature not supported"}var h=new a({array:g});this.hTLV=h.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.reqList!==undefined){var e=new d.TBSRequest(f);this.dTbsRequest=e}}};YAHOO.lang.extend(KJUR.asn1.ocsp.OCSPRequest,KJUR.asn1.ASN1Object);KJUR.asn1.ocsp.OCSPUtil={};KJUR.asn1.ocsp.OCSPUtil.getRequestHex=function(a,b,h){var d=KJUR,c=d.asn1,e=c.ocsp;if(h===undefined){h=e.DEFAULT_HASH}var g={alg:h,issuerCert:a,subjectCert:b};var f=new e.OCSPRequest({reqList:[g]});return f.getEncodedHex()};KJUR.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(b){var k=ASN1HEX;var c=k.getVbyList;var d=k.getIdxbyList;var c=k.getVbyList;var f=k.getV;var l={};try{var i=c(b,0,[0],"0a");l.responseStatus=parseInt(i,16)}catch(e){}if(l.responseStatus!==0){return l}try{var g=d(b,0,[1,0,1,0,0,2,0,1]);if(b.substr(g,2)==="80"){l.certStatus="good"}else{if(b.substr(g,2)==="a1"){l.certStatus="revoked";l.revocationTime=hextoutf8(c(b,g,[0]))}else{if(b.substr(g,2)==="82"){l.certStatus="unknown"}}}}catch(e){}try{var a=d(b,0,[1,0,1,0,0,2,0,2]);l.thisUpdate=hextoutf8(f(b,a))}catch(e){}try{var j=d(b,0,[1,0,1,0,0,2,0,3]);if(b.substr(j,2)==="a0"){l.nextUpdate=hextoutf8(c(b,j,[0]))}}catch(e){}return l};
75362var KJUR;if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.lang=="undefined"||!KJUR.lang){KJUR.lang={}}KJUR.lang.String=function(){};function Base64x(){}function stoBA(d){var b=new Array();for(var c=0;c<d.length;c++){b[c]=d.charCodeAt(c)}return b}function BAtos(b){var d="";for(var c=0;c<b.length;c++){d=d+String.fromCharCode(b[c])}return d}function BAtohex(b){var e="";for(var d=0;d<b.length;d++){var c=b[d].toString(16);if(c.length==1){c="0"+c}e=e+c}return e}function stohex(a){return BAtohex(stoBA(a))}function stob64(a){return hex2b64(stohex(a))}function stob64u(a){return b64tob64u(hex2b64(stohex(a)))}function b64utos(a){return BAtos(b64toBA(b64utob64(a)))}function b64tob64u(a){a=a.replace(/\=/g,"");a=a.replace(/\+/g,"-");a=a.replace(/\//g,"_");return a}function b64utob64(a){if(a.length%4==2){a=a+"=="}else{if(a.length%4==3){a=a+"="}}a=a.replace(/-/g,"+");a=a.replace(/_/g,"/");return a}function hextob64u(a){if(a.length%2==1){a="0"+a}return b64tob64u(hex2b64(a))}function b64utohex(a){return b64tohex(b64utob64(a))}var utf8tob64u,b64utoutf8;if(typeof Buffer==="function"){utf8tob64u=function(a){return b64tob64u(new Buffer(a,"utf8").toString("base64"))};b64utoutf8=function(a){return new Buffer(b64utob64(a),"base64").toString("utf8")}}else{utf8tob64u=function(a){return hextob64u(uricmptohex(encodeURIComponentAll(a)))};b64utoutf8=function(a){return decodeURIComponent(hextouricmp(b64utohex(a)))}}function utf8tob64(a){return hex2b64(uricmptohex(encodeURIComponentAll(a)))}function b64toutf8(a){return decodeURIComponent(hextouricmp(b64tohex(a)))}function utf8tohex(a){return uricmptohex(encodeURIComponentAll(a))}function hextoutf8(a){return decodeURIComponent(hextouricmp(a))}function hextorstr(c){var b="";for(var a=0;a<c.length-1;a+=2){b+=String.fromCharCode(parseInt(c.substr(a,2),16))}return b}function rstrtohex(c){var a="";for(var b=0;b<c.length;b++){a+=("0"+c.charCodeAt(b).toString(16)).slice(-2)}return a}function hextob64(a){return hex2b64(a)}function hextob64nl(b){var a=hextob64(b);var c=a.replace(/(.{64})/g,"$1\r\n");c=c.replace(/\r\n$/,"");return c}function b64nltohex(b){var a=b.replace(/[^0-9A-Za-z\/+=]*/g,"");var c=b64tohex(a);return c}function hextopem(a,b){var c=hextob64nl(a);return"-----BEGIN "+b+"-----\r\n"+c+"\r\n-----END "+b+"-----\r\n"}function pemtohex(a,b){if(a.indexOf("-----BEGIN ")==-1){throw"can't find PEM header: "+b}if(b!==undefined){a=a.replace("-----BEGIN "+b+"-----","");a=a.replace("-----END "+b+"-----","")}else{a=a.replace(/-----BEGIN [^-]+-----/,"");a=a.replace(/-----END [^-]+-----/,"")}return b64nltohex(a)}function hextoArrayBuffer(d){if(d.length%2!=0){throw"input is not even length"}if(d.match(/^[0-9A-Fa-f]+$/)==null){throw"input is not hexadecimal"}var b=new ArrayBuffer(d.length/2);var a=new DataView(b);for(var c=0;c<d.length/2;c++){a.setUint8(c,parseInt(d.substr(c*2,2),16))}return b}function ArrayBuffertohex(b){var d="";var a=new DataView(b);for(var c=0;c<b.byteLength;c++){d+=("00"+a.getUint8(c).toString(16)).slice(-2)}return d}function zulutomsec(n){var l,j,m,e,f,i,b,k;var a,h,g,c;c=n.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/);if(c){a=c[1];l=parseInt(a);if(a.length===2){if(50<=l&&l<100){l=1900+l}else{if(0<=l&&l<50){l=2000+l}}}j=parseInt(c[2])-1;m=parseInt(c[3]);e=parseInt(c[4]);f=parseInt(c[5]);i=parseInt(c[6]);b=0;h=c[7];if(h!==""){g=(h.substr(1)+"00").substr(0,3);b=parseInt(g)}return Date.UTC(l,j,m,e,f,i,b)}throw"unsupported zulu format: "+n}function zulutosec(a){var b=zulutomsec(a);return ~~(b/1000)}function zulutodate(a){return new Date(zulutomsec(a))}function datetozulu(g,e,f){var b;var a=g.getUTCFullYear();if(e){if(a<1950||2049<a){throw"not proper year for UTCTime: "+a}b=(""+a).slice(-2)}else{b=("000"+a).slice(-4)}b+=("0"+(g.getUTCMonth()+1)).slice(-2);b+=("0"+g.getUTCDate()).slice(-2);b+=("0"+g.getUTCHours()).slice(-2);b+=("0"+g.getUTCMinutes()).slice(-2);b+=("0"+g.getUTCSeconds()).slice(-2);if(f){var c=g.getUTCMilliseconds();if(c!==0){c=("00"+c).slice(-3);c=c.replace(/0+$/g,"");b+="."+c}}b+="Z";return b}function uricmptohex(a){return a.replace(/%/g,"")}function hextouricmp(a){return a.replace(/(..)/g,"%$1")}function ipv6tohex(g){var b="malformed IPv6 address";if(!g.match(/^[0-9A-Fa-f:]+$/)){throw b}g=g.toLowerCase();var d=g.split(":").length-1;if(d<2){throw b}var e=":".repeat(7-d+2);g=g.replace("::",e);var c=g.split(":");if(c.length!=8){throw b}for(var f=0;f<8;f++){c[f]=("0000"+c[f]).slice(-4)}return c.join("")}function hextoipv6(e){if(!e.match(/^[0-9A-Fa-f]{32}$/)){throw"malformed IPv6 address octet"}e=e.toLowerCase();var b=e.match(/.{1,4}/g);for(var d=0;d<8;d++){b[d]=b[d].replace(/^0+/,"");if(b[d]==""){b[d]="0"}}e=":"+b.join(":")+":";var c=e.match(/:(0:){2,}/g);if(c===null){return e.slice(1,-1)}var f="";for(var d=0;d<c.length;d++){if(c[d].length>f.length){f=c[d]}}e=e.replace(f,"::");return e.slice(1,-1)}function hextoip(b){var d="malformed hex value";if(!b.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/)){throw d}if(b.length==8){var c;try{c=parseInt(b.substr(0,2),16)+"."+parseInt(b.substr(2,2),16)+"."+parseInt(b.substr(4,2),16)+"."+parseInt(b.substr(6,2),16);return c}catch(a){throw d}}else{if(b.length==32){return hextoipv6(b)}else{return b}}}function iptohex(f){var j="malformed IP address";f=f.toLowerCase(f);if(f.match(/^[0-9.]+$/)){var b=f.split(".");if(b.length!==4){throw j}var g="";try{for(var e=0;e<4;e++){var h=parseInt(b[e]);g+=("0"+h.toString(16)).slice(-2)}return g}catch(c){throw j}}else{if(f.match(/^[0-9a-f:]+$/)&&f.indexOf(":")!==-1){return ipv6tohex(f)}else{throw j}}}function encodeURIComponentAll(a){var d=encodeURIComponent(a);var b="";for(var c=0;c<d.length;c++){if(d[c]=="%"){b=b+d.substr(c,3);c=c+2}else{b=b+"%"+stohex(d[c])}}return b}function newline_toUnix(a){a=a.replace(/\r\n/mg,"\n");return a}function newline_toDos(a){a=a.replace(/\r\n/mg,"\n");a=a.replace(/\n/mg,"\r\n");return a}KJUR.lang.String.isInteger=function(a){if(a.match(/^[0-9]+$/)){return true}else{if(a.match(/^-[0-9]+$/)){return true}else{return false}}};KJUR.lang.String.isHex=function(a){if(a.length%2==0&&(a.match(/^[0-9a-f]+$/)||a.match(/^[0-9A-F]+$/))){return true}else{return false}};KJUR.lang.String.isBase64=function(a){a=a.replace(/\s+/g,"");if(a.match(/^[0-9A-Za-z+\/]+={0,3}$/)&&a.length%4==0){return true}else{return false}};KJUR.lang.String.isBase64URL=function(a){if(a.match(/[+/=]/)){return false}a=b64utob64(a);return KJUR.lang.String.isBase64(a)};KJUR.lang.String.isIntegerArray=function(a){a=a.replace(/\s+/g,"");if(a.match(/^\[[0-9,]+\]$/)){return true}else{return false}};function hextoposhex(a){if(a.length%2==1){return"0"+a}if(a.substr(0,1)>"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255<f){throw"integer not in range 0-255"}var d=("00"+f.toString(16)).slice(-2);return d}).join("");return c}catch(a){throw"malformed integer array string: "+a}}var strdiffidx=function(c,a){var d=c.length;if(c.length>a.length){d=a.length}for(var b=0;b<d;b++){if(c.charCodeAt(b)!=a.charCodeAt(b)){return b}}if(c.length!=a.length){return d}return -1};
75363if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414",};this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa",};this.CRYPTOJSMESSAGEDIGESTNAME={md5:CryptoJS.algo.MD5,sha1:CryptoJS.algo.SHA1,sha224:CryptoJS.algo.SHA224,sha256:CryptoJS.algo.SHA256,sha384:CryptoJS.algo.SHA384,sha512:CryptoJS.algo.SHA512,ripemd160:CryptoJS.algo.RIPEMD160};this.getDigestInfoHex=function(a,b){if(typeof this.DIGESTINFOHEAD[b]=="undefined"){throw"alg not supported in Util.DIGESTINFOHEAD: "+b}return this.DIGESTINFOHEAD[b]+a};this.getPaddedDigestInfoHex=function(h,a,j){var c=this.getDigestInfoHex(h,a);var d=j/4;if(c.length+22>d){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f<l;f+=2){g+="ff"}var e=b+g+k;return e};this.hashString=function(a,c){var b=new KJUR.crypto.MessageDigest({alg:c});return b.digestString(a)};this.hashHex=function(b,c){var a=new KJUR.crypto.MessageDigest({alg:c});return a.digestHex(b)};this.sha1=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"});return b.digestString(a)};this.sha256=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return b.digestString(a)};this.sha256Hex=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return b.digestHex(a)};this.sha512=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return b.digestString(a)};this.sha512Hex=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return b.digestHex(a)}};KJUR.crypto.Util.md5=function(a){var b=new KJUR.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return b.digestString(a)};KJUR.crypto.Util.ripemd160=function(a){var b=new KJUR.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return b.digestString(a)};KJUR.crypto.Util.SECURERANDOMGEN=new SecureRandom();KJUR.crypto.Util.getRandomHexOfNbytes=function(b){var a=new Array(b);KJUR.crypto.Util.SECURERANDOMGEN.nextBytes(a);return BAtohex(a)};KJUR.crypto.Util.getRandomBigIntegerOfNbytes=function(a){return new BigInteger(KJUR.crypto.Util.getRandomHexOfNbytes(a),16)};KJUR.crypto.Util.getRandomHexOfNbits=function(d){var c=d%8;var a=(d-c)/8;var b=new Array(a+1);KJUR.crypto.Util.SECURERANDOMGEN.nextBytes(b);b[0]=(((255<<c)&255)^255)&b[0];return BAtohex(b)};KJUR.crypto.Util.getRandomBigIntegerOfNbits=function(a){return new BigInteger(KJUR.crypto.Util.getRandomHexOfNbits(a),16)};KJUR.crypto.Util.getRandomBigIntegerZeroToMax=function(b){var a=b.bitLength();while(1){var c=KJUR.crypto.Util.getRandomBigIntegerOfNbits(a);if(b.compareTo(c)!=-1){return c}}};KJUR.crypto.Util.getRandomBigIntegerMinToMax=function(e,b){var c=e.compareTo(b);if(c==1){throw"biMin is greater than biMax"}if(c==0){return e}var a=b.subtract(e);var d=KJUR.crypto.Util.getRandomBigIntegerZeroToMax(a);return d.add(e)};KJUR.crypto.MessageDigest=function(c){var b=null;var a=null;var d=null;this.setAlgAndProvider=function(g,f){g=KJUR.crypto.MessageDigest.getCanonicalAlgName(g);if(g!==null&&f===undefined){f=KJUR.crypto.Util.DEFAULTPROVIDER[g]}if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(g)!=-1&&f=="cryptojs"){try{this.md=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[g].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+g+"/"+e}this.updateString=function(h){this.md.update(h)};this.updateHex=function(h){var i=CryptoJS.enc.Hex.parse(h);this.md.update(i)};this.digest=function(){var h=this.md.finalize();return h.toString(CryptoJS.enc.Hex)};this.digestString=function(h){this.updateString(h);return this.digest()};this.digestHex=function(h){this.updateHex(h);return this.digest()}}if(":sha256:".indexOf(g)!=-1&&f=="sjcl"){try{this.md=new sjcl.hash.sha256()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+g+"/"+e}this.updateString=function(h){this.md.update(h)};this.updateHex=function(i){var h=sjcl.codec.hex.toBits(i);this.md.update(h)};this.digest=function(){var h=this.md.finalize();return sjcl.codec.hex.fromBits(h)};this.digestString=function(h){this.updateString(h);return this.digest()};this.digestHex=function(h){this.updateHex(h);return this.digest()}}};this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName};this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName};this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName};this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName};this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName};if(c!==undefined){if(c.alg!==undefined){this.algName=c.alg;if(c.prov===undefined){this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]}this.setAlgAndProvider(this.algName,this.provName)}}};KJUR.crypto.MessageDigest.getCanonicalAlgName=function(a){if(typeof a==="string"){a=a.toLowerCase();a=a.replace(/-/,"")}return a};KJUR.crypto.MessageDigest.getHashLength=function(c){var b=KJUR.crypto.MessageDigest;var a=b.getCanonicalAlgName(c);if(b.HASHLENGTH[a]===undefined){throw"not supported algorithm: "+c}return b.HASHLENGTH[a]};KJUR.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20};KJUR.crypto.Mac=function(d){var f=null;var c=null;var a=null;var e=null;var b=null;this.setAlgAndProvider=function(k,i){k=k.toLowerCase();if(k==null){k="hmacsha1"}k=k.toLowerCase();if(k.substr(0,4)!="hmac"){throw"setAlgAndProvider unsupported HMAC alg: "+k}if(i===undefined){i=KJUR.crypto.Util.DEFAULTPROVIDER[k]}this.algProv=k+"/"+i;var g=k.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(g)!=-1&&i=="cryptojs"){try{var j=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[g];this.mac=CryptoJS.algo.HMAC.create(j,this.pass)}catch(h){throw"setAlgAndProvider hash alg set fail hashAlg="+g+"/"+h}this.updateString=function(l){this.mac.update(l)};this.updateHex=function(l){var m=CryptoJS.enc.Hex.parse(l);this.mac.update(m)};this.doFinal=function(){var l=this.mac.finalize();return l.toString(CryptoJS.enc.Hex)};this.doFinalString=function(l){this.updateString(l);return this.doFinal()};this.doFinalHex=function(l){this.updateHex(l);return this.doFinal()}}};this.updateString=function(g){throw"updateString(str) not supported for this alg/prov: "+this.algProv};this.updateHex=function(g){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv};this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv};this.doFinalString=function(g){throw"digestString(str) not supported for this alg/prov: "+this.algProv};this.doFinalHex=function(g){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv};this.setPassword=function(h){if(typeof h=="string"){var g=h;if(h.length%2==1||!h.match(/^[0-9A-Fa-f]+$/)){g=rstrtohex(h)}this.pass=CryptoJS.enc.Hex.parse(g);return}if(typeof h!="object"){throw"KJUR.crypto.Mac unsupported password type: "+h}var g=null;if(h.hex!==undefined){if(h.hex.length%2!=0||!h.hex.match(/^[0-9A-Fa-f]+$/)){throw"Mac: wrong hex password: "+h.hex}g=h.hex}if(h.utf8!==undefined){g=utf8tohex(h.utf8)}if(h.rstr!==undefined){g=rstrtohex(h.rstr)}if(h.b64!==undefined){g=b64tohex(h.b64)}if(h.b64u!==undefined){g=b64utohex(h.b64u)}if(g==null){throw"KJUR.crypto.Mac unsupported password type: "+h}this.pass=CryptoJS.enc.Hex.parse(g)};if(d!==undefined){if(d.pass!==undefined){this.setPassword(d.pass)}if(d.alg!==undefined){this.algName=d.alg;if(d.prov===undefined){this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]}this.setAlgAndProvider(this.algName,this.provName)}}};KJUR.crypto.Signature=function(o){var q=null;var n=null;var r=null;var c=null;var l=null;var d=null;var k=null;var h=null;var p=null;var e=null;var b=-1;var g=null;var j=null;var a=null;var i=null;var f=null;this._setAlgNames=function(){var s=this.algName.match(/^(.+)with(.+)$/);if(s){this.mdAlgName=s[1].toLowerCase();this.pubkeyAlgName=s[2].toLowerCase()}};this._zeroPaddingOfSignature=function(x,w){var v="";var t=w/4-x.length;for(var u=0;u<t;u++){v=v+"0"}return v+x};this.setAlgAndProvider=function(u,t){this._setAlgNames();if(t!="cryptojs/jsrsa"){throw"provider not supported: "+t}if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new KJUR.crypto.MessageDigest({alg:this.mdAlgName})}catch(s){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+s}this.init=function(w,x){var y=null;try{if(x===undefined){y=KEYUTIL.getKey(w)}else{y=KEYUTIL.getKey(w,x)}}catch(v){throw"init failed:"+v}if(y.isPrivate===true){this.prvKey=y;this.state="SIGN"}else{if(y.isPublic===true){this.pubKey=y;this.state="VERIFY"}else{throw"init failed.:"+y}}};this.updateString=function(v){this.md.updateString(v)};this.updateHex=function(v){this.md.updateHex(v)};this.sign=function(){this.sHashHex=this.md.digest();if(typeof this.ecprvhex!="undefined"&&typeof this.eccurvename!="undefined"){var v=new KJUR.crypto.ECDSA({curve:this.eccurvename});this.hSign=v.signHex(this.sHashHex,this.ecprvhex)}else{if(this.prvKey instanceof RSAKey&&this.pubkeyAlgName==="rsaandmgf1"){this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen)}else{if(this.prvKey instanceof RSAKey&&this.pubkeyAlgName==="rsa"){this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName)}else{if(this.prvKey instanceof KJUR.crypto.ECDSA){this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}else{if(this.prvKey instanceof KJUR.crypto.DSA){this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}else{throw"Signature: unsupported private key alg: "+this.pubkeyAlgName}}}}}return this.hSign};this.signString=function(v){this.updateString(v);return this.sign()};this.signHex=function(v){this.updateHex(v);return this.sign()};this.verify=function(v){this.sHashHex=this.md.digest();if(typeof this.ecpubhex!="undefined"&&typeof this.eccurvename!="undefined"){var w=new KJUR.crypto.ECDSA({curve:this.eccurvename});return w.verifyHex(this.sHashHex,v,this.ecpubhex)}else{if(this.pubKey instanceof RSAKey&&this.pubkeyAlgName==="rsaandmgf1"){return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,v,this.mdAlgName,this.pssSaltLen)}else{if(this.pubKey instanceof RSAKey&&this.pubkeyAlgName==="rsa"){return this.pubKey.verifyWithMessageHash(this.sHashHex,v)}else{if(KJUR.crypto.ECDSA!==undefined&&this.pubKey instanceof KJUR.crypto.ECDSA){return this.pubKey.verifyWithMessageHash(this.sHashHex,v)}else{if(KJUR.crypto.DSA!==undefined&&this.pubKey instanceof KJUR.crypto.DSA){return this.pubKey.verifyWithMessageHash(this.sHashHex,v)}else{throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}}}}}}};this.init=function(s,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName};this.updateString=function(s){throw"updateString(str) not supported for this alg:prov="+this.algProvName};this.updateHex=function(s){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName};this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName};this.signString=function(s){throw"digestString(str) not supported for this alg:prov="+this.algProvName};this.signHex=function(s){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName};this.verify=function(s){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName};this.initParams=o;if(o!==undefined){if(o.alg!==undefined){this.algName=o.alg;if(o.prov===undefined){this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]}else{this.provName=o.prov}this.algProvName=this.algName+":"+this.provName;this.setAlgAndProvider(this.algName,this.provName);this._setAlgNames()}if(o.psssaltlen!==undefined){this.pssSaltLen=o.psssaltlen}if(o.prvkeypem!==undefined){if(o.prvkeypas!==undefined){throw"both prvkeypem and prvkeypas parameters not supported"}else{try{var q=KEYUTIL.getKey(o.prvkeypem);this.init(q)}catch(m){throw"fatal error to load pem private key: "+m}}}}};KJUR.crypto.Cipher=function(a){};KJUR.crypto.Cipher.encrypt=function(e,f,d){if(f instanceof RSAKey&&f.isPublic){var c=KJUR.crypto.Cipher.getAlgByKeyAndName(f,d);if(c==="RSA"){return f.encrypt(e)}if(c==="RSAOAEP"){return f.encryptOAEP(e,"sha1")}var b=c.match(/^RSAOAEP(\d+)$/);if(b!==null){return f.encryptOAEP(e,"sha"+b[1])}throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+d}else{throw"Cipher.encrypt: unsupported key or algorithm"}};KJUR.crypto.Cipher.decrypt=function(e,f,d){if(f instanceof RSAKey&&f.isPrivate){var c=KJUR.crypto.Cipher.getAlgByKeyAndName(f,d);if(c==="RSA"){return f.decrypt(e)}if(c==="RSAOAEP"){return f.decryptOAEP(e,"sha1")}var b=c.match(/^RSAOAEP(\d+)$/);if(b!==null){return f.decryptOAEP(e,"sha"+b[1])}throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+d}else{throw"Cipher.decrypt: unsupported key or algorithm"}};KJUR.crypto.Cipher.getAlgByKeyAndName=function(b,a){if(b instanceof RSAKey){if(":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(a)!=-1){return a}if(a===null||a===undefined){return"RSA"}throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+a}throw"getAlgByKeyAndName: not supported algorithm name: "+a};KJUR.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA",}};
75364if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECDSA=function(h){var e="secp256r1";var g=null;var b=null;var f=null;var a=new SecureRandom();var d=null;this.type="EC";this.isPrivate=false;this.isPublic=false;function c(s,o,r,n){var j=Math.max(o.bitLength(),n.bitLength());var t=s.add2D(r);var q=s.curve.getInfinity();for(var p=j-1;p>=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(b.length%32)==2){b=b.substr(2)}if(a.substr(0,2)=="00"&&(a.length%32)==2){a=a.substr(2)}if((b.length%32)==30){b="00"+b}if((a.length%32)==30){a="00"+a}if(b.length%32!=0){throw"unknown ECDSA sig r length error"}if(a.length%32!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null};
75365if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v<u.length;v++){c[u[v]]=A}}};KJUR.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field");KJUR.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field");KJUR.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field");KJUR.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]);KJUR.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]);KJUR.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]);KJUR.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]);KJUR.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]);KJUR.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]);KJUR.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);
75366if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.DSA=function(){this.p=null;this.q=null;this.g=null;this.y=null;this.x=null;this.type="DSA";this.isPrivate=false;this.isPublic=false;this.setPrivate=function(d,c,b,e,a){this.isPrivate=true;this.p=d;this.q=c;this.g=b;this.y=e;this.x=a};this.setPrivateHex=function(d,b,f,i,j){var c,a,e,g,h;c=new BigInteger(d,16);a=new BigInteger(b,16);e=new BigInteger(f,16);if(typeof i==="string"&&i.length>1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}};
75367var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"};
75368RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)};
75369var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b<a;b++){c=c+"0"}return c+e}RSAKey.prototype.sign=function(d,a){var b=function(e){return KJUR.crypto.Util.hashString(e,a)};var c=b(d);return this.signWithMessageHash(c,a)};RSAKey.prototype.signWithMessageHash=function(e,c){var f=KJUR.crypto.Util.getPaddedDigestInfoHex(e,c,this.n.bitLength());var b=parseBigInt(f,16);var d=this.doPrivate(b);var a=d.toString(16);return _zeroPaddingOfSignature(a,this.n.bitLength())};function pss_mgf1_str(c,a,e){var b="",d=0;while(b.length<a){b+=hextorstr(e(rstrtohex(c+String.fromCharCode.apply(String,[(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d<c-k-g-2;d+=1){j[d]=0}var e=String.fromCharCode.apply(String,j)+"\x01"+f;var h=pss_mgf1_str(n,e.length,o);var q=[];for(d=0;d<e.length;d+=1){q[d]=e.charCodeAt(d)^h.charCodeAt(d)}var p=(65280>>(8*c-m))&255;q[0]&=~p;for(d=0;d<g;d++){q.push(n.charCodeAt(d))}q.push(188);return _zeroPaddingOfSignature(this.doPrivate(new BigInteger(q)).toString(16),this.n.bitLength())};function _rsasign_getDecryptSignatureBI(a,d,c){var b=new RSAKey();b.setPublic(d,c);var e=b.doPublic(a);return e}function _rsasign_getHexDigestInfoFromSig(a,c,b){var e=_rsasign_getDecryptSignatureBI(a,c,b);var d=e.toString(16).replace(/^1f+00/,"");return d}function _rsasign_getAlgNameAndHashFromHexDisgestInfo(f){for(var e in KJUR.crypto.Util.DIGESTINFOHEAD){var d=KJUR.crypto.Util.DIGESTINFOHEAD[e];var b=d.length;if(f.substring(0,b)==d){var c=[e,f.substring(b)];return c}}return[]}RSAKey.prototype.verify=function(f,j){j=j.replace(_RE_HEXDECONLY,"");j=j.replace(/[ \n]+/g,"");var b=parseBigInt(j,16);if(b.bitLength()>this.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q<a.length;q+=1){a[q]&=255}while(a.length<m){a.unshift(0)}if(a[m-1]!==188){throw"encoded message does not end in 0xbc"}a=String.fromCharCode.apply(String,a);var d=a.substr(0,m-h-1);var e=a.substr(d.length,h);var p=(65280>>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q<d.length;q+=1){o[q]=d.charCodeAt(q)^n.charCodeAt(q)}o[0]&=~p;var b=m-h-c-2;for(q=0;q<b;q+=1){if(o[q]!==0){throw"leftmost octets not zero"}}if(o[b]!==1){throw"0x01 marker not found"}return e===hextorstr(r(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+j+String.fromCharCode.apply(String,o.slice(-c)))))};RSAKey.SALT_LEN_HLEN=-1;RSAKey.SALT_LEN_MAX=-2;RSAKey.SALT_LEN_RECOVER=-2;
75370function X509(){var k=ASN1HEX,j=k.getChildIdx,h=k.getV,b=k.getTLV,f=k.getVbyList,c=k.getTLVbyList,g=k.getIdxbyList,d=k.getVidx,i=k.oidname,a=X509,e=pemtohex;this.hex=null;this.version=0;this.foffset=0;this.aExtInfo=null;this.getVersion=function(){if(this.hex===null||this.version!==0){return this.version}if(c(this.hex,0,[0,0])!=="a003020102"){this.version=1;this.foffset=-1;return 1}this.version=3;return 3};this.getSerialNumberHex=function(){return f(this.hex,0,[0,1+this.foffset],"02")};this.getSignatureAlgorithmField=function(){return i(f(this.hex,0,[0,2+this.foffset,0],"06"))};this.getIssuerHex=function(){return c(this.hex,0,[0,3+this.foffset],"30")};this.getIssuerString=function(){return a.hex2dn(this.getIssuerHex())};this.getSubjectHex=function(){return c(this.hex,0,[0,5+this.foffset],"30")};this.getSubjectString=function(){return a.hex2dn(this.getSubjectHex())};this.getNotBefore=function(){var l=f(this.hex,0,[0,4+this.foffset,0]);l=l.replace(/(..)/g,"%$1");l=decodeURIComponent(l);return l};this.getNotAfter=function(){var l=f(this.hex,0,[0,4+this.foffset,1]);l=l.replace(/(..)/g,"%$1");l=decodeURIComponent(l);return l};this.getPublicKeyHex=function(){return k.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")};this.getPublicKeyIdx=function(){return g(this.hex,0,[0,6+this.foffset],"30")};this.getPublicKeyContentIdx=function(){var l=this.getPublicKeyIdx();return g(this.hex,l,[1,0],"30")};this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")};this.getSignatureAlgorithmName=function(){return i(f(this.hex,0,[1,0],"06"))};this.getSignatureValueHex=function(){return f(this.hex,0,[2],"03",true)};this.verifySignature=function(n){var o=this.getSignatureAlgorithmName();var l=this.getSignatureValueHex();var m=c(this.hex,0,[0],"30");var p=new KJUR.crypto.Signature({alg:o});p.init(n);p.updateHex(m);return p.verify(l)};this.parseExt=function(){if(this.version!==3){return -1}var p=g(this.hex,0,[0,7,0],"30");var m=j(this.hex,p);this.aExtInfo=new Array();for(var n=0;n<m.length;n++){var q={};q.critical=false;var l=j(this.hex,m[n]);var r=0;if(l.length===3){q.critical=true;r=1}q.oid=k.hextooidstr(f(this.hex,m[n],[0],"06"));var o=g(this.hex,m[n],[1+r]);q.vidx=d(this.hex,o);this.aExtInfo.push(q)}};this.getExtInfo=function(n){var l=this.aExtInfo;var o=n;if(!n.match(/^[0-9.]+$/)){o=KJUR.asn1.x509.OID.name2oid(n)}if(o===""){return undefined}for(var m=0;m<l.length;m++){if(l[m].oid===o){return l[m]}}return undefined};this.getExtBasicConstraints=function(){var n=this.getExtInfo("basicConstraints");if(n===undefined){return n}var l=h(this.hex,n.vidx);if(l===""){return{}}if(l==="0101ff"){return{cA:true}}if(l.substr(0,8)==="0101ff02"){var o=h(l,6);var m=parseInt(o,16);return{cA:true,pathLen:m}}throw"basicConstraints parse error"};this.getExtKeyUsageBin=function(){var o=this.getExtInfo("keyUsage");if(o===undefined){return""}var m=h(this.hex,o.vidx);if(m.length%2!=0||m.length<=2){throw"malformed key usage value"}var l=parseInt(m.substr(0,2));var n=parseInt(m.substr(2),16).toString(2);return n.substr(0,n.length-l)};this.getExtKeyUsageString=function(){var n=this.getExtKeyUsageBin();var l=new Array();for(var m=0;m<n.length;m++){if(n.substr(m,1)=="1"){l.push(X509.KEYUSAGE_NAME[m])}}return l.join(",")};this.getExtSubjectKeyIdentifier=function(){var l=this.getExtInfo("subjectKeyIdentifier");if(l===undefined){return l}return h(this.hex,l.vidx)};this.getExtAuthorityKeyIdentifier=function(){var p=this.getExtInfo("authorityKeyIdentifier");if(p===undefined){return p}var l={};var o=b(this.hex,p.vidx);var m=j(o,0);for(var n=0;n<m.length;n++){if(o.substr(m[n],2)==="80"){l.kid=h(o,m[n])}}return l};this.getExtExtKeyUsageName=function(){var p=this.getExtInfo("extKeyUsage");if(p===undefined){return p}var l=new Array();var o=b(this.hex,p.vidx);if(o===""){return l}var m=j(o,0);for(var n=0;n<m.length;n++){l.push(i(h(o,m[n])))}return l};this.getExtSubjectAltName=function(){var m=this.getExtSubjectAltName2();var l=new Array();for(var n=0;n<m.length;n++){if(m[n][0]==="DNS"){l.push(m[n][1])}}return l};this.getExtSubjectAltName2=function(){var p,s,r;var q=this.getExtInfo("subjectAltName");if(q===undefined){return q}var l=new Array();var o=b(this.hex,q.vidx);var m=j(o,0);for(var n=0;n<m.length;n++){r=o.substr(m[n],2);p=h(o,m[n]);if(r==="81"){s=hextoutf8(p);l.push(["MAIL",s])}if(r==="82"){s=hextoutf8(p);l.push(["DNS",s])}if(r==="84"){s=X509.hex2dn(p,0);l.push(["DN",s])}if(r==="86"){s=hextoutf8(p);l.push(["URI",s])}if(r==="87"){s=hextoip(p);l.push(["IP",s])}}return l};this.getExtCRLDistributionPointsURI=function(){var q=this.getExtInfo("cRLDistributionPoints");if(q===undefined){return q}var l=new Array();var m=j(this.hex,q.vidx);for(var o=0;o<m.length;o++){try{var r=f(this.hex,m[o],[0,0,0],"86");var p=hextoutf8(r);l.push(p)}catch(n){}}return l};this.getExtAIAInfo=function(){var p=this.getExtInfo("authorityInfoAccess");if(p===undefined){return p}var l={ocsp:[],caissuer:[]};var m=j(this.hex,p.vidx);for(var n=0;n<m.length;n++){var q=f(this.hex,m[n],[0],"06");var o=f(this.hex,m[n],[1],"86");if(q==="2b06010505073001"){l.ocsp.push(hextoutf8(o))}if(q==="2b06010505073002"){l.caissuer.push(hextoutf8(o))}}return l};this.getExtCertificatePolicies=function(){var o=this.getExtInfo("certificatePolicies");if(o===undefined){return o}var l=b(this.hex,o.vidx);var u=[];var s=j(l,0);for(var r=0;r<s.length;r++){var t={};var n=j(l,s[r]);t.id=i(h(l,n[0]));if(n.length===2){var m=j(l,n[1]);for(var q=0;q<m.length;q++){var p=f(l,m[q],[0],"06");if(p==="2b06010505070201"){t.cps=hextoutf8(f(l,m[q],[1]))}else{if(p==="2b06010505070202"){t.unotice=hextoutf8(f(l,m[q],[1,0]))}}}}u.push(t)}return u};this.readCertPEM=function(l){this.readCertHex(e(l))};this.readCertHex=function(l){this.hex=l;this.getVersion();try{g(this.hex,0,[0,7],"a3");this.parseExt()}catch(m){}};this.getInfo=function(){var m=X509;var B,u,z;B="Basic Fields\n";B+=" serial number: "+this.getSerialNumberHex()+"\n";B+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n";B+=" issuer: "+this.getIssuerString()+"\n";B+=" notBefore: "+this.getNotBefore()+"\n";B+=" notAfter: "+this.getNotAfter()+"\n";B+=" subject: "+this.getSubjectString()+"\n";B+=" subject public key info: \n";u=this.getPublicKey();B+=" key algorithm: "+u.type+"\n";if(u.type==="RSA"){B+=" n="+hextoposhex(u.n.toString(16)).substr(0,16)+"...\n";B+=" e="+hextoposhex(u.e.toString(16))+"\n"}z=this.aExtInfo;if(z!==undefined&&z!==null){B+="X509v3 Extensions:\n";for(var r=0;r<z.length;r++){var n=z[r];var A=KJUR.asn1.x509.OID.oid2name(n.oid);if(A===""){A=n.oid}var x="";if(n.critical===true){x="CRITICAL"}B+=" "+A+" "+x+":\n";if(A==="basicConstraints"){var v=this.getExtBasicConstraints();if(v.cA===undefined){B+=" {}\n"}else{B+=" cA=true";if(v.pathLen!==undefined){B+=", pathLen="+v.pathLen}B+="\n"}}else{if(A==="keyUsage"){B+=" "+this.getExtKeyUsageString()+"\n"}else{if(A==="subjectKeyIdentifier"){B+=" "+this.getExtSubjectKeyIdentifier()+"\n"}else{if(A==="authorityKeyIdentifier"){var l=this.getExtAuthorityKeyIdentifier();if(l.kid!==undefined){B+=" kid="+l.kid+"\n"}}else{if(A==="extKeyUsage"){var w=this.getExtExtKeyUsageName();B+=" "+w.join(", ")+"\n"}else{if(A==="subjectAltName"){var t=this.getExtSubjectAltName2();B+=" "+t+"\n"}else{if(A==="cRLDistributionPoints"){var y=this.getExtCRLDistributionPointsURI();B+=" "+y+"\n"}else{if(A==="authorityInfoAccess"){var p=this.getExtAIAInfo();if(p.ocsp!==undefined){B+=" ocsp: "+p.ocsp.join(",")+"\n"}if(p.caissuer!==undefined){B+=" caissuer: "+p.caissuer.join(",")+"\n"}}else{if(A==="certificatePolicies"){var o=this.getExtCertificatePolicies();for(var q=0;q<o.length;q++){if(o[q].id!==undefined){B+=" policy oid: "+o[q].id+"\n"}if(o[q].cps!==undefined){B+=" cps: "+o[q].cps+"\n"}}}}}}}}}}}}}B+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n";B+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n";return B}}X509.hex2dn=function(f,b){if(b===undefined){b=0}if(f.substr(b,2)!=="30"){throw"malformed DN"}var c=new Array();var d=ASN1HEX.getChildIdx(f,b);for(var e=0;e<d.length;e++){c.push(X509.hex2rdn(f,d[e]))}c=c.map(function(a){return a.replace("/","\\/")});return"/"+c.join("/")};X509.hex2rdn=function(f,b){if(b===undefined){b=0}if(f.substr(b,2)!=="31"){throw"malformed RDN"}var c=new Array();var d=ASN1HEX.getChildIdx(f,b);for(var e=0;e<d.length;e++){c.push(X509.hex2attrTypeValue(f,d[e]))}c=c.map(function(a){return a.replace("+","\\+")});return c.join("+")};X509.hex2attrTypeValue=function(d,i){var j=ASN1HEX;var h=j.getV;if(i===undefined){i=0}if(d.substr(i,2)!=="30"){throw"malformed attribute type and value"}var g=j.getChildIdx(d,i);if(g.length!==2||d.substr(g[0],2)!=="06"){"malformed attribute type and value"}var b=h(d,g[0]);var f=KJUR.asn1.ASN1Util.oidHexToInt(b);var e=KJUR.asn1.x509.OID.oid2atype(f);var a=h(d,g[1]);var c=hextorstr(a);return e+"="+c};X509.getPublicKeyFromCertHex=function(b){var a=new X509();a.readCertHex(b);return a.getPublicKey()};X509.getPublicKeyFromCertPEM=function(b){var a=new X509();a.readCertPEM(b);return a.getPublicKey()};X509.getPublicKeyInfoPropOfCertPEM=function(c){var e=ASN1HEX;var g=e.getVbyList;var b={};var a,f,d;b.algparam=null;a=new X509();a.readCertPEM(c);f=a.getPublicKeyHex();b.keyhex=g(f,0,[1],"03").substr(2);b.algoid=g(f,0,[0,0],"06");if(b.algoid==="2a8648ce3d0201"){b.algparam=g(f,0,[0,1],"06")}return b};X509.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];
75371if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.jws=="undefined"||!KJUR.jws){KJUR.jws={}}KJUR.jws.JWS=function(){var b=KJUR,a=b.jws.JWS,c=a.isSafeJSONString;this.parseJWS=function(g,j){if((this.parsedJWS!==undefined)&&(j||(this.parsedJWS.sigvalH!==undefined))){return}var i=g.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(i==null){throw"JWS signature is not a form of 'Head.Payload.SigValue'."}var k=i[1];var e=i[2];var l=i[3];var n=k+"."+e;this.parsedJWS={};this.parsedJWS.headB64U=k;this.parsedJWS.payloadB64U=e;this.parsedJWS.sigvalB64U=l;this.parsedJWS.si=n;if(!j){var h=b64utohex(l);var f=parseBigInt(h,16);this.parsedJWS.sigvalH=h;this.parsedJWS.sigvalBI=f}var d=b64utoutf8(k);var m=b64utoutf8(e);this.parsedJWS.headS=d;this.parsedJWS.payloadS=m;if(!c(d,this.parsedJWS,"headP")){throw"malformed JSON string for JWS Head: "+d}}};KJUR.jws.JWS.sign=function(i,v,y,z,a){var w=KJUR,m=w.jws,q=m.JWS,g=q.readSafeJSONString,p=q.isSafeJSONString,d=w.crypto,k=d.ECDSA,o=d.Mac,c=d.Signature,t=JSON;var s,j,n;if(typeof v!="string"&&typeof v!="object"){throw"spHeader must be JSON string or object: "+v}if(typeof v=="object"){j=v;s=t.stringify(j)}if(typeof v=="string"){s=v;if(!p(s)){throw"JWS Head is not safe JSON string: "+s}j=g(s)}n=y;if(typeof y=="object"){n=t.stringify(y)}if((i==""||i==null)&&j.alg!==undefined){i=j.alg}if((i!=""&&i!=null)&&j.alg===undefined){j.alg=i;s=t.stringify(j)}if(i!==j.alg){throw"alg and sHeader.alg doesn't match: "+i+"!="+j.alg}var r=null;if(q.jwsalg2sigalg[i]===undefined){throw"unsupported alg name: "+i}else{r=q.jwsalg2sigalg[i]}var e=utf8tob64u(s);var l=utf8tob64u(n);var b=e+"."+l;var x="";if(r.substr(0,4)=="Hmac"){if(z===undefined){throw"mac key shall be specified for HS* alg"}var h=new o({alg:r,prov:"cryptojs",pass:z});h.updateString(b);x=h.doFinal()}else{if(r.indexOf("withECDSA")!=-1){var f=new c({alg:r});f.init(z,a);f.updateString(b);hASN1Sig=f.sign();x=KJUR.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig)}else{if(r!="none"){var f=new c({alg:r});f.init(z,a);f.updateString(b);x=f.sign()}}}var u=hextob64u(x);return b+"."+u};KJUR.jws.JWS.verify=function(w,B,n){var x=KJUR,q=x.jws,t=q.JWS,i=t.readSafeJSONString,e=x.crypto,p=e.ECDSA,s=e.Mac,d=e.Signature,m;if(typeof RSAKey!==undefined){m=RSAKey}var y=w.split(".");if(y.length!==3){return false}var f=y[0];var r=y[1];var c=f+"."+r;var A=b64utohex(y[2]);var l=i(b64utoutf8(y[0]));var k=null;var z=null;if(l.alg===undefined){throw"algorithm not specified in header"}else{k=l.alg;z=k.substr(0,2)}if(n!=null&&Object.prototype.toString.call(n)==="[object Array]"&&n.length>0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriod<b){return false}}if(g.nbf!==undefined&&typeof g.nbf=="number"){if(b<g.nbf-r.gracePeriod){return false}}if(g.iat!==undefined&&typeof g.iat=="number"){if(b<g.iat-r.gracePeriod){return false}}if(g.jti!==undefined&&r.jti!==undefined){if(g.jti!==r.jti){return false}}if(!o.verify(e,l,r.alg)){return false}return true};KJUR.jws.JWS.includedArray=function(b,a){var c=KJUR.jws.JWS.inArray;if(b===null){return false}if(typeof b!=="object"){return false}if(typeof b.length!=="number"){return false}for(var d=0;d<b.length;d++){if(!c(b[d],a)){return false}}return true};KJUR.jws.JWS.inArray=function(d,b){if(b===null){return false}if(typeof b!=="object"){return false}if(typeof b.length!=="number"){return false}for(var c=0;c<b.length;c++){if(b[c]==d){return true}}return false};KJUR.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none",};KJUR.jws.JWS.isSafeJSONString=function(c,b,d){var e=null;try{e=jsonParse(c);if(typeof e!="object"){return 0}if(e.constructor===Array){return 0}if(b){b[d]=e}return 1}catch(a){return 0}};KJUR.jws.JWS.readSafeJSONString=function(b){var c=null;try{c=jsonParse(b);if(typeof c!="object"){return null}if(c.constructor===Array){return null}return c}catch(a){return null}};KJUR.jws.JWS.getEncodedSignatureValueFromJWS=function(b){var a=b.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(a==null){throw"JWS signature is not a form of 'Head.Payload.SigValue'."}return a[1]};KJUR.jws.JWS.getJWKthumbprint=function(d){if(d.kty!=="RSA"&&d.kty!=="EC"&&d.kty!=="oct"){throw"unsupported algorithm for JWK Thumprint"}var a="{";if(d.kty==="RSA"){if(typeof d.n!="string"||typeof d.e!="string"){throw"wrong n and e value for RSA key"}a+='"e":"'+d.e+'",';a+='"kty":"'+d.kty+'",';a+='"n":"'+d.n+'"}'}else{if(d.kty==="EC"){if(typeof d.crv!="string"||typeof d.x!="string"||typeof d.y!="string"){throw"wrong crv, x and y value for EC key"}a+='"crv":"'+d.crv+'",';a+='"kty":"'+d.kty+'",';a+='"x":"'+d.x+'",';a+='"y":"'+d.y+'"}'}else{if(d.kty==="oct"){if(typeof d.k!="string"){throw"wrong k value for oct(symmetric) key"}a+='"kty":"'+d.kty+'",';a+='"k":"'+d.k+'"}'}}}var b=rstrtohex(a);var c=KJUR.crypto.Util.hashHex(b,"sha256");var e=hextob64u(c);return e};KJUR.jws.IntDate={};KJUR.jws.IntDate.get=function(c){var b=KJUR.jws.IntDate,d=b.getNow,a=b.getZulu;if(c=="now"){return d()}else{if(c=="now + 1hour"){return d()+60*60}else{if(c=="now + 1day"){return d()+60*60*24}else{if(c=="now + 1month"){return d()+60*60*24*30}else{if(c=="now + 1year"){return d()+60*60*24*365}else{if(c.match(/Z$/)){return a(c)}else{if(c.match(/^[0-9]+$/)){return parseInt(c)}}}}}}}throw"unsupported format: "+c};KJUR.jws.IntDate.getZulu=function(a){return zulutosec(a)};KJUR.jws.IntDate.getNow=function(){var a=~~(new Date()/1000);return a};KJUR.jws.IntDate.intDate2UTCString=function(a){var b=new Date(a*1000);return b.toUTCString()};KJUR.jws.IntDate.intDate2Zulu=function(e){var i=new Date(e*1000),h=("0000"+i.getUTCFullYear()).slice(-4),g=("00"+(i.getUTCMonth()+1)).slice(-2),b=("00"+i.getUTCDate()).slice(-2),a=("00"+i.getUTCHours()).slice(-2),c=("00"+i.getUTCMinutes()).slice(-2),f=("00"+i.getUTCSeconds()).slice(-2);return h+g+b+a+c+f+"Z"};
75372if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.jws=="undefined"||!KJUR.jws){KJUR.jws={}}KJUR.jws.JWSJS=function(){var c=KJUR,b=c.jws,a=b.JWS,d=a.readSafeJSONString;this.aHeader=[];this.sPayload="";this.aSignature=[];this.init=function(){this.aHeader=[];this.sPayload=undefined;this.aSignature=[]};this.initWithJWS=function(f){this.init();var e=f.split(".");if(e.length!=3){throw"malformed input JWS"}this.aHeader.push(e[0]);this.sPayload=e[1];this.aSignature.push(e[2])};this.addSignature=function(e,h,m,k){if(this.sPayload===undefined||this.sPayload===null){throw"there's no JSON-JS signature to add."}var l=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length){throw"aHeader.length != aSignature.length"}try{var f=KJUR.jws.JWS.sign(e,h,this.sPayload,m,k);var j=f.split(".");var n=j[0];var g=j[2];this.aHeader.push(j[0]);this.aSignature.push(j[2])}catch(i){if(this.aHeader.length>l){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g<h.length;g++){var f=h[g];if(f.length!==2){return false}var e=this.verifyNth(g,f[0],f[1]);if(e===false){return false}}return true};this.verifyNth=function(f,j,g){if(this.aHeader.length<=f||this.aSignature.length<=f){return false}var h=this.aHeader[f];var k=this.aSignature[f];var l=h+"."+this.sPayload+"."+k;var e=false;try{e=a.verify(l,j,g)}catch(i){return false}return e};this.readJWSJS=function(g){if(typeof g==="string"){var f=d(g);if(f==null){throw"argument is not safe JSON object string"}this.aHeader=f.headers;this.sPayload=f.payload;this.aSignature=f.signatures}else{try{if(g.headers.length>0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.aSignatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}};
75373exports.SecureRandom = SecureRandom;
75374exports.rng_seed_time = rng_seed_time;
75375
75376exports.BigInteger = BigInteger;
75377exports.RSAKey = RSAKey;
75378exports.ECDSA = KJUR.crypto.ECDSA;
75379exports.DSA = KJUR.crypto.DSA;
75380exports.Signature = KJUR.crypto.Signature;
75381exports.MessageDigest = KJUR.crypto.MessageDigest;
75382exports.Mac = KJUR.crypto.Mac;
75383exports.Cipher = KJUR.crypto.Cipher;
75384exports.KEYUTIL = KEYUTIL;
75385exports.ASN1HEX = ASN1HEX;
75386exports.X509 = X509;
75387exports.CryptoJS = CryptoJS;
75388
75389// ext/base64.js
75390exports.b64tohex = b64tohex;
75391exports.b64toBA = b64toBA;
75392
75393// base64x.js
75394exports.stoBA = stoBA;
75395exports.BAtos = BAtos;
75396exports.BAtohex = BAtohex;
75397exports.stohex = stohex;
75398exports.stob64 = stob64;
75399exports.stob64u = stob64u;
75400exports.b64utos = b64utos;
75401exports.b64tob64u = b64tob64u;
75402exports.b64utob64 = b64utob64;
75403exports.hex2b64 = hex2b64;
75404exports.hextob64u = hextob64u;
75405exports.b64utohex = b64utohex;
75406exports.utf8tob64u = utf8tob64u;
75407exports.b64utoutf8 = b64utoutf8;
75408exports.utf8tob64 = utf8tob64;
75409exports.b64toutf8 = b64toutf8;
75410exports.utf8tohex = utf8tohex;
75411exports.hextoutf8 = hextoutf8;
75412exports.hextorstr = hextorstr;
75413exports.rstrtohex = rstrtohex;
75414exports.hextob64 = hextob64;
75415exports.hextob64nl = hextob64nl;
75416exports.b64nltohex = b64nltohex;
75417exports.hextopem = hextopem;
75418exports.pemtohex = pemtohex;
75419exports.hextoArrayBuffer = hextoArrayBuffer;
75420exports.ArrayBuffertohex = ArrayBuffertohex;
75421exports.zulutomsec = zulutomsec;
75422exports.zulutosec = zulutosec;
75423exports.zulutodate = zulutodate;
75424exports.datetozulu = datetozulu;
75425exports.uricmptohex = uricmptohex;
75426exports.hextouricmp = hextouricmp;
75427exports.ipv6tohex = ipv6tohex;
75428exports.hextoipv6 = hextoipv6;
75429exports.hextoip = hextoip;
75430exports.iptohex = iptohex;
75431exports.encodeURIComponentAll = encodeURIComponentAll;
75432exports.newline_toUnix = newline_toUnix;
75433exports.newline_toDos = newline_toDos;
75434exports.hextoposhex = hextoposhex;
75435exports.intarystrtohex = intarystrtohex;
75436exports.strdiffidx = strdiffidx;
75437
75438// name spaces
75439exports.KJUR = KJUR;
75440exports.crypto = KJUR.crypto;
75441exports.asn1 = KJUR.asn1;
75442exports.jws = KJUR.jws;
75443exports.lang = KJUR.lang;
75444
75445
75446
75447}).call(this,require("buffer").Buffer)
75448},{"buffer":146}],428:[function(require,module,exports){
75449/*
75450 A JavaScript implementation of the SHA family of hashes, as
75451 defined in FIPS PUB 180-4 and FIPS PUB 202, as well as the corresponding
75452 HMAC implementation as defined in FIPS PUB 198a
75453
75454 Copyright Brian Turek 2008-2017
75455 Distributed under the BSD License
75456 See http://caligatio.github.com/jsSHA/ for more information
75457
75458 Several functions taken from Paul Johnston
75459*/
75460'use strict';(function(Y){function C(c,a,b){var e=0,h=[],n=0,g,l,d,f,m,q,u,r,I=!1,v=[],w=[],t,y=!1,z=!1,x=-1;b=b||{};g=b.encoding||"UTF8";t=b.numRounds||1;if(t!==parseInt(t,10)||1>t)throw Error("numRounds must a integer >= 1");if("SHA-1"===c)m=512,q=K,u=Z,f=160,r=function(a){return a.slice()};else if(0===c.lastIndexOf("SHA-",0))if(q=function(a,b){return L(a,b,c)},u=function(a,b,h,e){var k,f;if("SHA-224"===c||"SHA-256"===c)k=(b+65>>>9<<4)+15,f=16;else if("SHA-384"===c||"SHA-512"===c)k=(b+129>>>10<<
754615)+31,f=32;else throw Error("Unexpected error in SHA-2 implementation");for(;a.length<=k;)a.push(0);a[b>>>5]|=128<<24-b%32;b=b+h;a[k]=b&4294967295;a[k-1]=b/4294967296|0;h=a.length;for(b=0;b<h;b+=f)e=L(a.slice(b,b+f),e,c);if("SHA-224"===c)a=[e[0],e[1],e[2],e[3],e[4],e[5],e[6]];else if("SHA-256"===c)a=e;else if("SHA-384"===c)a=[e[0].a,e[0].b,e[1].a,e[1].b,e[2].a,e[2].b,e[3].a,e[3].b,e[4].a,e[4].b,e[5].a,e[5].b];else if("SHA-512"===c)a=[e[0].a,e[0].b,e[1].a,e[1].b,e[2].a,e[2].b,e[3].a,e[3].b,e[4].a,
75462e[4].b,e[5].a,e[5].b,e[6].a,e[6].b,e[7].a,e[7].b];else throw Error("Unexpected error in SHA-2 implementation");return a},r=function(a){return a.slice()},"SHA-224"===c)m=512,f=224;else if("SHA-256"===c)m=512,f=256;else if("SHA-384"===c)m=1024,f=384;else if("SHA-512"===c)m=1024,f=512;else throw Error("Chosen SHA variant is not supported");else if(0===c.lastIndexOf("SHA3-",0)||0===c.lastIndexOf("SHAKE",0)){var F=6;q=D;r=function(a){var c=[],e;for(e=0;5>e;e+=1)c[e]=a[e].slice();return c};x=1;if("SHA3-224"===
75463c)m=1152,f=224;else if("SHA3-256"===c)m=1088,f=256;else if("SHA3-384"===c)m=832,f=384;else if("SHA3-512"===c)m=576,f=512;else if("SHAKE128"===c)m=1344,f=-1,F=31,z=!0;else if("SHAKE256"===c)m=1088,f=-1,F=31,z=!0;else throw Error("Chosen SHA variant is not supported");u=function(a,c,e,b,h){e=m;var k=F,f,g=[],n=e>>>5,l=0,d=c>>>5;for(f=0;f<d&&c>=e;f+=n)b=D(a.slice(f,f+n),b),c-=e;a=a.slice(f);for(c%=e;a.length<n;)a.push(0);f=c>>>3;a[f>>2]^=k<<f%4*8;a[n-1]^=2147483648;for(b=D(a,b);32*g.length<h;){a=b[l%
754645][l/5|0];g.push(a.b);if(32*g.length>=h)break;g.push(a.a);l+=1;0===64*l%e&&D(null,b)}return g}}else throw Error("Chosen SHA variant is not supported");d=M(a,g,x);l=A(c);this.setHMACKey=function(a,b,h){var k;if(!0===I)throw Error("HMAC key already set");if(!0===y)throw Error("Cannot set HMAC key after calling update");if(!0===z)throw Error("SHAKE is not supported for HMAC");g=(h||{}).encoding||"UTF8";b=M(b,g,x)(a);a=b.binLen;b=b.value;k=m>>>3;h=k/4-1;if(k<a/8){for(b=u(b,a,0,A(c),f);b.length<=h;)b.push(0);
75465b[h]&=4294967040}else if(k>a/8){for(;b.length<=h;)b.push(0);b[h]&=4294967040}for(a=0;a<=h;a+=1)v[a]=b[a]^909522486,w[a]=b[a]^1549556828;l=q(v,l);e=m;I=!0};this.update=function(a){var c,b,k,f=0,g=m>>>5;c=d(a,h,n);a=c.binLen;b=c.value;c=a>>>5;for(k=0;k<c;k+=g)f+m<=a&&(l=q(b.slice(k,k+g),l),f+=m);e+=f;h=b.slice(f>>>5);n=a%m;y=!0};this.getHash=function(a,b){var k,g,d,m;if(!0===I)throw Error("Cannot call getHash after setting HMAC key");d=N(b);if(!0===z){if(-1===d.shakeLen)throw Error("shakeLen must be specified in options");
75466f=d.shakeLen}switch(a){case "HEX":k=function(a){return O(a,f,x,d)};break;case "B64":k=function(a){return P(a,f,x,d)};break;case "BYTES":k=function(a){return Q(a,f,x)};break;case "ARRAYBUFFER":try{g=new ArrayBuffer(0)}catch(p){throw Error("ARRAYBUFFER not supported by this environment");}k=function(a){return R(a,f,x)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER");}m=u(h.slice(),n,e,r(l),f);for(g=1;g<t;g+=1)!0===z&&0!==f%32&&(m[m.length-1]&=16777215>>>24-f%32),m=u(m,f,
754670,A(c),f);return k(m)};this.getHMAC=function(a,b){var k,g,d,p;if(!1===I)throw Error("Cannot call getHMAC without first setting HMAC key");d=N(b);switch(a){case "HEX":k=function(a){return O(a,f,x,d)};break;case "B64":k=function(a){return P(a,f,x,d)};break;case "BYTES":k=function(a){return Q(a,f,x)};break;case "ARRAYBUFFER":try{k=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment");}k=function(a){return R(a,f,x)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER");
75468}g=u(h.slice(),n,e,r(l),f);p=q(w,A(c));p=u(g,f,m,p,f);return k(p)}}function b(c,a){this.a=c;this.b=a}function O(c,a,b,e){var h="";a/=8;var n,g,d;d=-1===b?3:0;for(n=0;n<a;n+=1)g=c[n>>>2]>>>8*(d+n%4*b),h+="0123456789abcdef".charAt(g>>>4&15)+"0123456789abcdef".charAt(g&15);return e.outputUpper?h.toUpperCase():h}function P(c,a,b,e){var h="",n=a/8,g,d,p,f;f=-1===b?3:0;for(g=0;g<n;g+=3)for(d=g+1<n?c[g+1>>>2]:0,p=g+2<n?c[g+2>>>2]:0,p=(c[g>>>2]>>>8*(f+g%4*b)&255)<<16|(d>>>8*(f+(g+1)%4*b)&255)<<8|p>>>8*(f+
75469(g+2)%4*b)&255,d=0;4>d;d+=1)8*g+6*d<=a?h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(p>>>6*(3-d)&63):h+=e.b64Pad;return h}function Q(c,a,b){var e="";a/=8;var h,d,g;g=-1===b?3:0;for(h=0;h<a;h+=1)d=c[h>>>2]>>>8*(g+h%4*b)&255,e+=String.fromCharCode(d);return e}function R(c,a,b){a/=8;var e,h=new ArrayBuffer(a),d,g;g=new Uint8Array(h);d=-1===b?3:0;for(e=0;e<a;e+=1)g[e]=c[e>>>2]>>>8*(d+e%4*b)&255;return h}function N(c){var a={outputUpper:!1,b64Pad:"=",shakeLen:-1};c=c||{};
75470a.outputUpper=c.outputUpper||!1;!0===c.hasOwnProperty("b64Pad")&&(a.b64Pad=c.b64Pad);if(!0===c.hasOwnProperty("shakeLen")){if(0!==c.shakeLen%8)throw Error("shakeLen must be a multiple of 8");a.shakeLen=c.shakeLen}if("boolean"!==typeof a.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!==typeof a.b64Pad)throw Error("Invalid b64Pad formatting option");return a}function M(c,a,b){switch(a){case "UTF8":case "UTF16BE":case "UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE");
75471}switch(c){case "HEX":c=function(a,c,d){var g=a.length,l,p,f,m,q,u;if(0!==g%2)throw Error("String of HEX type must be in byte increments");c=c||[0];d=d||0;q=d>>>3;u=-1===b?3:0;for(l=0;l<g;l+=2){p=parseInt(a.substr(l,2),16);if(isNaN(p))throw Error("String of HEX type contains invalid characters");m=(l>>>1)+q;for(f=m>>>2;c.length<=f;)c.push(0);c[f]|=p<<8*(u+m%4*b)}return{value:c,binLen:4*g+d}};break;case "TEXT":c=function(c,h,d){var g,l,p=0,f,m,q,u,r,t;h=h||[0];d=d||0;q=d>>>3;if("UTF8"===a)for(t=-1===
75472b?3:0,f=0;f<c.length;f+=1)for(g=c.charCodeAt(f),l=[],128>g?l.push(g):2048>g?(l.push(192|g>>>6),l.push(128|g&63)):55296>g||57344<=g?l.push(224|g>>>12,128|g>>>6&63,128|g&63):(f+=1,g=65536+((g&1023)<<10|c.charCodeAt(f)&1023),l.push(240|g>>>18,128|g>>>12&63,128|g>>>6&63,128|g&63)),m=0;m<l.length;m+=1){r=p+q;for(u=r>>>2;h.length<=u;)h.push(0);h[u]|=l[m]<<8*(t+r%4*b);p+=1}else if("UTF16BE"===a||"UTF16LE"===a)for(t=-1===b?2:0,l="UTF16LE"===a&&1!==b||"UTF16LE"!==a&&1===b,f=0;f<c.length;f+=1){g=c.charCodeAt(f);
75473!0===l&&(m=g&255,g=m<<8|g>>>8);r=p+q;for(u=r>>>2;h.length<=u;)h.push(0);h[u]|=g<<8*(t+r%4*b);p+=2}return{value:h,binLen:8*p+d}};break;case "B64":c=function(a,c,d){var g=0,l,p,f,m,q,u,r,t;if(-1===a.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");p=a.indexOf("=");a=a.replace(/\=/g,"");if(-1!==p&&p<a.length)throw Error("Invalid '=' found in base-64 string");c=c||[0];d=d||0;u=d>>>3;t=-1===b?3:0;for(p=0;p<a.length;p+=4){q=a.substr(p,4);for(f=m=0;f<q.length;f+=1)l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(q[f]),
75474m|=l<<18-6*f;for(f=0;f<q.length-1;f+=1){r=g+u;for(l=r>>>2;c.length<=l;)c.push(0);c[l]|=(m>>>16-8*f&255)<<8*(t+r%4*b);g+=1}}return{value:c,binLen:8*g+d}};break;case "BYTES":c=function(a,c,d){var g,l,p,f,m,q;c=c||[0];d=d||0;p=d>>>3;q=-1===b?3:0;for(l=0;l<a.length;l+=1)g=a.charCodeAt(l),m=l+p,f=m>>>2,c.length<=f&&c.push(0),c[f]|=g<<8*(q+m%4*b);return{value:c,binLen:8*a.length+d}};break;case "ARRAYBUFFER":try{c=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment");}c=
75475function(a,c,d){var g,l,p,f,m,q;c=c||[0];d=d||0;l=d>>>3;m=-1===b?3:0;q=new Uint8Array(a);for(g=0;g<a.byteLength;g+=1)f=g+l,p=f>>>2,c.length<=p&&c.push(0),c[p]|=q[g]<<8*(m+f%4*b);return{value:c,binLen:8*a.byteLength+d}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER");}return c}function y(c,a){return c<<a|c>>>32-a}function S(c,a){return 32<a?(a-=32,new b(c.b<<a|c.a>>>32-a,c.a<<a|c.b>>>32-a)):0!==a?new b(c.a<<a|c.b>>>32-a,c.b<<a|c.a>>>32-a):c}function w(c,a){return c>>>
75476a|c<<32-a}function t(c,a){var k=null,k=new b(c.a,c.b);return k=32>=a?new b(k.a>>>a|k.b<<32-a&4294967295,k.b>>>a|k.a<<32-a&4294967295):new b(k.b>>>a-32|k.a<<64-a&4294967295,k.a>>>a-32|k.b<<64-a&4294967295)}function T(c,a){var k=null;return k=32>=a?new b(c.a>>>a,c.b>>>a|c.a<<32-a&4294967295):new b(0,c.a>>>a-32)}function aa(c,a,b){return c&a^~c&b}function ba(c,a,k){return new b(c.a&a.a^~c.a&k.a,c.b&a.b^~c.b&k.b)}function U(c,a,b){return c&a^c&b^a&b}function ca(c,a,k){return new b(c.a&a.a^c.a&k.a^a.a&
75477k.a,c.b&a.b^c.b&k.b^a.b&k.b)}function da(c){return w(c,2)^w(c,13)^w(c,22)}function ea(c){var a=t(c,28),k=t(c,34);c=t(c,39);return new b(a.a^k.a^c.a,a.b^k.b^c.b)}function fa(c){return w(c,6)^w(c,11)^w(c,25)}function ga(c){var a=t(c,14),k=t(c,18);c=t(c,41);return new b(a.a^k.a^c.a,a.b^k.b^c.b)}function ha(c){return w(c,7)^w(c,18)^c>>>3}function ia(c){var a=t(c,1),k=t(c,8);c=T(c,7);return new b(a.a^k.a^c.a,a.b^k.b^c.b)}function ja(c){return w(c,17)^w(c,19)^c>>>10}function ka(c){var a=t(c,19),k=t(c,61);
75478c=T(c,6);return new b(a.a^k.a^c.a,a.b^k.b^c.b)}function G(c,a){var b=(c&65535)+(a&65535);return((c>>>16)+(a>>>16)+(b>>>16)&65535)<<16|b&65535}function la(c,a,b,e){var h=(c&65535)+(a&65535)+(b&65535)+(e&65535);return((c>>>16)+(a>>>16)+(b>>>16)+(e>>>16)+(h>>>16)&65535)<<16|h&65535}function H(c,a,b,e,h){var d=(c&65535)+(a&65535)+(b&65535)+(e&65535)+(h&65535);return((c>>>16)+(a>>>16)+(b>>>16)+(e>>>16)+(h>>>16)+(d>>>16)&65535)<<16|d&65535}function ma(c,a){var d,e,h;d=(c.b&65535)+(a.b&65535);e=(c.b>>>16)+
75479(a.b>>>16)+(d>>>16);h=(e&65535)<<16|d&65535;d=(c.a&65535)+(a.a&65535)+(e>>>16);e=(c.a>>>16)+(a.a>>>16)+(d>>>16);return new b((e&65535)<<16|d&65535,h)}function na(c,a,d,e){var h,n,g;h=(c.b&65535)+(a.b&65535)+(d.b&65535)+(e.b&65535);n=(c.b>>>16)+(a.b>>>16)+(d.b>>>16)+(e.b>>>16)+(h>>>16);g=(n&65535)<<16|h&65535;h=(c.a&65535)+(a.a&65535)+(d.a&65535)+(e.a&65535)+(n>>>16);n=(c.a>>>16)+(a.a>>>16)+(d.a>>>16)+(e.a>>>16)+(h>>>16);return new b((n&65535)<<16|h&65535,g)}function oa(c,a,d,e,h){var n,g,l;n=(c.b&
7548065535)+(a.b&65535)+(d.b&65535)+(e.b&65535)+(h.b&65535);g=(c.b>>>16)+(a.b>>>16)+(d.b>>>16)+(e.b>>>16)+(h.b>>>16)+(n>>>16);l=(g&65535)<<16|n&65535;n=(c.a&65535)+(a.a&65535)+(d.a&65535)+(e.a&65535)+(h.a&65535)+(g>>>16);g=(c.a>>>16)+(a.a>>>16)+(d.a>>>16)+(e.a>>>16)+(h.a>>>16)+(n>>>16);return new b((g&65535)<<16|n&65535,l)}function B(c,a){return new b(c.a^a.a,c.b^a.b)}function A(c){var a=[],d;if("SHA-1"===c)a=[1732584193,4023233417,2562383102,271733878,3285377520];else if(0===c.lastIndexOf("SHA-",0))switch(a=
75481[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],d=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],c){case "SHA-224":break;case "SHA-256":a=d;break;case "SHA-384":a=[new b(3418070365,a[0]),new b(1654270250,a[1]),new b(2438529370,a[2]),new b(355462360,a[3]),new b(1731405415,a[4]),new b(41048885895,a[5]),new b(3675008525,a[6]),new b(1203062813,a[7])];break;case "SHA-512":a=[new b(d[0],4089235720),new b(d[1],2227873595),
75482new b(d[2],4271175723),new b(d[3],1595750129),new b(d[4],2917565137),new b(d[5],725511199),new b(d[6],4215389547),new b(d[7],327033209)];break;default:throw Error("Unknown SHA variant");}else if(0===c.lastIndexOf("SHA3-",0)||0===c.lastIndexOf("SHAKE",0))for(c=0;5>c;c+=1)a[c]=[new b(0,0),new b(0,0),new b(0,0),new b(0,0),new b(0,0)];else throw Error("No SHA variants supported");return a}function K(c,a){var b=[],e,d,n,g,l,p,f;e=a[0];d=a[1];n=a[2];g=a[3];l=a[4];for(f=0;80>f;f+=1)b[f]=16>f?c[f]:y(b[f-
754833]^b[f-8]^b[f-14]^b[f-16],1),p=20>f?H(y(e,5),d&n^~d&g,l,1518500249,b[f]):40>f?H(y(e,5),d^n^g,l,1859775393,b[f]):60>f?H(y(e,5),U(d,n,g),l,2400959708,b[f]):H(y(e,5),d^n^g,l,3395469782,b[f]),l=g,g=n,n=y(d,30),d=e,e=p;a[0]=G(e,a[0]);a[1]=G(d,a[1]);a[2]=G(n,a[2]);a[3]=G(g,a[3]);a[4]=G(l,a[4]);return a}function Z(c,a,b,e){var d;for(d=(a+65>>>9<<4)+15;c.length<=d;)c.push(0);c[a>>>5]|=128<<24-a%32;a+=b;c[d]=a&4294967295;c[d-1]=a/4294967296|0;a=c.length;for(d=0;d<a;d+=16)e=K(c.slice(d,d+16),e);return e}function L(c,
75484a,k){var e,h,n,g,l,p,f,m,q,u,r,t,v,w,y,A,z,x,F,B,C,D,E=[],J;if("SHA-224"===k||"SHA-256"===k)u=64,t=1,D=Number,v=G,w=la,y=H,A=ha,z=ja,x=da,F=fa,C=U,B=aa,J=d;else if("SHA-384"===k||"SHA-512"===k)u=80,t=2,D=b,v=ma,w=na,y=oa,A=ia,z=ka,x=ea,F=ga,C=ca,B=ba,J=V;else throw Error("Unexpected error in SHA-2 implementation");k=a[0];e=a[1];h=a[2];n=a[3];g=a[4];l=a[5];p=a[6];f=a[7];for(r=0;r<u;r+=1)16>r?(q=r*t,m=c.length<=q?0:c[q],q=c.length<=q+1?0:c[q+1],E[r]=new D(m,q)):E[r]=w(z(E[r-2]),E[r-7],A(E[r-15]),E[r-
7548516]),m=y(f,F(g),B(g,l,p),J[r],E[r]),q=v(x(k),C(k,e,h)),f=p,p=l,l=g,g=v(n,m),n=h,h=e,e=k,k=v(m,q);a[0]=v(k,a[0]);a[1]=v(e,a[1]);a[2]=v(h,a[2]);a[3]=v(n,a[3]);a[4]=v(g,a[4]);a[5]=v(l,a[5]);a[6]=v(p,a[6]);a[7]=v(f,a[7]);return a}function D(c,a){var d,e,h,n,g=[],l=[];if(null!==c)for(e=0;e<c.length;e+=2)a[(e>>>1)%5][(e>>>1)/5|0]=B(a[(e>>>1)%5][(e>>>1)/5|0],new b(c[e+1],c[e]));for(d=0;24>d;d+=1){n=A("SHA3-");for(e=0;5>e;e+=1){h=a[e][0];var p=a[e][1],f=a[e][2],m=a[e][3],q=a[e][4];g[e]=new b(h.a^p.a^f.a^
75486m.a^q.a,h.b^p.b^f.b^m.b^q.b)}for(e=0;5>e;e+=1)l[e]=B(g[(e+4)%5],S(g[(e+1)%5],1));for(e=0;5>e;e+=1)for(h=0;5>h;h+=1)a[e][h]=B(a[e][h],l[e]);for(e=0;5>e;e+=1)for(h=0;5>h;h+=1)n[h][(2*e+3*h)%5]=S(a[e][h],W[e][h]);for(e=0;5>e;e+=1)for(h=0;5>h;h+=1)a[e][h]=B(n[e][h],new b(~n[(e+1)%5][h].a&n[(e+2)%5][h].a,~n[(e+1)%5][h].b&n[(e+2)%5][h].b));a[0][0]=B(a[0][0],X[d])}return a}var d,V,W,X;d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,
754871426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,
754882227730452,2361852424,2428436474,2756734187,3204031479,3329325298];V=[new b(d[0],3609767458),new b(d[1],602891725),new b(d[2],3964484399),new b(d[3],2173295548),new b(d[4],4081628472),new b(d[5],3053834265),new b(d[6],2937671579),new b(d[7],3664609560),new b(d[8],2734883394),new b(d[9],1164996542),new b(d[10],1323610764),new b(d[11],3590304994),new b(d[12],4068182383),new b(d[13],991336113),new b(d[14],633803317),new b(d[15],3479774868),new b(d[16],2666613458),new b(d[17],944711139),new b(d[18],2341262773),
75489new b(d[19],2007800933),new b(d[20],1495990901),new b(d[21],1856431235),new b(d[22],3175218132),new b(d[23],2198950837),new b(d[24],3999719339),new b(d[25],766784016),new b(d[26],2566594879),new b(d[27],3203337956),new b(d[28],1034457026),new b(d[29],2466948901),new b(d[30],3758326383),new b(d[31],168717936),new b(d[32],1188179964),new b(d[33],1546045734),new b(d[34],1522805485),new b(d[35],2643833823),new b(d[36],2343527390),new b(d[37],1014477480),new b(d[38],1206759142),new b(d[39],344077627),
75490new b(d[40],1290863460),new b(d[41],3158454273),new b(d[42],3505952657),new b(d[43],106217008),new b(d[44],3606008344),new b(d[45],1432725776),new b(d[46],1467031594),new b(d[47],851169720),new b(d[48],3100823752),new b(d[49],1363258195),new b(d[50],3750685593),new b(d[51],3785050280),new b(d[52],3318307427),new b(d[53],3812723403),new b(d[54],2003034995),new b(d[55],3602036899),new b(d[56],1575990012),new b(d[57],1125592928),new b(d[58],2716904306),new b(d[59],442776044),new b(d[60],593698344),new b(d[61],
754913733110249),new b(d[62],2999351573),new b(d[63],3815920427),new b(3391569614,3928383900),new b(3515267271,566280711),new b(3940187606,3454069534),new b(4118630271,4000239992),new b(116418474,1914138554),new b(174292421,2731055270),new b(289380356,3203993006),new b(460393269,320620315),new b(685471733,587496836),new b(852142971,1086792851),new b(1017036298,365543100),new b(1126000580,2618297676),new b(1288033470,3409855158),new b(1501505948,4234509866),new b(1607167915,987167468),new b(1816402316,
754921246189591)];X=[new b(0,1),new b(0,32898),new b(2147483648,32906),new b(2147483648,2147516416),new b(0,32907),new b(0,2147483649),new b(2147483648,2147516545),new b(2147483648,32777),new b(0,138),new b(0,136),new b(0,2147516425),new b(0,2147483658),new b(0,2147516555),new b(2147483648,139),new b(2147483648,32905),new b(2147483648,32771),new b(2147483648,32770),new b(2147483648,128),new b(0,32778),new b(2147483648,2147483658),new b(2147483648,2147516545),new b(2147483648,32896),new b(0,2147483649),
75493new b(2147483648,2147516424)];W=[[0,36,3,41,18],[1,44,10,45,2],[62,6,43,15,61],[28,55,25,21,56],[27,20,39,8,14]];"function"===typeof define&&define.amd?define(function(){return C}):"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(module.exports=C),exports=C):Y.jsSHA=C})(this);
75494
75495},{}],429:[function(require,module,exports){
75496'use strict'
75497module.exports = require('./lib/api')(require('./lib/keccak'))
75498
75499},{"./lib/api":430,"./lib/keccak":434}],430:[function(require,module,exports){
75500'use strict'
75501var createKeccak = require('./keccak')
75502var createShake = require('./shake')
75503
75504module.exports = function (KeccakState) {
75505 var Keccak = createKeccak(KeccakState)
75506 var Shake = createShake(KeccakState)
75507
75508 return function (algorithm, options) {
75509 var hash = typeof algorithm === 'string' ? algorithm.toLowerCase() : algorithm
75510 switch (hash) {
75511 case 'keccak224': return new Keccak(1152, 448, null, 224, options)
75512 case 'keccak256': return new Keccak(1088, 512, null, 256, options)
75513 case 'keccak384': return new Keccak(832, 768, null, 384, options)
75514 case 'keccak512': return new Keccak(576, 1024, null, 512, options)
75515
75516 case 'sha3-224': return new Keccak(1152, 448, 0x06, 224, options)
75517 case 'sha3-256': return new Keccak(1088, 512, 0x06, 256, options)
75518 case 'sha3-384': return new Keccak(832, 768, 0x06, 384, options)
75519 case 'sha3-512': return new Keccak(576, 1024, 0x06, 512, options)
75520
75521 case 'shake128': return new Shake(1344, 256, 0x1f, options)
75522 case 'shake256': return new Shake(1088, 512, 0x1f, options)
75523
75524 default: throw new Error('Invald algorithm: ' + algorithm)
75525 }
75526 }
75527}
75528
75529},{"./keccak":431,"./shake":432}],431:[function(require,module,exports){
75530'use strict'
75531var Buffer = require('safe-buffer').Buffer
75532var Transform = require('stream').Transform
75533var inherits = require('inherits')
75534
75535module.exports = function (KeccakState) {
75536 function Keccak (rate, capacity, delimitedSuffix, hashBitLength, options) {
75537 Transform.call(this, options)
75538
75539 this._rate = rate
75540 this._capacity = capacity
75541 this._delimitedSuffix = delimitedSuffix
75542 this._hashBitLength = hashBitLength
75543 this._options = options
75544
75545 this._state = new KeccakState()
75546 this._state.initialize(rate, capacity)
75547 this._finalized = false
75548 }
75549
75550 inherits(Keccak, Transform)
75551
75552 Keccak.prototype._transform = function (chunk, encoding, callback) {
75553 var error = null
75554 try {
75555 this.update(chunk, encoding)
75556 } catch (err) {
75557 error = err
75558 }
75559
75560 callback(error)
75561 }
75562
75563 Keccak.prototype._flush = function (callback) {
75564 var error = null
75565 try {
75566 this.push(this.digest())
75567 } catch (err) {
75568 error = err
75569 }
75570
75571 callback(error)
75572 }
75573
75574 Keccak.prototype.update = function (data, encoding) {
75575 if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')
75576 if (this._finalized) throw new Error('Digest already called')
75577 if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
75578
75579 this._state.absorb(data)
75580
75581 return this
75582 }
75583
75584 Keccak.prototype.digest = function (encoding) {
75585 if (this._finalized) throw new Error('Digest already called')
75586 this._finalized = true
75587
75588 if (this._delimitedSuffix) this._state.absorbLastFewBits(this._delimitedSuffix)
75589 var digest = this._state.squeeze(this._hashBitLength / 8)
75590 if (encoding !== undefined) digest = digest.toString(encoding)
75591
75592 this._resetState()
75593
75594 return digest
75595 }
75596
75597 // remove result from memory
75598 Keccak.prototype._resetState = function () {
75599 this._state.initialize(this._rate, this._capacity)
75600 return this
75601 }
75602
75603 // because sometimes we need hash right now and little later
75604 Keccak.prototype._clone = function () {
75605 var clone = new Keccak(this._rate, this._capacity, this._delimitedSuffix, this._hashBitLength, this._options)
75606 this._state.copy(clone._state)
75607 clone._finalized = this._finalized
75608
75609 return clone
75610 }
75611
75612 return Keccak
75613}
75614
75615},{"inherits":396,"safe-buffer":742,"stream":808}],432:[function(require,module,exports){
75616'use strict'
75617var Buffer = require('safe-buffer').Buffer
75618var Transform = require('stream').Transform
75619var inherits = require('inherits')
75620
75621module.exports = function (KeccakState) {
75622 function Shake (rate, capacity, delimitedSuffix, options) {
75623 Transform.call(this, options)
75624
75625 this._rate = rate
75626 this._capacity = capacity
75627 this._delimitedSuffix = delimitedSuffix
75628 this._options = options
75629
75630 this._state = new KeccakState()
75631 this._state.initialize(rate, capacity)
75632 this._finalized = false
75633 }
75634
75635 inherits(Shake, Transform)
75636
75637 Shake.prototype._transform = function (chunk, encoding, callback) {
75638 var error = null
75639 try {
75640 this.update(chunk, encoding)
75641 } catch (err) {
75642 error = err
75643 }
75644
75645 callback(error)
75646 }
75647
75648 Shake.prototype._flush = function () {}
75649
75650 Shake.prototype._read = function (size) {
75651 this.push(this.squeeze(size))
75652 }
75653
75654 Shake.prototype.update = function (data, encoding) {
75655 if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')
75656 if (this._finalized) throw new Error('Squeeze already called')
75657 if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
75658
75659 this._state.absorb(data)
75660
75661 return this
75662 }
75663
75664 Shake.prototype.squeeze = function (dataByteLength, encoding) {
75665 if (!this._finalized) {
75666 this._finalized = true
75667 this._state.absorbLastFewBits(this._delimitedSuffix)
75668 }
75669
75670 var data = this._state.squeeze(dataByteLength)
75671 if (encoding !== undefined) data = data.toString(encoding)
75672
75673 return data
75674 }
75675
75676 Shake.prototype._resetState = function () {
75677 this._state.initialize(this._rate, this._capacity)
75678 return this
75679 }
75680
75681 Shake.prototype._clone = function () {
75682 var clone = new Shake(this._rate, this._capacity, this._delimitedSuffix, this._options)
75683 this._state.copy(clone._state)
75684 clone._finalized = this._finalized
75685
75686 return clone
75687 }
75688
75689 return Shake
75690}
75691
75692},{"inherits":396,"safe-buffer":742,"stream":808}],433:[function(require,module,exports){
75693'use strict'
75694var P1600_ROUND_CONSTANTS = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]
75695
75696exports.p1600 = function (s) {
75697 for (var round = 0; round < 24; ++round) {
75698 // theta
75699 var lo0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]
75700 var hi0 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]
75701 var lo1 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]
75702 var hi1 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]
75703 var lo2 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]
75704 var hi2 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]
75705 var lo3 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]
75706 var hi3 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]
75707 var lo4 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]
75708 var hi4 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]
75709
75710 var lo = lo4 ^ (lo1 << 1 | hi1 >>> 31)
75711 var hi = hi4 ^ (hi1 << 1 | lo1 >>> 31)
75712 var t1slo0 = s[0] ^ lo
75713 var t1shi0 = s[1] ^ hi
75714 var t1slo5 = s[10] ^ lo
75715 var t1shi5 = s[11] ^ hi
75716 var t1slo10 = s[20] ^ lo
75717 var t1shi10 = s[21] ^ hi
75718 var t1slo15 = s[30] ^ lo
75719 var t1shi15 = s[31] ^ hi
75720 var t1slo20 = s[40] ^ lo
75721 var t1shi20 = s[41] ^ hi
75722 lo = lo0 ^ (lo2 << 1 | hi2 >>> 31)
75723 hi = hi0 ^ (hi2 << 1 | lo2 >>> 31)
75724 var t1slo1 = s[2] ^ lo
75725 var t1shi1 = s[3] ^ hi
75726 var t1slo6 = s[12] ^ lo
75727 var t1shi6 = s[13] ^ hi
75728 var t1slo11 = s[22] ^ lo
75729 var t1shi11 = s[23] ^ hi
75730 var t1slo16 = s[32] ^ lo
75731 var t1shi16 = s[33] ^ hi
75732 var t1slo21 = s[42] ^ lo
75733 var t1shi21 = s[43] ^ hi
75734 lo = lo1 ^ (lo3 << 1 | hi3 >>> 31)
75735 hi = hi1 ^ (hi3 << 1 | lo3 >>> 31)
75736 var t1slo2 = s[4] ^ lo
75737 var t1shi2 = s[5] ^ hi
75738 var t1slo7 = s[14] ^ lo
75739 var t1shi7 = s[15] ^ hi
75740 var t1slo12 = s[24] ^ lo
75741 var t1shi12 = s[25] ^ hi
75742 var t1slo17 = s[34] ^ lo
75743 var t1shi17 = s[35] ^ hi
75744 var t1slo22 = s[44] ^ lo
75745 var t1shi22 = s[45] ^ hi
75746 lo = lo2 ^ (lo4 << 1 | hi4 >>> 31)
75747 hi = hi2 ^ (hi4 << 1 | lo4 >>> 31)
75748 var t1slo3 = s[6] ^ lo
75749 var t1shi3 = s[7] ^ hi
75750 var t1slo8 = s[16] ^ lo
75751 var t1shi8 = s[17] ^ hi
75752 var t1slo13 = s[26] ^ lo
75753 var t1shi13 = s[27] ^ hi
75754 var t1slo18 = s[36] ^ lo
75755 var t1shi18 = s[37] ^ hi
75756 var t1slo23 = s[46] ^ lo
75757 var t1shi23 = s[47] ^ hi
75758 lo = lo3 ^ (lo0 << 1 | hi0 >>> 31)
75759 hi = hi3 ^ (hi0 << 1 | lo0 >>> 31)
75760 var t1slo4 = s[8] ^ lo
75761 var t1shi4 = s[9] ^ hi
75762 var t1slo9 = s[18] ^ lo
75763 var t1shi9 = s[19] ^ hi
75764 var t1slo14 = s[28] ^ lo
75765 var t1shi14 = s[29] ^ hi
75766 var t1slo19 = s[38] ^ lo
75767 var t1shi19 = s[39] ^ hi
75768 var t1slo24 = s[48] ^ lo
75769 var t1shi24 = s[49] ^ hi
75770
75771 // rho & pi
75772 var t2slo0 = t1slo0
75773 var t2shi0 = t1shi0
75774 var t2slo16 = (t1shi5 << 4 | t1slo5 >>> 28)
75775 var t2shi16 = (t1slo5 << 4 | t1shi5 >>> 28)
75776 var t2slo7 = (t1slo10 << 3 | t1shi10 >>> 29)
75777 var t2shi7 = (t1shi10 << 3 | t1slo10 >>> 29)
75778 var t2slo23 = (t1shi15 << 9 | t1slo15 >>> 23)
75779 var t2shi23 = (t1slo15 << 9 | t1shi15 >>> 23)
75780 var t2slo14 = (t1slo20 << 18 | t1shi20 >>> 14)
75781 var t2shi14 = (t1shi20 << 18 | t1slo20 >>> 14)
75782 var t2slo10 = (t1slo1 << 1 | t1shi1 >>> 31)
75783 var t2shi10 = (t1shi1 << 1 | t1slo1 >>> 31)
75784 var t2slo1 = (t1shi6 << 12 | t1slo6 >>> 20)
75785 var t2shi1 = (t1slo6 << 12 | t1shi6 >>> 20)
75786 var t2slo17 = (t1slo11 << 10 | t1shi11 >>> 22)
75787 var t2shi17 = (t1shi11 << 10 | t1slo11 >>> 22)
75788 var t2slo8 = (t1shi16 << 13 | t1slo16 >>> 19)
75789 var t2shi8 = (t1slo16 << 13 | t1shi16 >>> 19)
75790 var t2slo24 = (t1slo21 << 2 | t1shi21 >>> 30)
75791 var t2shi24 = (t1shi21 << 2 | t1slo21 >>> 30)
75792 var t2slo20 = (t1shi2 << 30 | t1slo2 >>> 2)
75793 var t2shi20 = (t1slo2 << 30 | t1shi2 >>> 2)
75794 var t2slo11 = (t1slo7 << 6 | t1shi7 >>> 26)
75795 var t2shi11 = (t1shi7 << 6 | t1slo7 >>> 26)
75796 var t2slo2 = (t1shi12 << 11 | t1slo12 >>> 21)
75797 var t2shi2 = (t1slo12 << 11 | t1shi12 >>> 21)
75798 var t2slo18 = (t1slo17 << 15 | t1shi17 >>> 17)
75799 var t2shi18 = (t1shi17 << 15 | t1slo17 >>> 17)
75800 var t2slo9 = (t1shi22 << 29 | t1slo22 >>> 3)
75801 var t2shi9 = (t1slo22 << 29 | t1shi22 >>> 3)
75802 var t2slo5 = (t1slo3 << 28 | t1shi3 >>> 4)
75803 var t2shi5 = (t1shi3 << 28 | t1slo3 >>> 4)
75804 var t2slo21 = (t1shi8 << 23 | t1slo8 >>> 9)
75805 var t2shi21 = (t1slo8 << 23 | t1shi8 >>> 9)
75806 var t2slo12 = (t1slo13 << 25 | t1shi13 >>> 7)
75807 var t2shi12 = (t1shi13 << 25 | t1slo13 >>> 7)
75808 var t2slo3 = (t1slo18 << 21 | t1shi18 >>> 11)
75809 var t2shi3 = (t1shi18 << 21 | t1slo18 >>> 11)
75810 var t2slo19 = (t1shi23 << 24 | t1slo23 >>> 8)
75811 var t2shi19 = (t1slo23 << 24 | t1shi23 >>> 8)
75812 var t2slo15 = (t1slo4 << 27 | t1shi4 >>> 5)
75813 var t2shi15 = (t1shi4 << 27 | t1slo4 >>> 5)
75814 var t2slo6 = (t1slo9 << 20 | t1shi9 >>> 12)
75815 var t2shi6 = (t1shi9 << 20 | t1slo9 >>> 12)
75816 var t2slo22 = (t1shi14 << 7 | t1slo14 >>> 25)
75817 var t2shi22 = (t1slo14 << 7 | t1shi14 >>> 25)
75818 var t2slo13 = (t1slo19 << 8 | t1shi19 >>> 24)
75819 var t2shi13 = (t1shi19 << 8 | t1slo19 >>> 24)
75820 var t2slo4 = (t1slo24 << 14 | t1shi24 >>> 18)
75821 var t2shi4 = (t1shi24 << 14 | t1slo24 >>> 18)
75822
75823 // chi
75824 s[0] = t2slo0 ^ (~t2slo1 & t2slo2)
75825 s[1] = t2shi0 ^ (~t2shi1 & t2shi2)
75826 s[10] = t2slo5 ^ (~t2slo6 & t2slo7)
75827 s[11] = t2shi5 ^ (~t2shi6 & t2shi7)
75828 s[20] = t2slo10 ^ (~t2slo11 & t2slo12)
75829 s[21] = t2shi10 ^ (~t2shi11 & t2shi12)
75830 s[30] = t2slo15 ^ (~t2slo16 & t2slo17)
75831 s[31] = t2shi15 ^ (~t2shi16 & t2shi17)
75832 s[40] = t2slo20 ^ (~t2slo21 & t2slo22)
75833 s[41] = t2shi20 ^ (~t2shi21 & t2shi22)
75834 s[2] = t2slo1 ^ (~t2slo2 & t2slo3)
75835 s[3] = t2shi1 ^ (~t2shi2 & t2shi3)
75836 s[12] = t2slo6 ^ (~t2slo7 & t2slo8)
75837 s[13] = t2shi6 ^ (~t2shi7 & t2shi8)
75838 s[22] = t2slo11 ^ (~t2slo12 & t2slo13)
75839 s[23] = t2shi11 ^ (~t2shi12 & t2shi13)
75840 s[32] = t2slo16 ^ (~t2slo17 & t2slo18)
75841 s[33] = t2shi16 ^ (~t2shi17 & t2shi18)
75842 s[42] = t2slo21 ^ (~t2slo22 & t2slo23)
75843 s[43] = t2shi21 ^ (~t2shi22 & t2shi23)
75844 s[4] = t2slo2 ^ (~t2slo3 & t2slo4)
75845 s[5] = t2shi2 ^ (~t2shi3 & t2shi4)
75846 s[14] = t2slo7 ^ (~t2slo8 & t2slo9)
75847 s[15] = t2shi7 ^ (~t2shi8 & t2shi9)
75848 s[24] = t2slo12 ^ (~t2slo13 & t2slo14)
75849 s[25] = t2shi12 ^ (~t2shi13 & t2shi14)
75850 s[34] = t2slo17 ^ (~t2slo18 & t2slo19)
75851 s[35] = t2shi17 ^ (~t2shi18 & t2shi19)
75852 s[44] = t2slo22 ^ (~t2slo23 & t2slo24)
75853 s[45] = t2shi22 ^ (~t2shi23 & t2shi24)
75854 s[6] = t2slo3 ^ (~t2slo4 & t2slo0)
75855 s[7] = t2shi3 ^ (~t2shi4 & t2shi0)
75856 s[16] = t2slo8 ^ (~t2slo9 & t2slo5)
75857 s[17] = t2shi8 ^ (~t2shi9 & t2shi5)
75858 s[26] = t2slo13 ^ (~t2slo14 & t2slo10)
75859 s[27] = t2shi13 ^ (~t2shi14 & t2shi10)
75860 s[36] = t2slo18 ^ (~t2slo19 & t2slo15)
75861 s[37] = t2shi18 ^ (~t2shi19 & t2shi15)
75862 s[46] = t2slo23 ^ (~t2slo24 & t2slo20)
75863 s[47] = t2shi23 ^ (~t2shi24 & t2shi20)
75864 s[8] = t2slo4 ^ (~t2slo0 & t2slo1)
75865 s[9] = t2shi4 ^ (~t2shi0 & t2shi1)
75866 s[18] = t2slo9 ^ (~t2slo5 & t2slo6)
75867 s[19] = t2shi9 ^ (~t2shi5 & t2shi6)
75868 s[28] = t2slo14 ^ (~t2slo10 & t2slo11)
75869 s[29] = t2shi14 ^ (~t2shi10 & t2shi11)
75870 s[38] = t2slo19 ^ (~t2slo15 & t2slo16)
75871 s[39] = t2shi19 ^ (~t2shi15 & t2shi16)
75872 s[48] = t2slo24 ^ (~t2slo20 & t2slo21)
75873 s[49] = t2shi24 ^ (~t2shi20 & t2shi21)
75874
75875 // iota
75876 s[0] ^= P1600_ROUND_CONSTANTS[round * 2]
75877 s[1] ^= P1600_ROUND_CONSTANTS[round * 2 + 1]
75878 }
75879}
75880
75881},{}],434:[function(require,module,exports){
75882'use strict'
75883var Buffer = require('safe-buffer').Buffer
75884var keccakState = require('./keccak-state-unroll')
75885
75886function Keccak () {
75887 // much faster than `new Array(50)`
75888 this.state = [
75889 0, 0, 0, 0, 0,
75890 0, 0, 0, 0, 0,
75891 0, 0, 0, 0, 0,
75892 0, 0, 0, 0, 0,
75893 0, 0, 0, 0, 0
75894 ]
75895
75896 this.blockSize = null
75897 this.count = 0
75898 this.squeezing = false
75899}
75900
75901Keccak.prototype.initialize = function (rate, capacity) {
75902 for (var i = 0; i < 50; ++i) this.state[i] = 0
75903 this.blockSize = rate / 8
75904 this.count = 0
75905 this.squeezing = false
75906}
75907
75908Keccak.prototype.absorb = function (data) {
75909 for (var i = 0; i < data.length; ++i) {
75910 this.state[~~(this.count / 4)] ^= data[i] << (8 * (this.count % 4))
75911 this.count += 1
75912 if (this.count === this.blockSize) {
75913 keccakState.p1600(this.state)
75914 this.count = 0
75915 }
75916 }
75917}
75918
75919Keccak.prototype.absorbLastFewBits = function (bits) {
75920 this.state[~~(this.count / 4)] ^= bits << (8 * (this.count % 4))
75921 if ((bits & 0x80) !== 0 && this.count === (this.blockSize - 1)) keccakState.p1600(this.state)
75922 this.state[~~((this.blockSize - 1) / 4)] ^= 0x80 << (8 * ((this.blockSize - 1) % 4))
75923 keccakState.p1600(this.state)
75924 this.count = 0
75925 this.squeezing = true
75926}
75927
75928Keccak.prototype.squeeze = function (length) {
75929 if (!this.squeezing) this.absorbLastFewBits(0x01)
75930
75931 var output = Buffer.alloc(length)
75932 for (var i = 0; i < length; ++i) {
75933 output[i] = (this.state[~~(this.count / 4)] >>> (8 * (this.count % 4))) & 0xff
75934 this.count += 1
75935 if (this.count === this.blockSize) {
75936 keccakState.p1600(this.state)
75937 this.count = 0
75938 }
75939 }
75940
75941 return output
75942}
75943
75944Keccak.prototype.copy = function (dest) {
75945 for (var i = 0; i < 50; ++i) dest.state[i] = this.state[i]
75946 dest.blockSize = this.blockSize
75947 dest.count = this.count
75948 dest.squeezing = this.squeezing
75949}
75950
75951module.exports = Keccak
75952
75953},{"./keccak-state-unroll":433,"safe-buffer":742}],435:[function(require,module,exports){
75954/*! kjua v0.6.0 - https://larsjung.de/kjua/ */
75955!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("kjua",[],r):"object"==typeof exports?exports.kjua=r():t.kjua=r()}("undefined"!=typeof self?self:this,function(){return function(e){var n={};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=n,o.d=function(t,r,e){o.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(r,t){if(1&t&&(r=o(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var n in r)o.d(e,n,function(t){return r[t]}.bind(null,n));return e},o.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(r,"a",r),r},o.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},o.p="",o(o.s=0)}([function(t,r,e){var n=e(1),a=n.create_canvas,u=n.canvas_to_img,f=n.dpr,c=e(3),l=e(4),s=e(6);t.exports=function(t){var r=Object.assign({},c,t),e=l(r.text,r.ecLevel,r.minVersion,r.quiet),n=r.ratio||f,o=a(r.size,n),i=o.getContext("2d");return i.scale(n,n),s(e,i,r),"image"===r.render?u(o):o}},function(u,t,r){(function(t){function n(t){return i.createElement(t)}function e(t,r){return t.getAttribute(r)}function o(t,r,e){return t.setAttribute(r,e)}var r=t.window,i=r.document,a=r.devicePixelRatio||1;u.exports={create_canvas:function(t,r){var e=n("canvas");return o(e,"width",t*r),o(e,"height",t*r),e.style.width="".concat(t,"px"),e.style.height="".concat(t,"px"),e},canvas_to_img:function(t){var r=n("img");return o(r,"crossorigin","anonymous"),o(r,"src",t.toDataURL("image/png")),o(r,"width",e(t,"width")),o(r,"height",e(t,"height")),r.style.width=t.style.width,r.style.height=t.style.height,r},dpr:a}}).call(this,r(2))},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r){t.exports={render:"image",crisp:!0,minVersion:1,ecLevel:"L",size:200,ratio:null,fill:"#333",back:"#fff",text:"no text",rounded:0,quiet:0,mode:"plain",mSize:30,mPosX:50,mPosY:50,label:"no label",fontname:"sans",fontcolor:"#333",image:null}},function(t,r,e){function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=/code length overflow/i,f=e(5);f.stringToBytes=f.stringToBytesFuncs["UTF-8"];t.exports=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"L",e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,o=function(t,r){for(var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=e=Math.max(1,e);o<=40;o+=1)try{var n=function(){var e=f(o,r);e.addData(t),e.make();var n=e.getModuleCount();return{v:{text:t,level:r,version:o,moduleCount:n,isDark:function(t,r){return 0<=t&&t<n&&0<=r&&r<n&&e.isDark(t,r)}}}}();if("object"===a(n))return n.v}catch(t){if(!(o<40&&u.test(t)))throw new Error(t)}return null}(t,r,e);if(o){var i=o.isDark;o.moduleCount+=2*n,o.isDark=function(t,r){return i(t-n,r-n)}}return o}},function(t,r,e){var n,o,i,a=function(){function i(t,r){function a(t,r){l=function(t){for(var r=new Array(t),e=0;e<t;e+=1){r[e]=new Array(t);for(var n=0;n<t;n+=1)r[e][n]=null}return r}(s=4*u+17),e(0,0),e(s-7,0),e(0,s-7),i(),o(),v(t,r),7<=u&&g(t),null==n&&(n=p(u,f,c)),d(n,r)}var u=t,f=y[r],l=null,s=0,n=null,c=[],h={},e=function(t,r){for(var e=-1;e<=7;e+=1)if(!(t+e<=-1||s<=t+e))for(var n=-1;n<=7;n+=1)r+n<=-1||s<=r+n||(l[t+e][r+n]=0<=e&&e<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==e||6==e)||2<=e&&e<=4&&2<=n&&n<=4)},o=function(){for(var t=8;t<s-8;t+=1)null==l[t][6]&&(l[t][6]=t%2==0);for(var r=8;r<s-8;r+=1)null==l[6][r]&&(l[6][r]=r%2==0)},i=function(){for(var t=w.getPatternPosition(u),r=0;r<t.length;r+=1)for(var e=0;e<t.length;e+=1){var n=t[r],o=t[e];if(null==l[n][o])for(var i=-2;i<=2;i+=1)for(var a=-2;a<=2;a+=1)l[n+i][o+a]=-2==i||2==i||-2==a||2==a||0==i&&0==a}},g=function(t){for(var r=w.getBCHTypeNumber(u),e=0;e<18;e+=1){var n=!t&&1==(r>>e&1);l[Math.floor(e/3)][e%3+s-8-3]=n}for(e=0;e<18;e+=1){n=!t&&1==(r>>e&1);l[e%3+s-8-3][Math.floor(e/3)]=n}},v=function(t,r){for(var e=f<<3|r,n=w.getBCHTypeInfo(e),o=0;o<15;o+=1){var i=!t&&1==(n>>o&1);o<6?l[o][8]=i:o<8?l[o+1][8]=i:l[s-15+o][8]=i}for(o=0;o<15;o+=1){i=!t&&1==(n>>o&1);o<8?l[8][s-o-1]=i:o<9?l[8][15-o-1+1]=i:l[8][15-o-1]=i}l[s-8][8]=!t},d=function(t,r){for(var e=-1,n=s-1,o=7,i=0,a=w.getMaskFunction(r),u=s-1;0<u;u-=2)for(6==u&&(u-=1);;){for(var f=0;f<2;f+=1)if(null==l[n][u-f]){var c=!1;i<t.length&&(c=1==(t[i]>>>o&1)),a(n,u-f)&&(c=!c),l[n][u-f]=c,-1==(o-=1)&&(i+=1,o=7)}if((n+=e)<0||s<=n){n-=e,e=-e;break}}},p=function(t,r,e){for(var n=B.getRSBlocks(t,r),o=C(),i=0;i<e.length;i+=1){var a=e[i];o.put(a.getMode(),4),o.put(a.getLength(),w.getLengthInBits(a.getMode(),t)),a.write(o)}var u=0;for(i=0;i<n.length;i+=1)u+=n[i].dataCount;if(o.getLengthInBits()>8*u)throw"code length overflow. ("+o.getLengthInBits()+">"+8*u+")";for(o.getLengthInBits()+4<=8*u&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*u||(o.put(236,8),o.getLengthInBits()>=8*u));)o.put(17,8);return function(t,r){for(var e=0,n=0,o=0,i=new Array(r.length),a=new Array(r.length),u=0;u<r.length;u+=1){var f=r[u].dataCount,c=r[u].totalCount-f;n=Math.max(n,f),o=Math.max(o,c),i[u]=new Array(f);for(var l=0;l<i[u].length;l+=1)i[u][l]=255&t.getBuffer()[l+e];e+=f;var s=w.getErrorCorrectPolynomial(c),g=m(i[u],s.getLength()-1).mod(s);for(a[u]=new Array(s.getLength()-1),l=0;l<a[u].length;l+=1){var h=l+g.getLength()-a[u].length;a[u][l]=0<=h?g.getAt(h):0}}var v=0;for(l=0;l<r.length;l+=1)v+=r[l].totalCount;var d=new Array(v),p=0;for(l=0;l<n;l+=1)for(u=0;u<r.length;u+=1)l<i[u].length&&(d[p]=i[u][l],p+=1);for(l=0;l<o;l+=1)for(u=0;u<r.length;u+=1)l<a[u].length&&(d[p]=a[u][l],p+=1);return d}(o,n)};return h.addData=function(t,r){var e=null;switch(r=r||"Byte"){case"Numeric":e=x(t);break;case"Alphanumeric":e=A(t);break;case"Byte":e=M(t);break;case"Kanji":e=S(t);break;default:throw"mode:"+r}c.push(e),n=null},h.isDark=function(t,r){if(t<0||s<=t||r<0||s<=r)throw t+","+r;return l[t][r]},h.getModuleCount=function(){return s},h.make=function(){if(u<1){for(var t=1;t<40;t++){for(var r=B.getRSBlocks(t,f),e=C(),n=0;n<c.length;n++){var o=c[n];e.put(o.getMode(),4),e.put(o.getLength(),w.getLengthInBits(o.getMode(),t)),o.write(e)}var i=0;for(n=0;n<r.length;n++)i+=r[n].dataCount;if(e.getLengthInBits()<=8*i)break}u=t}a(!1,function(){for(var t=0,r=0,e=0;e<8;e+=1){a(!0,e);var n=w.getLostPoint(h);(0==e||n<t)&&(t=n,r=e)}return r}())},h.createTableTag=function(t,r){t=t||2;var e="";e+='<table style="',e+=" border-width: 0px; border-style: none;",e+=" border-collapse: collapse;",e+=" padding: 0px; margin: "+(r=void 0===r?4*t:r)+"px;",e+='">',e+="<tbody>";for(var n=0;n<h.getModuleCount();n+=1){e+="<tr>";for(var o=0;o<h.getModuleCount();o+=1)e+='<td style="',e+=" border-width: 0px; border-style: none;",e+=" border-collapse: collapse;",e+=" padding: 0px; margin: 0px;",e+=" width: "+t+"px;",e+=" height: "+t+"px;",e+=" background-color: ",e+=h.isDark(n,o)?"#000000":"#ffffff",e+=";",e+='"/>';e+="</tr>"}return e+="</tbody>",e+="</table>"},h.createSvgTag=function(t,r){var e={};"object"==typeof t&&(t=(e=t).cellSize,r=e.margin),t=t||2,r=void 0===r?4*t:r;var n,o,i,a,u=h.getModuleCount()*t+2*r,f="";for(a="l"+t+",0 0,"+t+" -"+t+",0 0,-"+t+"z ",f+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',f+=e.scalable?"":' width="'+u+'px" height="'+u+'px"',f+=' viewBox="0 0 '+u+" "+u+'" ',f+=' preserveAspectRatio="xMinYMin meet">',f+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',f+='<path d="',o=0;o<h.getModuleCount();o+=1)for(i=o*t+r,n=0;n<h.getModuleCount();n+=1)h.isDark(o,n)&&(f+="M"+(n*t+r)+","+i+a);return f+='" stroke="transparent" fill="black"/>',f+="</svg>"},h.createDataURL=function(o,t){o=o||2,t=void 0===t?4*o:t;var r=h.getModuleCount()*o+2*t,i=t,a=r-t;return D(r,r,function(t,r){if(i<=t&&t<a&&i<=r&&r<a){var e=Math.floor((t-i)/o),n=Math.floor((r-i)/o);return h.isDark(n,e)?0:1}return 1})},h.createImgTag=function(t,r,e){t=t||2,r=void 0===r?4*t:r;var n=h.getModuleCount()*t+2*r,o="";return o+="<img",o+=' src="',o+=h.createDataURL(t,r),o+='"',o+=' width="',o+=n,o+='"',o+=' height="',o+=n,o+='"',e&&(o+=' alt="',o+=e,o+='"'),o+="/>"},h.createASCII=function(t,r){if((t=t||1)<2)return function(t){t=void 0===t?2:t;var r,e,n,o,i,a=1*h.getModuleCount()+2*t,u=t,f=a-t,c={"██":"█","█ ":"▀"," █":"▄"," ":" "},l={"██":"▀","█ ":"▀"," █":" "," ":" "},s="";for(r=0;r<a;r+=2){for(n=Math.floor((r-u)/1),o=Math.floor((r+1-u)/1),e=0;e<a;e+=1)i="█",u<=e&&e<f&&u<=r&&r<f&&h.isDark(n,Math.floor((e-u)/1))&&(i=" "),u<=e&&e<f&&u<=r+1&&r+1<f&&h.isDark(o,Math.floor((e-u)/1))?i+=" ":i+="█",s+=t<1&&f<=r+1?l[i]:c[i];s+="\n"}return a%2&&0<t?s.substring(0,s.length-a-1)+Array(1+a).join("▀"):s.substring(0,s.length-1)}(r);t-=1,r=void 0===r?2*t:r;var e,n,o,i,a=h.getModuleCount()*t+2*r,u=r,f=a-r,c=Array(t+1).join("██"),l=Array(t+1).join(" "),s="",g="";for(e=0;e<a;e+=1){for(o=Math.floor((e-u)/t),g="",n=0;n<a;n+=1)i=1,u<=n&&n<f&&u<=e&&e<f&&h.isDark(o,Math.floor((n-u)/t))&&(i=0),g+=i?c:l;for(o=0;o<t;o+=1)s+=g+"\n"}return s.substring(0,s.length-1)},h.renderTo2dContext=function(t,r){r=r||2;for(var e=h.getModuleCount(),n=0;n<e;n++)for(var o=0;o<e;o++)t.fillStyle=h.isDark(n,o)?"black":"white",t.fillRect(n*r,o*r,r,r)},h}i.stringToBytes=(i.stringToBytesFuncs={default:function(t){for(var r=[],e=0;e<t.length;e+=1){var n=t.charCodeAt(e);r.push(255&n)}return r}}).default,i.createStringToBytes=function(u,f){var i=function(){function t(){var t=r.read();if(-1==t)throw"eof";return t}for(var r=L(u),e=0,n={};;){var o=r.read();if(-1==o)break;var i=t(),a=t()<<8|t();n[String.fromCharCode(o<<8|i)]=a,e+=1}if(e!=f)throw e+" != "+f;return n}(),a="?".charCodeAt(0);return function(t){for(var r=[],e=0;e<t.length;e+=1){var n=t.charCodeAt(e);if(n<128)r.push(n);else{var o=i[t.charAt(e)];"number"==typeof o?(255&o)==o?r.push(o):(r.push(o>>>8),r.push(255&o)):r.push(a)}}return r}};var a=1,u=2,o=4,f=8,y={L:1,M:0,Q:3,H:2},n=0,c=1,l=2,s=3,g=4,h=5,v=6,d=7,w=function(){function e(t){for(var r=0;0!=t;)r+=1,t>>>=1;return r}var r=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t={};return t.getBCHTypeInfo=function(t){for(var r=t<<10;0<=e(r)-e(1335);)r^=1335<<e(r)-e(1335);return 21522^(t<<10|r)},t.getBCHTypeNumber=function(t){for(var r=t<<12;0<=e(r)-e(7973);)r^=7973<<e(r)-e(7973);return t<<12|r},t.getPatternPosition=function(t){return r[t-1]},t.getMaskFunction=function(t){switch(t){case n:return function(t,r){return(t+r)%2==0};case c:return function(t,r){return t%2==0};case l:return function(t,r){return r%3==0};case s:return function(t,r){return(t+r)%3==0};case g:return function(t,r){return(Math.floor(t/2)+Math.floor(r/3))%2==0};case h:return function(t,r){return t*r%2+t*r%3==0};case v:return function(t,r){return(t*r%2+t*r%3)%2==0};case d:return function(t,r){return(t*r%3+(t+r)%2)%2==0};default:throw"bad maskPattern:"+t}},t.getErrorCorrectPolynomial=function(t){for(var r=m([1],0),e=0;e<t;e+=1)r=r.multiply(m([1,p.gexp(e)],0));return r},t.getLengthInBits=function(t,r){if(1<=r&&r<10)switch(t){case a:return 10;case u:return 9;case o:case f:return 8;default:throw"mode:"+t}else if(r<27)switch(t){case a:return 12;case u:return 11;case o:return 16;case f:return 10;default:throw"mode:"+t}else{if(!(r<41))throw"type:"+r;switch(t){case a:return 14;case u:return 13;case o:return 16;case f:return 12;default:throw"mode:"+t}}},t.getLostPoint=function(t){for(var r=t.getModuleCount(),e=0,n=0;n<r;n+=1)for(var o=0;o<r;o+=1){for(var i=0,a=t.isDark(n,o),u=-1;u<=1;u+=1)if(!(n+u<0||r<=n+u))for(var f=-1;f<=1;f+=1)o+f<0||r<=o+f||0==u&&0==f||a==t.isDark(n+u,o+f)&&(i+=1);5<i&&(e+=3+i-5)}for(n=0;n<r-1;n+=1)for(o=0;o<r-1;o+=1){var c=0;t.isDark(n,o)&&(c+=1),t.isDark(n+1,o)&&(c+=1),t.isDark(n,o+1)&&(c+=1),t.isDark(n+1,o+1)&&(c+=1),0!=c&&4!=c||(e+=3)}for(n=0;n<r;n+=1)for(o=0;o<r-6;o+=1)t.isDark(n,o)&&!t.isDark(n,o+1)&&t.isDark(n,o+2)&&t.isDark(n,o+3)&&t.isDark(n,o+4)&&!t.isDark(n,o+5)&&t.isDark(n,o+6)&&(e+=40);for(o=0;o<r;o+=1)for(n=0;n<r-6;n+=1)t.isDark(n,o)&&!t.isDark(n+1,o)&&t.isDark(n+2,o)&&t.isDark(n+3,o)&&t.isDark(n+4,o)&&!t.isDark(n+5,o)&&t.isDark(n+6,o)&&(e+=40);var l=0;for(o=0;o<r;o+=1)for(n=0;n<r;n+=1)t.isDark(n,o)&&(l+=1);return e+=10*(Math.abs(100*l/r/r-50)/5)},t}(),p=function(){for(var r=new Array(256),e=new Array(256),t=0;t<8;t+=1)r[t]=1<<t;for(t=8;t<256;t+=1)r[t]=r[t-4]^r[t-5]^r[t-6]^r[t-8];for(t=0;t<255;t+=1)e[r[t]]=t;var n={glog:function(t){if(t<1)throw"glog("+t+")";return e[t]},gexp:function(t){for(;t<0;)t+=255;for(;256<=t;)t-=255;return r[t]}};return n}();function m(n,o){if(void 0===n.length)throw n.length+"/"+o;var r=function(){for(var t=0;t<n.length&&0==n[t];)t+=1;for(var r=new Array(n.length-t+o),e=0;e<n.length-t;e+=1)r[e]=n[e+t];return r}(),i={getAt:function(t){return r[t]},getLength:function(){return r.length},multiply:function(t){for(var r=new Array(i.getLength()+t.getLength()-1),e=0;e<i.getLength();e+=1)for(var n=0;n<t.getLength();n+=1)r[e+n]^=p.gexp(p.glog(i.getAt(e))+p.glog(t.getAt(n)));return m(r,0)},mod:function(t){if(i.getLength()-t.getLength()<0)return i;for(var r=p.glog(i.getAt(0))-p.glog(t.getAt(0)),e=new Array(i.getLength()),n=0;n<i.getLength();n+=1)e[n]=i.getAt(n);for(n=0;n<t.getLength();n+=1)e[n]^=p.gexp(p.glog(t.getAt(n))+r);return m(e,0).mod(t)}};return i}function b(){var e=[],o={writeByte:function(t){e.push(255&t)},writeShort:function(t){o.writeByte(t),o.writeByte(t>>>8)},writeBytes:function(t,r,e){r=r||0,e=e||t.length;for(var n=0;n<e;n+=1)o.writeByte(t[n+r])},writeString:function(t){for(var r=0;r<t.length;r+=1)o.writeByte(t.charCodeAt(r))},toByteArray:function(){return e},toString:function(){var t="";t+="[";for(var r=0;r<e.length;r+=1)0<r&&(t+=","),t+=e[r];return t+="]"}};return o}var k,t,B=(k=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],(t={}).getRSBlocks=function(t,r){var e=function(t,r){switch(r){case y.L:return k[4*(t-1)+0];case y.M:return k[4*(t-1)+1];case y.Q:return k[4*(t-1)+2];case y.H:return k[4*(t-1)+3];default:return}}(t,r);if(void 0===e)throw"bad rs block @ typeNumber:"+t+"/errorCorrectionLevel:"+r;for(var n,o,i=e.length/3,a=[],u=0;u<i;u+=1)for(var f=e[3*u+0],c=e[3*u+1],l=e[3*u+2],s=0;s<f;s+=1)a.push((n=l,o=void 0,(o={}).totalCount=c,o.dataCount=n,o));return a},t),C=function(){var e=[],n=0,o={getBuffer:function(){return e},getAt:function(t){var r=Math.floor(t/8);return 1==(e[r]>>>7-t%8&1)},put:function(t,r){for(var e=0;e<r;e+=1)o.putBit(1==(t>>>r-e-1&1))},getLengthInBits:function(){return n},putBit:function(t){var r=Math.floor(n/8);e.length<=r&&e.push(0),t&&(e[r]|=128>>>n%8),n+=1}};return o},x=function(t){var r=a,n=t,e={getMode:function(){return r},getLength:function(t){return n.length},write:function(t){for(var r=n,e=0;e+2<r.length;)t.put(o(r.substring(e,e+3)),10),e+=3;e<r.length&&(r.length-e==1?t.put(o(r.substring(e,e+1)),4):r.length-e==2&&t.put(o(r.substring(e,e+2)),7))}},o=function(t){for(var r=0,e=0;e<t.length;e+=1)r=10*r+i(t.charAt(e));return r},i=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);throw"illegal char :"+t};return e},A=function(t){var r=u,n=t,e={getMode:function(){return r},getLength:function(t){return n.length},write:function(t){for(var r=n,e=0;e+1<r.length;)t.put(45*o(r.charAt(e))+o(r.charAt(e+1)),11),e+=2;e<r.length&&t.put(o(r.charAt(e)),6)}},o=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);if("A"<=t&&t<="Z")return t.charCodeAt(0)-"A".charCodeAt(0)+10;switch(t){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+t}};return e},M=function(t){var r=o,e=i.stringToBytes(t),n={getMode:function(){return r},getLength:function(t){return e.length},write:function(t){for(var r=0;r<e.length;r+=1)t.put(e[r],8)}};return n},S=function(t){var r=f,n=i.stringToBytesFuncs.SJIS;if(!n)throw"sjis not supported.";!function(t,r){var e=n("友");if(2!=e.length||38726!=(e[0]<<8|e[1]))throw"sjis not supported."}();var o=n(t),e={getMode:function(){return r},getLength:function(t){return~~(o.length/2)},write:function(t){for(var r=o,e=0;e+1<r.length;){var n=(255&r[e])<<8|255&r[e+1];if(33088<=n&&n<=40956)n-=33088;else{if(!(57408<=n&&n<=60351))throw"illegal char at "+(e+1)+"/"+n;n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13),e+=2}if(e<r.length)throw"illegal char at "+(e+1)}};return e},L=function(t){var e=t,n=0,o=0,i=0,r={read:function(){for(;i<8;){if(n>=e.length){if(0==i)return-1;throw"unexpected end of file./"+i}var t=e.charAt(n);if(n+=1,"="==t)return i=0,-1;t.match(/^\s$/)||(o=o<<6|a(t.charCodeAt(0)),i+=6)}var r=o>>>i-8&255;return i-=8,r}},a=function(t){if(65<=t&&t<=90)return t-65;if(97<=t&&t<=122)return t-97+26;if(48<=t&&t<=57)return t-48+52;if(43==t)return 62;if(47==t)return 63;throw"c:"+t};return r},D=function(t,r,e){for(var n=function(t,r){var n=t,o=r,s=new Array(t*r),e={setPixel:function(t,r,e){s[r*n+t]=e},write:function(t){t.writeString("GIF87a"),t.writeShort(n),t.writeShort(o),t.writeByte(128),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(255),t.writeByte(255),t.writeByte(255),t.writeString(","),t.writeShort(0),t.writeShort(0),t.writeShort(n),t.writeShort(o),t.writeByte(0);var r=i(2);t.writeByte(2);for(var e=0;255<r.length-e;)t.writeByte(255),t.writeBytes(r,e,255),e+=255;t.writeByte(r.length-e),t.writeBytes(r,e,r.length-e),t.writeByte(0),t.writeString(";")}},i=function(t){for(var r=1<<t,e=1+(1<<t),n=t+1,o=g(),i=0;i<r;i+=1)o.add(String.fromCharCode(i));o.add(String.fromCharCode(r)),o.add(String.fromCharCode(e));var a=b(),u=function(t){var e=t,n=0,o=0,r={write:function(t,r){if(t>>>r!=0)throw"length over";for(;8<=n+r;)e.writeByte(255&(t<<n|o)),r-=8-n,t>>>=8-n,n=o=0;o|=t<<n,n+=r},flush:function(){0<n&&e.writeByte(o)}};return r}(a);u.write(r,n);var f=0,c=String.fromCharCode(s[f]);for(f+=1;f<s.length;){var l=String.fromCharCode(s[f]);f+=1,o.contains(c+l)?c+=l:(u.write(o.indexOf(c),n),o.size()<4095&&(o.size()==1<<n&&(n+=1),o.add(c+l)),c=l)}return u.write(o.indexOf(c),n),u.write(e,n),u.flush(),a.toByteArray()},g=function(){var r={},e=0,n={add:function(t){if(n.contains(t))throw"dup key:"+t;r[t]=e,e+=1},size:function(){return e},indexOf:function(t){return r[t]},contains:function(t){return void 0!==r[t]}};return n};return e}(t,r),o=0;o<r;o+=1)for(var i=0;i<t;i+=1)n.setPixel(i,o,e(i,o));var a=b();n.write(a);for(var u=function(){function e(t){a+=String.fromCharCode(r(63&t))}var n=0,o=0,i=0,a="",t={},r=function(t){if(t<0);else{if(t<26)return 65+t;if(t<52)return t-26+97;if(t<62)return t-52+48;if(62==t)return 43;if(63==t)return 47}throw"n:"+t};return t.writeByte=function(t){for(n=n<<8|255&t,o+=8,i+=1;6<=o;)e(n>>>o-6),o-=6},t.flush=function(){if(0<o&&(e(n<<6-o),o=n=0),i%3!=0)for(var t=3-i%3,r=0;r<t;r+=1)a+="="},t.toString=function(){return a},t}(),f=a.toByteArray(),c=0;c<f.length;c+=1)u.writeByte(f[c]);return u.flush(),"data:image/gif;base64,"+u};return i}();a.stringToBytesFuncs["UTF-8"]=function(t){return function(t){for(var r=[],e=0;e<t.length;e++){var n=t.charCodeAt(e);n<128?r.push(n):n<2048?r.push(192|n>>6,128|63&n):n<55296||57344<=n?r.push(224|n>>12,128|n>>6&63,128|63&n):(e++,n=65536+((1023&n)<<10|1023&t.charCodeAt(e)),r.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return r}(t)},o=[],void 0===(i="function"==typeof(n=function(){return a})?n.apply(r,o):n)||(t.exports=i)},function(t,r,e){function c(t,r,e,n,o,i){t.isDark(o,i)&&r.rect(i*n,o*n,n,n)}var l=e(7),n=e(8);t.exports=function(t,r,e){!function(t,r){t.fillStyle=r.back,t.fillRect(0,0,r.size,r.size)}(r,e),function(t,r,e){if(t){var n=0<e.rounded&&e.rounded<=100?l:c,o=t.moduleCount,i=e.size/o,a=0;e.crisp&&(i=Math.floor(i),a=Math.floor((e.size-i*o)/2)),r.translate(a,a),r.beginPath();for(var u=0;u<o;u+=1)for(var f=0;f<o;f+=1)n(t,r,e,i,u,f);r.fillStyle=e.fill,r.fill(),r.translate(-a,-a)}}(t,r,e),n(r,e)}},function(t,r){t.exports=function(t,r,e,n,o,i){var a=i*n,u=o*n,f=a+n,c=u+n,l=.005*e.rounded*n,s=t.isDark,g=o-1,h=o+1,v=i-1,d=i+1,p=s(o,i),y=s(g,v),w=s(g,i),m=s(g,d),b=s(o,d),k=s(h,d),B=s(h,i),C=s(h,v),x=s(o,v);r=function(t){return{c:t,m:function(){var t;return(t=this.c).moveTo.apply(t,arguments),this},l:function(){var t;return(t=this.c).lineTo.apply(t,arguments),this},a:function(){var t;return(t=this.c).arcTo.apply(t,arguments),this}}}(r),p?function(t,r,e,n,o,i,a,u,f,c){a?t.m(r+i,e):t.m(r,e),u?t.l(n-i,e).a(n,e,n,o,i):t.l(n,e),f?t.l(n,o-i).a(n,o,r,o,i):t.l(n,o),c?t.l(r+i,o).a(r,o,r,e,i):t.l(r,o),a?t.l(r,e+i).a(r,e,n,e,i):t.l(r,e)}(r,a,u,f,c,l,!w&&!x,!w&&!b,!B&&!b,!B&&!x):function(t,r,e,n,o,i,a,u,f,c){a&&t.m(r+i,e).l(r,e).l(r,e+i).a(r,e,r+i,e,i),u&&t.m(n-i,e).l(n,e).l(n,e+i).a(n,e,n-i,e,i),f&&t.m(n-i,o).l(n,o).l(n,o-i).a(n,o,n-i,o,i),c&&t.m(r+i,o).l(r,o).l(r,o-i).a(r,o,r+i,o,i)}(r,a,u,f,c,l,w&&x&&y,w&&b&&m,B&&b&&k,B&&x&&C)}},function(t,r){t.exports=function(t,r){var e=r.mode;"label"===e?function(t,r){var e=r.size,n="bold "+.01*r.mSize*e+"px "+r.fontname;t.strokeStyle=r.back,t.lineWidth=.01*r.mSize*e*.1,t.fillStyle=r.fontcolor,t.font=n;var o=t.measureText(r.label).width,i=.01*r.mSize,a=(1-o/e)*r.mPosX*.01*e,u=(1-i)*r.mPosY*.01*e+.75*r.mSize*.01*e;t.strokeText(r.label,a,u),t.fillText(r.label,a,u)}(t,r):"image"===e&&function(t,r){var e=r.size,n=r.image.naturalWidth||1,o=r.image.naturalHeight||1,i=.01*r.mSize,a=i*n/o,u=(1-a)*r.mPosX*.01*e,f=(1-i)*r.mPosY*.01*e,c=a*e,l=i*e;t.drawImage(r.image,u,f,c,l)}(t,r)}}])});
75956},{}],436:[function(require,module,exports){
75957var getNative = require('./_getNative'),
75958 root = require('./_root');
75959
75960/* Built-in method references that are verified to be native. */
75961var DataView = getNative(root, 'DataView');
75962
75963module.exports = DataView;
75964
75965},{"./_getNative":529,"./_root":573}],437:[function(require,module,exports){
75966var hashClear = require('./_hashClear'),
75967 hashDelete = require('./_hashDelete'),
75968 hashGet = require('./_hashGet'),
75969 hashHas = require('./_hashHas'),
75970 hashSet = require('./_hashSet');
75971
75972/**
75973 * Creates a hash object.
75974 *
75975 * @private
75976 * @constructor
75977 * @param {Array} [entries] The key-value pairs to cache.
75978 */
75979function Hash(entries) {
75980 var index = -1,
75981 length = entries == null ? 0 : entries.length;
75982
75983 this.clear();
75984 while (++index < length) {
75985 var entry = entries[index];
75986 this.set(entry[0], entry[1]);
75987 }
75988}
75989
75990// Add methods to `Hash`.
75991Hash.prototype.clear = hashClear;
75992Hash.prototype['delete'] = hashDelete;
75993Hash.prototype.get = hashGet;
75994Hash.prototype.has = hashHas;
75995Hash.prototype.set = hashSet;
75996
75997module.exports = Hash;
75998
75999},{"./_hashClear":538,"./_hashDelete":539,"./_hashGet":540,"./_hashHas":541,"./_hashSet":542}],438:[function(require,module,exports){
76000var listCacheClear = require('./_listCacheClear'),
76001 listCacheDelete = require('./_listCacheDelete'),
76002 listCacheGet = require('./_listCacheGet'),
76003 listCacheHas = require('./_listCacheHas'),
76004 listCacheSet = require('./_listCacheSet');
76005
76006/**
76007 * Creates an list cache object.
76008 *
76009 * @private
76010 * @constructor
76011 * @param {Array} [entries] The key-value pairs to cache.
76012 */
76013function ListCache(entries) {
76014 var index = -1,
76015 length = entries == null ? 0 : entries.length;
76016
76017 this.clear();
76018 while (++index < length) {
76019 var entry = entries[index];
76020 this.set(entry[0], entry[1]);
76021 }
76022}
76023
76024// Add methods to `ListCache`.
76025ListCache.prototype.clear = listCacheClear;
76026ListCache.prototype['delete'] = listCacheDelete;
76027ListCache.prototype.get = listCacheGet;
76028ListCache.prototype.has = listCacheHas;
76029ListCache.prototype.set = listCacheSet;
76030
76031module.exports = ListCache;
76032
76033},{"./_listCacheClear":553,"./_listCacheDelete":554,"./_listCacheGet":555,"./_listCacheHas":556,"./_listCacheSet":557}],439:[function(require,module,exports){
76034var getNative = require('./_getNative'),
76035 root = require('./_root');
76036
76037/* Built-in method references that are verified to be native. */
76038var Map = getNative(root, 'Map');
76039
76040module.exports = Map;
76041
76042},{"./_getNative":529,"./_root":573}],440:[function(require,module,exports){
76043var mapCacheClear = require('./_mapCacheClear'),
76044 mapCacheDelete = require('./_mapCacheDelete'),
76045 mapCacheGet = require('./_mapCacheGet'),
76046 mapCacheHas = require('./_mapCacheHas'),
76047 mapCacheSet = require('./_mapCacheSet');
76048
76049/**
76050 * Creates a map cache object to store key-value pairs.
76051 *
76052 * @private
76053 * @constructor
76054 * @param {Array} [entries] The key-value pairs to cache.
76055 */
76056function MapCache(entries) {
76057 var index = -1,
76058 length = entries == null ? 0 : entries.length;
76059
76060 this.clear();
76061 while (++index < length) {
76062 var entry = entries[index];
76063 this.set(entry[0], entry[1]);
76064 }
76065}
76066
76067// Add methods to `MapCache`.
76068MapCache.prototype.clear = mapCacheClear;
76069MapCache.prototype['delete'] = mapCacheDelete;
76070MapCache.prototype.get = mapCacheGet;
76071MapCache.prototype.has = mapCacheHas;
76072MapCache.prototype.set = mapCacheSet;
76073
76074module.exports = MapCache;
76075
76076},{"./_mapCacheClear":558,"./_mapCacheDelete":559,"./_mapCacheGet":560,"./_mapCacheHas":561,"./_mapCacheSet":562}],441:[function(require,module,exports){
76077var getNative = require('./_getNative'),
76078 root = require('./_root');
76079
76080/* Built-in method references that are verified to be native. */
76081var Promise = getNative(root, 'Promise');
76082
76083module.exports = Promise;
76084
76085},{"./_getNative":529,"./_root":573}],442:[function(require,module,exports){
76086var getNative = require('./_getNative'),
76087 root = require('./_root');
76088
76089/* Built-in method references that are verified to be native. */
76090var Set = getNative(root, 'Set');
76091
76092module.exports = Set;
76093
76094},{"./_getNative":529,"./_root":573}],443:[function(require,module,exports){
76095var MapCache = require('./_MapCache'),
76096 setCacheAdd = require('./_setCacheAdd'),
76097 setCacheHas = require('./_setCacheHas');
76098
76099/**
76100 *
76101 * Creates an array cache object to store unique values.
76102 *
76103 * @private
76104 * @constructor
76105 * @param {Array} [values] The values to cache.
76106 */
76107function SetCache(values) {
76108 var index = -1,
76109 length = values == null ? 0 : values.length;
76110
76111 this.__data__ = new MapCache;
76112 while (++index < length) {
76113 this.add(values[index]);
76114 }
76115}
76116
76117// Add methods to `SetCache`.
76118SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
76119SetCache.prototype.has = setCacheHas;
76120
76121module.exports = SetCache;
76122
76123},{"./_MapCache":440,"./_setCacheAdd":574,"./_setCacheHas":575}],444:[function(require,module,exports){
76124var ListCache = require('./_ListCache'),
76125 stackClear = require('./_stackClear'),
76126 stackDelete = require('./_stackDelete'),
76127 stackGet = require('./_stackGet'),
76128 stackHas = require('./_stackHas'),
76129 stackSet = require('./_stackSet');
76130
76131/**
76132 * Creates a stack cache object to store key-value pairs.
76133 *
76134 * @private
76135 * @constructor
76136 * @param {Array} [entries] The key-value pairs to cache.
76137 */
76138function Stack(entries) {
76139 var data = this.__data__ = new ListCache(entries);
76140 this.size = data.size;
76141}
76142
76143// Add methods to `Stack`.
76144Stack.prototype.clear = stackClear;
76145Stack.prototype['delete'] = stackDelete;
76146Stack.prototype.get = stackGet;
76147Stack.prototype.has = stackHas;
76148Stack.prototype.set = stackSet;
76149
76150module.exports = Stack;
76151
76152},{"./_ListCache":438,"./_stackClear":579,"./_stackDelete":580,"./_stackGet":581,"./_stackHas":582,"./_stackSet":583}],445:[function(require,module,exports){
76153var root = require('./_root');
76154
76155/** Built-in value references. */
76156var Symbol = root.Symbol;
76157
76158module.exports = Symbol;
76159
76160},{"./_root":573}],446:[function(require,module,exports){
76161var root = require('./_root');
76162
76163/** Built-in value references. */
76164var Uint8Array = root.Uint8Array;
76165
76166module.exports = Uint8Array;
76167
76168},{"./_root":573}],447:[function(require,module,exports){
76169var getNative = require('./_getNative'),
76170 root = require('./_root');
76171
76172/* Built-in method references that are verified to be native. */
76173var WeakMap = getNative(root, 'WeakMap');
76174
76175module.exports = WeakMap;
76176
76177},{"./_getNative":529,"./_root":573}],448:[function(require,module,exports){
76178/**
76179 * A faster alternative to `Function#apply`, this function invokes `func`
76180 * with the `this` binding of `thisArg` and the arguments of `args`.
76181 *
76182 * @private
76183 * @param {Function} func The function to invoke.
76184 * @param {*} thisArg The `this` binding of `func`.
76185 * @param {Array} args The arguments to invoke `func` with.
76186 * @returns {*} Returns the result of `func`.
76187 */
76188function apply(func, thisArg, args) {
76189 switch (args.length) {
76190 case 0: return func.call(thisArg);
76191 case 1: return func.call(thisArg, args[0]);
76192 case 2: return func.call(thisArg, args[0], args[1]);
76193 case 3: return func.call(thisArg, args[0], args[1], args[2]);
76194 }
76195 return func.apply(thisArg, args);
76196}
76197
76198module.exports = apply;
76199
76200},{}],449:[function(require,module,exports){
76201/**
76202 * A specialized version of `_.forEach` for arrays without support for
76203 * iteratee shorthands.
76204 *
76205 * @private
76206 * @param {Array} [array] The array to iterate over.
76207 * @param {Function} iteratee The function invoked per iteration.
76208 * @returns {Array} Returns `array`.
76209 */
76210function arrayEach(array, iteratee) {
76211 var index = -1,
76212 length = array == null ? 0 : array.length;
76213
76214 while (++index < length) {
76215 if (iteratee(array[index], index, array) === false) {
76216 break;
76217 }
76218 }
76219 return array;
76220}
76221
76222module.exports = arrayEach;
76223
76224},{}],450:[function(require,module,exports){
76225/**
76226 * A specialized version of `_.every` for arrays without support for
76227 * iteratee shorthands.
76228 *
76229 * @private
76230 * @param {Array} [array] The array to iterate over.
76231 * @param {Function} predicate The function invoked per iteration.
76232 * @returns {boolean} Returns `true` if all elements pass the predicate check,
76233 * else `false`.
76234 */
76235function arrayEvery(array, predicate) {
76236 var index = -1,
76237 length = array == null ? 0 : array.length;
76238
76239 while (++index < length) {
76240 if (!predicate(array[index], index, array)) {
76241 return false;
76242 }
76243 }
76244 return true;
76245}
76246
76247module.exports = arrayEvery;
76248
76249},{}],451:[function(require,module,exports){
76250/**
76251 * A specialized version of `_.filter` for arrays without support for
76252 * iteratee shorthands.
76253 *
76254 * @private
76255 * @param {Array} [array] The array to iterate over.
76256 * @param {Function} predicate The function invoked per iteration.
76257 * @returns {Array} Returns the new filtered array.
76258 */
76259function arrayFilter(array, predicate) {
76260 var index = -1,
76261 length = array == null ? 0 : array.length,
76262 resIndex = 0,
76263 result = [];
76264
76265 while (++index < length) {
76266 var value = array[index];
76267 if (predicate(value, index, array)) {
76268 result[resIndex++] = value;
76269 }
76270 }
76271 return result;
76272}
76273
76274module.exports = arrayFilter;
76275
76276},{}],452:[function(require,module,exports){
76277var baseTimes = require('./_baseTimes'),
76278 isArguments = require('./isArguments'),
76279 isArray = require('./isArray'),
76280 isBuffer = require('./isBuffer'),
76281 isIndex = require('./_isIndex'),
76282 isTypedArray = require('./isTypedArray');
76283
76284/** Used for built-in method references. */
76285var objectProto = Object.prototype;
76286
76287/** Used to check objects for own properties. */
76288var hasOwnProperty = objectProto.hasOwnProperty;
76289
76290/**
76291 * Creates an array of the enumerable property names of the array-like `value`.
76292 *
76293 * @private
76294 * @param {*} value The value to query.
76295 * @param {boolean} inherited Specify returning inherited property names.
76296 * @returns {Array} Returns the array of property names.
76297 */
76298function arrayLikeKeys(value, inherited) {
76299 var isArr = isArray(value),
76300 isArg = !isArr && isArguments(value),
76301 isBuff = !isArr && !isArg && isBuffer(value),
76302 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
76303 skipIndexes = isArr || isArg || isBuff || isType,
76304 result = skipIndexes ? baseTimes(value.length, String) : [],
76305 length = result.length;
76306
76307 for (var key in value) {
76308 if ((inherited || hasOwnProperty.call(value, key)) &&
76309 !(skipIndexes && (
76310 // Safari 9 has enumerable `arguments.length` in strict mode.
76311 key == 'length' ||
76312 // Node.js 0.10 has enumerable non-index properties on buffers.
76313 (isBuff && (key == 'offset' || key == 'parent')) ||
76314 // PhantomJS 2 has enumerable non-index properties on typed arrays.
76315 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
76316 // Skip index properties.
76317 isIndex(key, length)
76318 ))) {
76319 result.push(key);
76320 }
76321 }
76322 return result;
76323}
76324
76325module.exports = arrayLikeKeys;
76326
76327},{"./_baseTimes":496,"./_isIndex":546,"./isArguments":604,"./isArray":605,"./isBuffer":608,"./isTypedArray":620}],453:[function(require,module,exports){
76328/**
76329 * A specialized version of `_.map` for arrays without support for iteratee
76330 * shorthands.
76331 *
76332 * @private
76333 * @param {Array} [array] The array to iterate over.
76334 * @param {Function} iteratee The function invoked per iteration.
76335 * @returns {Array} Returns the new mapped array.
76336 */
76337function arrayMap(array, iteratee) {
76338 var index = -1,
76339 length = array == null ? 0 : array.length,
76340 result = Array(length);
76341
76342 while (++index < length) {
76343 result[index] = iteratee(array[index], index, array);
76344 }
76345 return result;
76346}
76347
76348module.exports = arrayMap;
76349
76350},{}],454:[function(require,module,exports){
76351/**
76352 * Appends the elements of `values` to `array`.
76353 *
76354 * @private
76355 * @param {Array} array The array to modify.
76356 * @param {Array} values The values to append.
76357 * @returns {Array} Returns `array`.
76358 */
76359function arrayPush(array, values) {
76360 var index = -1,
76361 length = values.length,
76362 offset = array.length;
76363
76364 while (++index < length) {
76365 array[offset + index] = values[index];
76366 }
76367 return array;
76368}
76369
76370module.exports = arrayPush;
76371
76372},{}],455:[function(require,module,exports){
76373/**
76374 * A specialized version of `_.some` for arrays without support for iteratee
76375 * shorthands.
76376 *
76377 * @private
76378 * @param {Array} [array] The array to iterate over.
76379 * @param {Function} predicate The function invoked per iteration.
76380 * @returns {boolean} Returns `true` if any element passes the predicate check,
76381 * else `false`.
76382 */
76383function arraySome(array, predicate) {
76384 var index = -1,
76385 length = array == null ? 0 : array.length;
76386
76387 while (++index < length) {
76388 if (predicate(array[index], index, array)) {
76389 return true;
76390 }
76391 }
76392 return false;
76393}
76394
76395module.exports = arraySome;
76396
76397},{}],456:[function(require,module,exports){
76398var baseProperty = require('./_baseProperty');
76399
76400/**
76401 * Gets the size of an ASCII `string`.
76402 *
76403 * @private
76404 * @param {string} string The string inspect.
76405 * @returns {number} Returns the string size.
76406 */
76407var asciiSize = baseProperty('length');
76408
76409module.exports = asciiSize;
76410
76411},{"./_baseProperty":490}],457:[function(require,module,exports){
76412/**
76413 * Converts an ASCII `string` to an array.
76414 *
76415 * @private
76416 * @param {string} string The string to convert.
76417 * @returns {Array} Returns the converted array.
76418 */
76419function asciiToArray(string) {
76420 return string.split('');
76421}
76422
76423module.exports = asciiToArray;
76424
76425},{}],458:[function(require,module,exports){
76426var baseAssignValue = require('./_baseAssignValue'),
76427 eq = require('./eq');
76428
76429/** Used for built-in method references. */
76430var objectProto = Object.prototype;
76431
76432/** Used to check objects for own properties. */
76433var hasOwnProperty = objectProto.hasOwnProperty;
76434
76435/**
76436 * Assigns `value` to `key` of `object` if the existing value is not equivalent
76437 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
76438 * for equality comparisons.
76439 *
76440 * @private
76441 * @param {Object} object The object to modify.
76442 * @param {string} key The key of the property to assign.
76443 * @param {*} value The value to assign.
76444 */
76445function assignValue(object, key, value) {
76446 var objValue = object[key];
76447 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
76448 (value === undefined && !(key in object))) {
76449 baseAssignValue(object, key, value);
76450 }
76451}
76452
76453module.exports = assignValue;
76454
76455},{"./_baseAssignValue":462,"./eq":596}],459:[function(require,module,exports){
76456var eq = require('./eq');
76457
76458/**
76459 * Gets the index at which the `key` is found in `array` of key-value pairs.
76460 *
76461 * @private
76462 * @param {Array} array The array to inspect.
76463 * @param {*} key The key to search for.
76464 * @returns {number} Returns the index of the matched value, else `-1`.
76465 */
76466function assocIndexOf(array, key) {
76467 var length = array.length;
76468 while (length--) {
76469 if (eq(array[length][0], key)) {
76470 return length;
76471 }
76472 }
76473 return -1;
76474}
76475
76476module.exports = assocIndexOf;
76477
76478},{"./eq":596}],460:[function(require,module,exports){
76479var copyObject = require('./_copyObject'),
76480 keys = require('./keys');
76481
76482/**
76483 * The base implementation of `_.assign` without support for multiple sources
76484 * or `customizer` functions.
76485 *
76486 * @private
76487 * @param {Object} object The destination object.
76488 * @param {Object} source The source object.
76489 * @returns {Object} Returns `object`.
76490 */
76491function baseAssign(object, source) {
76492 return object && copyObject(source, keys(source), object);
76493}
76494
76495module.exports = baseAssign;
76496
76497},{"./_copyObject":512,"./keys":622}],461:[function(require,module,exports){
76498var copyObject = require('./_copyObject'),
76499 keysIn = require('./keysIn');
76500
76501/**
76502 * The base implementation of `_.assignIn` without support for multiple sources
76503 * or `customizer` functions.
76504 *
76505 * @private
76506 * @param {Object} object The destination object.
76507 * @param {Object} source The source object.
76508 * @returns {Object} Returns `object`.
76509 */
76510function baseAssignIn(object, source) {
76511 return object && copyObject(source, keysIn(source), object);
76512}
76513
76514module.exports = baseAssignIn;
76515
76516},{"./_copyObject":512,"./keysIn":623}],462:[function(require,module,exports){
76517var defineProperty = require('./_defineProperty');
76518
76519/**
76520 * The base implementation of `assignValue` and `assignMergeValue` without
76521 * value checks.
76522 *
76523 * @private
76524 * @param {Object} object The object to modify.
76525 * @param {string} key The key of the property to assign.
76526 * @param {*} value The value to assign.
76527 */
76528function baseAssignValue(object, key, value) {
76529 if (key == '__proto__' && defineProperty) {
76530 defineProperty(object, key, {
76531 'configurable': true,
76532 'enumerable': true,
76533 'value': value,
76534 'writable': true
76535 });
76536 } else {
76537 object[key] = value;
76538 }
76539}
76540
76541module.exports = baseAssignValue;
76542
76543},{"./_defineProperty":520}],463:[function(require,module,exports){
76544var Stack = require('./_Stack'),
76545 arrayEach = require('./_arrayEach'),
76546 assignValue = require('./_assignValue'),
76547 baseAssign = require('./_baseAssign'),
76548 baseAssignIn = require('./_baseAssignIn'),
76549 cloneBuffer = require('./_cloneBuffer'),
76550 copyArray = require('./_copyArray'),
76551 copySymbols = require('./_copySymbols'),
76552 copySymbolsIn = require('./_copySymbolsIn'),
76553 getAllKeys = require('./_getAllKeys'),
76554 getAllKeysIn = require('./_getAllKeysIn'),
76555 getTag = require('./_getTag'),
76556 initCloneArray = require('./_initCloneArray'),
76557 initCloneByTag = require('./_initCloneByTag'),
76558 initCloneObject = require('./_initCloneObject'),
76559 isArray = require('./isArray'),
76560 isBuffer = require('./isBuffer'),
76561 isMap = require('./isMap'),
76562 isObject = require('./isObject'),
76563 isSet = require('./isSet'),
76564 keys = require('./keys');
76565
76566/** Used to compose bitmasks for cloning. */
76567var CLONE_DEEP_FLAG = 1,
76568 CLONE_FLAT_FLAG = 2,
76569 CLONE_SYMBOLS_FLAG = 4;
76570
76571/** `Object#toString` result references. */
76572var argsTag = '[object Arguments]',
76573 arrayTag = '[object Array]',
76574 boolTag = '[object Boolean]',
76575 dateTag = '[object Date]',
76576 errorTag = '[object Error]',
76577 funcTag = '[object Function]',
76578 genTag = '[object GeneratorFunction]',
76579 mapTag = '[object Map]',
76580 numberTag = '[object Number]',
76581 objectTag = '[object Object]',
76582 regexpTag = '[object RegExp]',
76583 setTag = '[object Set]',
76584 stringTag = '[object String]',
76585 symbolTag = '[object Symbol]',
76586 weakMapTag = '[object WeakMap]';
76587
76588var arrayBufferTag = '[object ArrayBuffer]',
76589 dataViewTag = '[object DataView]',
76590 float32Tag = '[object Float32Array]',
76591 float64Tag = '[object Float64Array]',
76592 int8Tag = '[object Int8Array]',
76593 int16Tag = '[object Int16Array]',
76594 int32Tag = '[object Int32Array]',
76595 uint8Tag = '[object Uint8Array]',
76596 uint8ClampedTag = '[object Uint8ClampedArray]',
76597 uint16Tag = '[object Uint16Array]',
76598 uint32Tag = '[object Uint32Array]';
76599
76600/** Used to identify `toStringTag` values supported by `_.clone`. */
76601var cloneableTags = {};
76602cloneableTags[argsTag] = cloneableTags[arrayTag] =
76603cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
76604cloneableTags[boolTag] = cloneableTags[dateTag] =
76605cloneableTags[float32Tag] = cloneableTags[float64Tag] =
76606cloneableTags[int8Tag] = cloneableTags[int16Tag] =
76607cloneableTags[int32Tag] = cloneableTags[mapTag] =
76608cloneableTags[numberTag] = cloneableTags[objectTag] =
76609cloneableTags[regexpTag] = cloneableTags[setTag] =
76610cloneableTags[stringTag] = cloneableTags[symbolTag] =
76611cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
76612cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
76613cloneableTags[errorTag] = cloneableTags[funcTag] =
76614cloneableTags[weakMapTag] = false;
76615
76616/**
76617 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
76618 * traversed objects.
76619 *
76620 * @private
76621 * @param {*} value The value to clone.
76622 * @param {boolean} bitmask The bitmask flags.
76623 * 1 - Deep clone
76624 * 2 - Flatten inherited properties
76625 * 4 - Clone symbols
76626 * @param {Function} [customizer] The function to customize cloning.
76627 * @param {string} [key] The key of `value`.
76628 * @param {Object} [object] The parent object of `value`.
76629 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
76630 * @returns {*} Returns the cloned value.
76631 */
76632function baseClone(value, bitmask, customizer, key, object, stack) {
76633 var result,
76634 isDeep = bitmask & CLONE_DEEP_FLAG,
76635 isFlat = bitmask & CLONE_FLAT_FLAG,
76636 isFull = bitmask & CLONE_SYMBOLS_FLAG;
76637
76638 if (customizer) {
76639 result = object ? customizer(value, key, object, stack) : customizer(value);
76640 }
76641 if (result !== undefined) {
76642 return result;
76643 }
76644 if (!isObject(value)) {
76645 return value;
76646 }
76647 var isArr = isArray(value);
76648 if (isArr) {
76649 result = initCloneArray(value);
76650 if (!isDeep) {
76651 return copyArray(value, result);
76652 }
76653 } else {
76654 var tag = getTag(value),
76655 isFunc = tag == funcTag || tag == genTag;
76656
76657 if (isBuffer(value)) {
76658 return cloneBuffer(value, isDeep);
76659 }
76660 if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
76661 result = (isFlat || isFunc) ? {} : initCloneObject(value);
76662 if (!isDeep) {
76663 return isFlat
76664 ? copySymbolsIn(value, baseAssignIn(result, value))
76665 : copySymbols(value, baseAssign(result, value));
76666 }
76667 } else {
76668 if (!cloneableTags[tag]) {
76669 return object ? value : {};
76670 }
76671 result = initCloneByTag(value, tag, isDeep);
76672 }
76673 }
76674 // Check for circular references and return its corresponding clone.
76675 stack || (stack = new Stack);
76676 var stacked = stack.get(value);
76677 if (stacked) {
76678 return stacked;
76679 }
76680 stack.set(value, result);
76681
76682 if (isSet(value)) {
76683 value.forEach(function(subValue) {
76684 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
76685 });
76686 } else if (isMap(value)) {
76687 value.forEach(function(subValue, key) {
76688 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
76689 });
76690 }
76691
76692 var keysFunc = isFull
76693 ? (isFlat ? getAllKeysIn : getAllKeys)
76694 : (isFlat ? keysIn : keys);
76695
76696 var props = isArr ? undefined : keysFunc(value);
76697 arrayEach(props || value, function(subValue, key) {
76698 if (props) {
76699 key = subValue;
76700 subValue = value[key];
76701 }
76702 // Recursively populate clone (susceptible to call stack limits).
76703 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
76704 });
76705 return result;
76706}
76707
76708module.exports = baseClone;
76709
76710},{"./_Stack":444,"./_arrayEach":449,"./_assignValue":458,"./_baseAssign":460,"./_baseAssignIn":461,"./_cloneBuffer":506,"./_copyArray":511,"./_copySymbols":513,"./_copySymbolsIn":514,"./_getAllKeys":525,"./_getAllKeysIn":526,"./_getTag":534,"./_initCloneArray":543,"./_initCloneByTag":544,"./_initCloneObject":545,"./isArray":605,"./isBuffer":608,"./isMap":612,"./isObject":615,"./isSet":617,"./keys":622}],464:[function(require,module,exports){
76711var isObject = require('./isObject');
76712
76713/** Built-in value references. */
76714var objectCreate = Object.create;
76715
76716/**
76717 * The base implementation of `_.create` without support for assigning
76718 * properties to the created object.
76719 *
76720 * @private
76721 * @param {Object} proto The object to inherit from.
76722 * @returns {Object} Returns the new object.
76723 */
76724var baseCreate = (function() {
76725 function object() {}
76726 return function(proto) {
76727 if (!isObject(proto)) {
76728 return {};
76729 }
76730 if (objectCreate) {
76731 return objectCreate(proto);
76732 }
76733 object.prototype = proto;
76734 var result = new object;
76735 object.prototype = undefined;
76736 return result;
76737 };
76738}());
76739
76740module.exports = baseCreate;
76741
76742},{"./isObject":615}],465:[function(require,module,exports){
76743var baseForOwn = require('./_baseForOwn'),
76744 createBaseEach = require('./_createBaseEach');
76745
76746/**
76747 * The base implementation of `_.forEach` without support for iteratee shorthands.
76748 *
76749 * @private
76750 * @param {Array|Object} collection The collection to iterate over.
76751 * @param {Function} iteratee The function invoked per iteration.
76752 * @returns {Array|Object} Returns `collection`.
76753 */
76754var baseEach = createBaseEach(baseForOwn);
76755
76756module.exports = baseEach;
76757
76758},{"./_baseForOwn":469,"./_createBaseEach":517}],466:[function(require,module,exports){
76759var baseEach = require('./_baseEach');
76760
76761/**
76762 * The base implementation of `_.every` without support for iteratee shorthands.
76763 *
76764 * @private
76765 * @param {Array|Object} collection The collection to iterate over.
76766 * @param {Function} predicate The function invoked per iteration.
76767 * @returns {boolean} Returns `true` if all elements pass the predicate check,
76768 * else `false`
76769 */
76770function baseEvery(collection, predicate) {
76771 var result = true;
76772 baseEach(collection, function(value, index, collection) {
76773 result = !!predicate(value, index, collection);
76774 return result;
76775 });
76776 return result;
76777}
76778
76779module.exports = baseEvery;
76780
76781},{"./_baseEach":465}],467:[function(require,module,exports){
76782/**
76783 * The base implementation of `_.findIndex` and `_.findLastIndex` without
76784 * support for iteratee shorthands.
76785 *
76786 * @private
76787 * @param {Array} array The array to inspect.
76788 * @param {Function} predicate The function invoked per iteration.
76789 * @param {number} fromIndex The index to search from.
76790 * @param {boolean} [fromRight] Specify iterating from right to left.
76791 * @returns {number} Returns the index of the matched value, else `-1`.
76792 */
76793function baseFindIndex(array, predicate, fromIndex, fromRight) {
76794 var length = array.length,
76795 index = fromIndex + (fromRight ? 1 : -1);
76796
76797 while ((fromRight ? index-- : ++index < length)) {
76798 if (predicate(array[index], index, array)) {
76799 return index;
76800 }
76801 }
76802 return -1;
76803}
76804
76805module.exports = baseFindIndex;
76806
76807},{}],468:[function(require,module,exports){
76808var createBaseFor = require('./_createBaseFor');
76809
76810/**
76811 * The base implementation of `baseForOwn` which iterates over `object`
76812 * properties returned by `keysFunc` and invokes `iteratee` for each property.
76813 * Iteratee functions may exit iteration early by explicitly returning `false`.
76814 *
76815 * @private
76816 * @param {Object} object The object to iterate over.
76817 * @param {Function} iteratee The function invoked per iteration.
76818 * @param {Function} keysFunc The function to get the keys of `object`.
76819 * @returns {Object} Returns `object`.
76820 */
76821var baseFor = createBaseFor();
76822
76823module.exports = baseFor;
76824
76825},{"./_createBaseFor":518}],469:[function(require,module,exports){
76826var baseFor = require('./_baseFor'),
76827 keys = require('./keys');
76828
76829/**
76830 * The base implementation of `_.forOwn` without support for iteratee shorthands.
76831 *
76832 * @private
76833 * @param {Object} object The object to iterate over.
76834 * @param {Function} iteratee The function invoked per iteration.
76835 * @returns {Object} Returns `object`.
76836 */
76837function baseForOwn(object, iteratee) {
76838 return object && baseFor(object, iteratee, keys);
76839}
76840
76841module.exports = baseForOwn;
76842
76843},{"./_baseFor":468,"./keys":622}],470:[function(require,module,exports){
76844var castPath = require('./_castPath'),
76845 toKey = require('./_toKey');
76846
76847/**
76848 * The base implementation of `_.get` without support for default values.
76849 *
76850 * @private
76851 * @param {Object} object The object to query.
76852 * @param {Array|string} path The path of the property to get.
76853 * @returns {*} Returns the resolved value.
76854 */
76855function baseGet(object, path) {
76856 path = castPath(path, object);
76857
76858 var index = 0,
76859 length = path.length;
76860
76861 while (object != null && index < length) {
76862 object = object[toKey(path[index++])];
76863 }
76864 return (index && index == length) ? object : undefined;
76865}
76866
76867module.exports = baseGet;
76868
76869},{"./_castPath":502,"./_toKey":588}],471:[function(require,module,exports){
76870var arrayPush = require('./_arrayPush'),
76871 isArray = require('./isArray');
76872
76873/**
76874 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
76875 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
76876 * symbols of `object`.
76877 *
76878 * @private
76879 * @param {Object} object The object to query.
76880 * @param {Function} keysFunc The function to get the keys of `object`.
76881 * @param {Function} symbolsFunc The function to get the symbols of `object`.
76882 * @returns {Array} Returns the array of property names and symbols.
76883 */
76884function baseGetAllKeys(object, keysFunc, symbolsFunc) {
76885 var result = keysFunc(object);
76886 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
76887}
76888
76889module.exports = baseGetAllKeys;
76890
76891},{"./_arrayPush":454,"./isArray":605}],472:[function(require,module,exports){
76892var Symbol = require('./_Symbol'),
76893 getRawTag = require('./_getRawTag'),
76894 objectToString = require('./_objectToString');
76895
76896/** `Object#toString` result references. */
76897var nullTag = '[object Null]',
76898 undefinedTag = '[object Undefined]';
76899
76900/** Built-in value references. */
76901var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
76902
76903/**
76904 * The base implementation of `getTag` without fallbacks for buggy environments.
76905 *
76906 * @private
76907 * @param {*} value The value to query.
76908 * @returns {string} Returns the `toStringTag`.
76909 */
76910function baseGetTag(value) {
76911 if (value == null) {
76912 return value === undefined ? undefinedTag : nullTag;
76913 }
76914 return (symToStringTag && symToStringTag in Object(value))
76915 ? getRawTag(value)
76916 : objectToString(value);
76917}
76918
76919module.exports = baseGetTag;
76920
76921},{"./_Symbol":445,"./_getRawTag":531,"./_objectToString":570}],473:[function(require,module,exports){
76922/**
76923 * The base implementation of `_.hasIn` without support for deep paths.
76924 *
76925 * @private
76926 * @param {Object} [object] The object to query.
76927 * @param {Array|string} key The key to check.
76928 * @returns {boolean} Returns `true` if `key` exists, else `false`.
76929 */
76930function baseHasIn(object, key) {
76931 return object != null && key in Object(object);
76932}
76933
76934module.exports = baseHasIn;
76935
76936},{}],474:[function(require,module,exports){
76937var baseFindIndex = require('./_baseFindIndex'),
76938 baseIsNaN = require('./_baseIsNaN'),
76939 strictIndexOf = require('./_strictIndexOf');
76940
76941/**
76942 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
76943 *
76944 * @private
76945 * @param {Array} array The array to inspect.
76946 * @param {*} value The value to search for.
76947 * @param {number} fromIndex The index to search from.
76948 * @returns {number} Returns the index of the matched value, else `-1`.
76949 */
76950function baseIndexOf(array, value, fromIndex) {
76951 return value === value
76952 ? strictIndexOf(array, value, fromIndex)
76953 : baseFindIndex(array, baseIsNaN, fromIndex);
76954}
76955
76956module.exports = baseIndexOf;
76957
76958},{"./_baseFindIndex":467,"./_baseIsNaN":480,"./_strictIndexOf":584}],475:[function(require,module,exports){
76959var baseGetTag = require('./_baseGetTag'),
76960 isObjectLike = require('./isObjectLike');
76961
76962/** `Object#toString` result references. */
76963var argsTag = '[object Arguments]';
76964
76965/**
76966 * The base implementation of `_.isArguments`.
76967 *
76968 * @private
76969 * @param {*} value The value to check.
76970 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
76971 */
76972function baseIsArguments(value) {
76973 return isObjectLike(value) && baseGetTag(value) == argsTag;
76974}
76975
76976module.exports = baseIsArguments;
76977
76978},{"./_baseGetTag":472,"./isObjectLike":616}],476:[function(require,module,exports){
76979var baseIsEqualDeep = require('./_baseIsEqualDeep'),
76980 isObjectLike = require('./isObjectLike');
76981
76982/**
76983 * The base implementation of `_.isEqual` which supports partial comparisons
76984 * and tracks traversed objects.
76985 *
76986 * @private
76987 * @param {*} value The value to compare.
76988 * @param {*} other The other value to compare.
76989 * @param {boolean} bitmask The bitmask flags.
76990 * 1 - Unordered comparison
76991 * 2 - Partial comparison
76992 * @param {Function} [customizer] The function to customize comparisons.
76993 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
76994 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
76995 */
76996function baseIsEqual(value, other, bitmask, customizer, stack) {
76997 if (value === other) {
76998 return true;
76999 }
77000 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
77001 return value !== value && other !== other;
77002 }
77003 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
77004}
77005
77006module.exports = baseIsEqual;
77007
77008},{"./_baseIsEqualDeep":477,"./isObjectLike":616}],477:[function(require,module,exports){
77009var Stack = require('./_Stack'),
77010 equalArrays = require('./_equalArrays'),
77011 equalByTag = require('./_equalByTag'),
77012 equalObjects = require('./_equalObjects'),
77013 getTag = require('./_getTag'),
77014 isArray = require('./isArray'),
77015 isBuffer = require('./isBuffer'),
77016 isTypedArray = require('./isTypedArray');
77017
77018/** Used to compose bitmasks for value comparisons. */
77019var COMPARE_PARTIAL_FLAG = 1;
77020
77021/** `Object#toString` result references. */
77022var argsTag = '[object Arguments]',
77023 arrayTag = '[object Array]',
77024 objectTag = '[object Object]';
77025
77026/** Used for built-in method references. */
77027var objectProto = Object.prototype;
77028
77029/** Used to check objects for own properties. */
77030var hasOwnProperty = objectProto.hasOwnProperty;
77031
77032/**
77033 * A specialized version of `baseIsEqual` for arrays and objects which performs
77034 * deep comparisons and tracks traversed objects enabling objects with circular
77035 * references to be compared.
77036 *
77037 * @private
77038 * @param {Object} object The object to compare.
77039 * @param {Object} other The other object to compare.
77040 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
77041 * @param {Function} customizer The function to customize comparisons.
77042 * @param {Function} equalFunc The function to determine equivalents of values.
77043 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
77044 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
77045 */
77046function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
77047 var objIsArr = isArray(object),
77048 othIsArr = isArray(other),
77049 objTag = objIsArr ? arrayTag : getTag(object),
77050 othTag = othIsArr ? arrayTag : getTag(other);
77051
77052 objTag = objTag == argsTag ? objectTag : objTag;
77053 othTag = othTag == argsTag ? objectTag : othTag;
77054
77055 var objIsObj = objTag == objectTag,
77056 othIsObj = othTag == objectTag,
77057 isSameTag = objTag == othTag;
77058
77059 if (isSameTag && isBuffer(object)) {
77060 if (!isBuffer(other)) {
77061 return false;
77062 }
77063 objIsArr = true;
77064 objIsObj = false;
77065 }
77066 if (isSameTag && !objIsObj) {
77067 stack || (stack = new Stack);
77068 return (objIsArr || isTypedArray(object))
77069 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
77070 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
77071 }
77072 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
77073 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
77074 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
77075
77076 if (objIsWrapped || othIsWrapped) {
77077 var objUnwrapped = objIsWrapped ? object.value() : object,
77078 othUnwrapped = othIsWrapped ? other.value() : other;
77079
77080 stack || (stack = new Stack);
77081 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
77082 }
77083 }
77084 if (!isSameTag) {
77085 return false;
77086 }
77087 stack || (stack = new Stack);
77088 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
77089}
77090
77091module.exports = baseIsEqualDeep;
77092
77093},{"./_Stack":444,"./_equalArrays":521,"./_equalByTag":522,"./_equalObjects":523,"./_getTag":534,"./isArray":605,"./isBuffer":608,"./isTypedArray":620}],478:[function(require,module,exports){
77094var getTag = require('./_getTag'),
77095 isObjectLike = require('./isObjectLike');
77096
77097/** `Object#toString` result references. */
77098var mapTag = '[object Map]';
77099
77100/**
77101 * The base implementation of `_.isMap` without Node.js optimizations.
77102 *
77103 * @private
77104 * @param {*} value The value to check.
77105 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
77106 */
77107function baseIsMap(value) {
77108 return isObjectLike(value) && getTag(value) == mapTag;
77109}
77110
77111module.exports = baseIsMap;
77112
77113},{"./_getTag":534,"./isObjectLike":616}],479:[function(require,module,exports){
77114var Stack = require('./_Stack'),
77115 baseIsEqual = require('./_baseIsEqual');
77116
77117/** Used to compose bitmasks for value comparisons. */
77118var COMPARE_PARTIAL_FLAG = 1,
77119 COMPARE_UNORDERED_FLAG = 2;
77120
77121/**
77122 * The base implementation of `_.isMatch` without support for iteratee shorthands.
77123 *
77124 * @private
77125 * @param {Object} object The object to inspect.
77126 * @param {Object} source The object of property values to match.
77127 * @param {Array} matchData The property names, values, and compare flags to match.
77128 * @param {Function} [customizer] The function to customize comparisons.
77129 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
77130 */
77131function baseIsMatch(object, source, matchData, customizer) {
77132 var index = matchData.length,
77133 length = index,
77134 noCustomizer = !customizer;
77135
77136 if (object == null) {
77137 return !length;
77138 }
77139 object = Object(object);
77140 while (index--) {
77141 var data = matchData[index];
77142 if ((noCustomizer && data[2])
77143 ? data[1] !== object[data[0]]
77144 : !(data[0] in object)
77145 ) {
77146 return false;
77147 }
77148 }
77149 while (++index < length) {
77150 data = matchData[index];
77151 var key = data[0],
77152 objValue = object[key],
77153 srcValue = data[1];
77154
77155 if (noCustomizer && data[2]) {
77156 if (objValue === undefined && !(key in object)) {
77157 return false;
77158 }
77159 } else {
77160 var stack = new Stack;
77161 if (customizer) {
77162 var result = customizer(objValue, srcValue, key, object, source, stack);
77163 }
77164 if (!(result === undefined
77165 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
77166 : result
77167 )) {
77168 return false;
77169 }
77170 }
77171 }
77172 return true;
77173}
77174
77175module.exports = baseIsMatch;
77176
77177},{"./_Stack":444,"./_baseIsEqual":476}],480:[function(require,module,exports){
77178/**
77179 * The base implementation of `_.isNaN` without support for number objects.
77180 *
77181 * @private
77182 * @param {*} value The value to check.
77183 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
77184 */
77185function baseIsNaN(value) {
77186 return value !== value;
77187}
77188
77189module.exports = baseIsNaN;
77190
77191},{}],481:[function(require,module,exports){
77192var isFunction = require('./isFunction'),
77193 isMasked = require('./_isMasked'),
77194 isObject = require('./isObject'),
77195 toSource = require('./_toSource');
77196
77197/**
77198 * Used to match `RegExp`
77199 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
77200 */
77201var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
77202
77203/** Used to detect host constructors (Safari). */
77204var reIsHostCtor = /^\[object .+?Constructor\]$/;
77205
77206/** Used for built-in method references. */
77207var funcProto = Function.prototype,
77208 objectProto = Object.prototype;
77209
77210/** Used to resolve the decompiled source of functions. */
77211var funcToString = funcProto.toString;
77212
77213/** Used to check objects for own properties. */
77214var hasOwnProperty = objectProto.hasOwnProperty;
77215
77216/** Used to detect if a method is native. */
77217var reIsNative = RegExp('^' +
77218 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
77219 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
77220);
77221
77222/**
77223 * The base implementation of `_.isNative` without bad shim checks.
77224 *
77225 * @private
77226 * @param {*} value The value to check.
77227 * @returns {boolean} Returns `true` if `value` is a native function,
77228 * else `false`.
77229 */
77230function baseIsNative(value) {
77231 if (!isObject(value) || isMasked(value)) {
77232 return false;
77233 }
77234 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
77235 return pattern.test(toSource(value));
77236}
77237
77238module.exports = baseIsNative;
77239
77240},{"./_isMasked":550,"./_toSource":589,"./isFunction":610,"./isObject":615}],482:[function(require,module,exports){
77241var getTag = require('./_getTag'),
77242 isObjectLike = require('./isObjectLike');
77243
77244/** `Object#toString` result references. */
77245var setTag = '[object Set]';
77246
77247/**
77248 * The base implementation of `_.isSet` without Node.js optimizations.
77249 *
77250 * @private
77251 * @param {*} value The value to check.
77252 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
77253 */
77254function baseIsSet(value) {
77255 return isObjectLike(value) && getTag(value) == setTag;
77256}
77257
77258module.exports = baseIsSet;
77259
77260},{"./_getTag":534,"./isObjectLike":616}],483:[function(require,module,exports){
77261var baseGetTag = require('./_baseGetTag'),
77262 isLength = require('./isLength'),
77263 isObjectLike = require('./isObjectLike');
77264
77265/** `Object#toString` result references. */
77266var argsTag = '[object Arguments]',
77267 arrayTag = '[object Array]',
77268 boolTag = '[object Boolean]',
77269 dateTag = '[object Date]',
77270 errorTag = '[object Error]',
77271 funcTag = '[object Function]',
77272 mapTag = '[object Map]',
77273 numberTag = '[object Number]',
77274 objectTag = '[object Object]',
77275 regexpTag = '[object RegExp]',
77276 setTag = '[object Set]',
77277 stringTag = '[object String]',
77278 weakMapTag = '[object WeakMap]';
77279
77280var arrayBufferTag = '[object ArrayBuffer]',
77281 dataViewTag = '[object DataView]',
77282 float32Tag = '[object Float32Array]',
77283 float64Tag = '[object Float64Array]',
77284 int8Tag = '[object Int8Array]',
77285 int16Tag = '[object Int16Array]',
77286 int32Tag = '[object Int32Array]',
77287 uint8Tag = '[object Uint8Array]',
77288 uint8ClampedTag = '[object Uint8ClampedArray]',
77289 uint16Tag = '[object Uint16Array]',
77290 uint32Tag = '[object Uint32Array]';
77291
77292/** Used to identify `toStringTag` values of typed arrays. */
77293var typedArrayTags = {};
77294typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
77295typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
77296typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
77297typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
77298typedArrayTags[uint32Tag] = true;
77299typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
77300typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
77301typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
77302typedArrayTags[errorTag] = typedArrayTags[funcTag] =
77303typedArrayTags[mapTag] = typedArrayTags[numberTag] =
77304typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
77305typedArrayTags[setTag] = typedArrayTags[stringTag] =
77306typedArrayTags[weakMapTag] = false;
77307
77308/**
77309 * The base implementation of `_.isTypedArray` without Node.js optimizations.
77310 *
77311 * @private
77312 * @param {*} value The value to check.
77313 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
77314 */
77315function baseIsTypedArray(value) {
77316 return isObjectLike(value) &&
77317 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
77318}
77319
77320module.exports = baseIsTypedArray;
77321
77322},{"./_baseGetTag":472,"./isLength":611,"./isObjectLike":616}],484:[function(require,module,exports){
77323var baseMatches = require('./_baseMatches'),
77324 baseMatchesProperty = require('./_baseMatchesProperty'),
77325 identity = require('./identity'),
77326 isArray = require('./isArray'),
77327 property = require('./property');
77328
77329/**
77330 * The base implementation of `_.iteratee`.
77331 *
77332 * @private
77333 * @param {*} [value=_.identity] The value to convert to an iteratee.
77334 * @returns {Function} Returns the iteratee.
77335 */
77336function baseIteratee(value) {
77337 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
77338 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
77339 if (typeof value == 'function') {
77340 return value;
77341 }
77342 if (value == null) {
77343 return identity;
77344 }
77345 if (typeof value == 'object') {
77346 return isArray(value)
77347 ? baseMatchesProperty(value[0], value[1])
77348 : baseMatches(value);
77349 }
77350 return property(value);
77351}
77352
77353module.exports = baseIteratee;
77354
77355},{"./_baseMatches":488,"./_baseMatchesProperty":489,"./identity":603,"./isArray":605,"./property":627}],485:[function(require,module,exports){
77356var isPrototype = require('./_isPrototype'),
77357 nativeKeys = require('./_nativeKeys');
77358
77359/** Used for built-in method references. */
77360var objectProto = Object.prototype;
77361
77362/** Used to check objects for own properties. */
77363var hasOwnProperty = objectProto.hasOwnProperty;
77364
77365/**
77366 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
77367 *
77368 * @private
77369 * @param {Object} object The object to query.
77370 * @returns {Array} Returns the array of property names.
77371 */
77372function baseKeys(object) {
77373 if (!isPrototype(object)) {
77374 return nativeKeys(object);
77375 }
77376 var result = [];
77377 for (var key in Object(object)) {
77378 if (hasOwnProperty.call(object, key) && key != 'constructor') {
77379 result.push(key);
77380 }
77381 }
77382 return result;
77383}
77384
77385module.exports = baseKeys;
77386
77387},{"./_isPrototype":551,"./_nativeKeys":567}],486:[function(require,module,exports){
77388var isObject = require('./isObject'),
77389 isPrototype = require('./_isPrototype'),
77390 nativeKeysIn = require('./_nativeKeysIn');
77391
77392/** Used for built-in method references. */
77393var objectProto = Object.prototype;
77394
77395/** Used to check objects for own properties. */
77396var hasOwnProperty = objectProto.hasOwnProperty;
77397
77398/**
77399 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
77400 *
77401 * @private
77402 * @param {Object} object The object to query.
77403 * @returns {Array} Returns the array of property names.
77404 */
77405function baseKeysIn(object) {
77406 if (!isObject(object)) {
77407 return nativeKeysIn(object);
77408 }
77409 var isProto = isPrototype(object),
77410 result = [];
77411
77412 for (var key in object) {
77413 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
77414 result.push(key);
77415 }
77416 }
77417 return result;
77418}
77419
77420module.exports = baseKeysIn;
77421
77422},{"./_isPrototype":551,"./_nativeKeysIn":568,"./isObject":615}],487:[function(require,module,exports){
77423var baseEach = require('./_baseEach'),
77424 isArrayLike = require('./isArrayLike');
77425
77426/**
77427 * The base implementation of `_.map` without support for iteratee shorthands.
77428 *
77429 * @private
77430 * @param {Array|Object} collection The collection to iterate over.
77431 * @param {Function} iteratee The function invoked per iteration.
77432 * @returns {Array} Returns the new mapped array.
77433 */
77434function baseMap(collection, iteratee) {
77435 var index = -1,
77436 result = isArrayLike(collection) ? Array(collection.length) : [];
77437
77438 baseEach(collection, function(value, key, collection) {
77439 result[++index] = iteratee(value, key, collection);
77440 });
77441 return result;
77442}
77443
77444module.exports = baseMap;
77445
77446},{"./_baseEach":465,"./isArrayLike":606}],488:[function(require,module,exports){
77447var baseIsMatch = require('./_baseIsMatch'),
77448 getMatchData = require('./_getMatchData'),
77449 matchesStrictComparable = require('./_matchesStrictComparable');
77450
77451/**
77452 * The base implementation of `_.matches` which doesn't clone `source`.
77453 *
77454 * @private
77455 * @param {Object} source The object of property values to match.
77456 * @returns {Function} Returns the new spec function.
77457 */
77458function baseMatches(source) {
77459 var matchData = getMatchData(source);
77460 if (matchData.length == 1 && matchData[0][2]) {
77461 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
77462 }
77463 return function(object) {
77464 return object === source || baseIsMatch(object, source, matchData);
77465 };
77466}
77467
77468module.exports = baseMatches;
77469
77470},{"./_baseIsMatch":479,"./_getMatchData":528,"./_matchesStrictComparable":564}],489:[function(require,module,exports){
77471var baseIsEqual = require('./_baseIsEqual'),
77472 get = require('./get'),
77473 hasIn = require('./hasIn'),
77474 isKey = require('./_isKey'),
77475 isStrictComparable = require('./_isStrictComparable'),
77476 matchesStrictComparable = require('./_matchesStrictComparable'),
77477 toKey = require('./_toKey');
77478
77479/** Used to compose bitmasks for value comparisons. */
77480var COMPARE_PARTIAL_FLAG = 1,
77481 COMPARE_UNORDERED_FLAG = 2;
77482
77483/**
77484 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
77485 *
77486 * @private
77487 * @param {string} path The path of the property to get.
77488 * @param {*} srcValue The value to match.
77489 * @returns {Function} Returns the new spec function.
77490 */
77491function baseMatchesProperty(path, srcValue) {
77492 if (isKey(path) && isStrictComparable(srcValue)) {
77493 return matchesStrictComparable(toKey(path), srcValue);
77494 }
77495 return function(object) {
77496 var objValue = get(object, path);
77497 return (objValue === undefined && objValue === srcValue)
77498 ? hasIn(object, path)
77499 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
77500 };
77501}
77502
77503module.exports = baseMatchesProperty;
77504
77505},{"./_baseIsEqual":476,"./_isKey":548,"./_isStrictComparable":552,"./_matchesStrictComparable":564,"./_toKey":588,"./get":601,"./hasIn":602}],490:[function(require,module,exports){
77506/**
77507 * The base implementation of `_.property` without support for deep paths.
77508 *
77509 * @private
77510 * @param {string} key The key of the property to get.
77511 * @returns {Function} Returns the new accessor function.
77512 */
77513function baseProperty(key) {
77514 return function(object) {
77515 return object == null ? undefined : object[key];
77516 };
77517}
77518
77519module.exports = baseProperty;
77520
77521},{}],491:[function(require,module,exports){
77522var baseGet = require('./_baseGet');
77523
77524/**
77525 * A specialized version of `baseProperty` which supports deep paths.
77526 *
77527 * @private
77528 * @param {Array|string} path The path of the property to get.
77529 * @returns {Function} Returns the new accessor function.
77530 */
77531function basePropertyDeep(path) {
77532 return function(object) {
77533 return baseGet(object, path);
77534 };
77535}
77536
77537module.exports = basePropertyDeep;
77538
77539},{"./_baseGet":470}],492:[function(require,module,exports){
77540/** Used as references for various `Number` constants. */
77541var MAX_SAFE_INTEGER = 9007199254740991;
77542
77543/* Built-in method references for those with the same name as other `lodash` methods. */
77544var nativeFloor = Math.floor;
77545
77546/**
77547 * The base implementation of `_.repeat` which doesn't coerce arguments.
77548 *
77549 * @private
77550 * @param {string} string The string to repeat.
77551 * @param {number} n The number of times to repeat the string.
77552 * @returns {string} Returns the repeated string.
77553 */
77554function baseRepeat(string, n) {
77555 var result = '';
77556 if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
77557 return result;
77558 }
77559 // Leverage the exponentiation by squaring algorithm for a faster repeat.
77560 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
77561 do {
77562 if (n % 2) {
77563 result += string;
77564 }
77565 n = nativeFloor(n / 2);
77566 if (n) {
77567 string += string;
77568 }
77569 } while (n);
77570
77571 return result;
77572}
77573
77574module.exports = baseRepeat;
77575
77576},{}],493:[function(require,module,exports){
77577var identity = require('./identity'),
77578 overRest = require('./_overRest'),
77579 setToString = require('./_setToString');
77580
77581/**
77582 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
77583 *
77584 * @private
77585 * @param {Function} func The function to apply a rest parameter to.
77586 * @param {number} [start=func.length-1] The start position of the rest parameter.
77587 * @returns {Function} Returns the new function.
77588 */
77589function baseRest(func, start) {
77590 return setToString(overRest(func, start, identity), func + '');
77591}
77592
77593module.exports = baseRest;
77594
77595},{"./_overRest":572,"./_setToString":577,"./identity":603}],494:[function(require,module,exports){
77596var constant = require('./constant'),
77597 defineProperty = require('./_defineProperty'),
77598 identity = require('./identity');
77599
77600/**
77601 * The base implementation of `setToString` without support for hot loop shorting.
77602 *
77603 * @private
77604 * @param {Function} func The function to modify.
77605 * @param {Function} string The `toString` result.
77606 * @returns {Function} Returns `func`.
77607 */
77608var baseSetToString = !defineProperty ? identity : function(func, string) {
77609 return defineProperty(func, 'toString', {
77610 'configurable': true,
77611 'enumerable': false,
77612 'value': constant(string),
77613 'writable': true
77614 });
77615};
77616
77617module.exports = baseSetToString;
77618
77619},{"./_defineProperty":520,"./constant":594,"./identity":603}],495:[function(require,module,exports){
77620/**
77621 * The base implementation of `_.slice` without an iteratee call guard.
77622 *
77623 * @private
77624 * @param {Array} array The array to slice.
77625 * @param {number} [start=0] The start position.
77626 * @param {number} [end=array.length] The end position.
77627 * @returns {Array} Returns the slice of `array`.
77628 */
77629function baseSlice(array, start, end) {
77630 var index = -1,
77631 length = array.length;
77632
77633 if (start < 0) {
77634 start = -start > length ? 0 : (length + start);
77635 }
77636 end = end > length ? length : end;
77637 if (end < 0) {
77638 end += length;
77639 }
77640 length = start > end ? 0 : ((end - start) >>> 0);
77641 start >>>= 0;
77642
77643 var result = Array(length);
77644 while (++index < length) {
77645 result[index] = array[index + start];
77646 }
77647 return result;
77648}
77649
77650module.exports = baseSlice;
77651
77652},{}],496:[function(require,module,exports){
77653/**
77654 * The base implementation of `_.times` without support for iteratee shorthands
77655 * or max array length checks.
77656 *
77657 * @private
77658 * @param {number} n The number of times to invoke `iteratee`.
77659 * @param {Function} iteratee The function invoked per iteration.
77660 * @returns {Array} Returns the array of results.
77661 */
77662function baseTimes(n, iteratee) {
77663 var index = -1,
77664 result = Array(n);
77665
77666 while (++index < n) {
77667 result[index] = iteratee(index);
77668 }
77669 return result;
77670}
77671
77672module.exports = baseTimes;
77673
77674},{}],497:[function(require,module,exports){
77675var Symbol = require('./_Symbol'),
77676 arrayMap = require('./_arrayMap'),
77677 isArray = require('./isArray'),
77678 isSymbol = require('./isSymbol');
77679
77680/** Used as references for various `Number` constants. */
77681var INFINITY = 1 / 0;
77682
77683/** Used to convert symbols to primitives and strings. */
77684var symbolProto = Symbol ? Symbol.prototype : undefined,
77685 symbolToString = symbolProto ? symbolProto.toString : undefined;
77686
77687/**
77688 * The base implementation of `_.toString` which doesn't convert nullish
77689 * values to empty strings.
77690 *
77691 * @private
77692 * @param {*} value The value to process.
77693 * @returns {string} Returns the string.
77694 */
77695function baseToString(value) {
77696 // Exit early for strings to avoid a performance hit in some environments.
77697 if (typeof value == 'string') {
77698 return value;
77699 }
77700 if (isArray(value)) {
77701 // Recursively convert values (susceptible to call stack limits).
77702 return arrayMap(value, baseToString) + '';
77703 }
77704 if (isSymbol(value)) {
77705 return symbolToString ? symbolToString.call(value) : '';
77706 }
77707 var result = (value + '');
77708 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
77709}
77710
77711module.exports = baseToString;
77712
77713},{"./_Symbol":445,"./_arrayMap":453,"./isArray":605,"./isSymbol":619}],498:[function(require,module,exports){
77714/**
77715 * The base implementation of `_.unary` without support for storing metadata.
77716 *
77717 * @private
77718 * @param {Function} func The function to cap arguments for.
77719 * @returns {Function} Returns the new capped function.
77720 */
77721function baseUnary(func) {
77722 return function(value) {
77723 return func(value);
77724 };
77725}
77726
77727module.exports = baseUnary;
77728
77729},{}],499:[function(require,module,exports){
77730var arrayMap = require('./_arrayMap');
77731
77732/**
77733 * The base implementation of `_.values` and `_.valuesIn` which creates an
77734 * array of `object` property values corresponding to the property names
77735 * of `props`.
77736 *
77737 * @private
77738 * @param {Object} object The object to query.
77739 * @param {Array} props The property names to get values for.
77740 * @returns {Object} Returns the array of property values.
77741 */
77742function baseValues(object, props) {
77743 return arrayMap(props, function(key) {
77744 return object[key];
77745 });
77746}
77747
77748module.exports = baseValues;
77749
77750},{"./_arrayMap":453}],500:[function(require,module,exports){
77751/**
77752 * Checks if a `cache` value for `key` exists.
77753 *
77754 * @private
77755 * @param {Object} cache The cache to query.
77756 * @param {string} key The key of the entry to check.
77757 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
77758 */
77759function cacheHas(cache, key) {
77760 return cache.has(key);
77761}
77762
77763module.exports = cacheHas;
77764
77765},{}],501:[function(require,module,exports){
77766var identity = require('./identity');
77767
77768/**
77769 * Casts `value` to `identity` if it's not a function.
77770 *
77771 * @private
77772 * @param {*} value The value to inspect.
77773 * @returns {Function} Returns cast function.
77774 */
77775function castFunction(value) {
77776 return typeof value == 'function' ? value : identity;
77777}
77778
77779module.exports = castFunction;
77780
77781},{"./identity":603}],502:[function(require,module,exports){
77782var isArray = require('./isArray'),
77783 isKey = require('./_isKey'),
77784 stringToPath = require('./_stringToPath'),
77785 toString = require('./toString');
77786
77787/**
77788 * Casts `value` to a path array if it's not one.
77789 *
77790 * @private
77791 * @param {*} value The value to inspect.
77792 * @param {Object} [object] The object to query keys on.
77793 * @returns {Array} Returns the cast property path array.
77794 */
77795function castPath(value, object) {
77796 if (isArray(value)) {
77797 return value;
77798 }
77799 return isKey(value, object) ? [value] : stringToPath(toString(value));
77800}
77801
77802module.exports = castPath;
77803
77804},{"./_isKey":548,"./_stringToPath":587,"./isArray":605,"./toString":634}],503:[function(require,module,exports){
77805var baseSlice = require('./_baseSlice');
77806
77807/**
77808 * Casts `array` to a slice if it's needed.
77809 *
77810 * @private
77811 * @param {Array} array The array to inspect.
77812 * @param {number} start The start position.
77813 * @param {number} [end=array.length] The end position.
77814 * @returns {Array} Returns the cast slice.
77815 */
77816function castSlice(array, start, end) {
77817 var length = array.length;
77818 end = end === undefined ? length : end;
77819 return (!start && end >= length) ? array : baseSlice(array, start, end);
77820}
77821
77822module.exports = castSlice;
77823
77824},{"./_baseSlice":495}],504:[function(require,module,exports){
77825var baseIndexOf = require('./_baseIndexOf');
77826
77827/**
77828 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
77829 * that is not found in the character symbols.
77830 *
77831 * @private
77832 * @param {Array} strSymbols The string symbols to inspect.
77833 * @param {Array} chrSymbols The character symbols to find.
77834 * @returns {number} Returns the index of the last unmatched string symbol.
77835 */
77836function charsEndIndex(strSymbols, chrSymbols) {
77837 var index = strSymbols.length;
77838
77839 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
77840 return index;
77841}
77842
77843module.exports = charsEndIndex;
77844
77845},{"./_baseIndexOf":474}],505:[function(require,module,exports){
77846var Uint8Array = require('./_Uint8Array');
77847
77848/**
77849 * Creates a clone of `arrayBuffer`.
77850 *
77851 * @private
77852 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
77853 * @returns {ArrayBuffer} Returns the cloned array buffer.
77854 */
77855function cloneArrayBuffer(arrayBuffer) {
77856 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
77857 new Uint8Array(result).set(new Uint8Array(arrayBuffer));
77858 return result;
77859}
77860
77861module.exports = cloneArrayBuffer;
77862
77863},{"./_Uint8Array":446}],506:[function(require,module,exports){
77864var root = require('./_root');
77865
77866/** Detect free variable `exports`. */
77867var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
77868
77869/** Detect free variable `module`. */
77870var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
77871
77872/** Detect the popular CommonJS extension `module.exports`. */
77873var moduleExports = freeModule && freeModule.exports === freeExports;
77874
77875/** Built-in value references. */
77876var Buffer = moduleExports ? root.Buffer : undefined,
77877 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
77878
77879/**
77880 * Creates a clone of `buffer`.
77881 *
77882 * @private
77883 * @param {Buffer} buffer The buffer to clone.
77884 * @param {boolean} [isDeep] Specify a deep clone.
77885 * @returns {Buffer} Returns the cloned buffer.
77886 */
77887function cloneBuffer(buffer, isDeep) {
77888 if (isDeep) {
77889 return buffer.slice();
77890 }
77891 var length = buffer.length,
77892 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
77893
77894 buffer.copy(result);
77895 return result;
77896}
77897
77898module.exports = cloneBuffer;
77899
77900},{"./_root":573}],507:[function(require,module,exports){
77901var cloneArrayBuffer = require('./_cloneArrayBuffer');
77902
77903/**
77904 * Creates a clone of `dataView`.
77905 *
77906 * @private
77907 * @param {Object} dataView The data view to clone.
77908 * @param {boolean} [isDeep] Specify a deep clone.
77909 * @returns {Object} Returns the cloned data view.
77910 */
77911function cloneDataView(dataView, isDeep) {
77912 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
77913 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
77914}
77915
77916module.exports = cloneDataView;
77917
77918},{"./_cloneArrayBuffer":505}],508:[function(require,module,exports){
77919/** Used to match `RegExp` flags from their coerced string values. */
77920var reFlags = /\w*$/;
77921
77922/**
77923 * Creates a clone of `regexp`.
77924 *
77925 * @private
77926 * @param {Object} regexp The regexp to clone.
77927 * @returns {Object} Returns the cloned regexp.
77928 */
77929function cloneRegExp(regexp) {
77930 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
77931 result.lastIndex = regexp.lastIndex;
77932 return result;
77933}
77934
77935module.exports = cloneRegExp;
77936
77937},{}],509:[function(require,module,exports){
77938var Symbol = require('./_Symbol');
77939
77940/** Used to convert symbols to primitives and strings. */
77941var symbolProto = Symbol ? Symbol.prototype : undefined,
77942 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
77943
77944/**
77945 * Creates a clone of the `symbol` object.
77946 *
77947 * @private
77948 * @param {Object} symbol The symbol object to clone.
77949 * @returns {Object} Returns the cloned symbol object.
77950 */
77951function cloneSymbol(symbol) {
77952 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
77953}
77954
77955module.exports = cloneSymbol;
77956
77957},{"./_Symbol":445}],510:[function(require,module,exports){
77958var cloneArrayBuffer = require('./_cloneArrayBuffer');
77959
77960/**
77961 * Creates a clone of `typedArray`.
77962 *
77963 * @private
77964 * @param {Object} typedArray The typed array to clone.
77965 * @param {boolean} [isDeep] Specify a deep clone.
77966 * @returns {Object} Returns the cloned typed array.
77967 */
77968function cloneTypedArray(typedArray, isDeep) {
77969 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
77970 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
77971}
77972
77973module.exports = cloneTypedArray;
77974
77975},{"./_cloneArrayBuffer":505}],511:[function(require,module,exports){
77976/**
77977 * Copies the values of `source` to `array`.
77978 *
77979 * @private
77980 * @param {Array} source The array to copy values from.
77981 * @param {Array} [array=[]] The array to copy values to.
77982 * @returns {Array} Returns `array`.
77983 */
77984function copyArray(source, array) {
77985 var index = -1,
77986 length = source.length;
77987
77988 array || (array = Array(length));
77989 while (++index < length) {
77990 array[index] = source[index];
77991 }
77992 return array;
77993}
77994
77995module.exports = copyArray;
77996
77997},{}],512:[function(require,module,exports){
77998var assignValue = require('./_assignValue'),
77999 baseAssignValue = require('./_baseAssignValue');
78000
78001/**
78002 * Copies properties of `source` to `object`.
78003 *
78004 * @private
78005 * @param {Object} source The object to copy properties from.
78006 * @param {Array} props The property identifiers to copy.
78007 * @param {Object} [object={}] The object to copy properties to.
78008 * @param {Function} [customizer] The function to customize copied values.
78009 * @returns {Object} Returns `object`.
78010 */
78011function copyObject(source, props, object, customizer) {
78012 var isNew = !object;
78013 object || (object = {});
78014
78015 var index = -1,
78016 length = props.length;
78017
78018 while (++index < length) {
78019 var key = props[index];
78020
78021 var newValue = customizer
78022 ? customizer(object[key], source[key], key, object, source)
78023 : undefined;
78024
78025 if (newValue === undefined) {
78026 newValue = source[key];
78027 }
78028 if (isNew) {
78029 baseAssignValue(object, key, newValue);
78030 } else {
78031 assignValue(object, key, newValue);
78032 }
78033 }
78034 return object;
78035}
78036
78037module.exports = copyObject;
78038
78039},{"./_assignValue":458,"./_baseAssignValue":462}],513:[function(require,module,exports){
78040var copyObject = require('./_copyObject'),
78041 getSymbols = require('./_getSymbols');
78042
78043/**
78044 * Copies own symbols of `source` to `object`.
78045 *
78046 * @private
78047 * @param {Object} source The object to copy symbols from.
78048 * @param {Object} [object={}] The object to copy symbols to.
78049 * @returns {Object} Returns `object`.
78050 */
78051function copySymbols(source, object) {
78052 return copyObject(source, getSymbols(source), object);
78053}
78054
78055module.exports = copySymbols;
78056
78057},{"./_copyObject":512,"./_getSymbols":532}],514:[function(require,module,exports){
78058var copyObject = require('./_copyObject'),
78059 getSymbolsIn = require('./_getSymbolsIn');
78060
78061/**
78062 * Copies own and inherited symbols of `source` to `object`.
78063 *
78064 * @private
78065 * @param {Object} source The object to copy symbols from.
78066 * @param {Object} [object={}] The object to copy symbols to.
78067 * @returns {Object} Returns `object`.
78068 */
78069function copySymbolsIn(source, object) {
78070 return copyObject(source, getSymbolsIn(source), object);
78071}
78072
78073module.exports = copySymbolsIn;
78074
78075},{"./_copyObject":512,"./_getSymbolsIn":533}],515:[function(require,module,exports){
78076var root = require('./_root');
78077
78078/** Used to detect overreaching core-js shims. */
78079var coreJsData = root['__core-js_shared__'];
78080
78081module.exports = coreJsData;
78082
78083},{"./_root":573}],516:[function(require,module,exports){
78084var baseRest = require('./_baseRest'),
78085 isIterateeCall = require('./_isIterateeCall');
78086
78087/**
78088 * Creates a function like `_.assign`.
78089 *
78090 * @private
78091 * @param {Function} assigner The function to assign values.
78092 * @returns {Function} Returns the new assigner function.
78093 */
78094function createAssigner(assigner) {
78095 return baseRest(function(object, sources) {
78096 var index = -1,
78097 length = sources.length,
78098 customizer = length > 1 ? sources[length - 1] : undefined,
78099 guard = length > 2 ? sources[2] : undefined;
78100
78101 customizer = (assigner.length > 3 && typeof customizer == 'function')
78102 ? (length--, customizer)
78103 : undefined;
78104
78105 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
78106 customizer = length < 3 ? undefined : customizer;
78107 length = 1;
78108 }
78109 object = Object(object);
78110 while (++index < length) {
78111 var source = sources[index];
78112 if (source) {
78113 assigner(object, source, index, customizer);
78114 }
78115 }
78116 return object;
78117 });
78118}
78119
78120module.exports = createAssigner;
78121
78122},{"./_baseRest":493,"./_isIterateeCall":547}],517:[function(require,module,exports){
78123var isArrayLike = require('./isArrayLike');
78124
78125/**
78126 * Creates a `baseEach` or `baseEachRight` function.
78127 *
78128 * @private
78129 * @param {Function} eachFunc The function to iterate over a collection.
78130 * @param {boolean} [fromRight] Specify iterating from right to left.
78131 * @returns {Function} Returns the new base function.
78132 */
78133function createBaseEach(eachFunc, fromRight) {
78134 return function(collection, iteratee) {
78135 if (collection == null) {
78136 return collection;
78137 }
78138 if (!isArrayLike(collection)) {
78139 return eachFunc(collection, iteratee);
78140 }
78141 var length = collection.length,
78142 index = fromRight ? length : -1,
78143 iterable = Object(collection);
78144
78145 while ((fromRight ? index-- : ++index < length)) {
78146 if (iteratee(iterable[index], index, iterable) === false) {
78147 break;
78148 }
78149 }
78150 return collection;
78151 };
78152}
78153
78154module.exports = createBaseEach;
78155
78156},{"./isArrayLike":606}],518:[function(require,module,exports){
78157/**
78158 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
78159 *
78160 * @private
78161 * @param {boolean} [fromRight] Specify iterating from right to left.
78162 * @returns {Function} Returns the new base function.
78163 */
78164function createBaseFor(fromRight) {
78165 return function(object, iteratee, keysFunc) {
78166 var index = -1,
78167 iterable = Object(object),
78168 props = keysFunc(object),
78169 length = props.length;
78170
78171 while (length--) {
78172 var key = props[fromRight ? length : ++index];
78173 if (iteratee(iterable[key], key, iterable) === false) {
78174 break;
78175 }
78176 }
78177 return object;
78178 };
78179}
78180
78181module.exports = createBaseFor;
78182
78183},{}],519:[function(require,module,exports){
78184var baseRepeat = require('./_baseRepeat'),
78185 baseToString = require('./_baseToString'),
78186 castSlice = require('./_castSlice'),
78187 hasUnicode = require('./_hasUnicode'),
78188 stringSize = require('./_stringSize'),
78189 stringToArray = require('./_stringToArray');
78190
78191/* Built-in method references for those with the same name as other `lodash` methods. */
78192var nativeCeil = Math.ceil;
78193
78194/**
78195 * Creates the padding for `string` based on `length`. The `chars` string
78196 * is truncated if the number of characters exceeds `length`.
78197 *
78198 * @private
78199 * @param {number} length The padding length.
78200 * @param {string} [chars=' '] The string used as padding.
78201 * @returns {string} Returns the padding for `string`.
78202 */
78203function createPadding(length, chars) {
78204 chars = chars === undefined ? ' ' : baseToString(chars);
78205
78206 var charsLength = chars.length;
78207 if (charsLength < 2) {
78208 return charsLength ? baseRepeat(chars, length) : chars;
78209 }
78210 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
78211 return hasUnicode(chars)
78212 ? castSlice(stringToArray(result), 0, length).join('')
78213 : result.slice(0, length);
78214}
78215
78216module.exports = createPadding;
78217
78218},{"./_baseRepeat":492,"./_baseToString":497,"./_castSlice":503,"./_hasUnicode":537,"./_stringSize":585,"./_stringToArray":586}],520:[function(require,module,exports){
78219var getNative = require('./_getNative');
78220
78221var defineProperty = (function() {
78222 try {
78223 var func = getNative(Object, 'defineProperty');
78224 func({}, '', {});
78225 return func;
78226 } catch (e) {}
78227}());
78228
78229module.exports = defineProperty;
78230
78231},{"./_getNative":529}],521:[function(require,module,exports){
78232var SetCache = require('./_SetCache'),
78233 arraySome = require('./_arraySome'),
78234 cacheHas = require('./_cacheHas');
78235
78236/** Used to compose bitmasks for value comparisons. */
78237var COMPARE_PARTIAL_FLAG = 1,
78238 COMPARE_UNORDERED_FLAG = 2;
78239
78240/**
78241 * A specialized version of `baseIsEqualDeep` for arrays with support for
78242 * partial deep comparisons.
78243 *
78244 * @private
78245 * @param {Array} array The array to compare.
78246 * @param {Array} other The other array to compare.
78247 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
78248 * @param {Function} customizer The function to customize comparisons.
78249 * @param {Function} equalFunc The function to determine equivalents of values.
78250 * @param {Object} stack Tracks traversed `array` and `other` objects.
78251 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
78252 */
78253function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
78254 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
78255 arrLength = array.length,
78256 othLength = other.length;
78257
78258 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
78259 return false;
78260 }
78261 // Assume cyclic values are equal.
78262 var stacked = stack.get(array);
78263 if (stacked && stack.get(other)) {
78264 return stacked == other;
78265 }
78266 var index = -1,
78267 result = true,
78268 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
78269
78270 stack.set(array, other);
78271 stack.set(other, array);
78272
78273 // Ignore non-index properties.
78274 while (++index < arrLength) {
78275 var arrValue = array[index],
78276 othValue = other[index];
78277
78278 if (customizer) {
78279 var compared = isPartial
78280 ? customizer(othValue, arrValue, index, other, array, stack)
78281 : customizer(arrValue, othValue, index, array, other, stack);
78282 }
78283 if (compared !== undefined) {
78284 if (compared) {
78285 continue;
78286 }
78287 result = false;
78288 break;
78289 }
78290 // Recursively compare arrays (susceptible to call stack limits).
78291 if (seen) {
78292 if (!arraySome(other, function(othValue, othIndex) {
78293 if (!cacheHas(seen, othIndex) &&
78294 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
78295 return seen.push(othIndex);
78296 }
78297 })) {
78298 result = false;
78299 break;
78300 }
78301 } else if (!(
78302 arrValue === othValue ||
78303 equalFunc(arrValue, othValue, bitmask, customizer, stack)
78304 )) {
78305 result = false;
78306 break;
78307 }
78308 }
78309 stack['delete'](array);
78310 stack['delete'](other);
78311 return result;
78312}
78313
78314module.exports = equalArrays;
78315
78316},{"./_SetCache":443,"./_arraySome":455,"./_cacheHas":500}],522:[function(require,module,exports){
78317var Symbol = require('./_Symbol'),
78318 Uint8Array = require('./_Uint8Array'),
78319 eq = require('./eq'),
78320 equalArrays = require('./_equalArrays'),
78321 mapToArray = require('./_mapToArray'),
78322 setToArray = require('./_setToArray');
78323
78324/** Used to compose bitmasks for value comparisons. */
78325var COMPARE_PARTIAL_FLAG = 1,
78326 COMPARE_UNORDERED_FLAG = 2;
78327
78328/** `Object#toString` result references. */
78329var boolTag = '[object Boolean]',
78330 dateTag = '[object Date]',
78331 errorTag = '[object Error]',
78332 mapTag = '[object Map]',
78333 numberTag = '[object Number]',
78334 regexpTag = '[object RegExp]',
78335 setTag = '[object Set]',
78336 stringTag = '[object String]',
78337 symbolTag = '[object Symbol]';
78338
78339var arrayBufferTag = '[object ArrayBuffer]',
78340 dataViewTag = '[object DataView]';
78341
78342/** Used to convert symbols to primitives and strings. */
78343var symbolProto = Symbol ? Symbol.prototype : undefined,
78344 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
78345
78346/**
78347 * A specialized version of `baseIsEqualDeep` for comparing objects of
78348 * the same `toStringTag`.
78349 *
78350 * **Note:** This function only supports comparing values with tags of
78351 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
78352 *
78353 * @private
78354 * @param {Object} object The object to compare.
78355 * @param {Object} other The other object to compare.
78356 * @param {string} tag The `toStringTag` of the objects to compare.
78357 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
78358 * @param {Function} customizer The function to customize comparisons.
78359 * @param {Function} equalFunc The function to determine equivalents of values.
78360 * @param {Object} stack Tracks traversed `object` and `other` objects.
78361 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
78362 */
78363function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
78364 switch (tag) {
78365 case dataViewTag:
78366 if ((object.byteLength != other.byteLength) ||
78367 (object.byteOffset != other.byteOffset)) {
78368 return false;
78369 }
78370 object = object.buffer;
78371 other = other.buffer;
78372
78373 case arrayBufferTag:
78374 if ((object.byteLength != other.byteLength) ||
78375 !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
78376 return false;
78377 }
78378 return true;
78379
78380 case boolTag:
78381 case dateTag:
78382 case numberTag:
78383 // Coerce booleans to `1` or `0` and dates to milliseconds.
78384 // Invalid dates are coerced to `NaN`.
78385 return eq(+object, +other);
78386
78387 case errorTag:
78388 return object.name == other.name && object.message == other.message;
78389
78390 case regexpTag:
78391 case stringTag:
78392 // Coerce regexes to strings and treat strings, primitives and objects,
78393 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
78394 // for more details.
78395 return object == (other + '');
78396
78397 case mapTag:
78398 var convert = mapToArray;
78399
78400 case setTag:
78401 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
78402 convert || (convert = setToArray);
78403
78404 if (object.size != other.size && !isPartial) {
78405 return false;
78406 }
78407 // Assume cyclic values are equal.
78408 var stacked = stack.get(object);
78409 if (stacked) {
78410 return stacked == other;
78411 }
78412 bitmask |= COMPARE_UNORDERED_FLAG;
78413
78414 // Recursively compare objects (susceptible to call stack limits).
78415 stack.set(object, other);
78416 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
78417 stack['delete'](object);
78418 return result;
78419
78420 case symbolTag:
78421 if (symbolValueOf) {
78422 return symbolValueOf.call(object) == symbolValueOf.call(other);
78423 }
78424 }
78425 return false;
78426}
78427
78428module.exports = equalByTag;
78429
78430},{"./_Symbol":445,"./_Uint8Array":446,"./_equalArrays":521,"./_mapToArray":563,"./_setToArray":576,"./eq":596}],523:[function(require,module,exports){
78431var getAllKeys = require('./_getAllKeys');
78432
78433/** Used to compose bitmasks for value comparisons. */
78434var COMPARE_PARTIAL_FLAG = 1;
78435
78436/** Used for built-in method references. */
78437var objectProto = Object.prototype;
78438
78439/** Used to check objects for own properties. */
78440var hasOwnProperty = objectProto.hasOwnProperty;
78441
78442/**
78443 * A specialized version of `baseIsEqualDeep` for objects with support for
78444 * partial deep comparisons.
78445 *
78446 * @private
78447 * @param {Object} object The object to compare.
78448 * @param {Object} other The other object to compare.
78449 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
78450 * @param {Function} customizer The function to customize comparisons.
78451 * @param {Function} equalFunc The function to determine equivalents of values.
78452 * @param {Object} stack Tracks traversed `object` and `other` objects.
78453 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
78454 */
78455function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
78456 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
78457 objProps = getAllKeys(object),
78458 objLength = objProps.length,
78459 othProps = getAllKeys(other),
78460 othLength = othProps.length;
78461
78462 if (objLength != othLength && !isPartial) {
78463 return false;
78464 }
78465 var index = objLength;
78466 while (index--) {
78467 var key = objProps[index];
78468 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
78469 return false;
78470 }
78471 }
78472 // Assume cyclic values are equal.
78473 var stacked = stack.get(object);
78474 if (stacked && stack.get(other)) {
78475 return stacked == other;
78476 }
78477 var result = true;
78478 stack.set(object, other);
78479 stack.set(other, object);
78480
78481 var skipCtor = isPartial;
78482 while (++index < objLength) {
78483 key = objProps[index];
78484 var objValue = object[key],
78485 othValue = other[key];
78486
78487 if (customizer) {
78488 var compared = isPartial
78489 ? customizer(othValue, objValue, key, other, object, stack)
78490 : customizer(objValue, othValue, key, object, other, stack);
78491 }
78492 // Recursively compare objects (susceptible to call stack limits).
78493 if (!(compared === undefined
78494 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
78495 : compared
78496 )) {
78497 result = false;
78498 break;
78499 }
78500 skipCtor || (skipCtor = key == 'constructor');
78501 }
78502 if (result && !skipCtor) {
78503 var objCtor = object.constructor,
78504 othCtor = other.constructor;
78505
78506 // Non `Object` object instances with different constructors are not equal.
78507 if (objCtor != othCtor &&
78508 ('constructor' in object && 'constructor' in other) &&
78509 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
78510 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
78511 result = false;
78512 }
78513 }
78514 stack['delete'](object);
78515 stack['delete'](other);
78516 return result;
78517}
78518
78519module.exports = equalObjects;
78520
78521},{"./_getAllKeys":525}],524:[function(require,module,exports){
78522(function (global){
78523/** Detect free variable `global` from Node.js. */
78524var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
78525
78526module.exports = freeGlobal;
78527
78528}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
78529},{}],525:[function(require,module,exports){
78530var baseGetAllKeys = require('./_baseGetAllKeys'),
78531 getSymbols = require('./_getSymbols'),
78532 keys = require('./keys');
78533
78534/**
78535 * Creates an array of own enumerable property names and symbols of `object`.
78536 *
78537 * @private
78538 * @param {Object} object The object to query.
78539 * @returns {Array} Returns the array of property names and symbols.
78540 */
78541function getAllKeys(object) {
78542 return baseGetAllKeys(object, keys, getSymbols);
78543}
78544
78545module.exports = getAllKeys;
78546
78547},{"./_baseGetAllKeys":471,"./_getSymbols":532,"./keys":622}],526:[function(require,module,exports){
78548var baseGetAllKeys = require('./_baseGetAllKeys'),
78549 getSymbolsIn = require('./_getSymbolsIn'),
78550 keysIn = require('./keysIn');
78551
78552/**
78553 * Creates an array of own and inherited enumerable property names and
78554 * symbols of `object`.
78555 *
78556 * @private
78557 * @param {Object} object The object to query.
78558 * @returns {Array} Returns the array of property names and symbols.
78559 */
78560function getAllKeysIn(object) {
78561 return baseGetAllKeys(object, keysIn, getSymbolsIn);
78562}
78563
78564module.exports = getAllKeysIn;
78565
78566},{"./_baseGetAllKeys":471,"./_getSymbolsIn":533,"./keysIn":623}],527:[function(require,module,exports){
78567var isKeyable = require('./_isKeyable');
78568
78569/**
78570 * Gets the data for `map`.
78571 *
78572 * @private
78573 * @param {Object} map The map to query.
78574 * @param {string} key The reference key.
78575 * @returns {*} Returns the map data.
78576 */
78577function getMapData(map, key) {
78578 var data = map.__data__;
78579 return isKeyable(key)
78580 ? data[typeof key == 'string' ? 'string' : 'hash']
78581 : data.map;
78582}
78583
78584module.exports = getMapData;
78585
78586},{"./_isKeyable":549}],528:[function(require,module,exports){
78587var isStrictComparable = require('./_isStrictComparable'),
78588 keys = require('./keys');
78589
78590/**
78591 * Gets the property names, values, and compare flags of `object`.
78592 *
78593 * @private
78594 * @param {Object} object The object to query.
78595 * @returns {Array} Returns the match data of `object`.
78596 */
78597function getMatchData(object) {
78598 var result = keys(object),
78599 length = result.length;
78600
78601 while (length--) {
78602 var key = result[length],
78603 value = object[key];
78604
78605 result[length] = [key, value, isStrictComparable(value)];
78606 }
78607 return result;
78608}
78609
78610module.exports = getMatchData;
78611
78612},{"./_isStrictComparable":552,"./keys":622}],529:[function(require,module,exports){
78613var baseIsNative = require('./_baseIsNative'),
78614 getValue = require('./_getValue');
78615
78616/**
78617 * Gets the native function at `key` of `object`.
78618 *
78619 * @private
78620 * @param {Object} object The object to query.
78621 * @param {string} key The key of the method to get.
78622 * @returns {*} Returns the function if it's native, else `undefined`.
78623 */
78624function getNative(object, key) {
78625 var value = getValue(object, key);
78626 return baseIsNative(value) ? value : undefined;
78627}
78628
78629module.exports = getNative;
78630
78631},{"./_baseIsNative":481,"./_getValue":535}],530:[function(require,module,exports){
78632var overArg = require('./_overArg');
78633
78634/** Built-in value references. */
78635var getPrototype = overArg(Object.getPrototypeOf, Object);
78636
78637module.exports = getPrototype;
78638
78639},{"./_overArg":571}],531:[function(require,module,exports){
78640var Symbol = require('./_Symbol');
78641
78642/** Used for built-in method references. */
78643var objectProto = Object.prototype;
78644
78645/** Used to check objects for own properties. */
78646var hasOwnProperty = objectProto.hasOwnProperty;
78647
78648/**
78649 * Used to resolve the
78650 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
78651 * of values.
78652 */
78653var nativeObjectToString = objectProto.toString;
78654
78655/** Built-in value references. */
78656var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
78657
78658/**
78659 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
78660 *
78661 * @private
78662 * @param {*} value The value to query.
78663 * @returns {string} Returns the raw `toStringTag`.
78664 */
78665function getRawTag(value) {
78666 var isOwn = hasOwnProperty.call(value, symToStringTag),
78667 tag = value[symToStringTag];
78668
78669 try {
78670 value[symToStringTag] = undefined;
78671 var unmasked = true;
78672 } catch (e) {}
78673
78674 var result = nativeObjectToString.call(value);
78675 if (unmasked) {
78676 if (isOwn) {
78677 value[symToStringTag] = tag;
78678 } else {
78679 delete value[symToStringTag];
78680 }
78681 }
78682 return result;
78683}
78684
78685module.exports = getRawTag;
78686
78687},{"./_Symbol":445}],532:[function(require,module,exports){
78688var arrayFilter = require('./_arrayFilter'),
78689 stubArray = require('./stubArray');
78690
78691/** Used for built-in method references. */
78692var objectProto = Object.prototype;
78693
78694/** Built-in value references. */
78695var propertyIsEnumerable = objectProto.propertyIsEnumerable;
78696
78697/* Built-in method references for those with the same name as other `lodash` methods. */
78698var nativeGetSymbols = Object.getOwnPropertySymbols;
78699
78700/**
78701 * Creates an array of the own enumerable symbols of `object`.
78702 *
78703 * @private
78704 * @param {Object} object The object to query.
78705 * @returns {Array} Returns the array of symbols.
78706 */
78707var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
78708 if (object == null) {
78709 return [];
78710 }
78711 object = Object(object);
78712 return arrayFilter(nativeGetSymbols(object), function(symbol) {
78713 return propertyIsEnumerable.call(object, symbol);
78714 });
78715};
78716
78717module.exports = getSymbols;
78718
78719},{"./_arrayFilter":451,"./stubArray":628}],533:[function(require,module,exports){
78720var arrayPush = require('./_arrayPush'),
78721 getPrototype = require('./_getPrototype'),
78722 getSymbols = require('./_getSymbols'),
78723 stubArray = require('./stubArray');
78724
78725/* Built-in method references for those with the same name as other `lodash` methods. */
78726var nativeGetSymbols = Object.getOwnPropertySymbols;
78727
78728/**
78729 * Creates an array of the own and inherited enumerable symbols of `object`.
78730 *
78731 * @private
78732 * @param {Object} object The object to query.
78733 * @returns {Array} Returns the array of symbols.
78734 */
78735var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
78736 var result = [];
78737 while (object) {
78738 arrayPush(result, getSymbols(object));
78739 object = getPrototype(object);
78740 }
78741 return result;
78742};
78743
78744module.exports = getSymbolsIn;
78745
78746},{"./_arrayPush":454,"./_getPrototype":530,"./_getSymbols":532,"./stubArray":628}],534:[function(require,module,exports){
78747var DataView = require('./_DataView'),
78748 Map = require('./_Map'),
78749 Promise = require('./_Promise'),
78750 Set = require('./_Set'),
78751 WeakMap = require('./_WeakMap'),
78752 baseGetTag = require('./_baseGetTag'),
78753 toSource = require('./_toSource');
78754
78755/** `Object#toString` result references. */
78756var mapTag = '[object Map]',
78757 objectTag = '[object Object]',
78758 promiseTag = '[object Promise]',
78759 setTag = '[object Set]',
78760 weakMapTag = '[object WeakMap]';
78761
78762var dataViewTag = '[object DataView]';
78763
78764/** Used to detect maps, sets, and weakmaps. */
78765var dataViewCtorString = toSource(DataView),
78766 mapCtorString = toSource(Map),
78767 promiseCtorString = toSource(Promise),
78768 setCtorString = toSource(Set),
78769 weakMapCtorString = toSource(WeakMap);
78770
78771/**
78772 * Gets the `toStringTag` of `value`.
78773 *
78774 * @private
78775 * @param {*} value The value to query.
78776 * @returns {string} Returns the `toStringTag`.
78777 */
78778var getTag = baseGetTag;
78779
78780// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
78781if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
78782 (Map && getTag(new Map) != mapTag) ||
78783 (Promise && getTag(Promise.resolve()) != promiseTag) ||
78784 (Set && getTag(new Set) != setTag) ||
78785 (WeakMap && getTag(new WeakMap) != weakMapTag)) {
78786 getTag = function(value) {
78787 var result = baseGetTag(value),
78788 Ctor = result == objectTag ? value.constructor : undefined,
78789 ctorString = Ctor ? toSource(Ctor) : '';
78790
78791 if (ctorString) {
78792 switch (ctorString) {
78793 case dataViewCtorString: return dataViewTag;
78794 case mapCtorString: return mapTag;
78795 case promiseCtorString: return promiseTag;
78796 case setCtorString: return setTag;
78797 case weakMapCtorString: return weakMapTag;
78798 }
78799 }
78800 return result;
78801 };
78802}
78803
78804module.exports = getTag;
78805
78806},{"./_DataView":436,"./_Map":439,"./_Promise":441,"./_Set":442,"./_WeakMap":447,"./_baseGetTag":472,"./_toSource":589}],535:[function(require,module,exports){
78807/**
78808 * Gets the value at `key` of `object`.
78809 *
78810 * @private
78811 * @param {Object} [object] The object to query.
78812 * @param {string} key The key of the property to get.
78813 * @returns {*} Returns the property value.
78814 */
78815function getValue(object, key) {
78816 return object == null ? undefined : object[key];
78817}
78818
78819module.exports = getValue;
78820
78821},{}],536:[function(require,module,exports){
78822var castPath = require('./_castPath'),
78823 isArguments = require('./isArguments'),
78824 isArray = require('./isArray'),
78825 isIndex = require('./_isIndex'),
78826 isLength = require('./isLength'),
78827 toKey = require('./_toKey');
78828
78829/**
78830 * Checks if `path` exists on `object`.
78831 *
78832 * @private
78833 * @param {Object} object The object to query.
78834 * @param {Array|string} path The path to check.
78835 * @param {Function} hasFunc The function to check properties.
78836 * @returns {boolean} Returns `true` if `path` exists, else `false`.
78837 */
78838function hasPath(object, path, hasFunc) {
78839 path = castPath(path, object);
78840
78841 var index = -1,
78842 length = path.length,
78843 result = false;
78844
78845 while (++index < length) {
78846 var key = toKey(path[index]);
78847 if (!(result = object != null && hasFunc(object, key))) {
78848 break;
78849 }
78850 object = object[key];
78851 }
78852 if (result || ++index != length) {
78853 return result;
78854 }
78855 length = object == null ? 0 : object.length;
78856 return !!length && isLength(length) && isIndex(key, length) &&
78857 (isArray(object) || isArguments(object));
78858}
78859
78860module.exports = hasPath;
78861
78862},{"./_castPath":502,"./_isIndex":546,"./_toKey":588,"./isArguments":604,"./isArray":605,"./isLength":611}],537:[function(require,module,exports){
78863/** Used to compose unicode character classes. */
78864var rsAstralRange = '\\ud800-\\udfff',
78865 rsComboMarksRange = '\\u0300-\\u036f',
78866 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
78867 rsComboSymbolsRange = '\\u20d0-\\u20ff',
78868 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
78869 rsVarRange = '\\ufe0e\\ufe0f';
78870
78871/** Used to compose unicode capture groups. */
78872var rsZWJ = '\\u200d';
78873
78874/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
78875var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
78876
78877/**
78878 * Checks if `string` contains Unicode symbols.
78879 *
78880 * @private
78881 * @param {string} string The string to inspect.
78882 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
78883 */
78884function hasUnicode(string) {
78885 return reHasUnicode.test(string);
78886}
78887
78888module.exports = hasUnicode;
78889
78890},{}],538:[function(require,module,exports){
78891var nativeCreate = require('./_nativeCreate');
78892
78893/**
78894 * Removes all key-value entries from the hash.
78895 *
78896 * @private
78897 * @name clear
78898 * @memberOf Hash
78899 */
78900function hashClear() {
78901 this.__data__ = nativeCreate ? nativeCreate(null) : {};
78902 this.size = 0;
78903}
78904
78905module.exports = hashClear;
78906
78907},{"./_nativeCreate":566}],539:[function(require,module,exports){
78908/**
78909 * Removes `key` and its value from the hash.
78910 *
78911 * @private
78912 * @name delete
78913 * @memberOf Hash
78914 * @param {Object} hash The hash to modify.
78915 * @param {string} key The key of the value to remove.
78916 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
78917 */
78918function hashDelete(key) {
78919 var result = this.has(key) && delete this.__data__[key];
78920 this.size -= result ? 1 : 0;
78921 return result;
78922}
78923
78924module.exports = hashDelete;
78925
78926},{}],540:[function(require,module,exports){
78927var nativeCreate = require('./_nativeCreate');
78928
78929/** Used to stand-in for `undefined` hash values. */
78930var HASH_UNDEFINED = '__lodash_hash_undefined__';
78931
78932/** Used for built-in method references. */
78933var objectProto = Object.prototype;
78934
78935/** Used to check objects for own properties. */
78936var hasOwnProperty = objectProto.hasOwnProperty;
78937
78938/**
78939 * Gets the hash value for `key`.
78940 *
78941 * @private
78942 * @name get
78943 * @memberOf Hash
78944 * @param {string} key The key of the value to get.
78945 * @returns {*} Returns the entry value.
78946 */
78947function hashGet(key) {
78948 var data = this.__data__;
78949 if (nativeCreate) {
78950 var result = data[key];
78951 return result === HASH_UNDEFINED ? undefined : result;
78952 }
78953 return hasOwnProperty.call(data, key) ? data[key] : undefined;
78954}
78955
78956module.exports = hashGet;
78957
78958},{"./_nativeCreate":566}],541:[function(require,module,exports){
78959var nativeCreate = require('./_nativeCreate');
78960
78961/** Used for built-in method references. */
78962var objectProto = Object.prototype;
78963
78964/** Used to check objects for own properties. */
78965var hasOwnProperty = objectProto.hasOwnProperty;
78966
78967/**
78968 * Checks if a hash value for `key` exists.
78969 *
78970 * @private
78971 * @name has
78972 * @memberOf Hash
78973 * @param {string} key The key of the entry to check.
78974 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
78975 */
78976function hashHas(key) {
78977 var data = this.__data__;
78978 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
78979}
78980
78981module.exports = hashHas;
78982
78983},{"./_nativeCreate":566}],542:[function(require,module,exports){
78984var nativeCreate = require('./_nativeCreate');
78985
78986/** Used to stand-in for `undefined` hash values. */
78987var HASH_UNDEFINED = '__lodash_hash_undefined__';
78988
78989/**
78990 * Sets the hash `key` to `value`.
78991 *
78992 * @private
78993 * @name set
78994 * @memberOf Hash
78995 * @param {string} key The key of the value to set.
78996 * @param {*} value The value to set.
78997 * @returns {Object} Returns the hash instance.
78998 */
78999function hashSet(key, value) {
79000 var data = this.__data__;
79001 this.size += this.has(key) ? 0 : 1;
79002 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
79003 return this;
79004}
79005
79006module.exports = hashSet;
79007
79008},{"./_nativeCreate":566}],543:[function(require,module,exports){
79009/** Used for built-in method references. */
79010var objectProto = Object.prototype;
79011
79012/** Used to check objects for own properties. */
79013var hasOwnProperty = objectProto.hasOwnProperty;
79014
79015/**
79016 * Initializes an array clone.
79017 *
79018 * @private
79019 * @param {Array} array The array to clone.
79020 * @returns {Array} Returns the initialized clone.
79021 */
79022function initCloneArray(array) {
79023 var length = array.length,
79024 result = new array.constructor(length);
79025
79026 // Add properties assigned by `RegExp#exec`.
79027 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
79028 result.index = array.index;
79029 result.input = array.input;
79030 }
79031 return result;
79032}
79033
79034module.exports = initCloneArray;
79035
79036},{}],544:[function(require,module,exports){
79037var cloneArrayBuffer = require('./_cloneArrayBuffer'),
79038 cloneDataView = require('./_cloneDataView'),
79039 cloneRegExp = require('./_cloneRegExp'),
79040 cloneSymbol = require('./_cloneSymbol'),
79041 cloneTypedArray = require('./_cloneTypedArray');
79042
79043/** `Object#toString` result references. */
79044var boolTag = '[object Boolean]',
79045 dateTag = '[object Date]',
79046 mapTag = '[object Map]',
79047 numberTag = '[object Number]',
79048 regexpTag = '[object RegExp]',
79049 setTag = '[object Set]',
79050 stringTag = '[object String]',
79051 symbolTag = '[object Symbol]';
79052
79053var arrayBufferTag = '[object ArrayBuffer]',
79054 dataViewTag = '[object DataView]',
79055 float32Tag = '[object Float32Array]',
79056 float64Tag = '[object Float64Array]',
79057 int8Tag = '[object Int8Array]',
79058 int16Tag = '[object Int16Array]',
79059 int32Tag = '[object Int32Array]',
79060 uint8Tag = '[object Uint8Array]',
79061 uint8ClampedTag = '[object Uint8ClampedArray]',
79062 uint16Tag = '[object Uint16Array]',
79063 uint32Tag = '[object Uint32Array]';
79064
79065/**
79066 * Initializes an object clone based on its `toStringTag`.
79067 *
79068 * **Note:** This function only supports cloning values with tags of
79069 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
79070 *
79071 * @private
79072 * @param {Object} object The object to clone.
79073 * @param {string} tag The `toStringTag` of the object to clone.
79074 * @param {boolean} [isDeep] Specify a deep clone.
79075 * @returns {Object} Returns the initialized clone.
79076 */
79077function initCloneByTag(object, tag, isDeep) {
79078 var Ctor = object.constructor;
79079 switch (tag) {
79080 case arrayBufferTag:
79081 return cloneArrayBuffer(object);
79082
79083 case boolTag:
79084 case dateTag:
79085 return new Ctor(+object);
79086
79087 case dataViewTag:
79088 return cloneDataView(object, isDeep);
79089
79090 case float32Tag: case float64Tag:
79091 case int8Tag: case int16Tag: case int32Tag:
79092 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
79093 return cloneTypedArray(object, isDeep);
79094
79095 case mapTag:
79096 return new Ctor;
79097
79098 case numberTag:
79099 case stringTag:
79100 return new Ctor(object);
79101
79102 case regexpTag:
79103 return cloneRegExp(object);
79104
79105 case setTag:
79106 return new Ctor;
79107
79108 case symbolTag:
79109 return cloneSymbol(object);
79110 }
79111}
79112
79113module.exports = initCloneByTag;
79114
79115},{"./_cloneArrayBuffer":505,"./_cloneDataView":507,"./_cloneRegExp":508,"./_cloneSymbol":509,"./_cloneTypedArray":510}],545:[function(require,module,exports){
79116var baseCreate = require('./_baseCreate'),
79117 getPrototype = require('./_getPrototype'),
79118 isPrototype = require('./_isPrototype');
79119
79120/**
79121 * Initializes an object clone.
79122 *
79123 * @private
79124 * @param {Object} object The object to clone.
79125 * @returns {Object} Returns the initialized clone.
79126 */
79127function initCloneObject(object) {
79128 return (typeof object.constructor == 'function' && !isPrototype(object))
79129 ? baseCreate(getPrototype(object))
79130 : {};
79131}
79132
79133module.exports = initCloneObject;
79134
79135},{"./_baseCreate":464,"./_getPrototype":530,"./_isPrototype":551}],546:[function(require,module,exports){
79136/** Used as references for various `Number` constants. */
79137var MAX_SAFE_INTEGER = 9007199254740991;
79138
79139/** Used to detect unsigned integer values. */
79140var reIsUint = /^(?:0|[1-9]\d*)$/;
79141
79142/**
79143 * Checks if `value` is a valid array-like index.
79144 *
79145 * @private
79146 * @param {*} value The value to check.
79147 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
79148 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
79149 */
79150function isIndex(value, length) {
79151 var type = typeof value;
79152 length = length == null ? MAX_SAFE_INTEGER : length;
79153
79154 return !!length &&
79155 (type == 'number' ||
79156 (type != 'symbol' && reIsUint.test(value))) &&
79157 (value > -1 && value % 1 == 0 && value < length);
79158}
79159
79160module.exports = isIndex;
79161
79162},{}],547:[function(require,module,exports){
79163var eq = require('./eq'),
79164 isArrayLike = require('./isArrayLike'),
79165 isIndex = require('./_isIndex'),
79166 isObject = require('./isObject');
79167
79168/**
79169 * Checks if the given arguments are from an iteratee call.
79170 *
79171 * @private
79172 * @param {*} value The potential iteratee value argument.
79173 * @param {*} index The potential iteratee index or key argument.
79174 * @param {*} object The potential iteratee object argument.
79175 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
79176 * else `false`.
79177 */
79178function isIterateeCall(value, index, object) {
79179 if (!isObject(object)) {
79180 return false;
79181 }
79182 var type = typeof index;
79183 if (type == 'number'
79184 ? (isArrayLike(object) && isIndex(index, object.length))
79185 : (type == 'string' && index in object)
79186 ) {
79187 return eq(object[index], value);
79188 }
79189 return false;
79190}
79191
79192module.exports = isIterateeCall;
79193
79194},{"./_isIndex":546,"./eq":596,"./isArrayLike":606,"./isObject":615}],548:[function(require,module,exports){
79195var isArray = require('./isArray'),
79196 isSymbol = require('./isSymbol');
79197
79198/** Used to match property names within property paths. */
79199var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
79200 reIsPlainProp = /^\w*$/;
79201
79202/**
79203 * Checks if `value` is a property name and not a property path.
79204 *
79205 * @private
79206 * @param {*} value The value to check.
79207 * @param {Object} [object] The object to query keys on.
79208 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
79209 */
79210function isKey(value, object) {
79211 if (isArray(value)) {
79212 return false;
79213 }
79214 var type = typeof value;
79215 if (type == 'number' || type == 'symbol' || type == 'boolean' ||
79216 value == null || isSymbol(value)) {
79217 return true;
79218 }
79219 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
79220 (object != null && value in Object(object));
79221}
79222
79223module.exports = isKey;
79224
79225},{"./isArray":605,"./isSymbol":619}],549:[function(require,module,exports){
79226/**
79227 * Checks if `value` is suitable for use as unique object key.
79228 *
79229 * @private
79230 * @param {*} value The value to check.
79231 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
79232 */
79233function isKeyable(value) {
79234 var type = typeof value;
79235 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
79236 ? (value !== '__proto__')
79237 : (value === null);
79238}
79239
79240module.exports = isKeyable;
79241
79242},{}],550:[function(require,module,exports){
79243var coreJsData = require('./_coreJsData');
79244
79245/** Used to detect methods masquerading as native. */
79246var maskSrcKey = (function() {
79247 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
79248 return uid ? ('Symbol(src)_1.' + uid) : '';
79249}());
79250
79251/**
79252 * Checks if `func` has its source masked.
79253 *
79254 * @private
79255 * @param {Function} func The function to check.
79256 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
79257 */
79258function isMasked(func) {
79259 return !!maskSrcKey && (maskSrcKey in func);
79260}
79261
79262module.exports = isMasked;
79263
79264},{"./_coreJsData":515}],551:[function(require,module,exports){
79265/** Used for built-in method references. */
79266var objectProto = Object.prototype;
79267
79268/**
79269 * Checks if `value` is likely a prototype object.
79270 *
79271 * @private
79272 * @param {*} value The value to check.
79273 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
79274 */
79275function isPrototype(value) {
79276 var Ctor = value && value.constructor,
79277 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
79278
79279 return value === proto;
79280}
79281
79282module.exports = isPrototype;
79283
79284},{}],552:[function(require,module,exports){
79285var isObject = require('./isObject');
79286
79287/**
79288 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
79289 *
79290 * @private
79291 * @param {*} value The value to check.
79292 * @returns {boolean} Returns `true` if `value` if suitable for strict
79293 * equality comparisons, else `false`.
79294 */
79295function isStrictComparable(value) {
79296 return value === value && !isObject(value);
79297}
79298
79299module.exports = isStrictComparable;
79300
79301},{"./isObject":615}],553:[function(require,module,exports){
79302/**
79303 * Removes all key-value entries from the list cache.
79304 *
79305 * @private
79306 * @name clear
79307 * @memberOf ListCache
79308 */
79309function listCacheClear() {
79310 this.__data__ = [];
79311 this.size = 0;
79312}
79313
79314module.exports = listCacheClear;
79315
79316},{}],554:[function(require,module,exports){
79317var assocIndexOf = require('./_assocIndexOf');
79318
79319/** Used for built-in method references. */
79320var arrayProto = Array.prototype;
79321
79322/** Built-in value references. */
79323var splice = arrayProto.splice;
79324
79325/**
79326 * Removes `key` and its value from the list cache.
79327 *
79328 * @private
79329 * @name delete
79330 * @memberOf ListCache
79331 * @param {string} key The key of the value to remove.
79332 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
79333 */
79334function listCacheDelete(key) {
79335 var data = this.__data__,
79336 index = assocIndexOf(data, key);
79337
79338 if (index < 0) {
79339 return false;
79340 }
79341 var lastIndex = data.length - 1;
79342 if (index == lastIndex) {
79343 data.pop();
79344 } else {
79345 splice.call(data, index, 1);
79346 }
79347 --this.size;
79348 return true;
79349}
79350
79351module.exports = listCacheDelete;
79352
79353},{"./_assocIndexOf":459}],555:[function(require,module,exports){
79354var assocIndexOf = require('./_assocIndexOf');
79355
79356/**
79357 * Gets the list cache value for `key`.
79358 *
79359 * @private
79360 * @name get
79361 * @memberOf ListCache
79362 * @param {string} key The key of the value to get.
79363 * @returns {*} Returns the entry value.
79364 */
79365function listCacheGet(key) {
79366 var data = this.__data__,
79367 index = assocIndexOf(data, key);
79368
79369 return index < 0 ? undefined : data[index][1];
79370}
79371
79372module.exports = listCacheGet;
79373
79374},{"./_assocIndexOf":459}],556:[function(require,module,exports){
79375var assocIndexOf = require('./_assocIndexOf');
79376
79377/**
79378 * Checks if a list cache value for `key` exists.
79379 *
79380 * @private
79381 * @name has
79382 * @memberOf ListCache
79383 * @param {string} key The key of the entry to check.
79384 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
79385 */
79386function listCacheHas(key) {
79387 return assocIndexOf(this.__data__, key) > -1;
79388}
79389
79390module.exports = listCacheHas;
79391
79392},{"./_assocIndexOf":459}],557:[function(require,module,exports){
79393var assocIndexOf = require('./_assocIndexOf');
79394
79395/**
79396 * Sets the list cache `key` to `value`.
79397 *
79398 * @private
79399 * @name set
79400 * @memberOf ListCache
79401 * @param {string} key The key of the value to set.
79402 * @param {*} value The value to set.
79403 * @returns {Object} Returns the list cache instance.
79404 */
79405function listCacheSet(key, value) {
79406 var data = this.__data__,
79407 index = assocIndexOf(data, key);
79408
79409 if (index < 0) {
79410 ++this.size;
79411 data.push([key, value]);
79412 } else {
79413 data[index][1] = value;
79414 }
79415 return this;
79416}
79417
79418module.exports = listCacheSet;
79419
79420},{"./_assocIndexOf":459}],558:[function(require,module,exports){
79421var Hash = require('./_Hash'),
79422 ListCache = require('./_ListCache'),
79423 Map = require('./_Map');
79424
79425/**
79426 * Removes all key-value entries from the map.
79427 *
79428 * @private
79429 * @name clear
79430 * @memberOf MapCache
79431 */
79432function mapCacheClear() {
79433 this.size = 0;
79434 this.__data__ = {
79435 'hash': new Hash,
79436 'map': new (Map || ListCache),
79437 'string': new Hash
79438 };
79439}
79440
79441module.exports = mapCacheClear;
79442
79443},{"./_Hash":437,"./_ListCache":438,"./_Map":439}],559:[function(require,module,exports){
79444var getMapData = require('./_getMapData');
79445
79446/**
79447 * Removes `key` and its value from the map.
79448 *
79449 * @private
79450 * @name delete
79451 * @memberOf MapCache
79452 * @param {string} key The key of the value to remove.
79453 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
79454 */
79455function mapCacheDelete(key) {
79456 var result = getMapData(this, key)['delete'](key);
79457 this.size -= result ? 1 : 0;
79458 return result;
79459}
79460
79461module.exports = mapCacheDelete;
79462
79463},{"./_getMapData":527}],560:[function(require,module,exports){
79464var getMapData = require('./_getMapData');
79465
79466/**
79467 * Gets the map value for `key`.
79468 *
79469 * @private
79470 * @name get
79471 * @memberOf MapCache
79472 * @param {string} key The key of the value to get.
79473 * @returns {*} Returns the entry value.
79474 */
79475function mapCacheGet(key) {
79476 return getMapData(this, key).get(key);
79477}
79478
79479module.exports = mapCacheGet;
79480
79481},{"./_getMapData":527}],561:[function(require,module,exports){
79482var getMapData = require('./_getMapData');
79483
79484/**
79485 * Checks if a map value for `key` exists.
79486 *
79487 * @private
79488 * @name has
79489 * @memberOf MapCache
79490 * @param {string} key The key of the entry to check.
79491 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
79492 */
79493function mapCacheHas(key) {
79494 return getMapData(this, key).has(key);
79495}
79496
79497module.exports = mapCacheHas;
79498
79499},{"./_getMapData":527}],562:[function(require,module,exports){
79500var getMapData = require('./_getMapData');
79501
79502/**
79503 * Sets the map `key` to `value`.
79504 *
79505 * @private
79506 * @name set
79507 * @memberOf MapCache
79508 * @param {string} key The key of the value to set.
79509 * @param {*} value The value to set.
79510 * @returns {Object} Returns the map cache instance.
79511 */
79512function mapCacheSet(key, value) {
79513 var data = getMapData(this, key),
79514 size = data.size;
79515
79516 data.set(key, value);
79517 this.size += data.size == size ? 0 : 1;
79518 return this;
79519}
79520
79521module.exports = mapCacheSet;
79522
79523},{"./_getMapData":527}],563:[function(require,module,exports){
79524/**
79525 * Converts `map` to its key-value pairs.
79526 *
79527 * @private
79528 * @param {Object} map The map to convert.
79529 * @returns {Array} Returns the key-value pairs.
79530 */
79531function mapToArray(map) {
79532 var index = -1,
79533 result = Array(map.size);
79534
79535 map.forEach(function(value, key) {
79536 result[++index] = [key, value];
79537 });
79538 return result;
79539}
79540
79541module.exports = mapToArray;
79542
79543},{}],564:[function(require,module,exports){
79544/**
79545 * A specialized version of `matchesProperty` for source values suitable
79546 * for strict equality comparisons, i.e. `===`.
79547 *
79548 * @private
79549 * @param {string} key The key of the property to get.
79550 * @param {*} srcValue The value to match.
79551 * @returns {Function} Returns the new spec function.
79552 */
79553function matchesStrictComparable(key, srcValue) {
79554 return function(object) {
79555 if (object == null) {
79556 return false;
79557 }
79558 return object[key] === srcValue &&
79559 (srcValue !== undefined || (key in Object(object)));
79560 };
79561}
79562
79563module.exports = matchesStrictComparable;
79564
79565},{}],565:[function(require,module,exports){
79566var memoize = require('./memoize');
79567
79568/** Used as the maximum memoize cache size. */
79569var MAX_MEMOIZE_SIZE = 500;
79570
79571/**
79572 * A specialized version of `_.memoize` which clears the memoized function's
79573 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
79574 *
79575 * @private
79576 * @param {Function} func The function to have its output memoized.
79577 * @returns {Function} Returns the new memoized function.
79578 */
79579function memoizeCapped(func) {
79580 var result = memoize(func, function(key) {
79581 if (cache.size === MAX_MEMOIZE_SIZE) {
79582 cache.clear();
79583 }
79584 return key;
79585 });
79586
79587 var cache = result.cache;
79588 return result;
79589}
79590
79591module.exports = memoizeCapped;
79592
79593},{"./memoize":625}],566:[function(require,module,exports){
79594var getNative = require('./_getNative');
79595
79596/* Built-in method references that are verified to be native. */
79597var nativeCreate = getNative(Object, 'create');
79598
79599module.exports = nativeCreate;
79600
79601},{"./_getNative":529}],567:[function(require,module,exports){
79602var overArg = require('./_overArg');
79603
79604/* Built-in method references for those with the same name as other `lodash` methods. */
79605var nativeKeys = overArg(Object.keys, Object);
79606
79607module.exports = nativeKeys;
79608
79609},{"./_overArg":571}],568:[function(require,module,exports){
79610/**
79611 * This function is like
79612 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
79613 * except that it includes inherited enumerable properties.
79614 *
79615 * @private
79616 * @param {Object} object The object to query.
79617 * @returns {Array} Returns the array of property names.
79618 */
79619function nativeKeysIn(object) {
79620 var result = [];
79621 if (object != null) {
79622 for (var key in Object(object)) {
79623 result.push(key);
79624 }
79625 }
79626 return result;
79627}
79628
79629module.exports = nativeKeysIn;
79630
79631},{}],569:[function(require,module,exports){
79632var freeGlobal = require('./_freeGlobal');
79633
79634/** Detect free variable `exports`. */
79635var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
79636
79637/** Detect free variable `module`. */
79638var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
79639
79640/** Detect the popular CommonJS extension `module.exports`. */
79641var moduleExports = freeModule && freeModule.exports === freeExports;
79642
79643/** Detect free variable `process` from Node.js. */
79644var freeProcess = moduleExports && freeGlobal.process;
79645
79646/** Used to access faster Node.js helpers. */
79647var nodeUtil = (function() {
79648 try {
79649 // Use `util.types` for Node.js 10+.
79650 var types = freeModule && freeModule.require && freeModule.require('util').types;
79651
79652 if (types) {
79653 return types;
79654 }
79655
79656 // Legacy `process.binding('util')` for Node.js < 10.
79657 return freeProcess && freeProcess.binding && freeProcess.binding('util');
79658 } catch (e) {}
79659}());
79660
79661module.exports = nodeUtil;
79662
79663},{"./_freeGlobal":524}],570:[function(require,module,exports){
79664/** Used for built-in method references. */
79665var objectProto = Object.prototype;
79666
79667/**
79668 * Used to resolve the
79669 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
79670 * of values.
79671 */
79672var nativeObjectToString = objectProto.toString;
79673
79674/**
79675 * Converts `value` to a string using `Object.prototype.toString`.
79676 *
79677 * @private
79678 * @param {*} value The value to convert.
79679 * @returns {string} Returns the converted string.
79680 */
79681function objectToString(value) {
79682 return nativeObjectToString.call(value);
79683}
79684
79685module.exports = objectToString;
79686
79687},{}],571:[function(require,module,exports){
79688/**
79689 * Creates a unary function that invokes `func` with its argument transformed.
79690 *
79691 * @private
79692 * @param {Function} func The function to wrap.
79693 * @param {Function} transform The argument transform.
79694 * @returns {Function} Returns the new function.
79695 */
79696function overArg(func, transform) {
79697 return function(arg) {
79698 return func(transform(arg));
79699 };
79700}
79701
79702module.exports = overArg;
79703
79704},{}],572:[function(require,module,exports){
79705var apply = require('./_apply');
79706
79707/* Built-in method references for those with the same name as other `lodash` methods. */
79708var nativeMax = Math.max;
79709
79710/**
79711 * A specialized version of `baseRest` which transforms the rest array.
79712 *
79713 * @private
79714 * @param {Function} func The function to apply a rest parameter to.
79715 * @param {number} [start=func.length-1] The start position of the rest parameter.
79716 * @param {Function} transform The rest array transform.
79717 * @returns {Function} Returns the new function.
79718 */
79719function overRest(func, start, transform) {
79720 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
79721 return function() {
79722 var args = arguments,
79723 index = -1,
79724 length = nativeMax(args.length - start, 0),
79725 array = Array(length);
79726
79727 while (++index < length) {
79728 array[index] = args[start + index];
79729 }
79730 index = -1;
79731 var otherArgs = Array(start + 1);
79732 while (++index < start) {
79733 otherArgs[index] = args[index];
79734 }
79735 otherArgs[start] = transform(array);
79736 return apply(func, this, otherArgs);
79737 };
79738}
79739
79740module.exports = overRest;
79741
79742},{"./_apply":448}],573:[function(require,module,exports){
79743var freeGlobal = require('./_freeGlobal');
79744
79745/** Detect free variable `self`. */
79746var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
79747
79748/** Used as a reference to the global object. */
79749var root = freeGlobal || freeSelf || Function('return this')();
79750
79751module.exports = root;
79752
79753},{"./_freeGlobal":524}],574:[function(require,module,exports){
79754/** Used to stand-in for `undefined` hash values. */
79755var HASH_UNDEFINED = '__lodash_hash_undefined__';
79756
79757/**
79758 * Adds `value` to the array cache.
79759 *
79760 * @private
79761 * @name add
79762 * @memberOf SetCache
79763 * @alias push
79764 * @param {*} value The value to cache.
79765 * @returns {Object} Returns the cache instance.
79766 */
79767function setCacheAdd(value) {
79768 this.__data__.set(value, HASH_UNDEFINED);
79769 return this;
79770}
79771
79772module.exports = setCacheAdd;
79773
79774},{}],575:[function(require,module,exports){
79775/**
79776 * Checks if `value` is in the array cache.
79777 *
79778 * @private
79779 * @name has
79780 * @memberOf SetCache
79781 * @param {*} value The value to search for.
79782 * @returns {number} Returns `true` if `value` is found, else `false`.
79783 */
79784function setCacheHas(value) {
79785 return this.__data__.has(value);
79786}
79787
79788module.exports = setCacheHas;
79789
79790},{}],576:[function(require,module,exports){
79791/**
79792 * Converts `set` to an array of its values.
79793 *
79794 * @private
79795 * @param {Object} set The set to convert.
79796 * @returns {Array} Returns the values.
79797 */
79798function setToArray(set) {
79799 var index = -1,
79800 result = Array(set.size);
79801
79802 set.forEach(function(value) {
79803 result[++index] = value;
79804 });
79805 return result;
79806}
79807
79808module.exports = setToArray;
79809
79810},{}],577:[function(require,module,exports){
79811var baseSetToString = require('./_baseSetToString'),
79812 shortOut = require('./_shortOut');
79813
79814/**
79815 * Sets the `toString` method of `func` to return `string`.
79816 *
79817 * @private
79818 * @param {Function} func The function to modify.
79819 * @param {Function} string The `toString` result.
79820 * @returns {Function} Returns `func`.
79821 */
79822var setToString = shortOut(baseSetToString);
79823
79824module.exports = setToString;
79825
79826},{"./_baseSetToString":494,"./_shortOut":578}],578:[function(require,module,exports){
79827/** Used to detect hot functions by number of calls within a span of milliseconds. */
79828var HOT_COUNT = 800,
79829 HOT_SPAN = 16;
79830
79831/* Built-in method references for those with the same name as other `lodash` methods. */
79832var nativeNow = Date.now;
79833
79834/**
79835 * Creates a function that'll short out and invoke `identity` instead
79836 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
79837 * milliseconds.
79838 *
79839 * @private
79840 * @param {Function} func The function to restrict.
79841 * @returns {Function} Returns the new shortable function.
79842 */
79843function shortOut(func) {
79844 var count = 0,
79845 lastCalled = 0;
79846
79847 return function() {
79848 var stamp = nativeNow(),
79849 remaining = HOT_SPAN - (stamp - lastCalled);
79850
79851 lastCalled = stamp;
79852 if (remaining > 0) {
79853 if (++count >= HOT_COUNT) {
79854 return arguments[0];
79855 }
79856 } else {
79857 count = 0;
79858 }
79859 return func.apply(undefined, arguments);
79860 };
79861}
79862
79863module.exports = shortOut;
79864
79865},{}],579:[function(require,module,exports){
79866var ListCache = require('./_ListCache');
79867
79868/**
79869 * Removes all key-value entries from the stack.
79870 *
79871 * @private
79872 * @name clear
79873 * @memberOf Stack
79874 */
79875function stackClear() {
79876 this.__data__ = new ListCache;
79877 this.size = 0;
79878}
79879
79880module.exports = stackClear;
79881
79882},{"./_ListCache":438}],580:[function(require,module,exports){
79883/**
79884 * Removes `key` and its value from the stack.
79885 *
79886 * @private
79887 * @name delete
79888 * @memberOf Stack
79889 * @param {string} key The key of the value to remove.
79890 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
79891 */
79892function stackDelete(key) {
79893 var data = this.__data__,
79894 result = data['delete'](key);
79895
79896 this.size = data.size;
79897 return result;
79898}
79899
79900module.exports = stackDelete;
79901
79902},{}],581:[function(require,module,exports){
79903/**
79904 * Gets the stack value for `key`.
79905 *
79906 * @private
79907 * @name get
79908 * @memberOf Stack
79909 * @param {string} key The key of the value to get.
79910 * @returns {*} Returns the entry value.
79911 */
79912function stackGet(key) {
79913 return this.__data__.get(key);
79914}
79915
79916module.exports = stackGet;
79917
79918},{}],582:[function(require,module,exports){
79919/**
79920 * Checks if a stack value for `key` exists.
79921 *
79922 * @private
79923 * @name has
79924 * @memberOf Stack
79925 * @param {string} key The key of the entry to check.
79926 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
79927 */
79928function stackHas(key) {
79929 return this.__data__.has(key);
79930}
79931
79932module.exports = stackHas;
79933
79934},{}],583:[function(require,module,exports){
79935var ListCache = require('./_ListCache'),
79936 Map = require('./_Map'),
79937 MapCache = require('./_MapCache');
79938
79939/** Used as the size to enable large array optimizations. */
79940var LARGE_ARRAY_SIZE = 200;
79941
79942/**
79943 * Sets the stack `key` to `value`.
79944 *
79945 * @private
79946 * @name set
79947 * @memberOf Stack
79948 * @param {string} key The key of the value to set.
79949 * @param {*} value The value to set.
79950 * @returns {Object} Returns the stack cache instance.
79951 */
79952function stackSet(key, value) {
79953 var data = this.__data__;
79954 if (data instanceof ListCache) {
79955 var pairs = data.__data__;
79956 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
79957 pairs.push([key, value]);
79958 this.size = ++data.size;
79959 return this;
79960 }
79961 data = this.__data__ = new MapCache(pairs);
79962 }
79963 data.set(key, value);
79964 this.size = data.size;
79965 return this;
79966}
79967
79968module.exports = stackSet;
79969
79970},{"./_ListCache":438,"./_Map":439,"./_MapCache":440}],584:[function(require,module,exports){
79971/**
79972 * A specialized version of `_.indexOf` which performs strict equality
79973 * comparisons of values, i.e. `===`.
79974 *
79975 * @private
79976 * @param {Array} array The array to inspect.
79977 * @param {*} value The value to search for.
79978 * @param {number} fromIndex The index to search from.
79979 * @returns {number} Returns the index of the matched value, else `-1`.
79980 */
79981function strictIndexOf(array, value, fromIndex) {
79982 var index = fromIndex - 1,
79983 length = array.length;
79984
79985 while (++index < length) {
79986 if (array[index] === value) {
79987 return index;
79988 }
79989 }
79990 return -1;
79991}
79992
79993module.exports = strictIndexOf;
79994
79995},{}],585:[function(require,module,exports){
79996var asciiSize = require('./_asciiSize'),
79997 hasUnicode = require('./_hasUnicode'),
79998 unicodeSize = require('./_unicodeSize');
79999
80000/**
80001 * Gets the number of symbols in `string`.
80002 *
80003 * @private
80004 * @param {string} string The string to inspect.
80005 * @returns {number} Returns the string size.
80006 */
80007function stringSize(string) {
80008 return hasUnicode(string)
80009 ? unicodeSize(string)
80010 : asciiSize(string);
80011}
80012
80013module.exports = stringSize;
80014
80015},{"./_asciiSize":456,"./_hasUnicode":537,"./_unicodeSize":590}],586:[function(require,module,exports){
80016var asciiToArray = require('./_asciiToArray'),
80017 hasUnicode = require('./_hasUnicode'),
80018 unicodeToArray = require('./_unicodeToArray');
80019
80020/**
80021 * Converts `string` to an array.
80022 *
80023 * @private
80024 * @param {string} string The string to convert.
80025 * @returns {Array} Returns the converted array.
80026 */
80027function stringToArray(string) {
80028 return hasUnicode(string)
80029 ? unicodeToArray(string)
80030 : asciiToArray(string);
80031}
80032
80033module.exports = stringToArray;
80034
80035},{"./_asciiToArray":457,"./_hasUnicode":537,"./_unicodeToArray":591}],587:[function(require,module,exports){
80036var memoizeCapped = require('./_memoizeCapped');
80037
80038/** Used to match property names within property paths. */
80039var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
80040
80041/** Used to match backslashes in property paths. */
80042var reEscapeChar = /\\(\\)?/g;
80043
80044/**
80045 * Converts `string` to a property path array.
80046 *
80047 * @private
80048 * @param {string} string The string to convert.
80049 * @returns {Array} Returns the property path array.
80050 */
80051var stringToPath = memoizeCapped(function(string) {
80052 var result = [];
80053 if (string.charCodeAt(0) === 46 /* . */) {
80054 result.push('');
80055 }
80056 string.replace(rePropName, function(match, number, quote, subString) {
80057 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
80058 });
80059 return result;
80060});
80061
80062module.exports = stringToPath;
80063
80064},{"./_memoizeCapped":565}],588:[function(require,module,exports){
80065var isSymbol = require('./isSymbol');
80066
80067/** Used as references for various `Number` constants. */
80068var INFINITY = 1 / 0;
80069
80070/**
80071 * Converts `value` to a string key if it's not a string or symbol.
80072 *
80073 * @private
80074 * @param {*} value The value to inspect.
80075 * @returns {string|symbol} Returns the key.
80076 */
80077function toKey(value) {
80078 if (typeof value == 'string' || isSymbol(value)) {
80079 return value;
80080 }
80081 var result = (value + '');
80082 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
80083}
80084
80085module.exports = toKey;
80086
80087},{"./isSymbol":619}],589:[function(require,module,exports){
80088/** Used for built-in method references. */
80089var funcProto = Function.prototype;
80090
80091/** Used to resolve the decompiled source of functions. */
80092var funcToString = funcProto.toString;
80093
80094/**
80095 * Converts `func` to its source code.
80096 *
80097 * @private
80098 * @param {Function} func The function to convert.
80099 * @returns {string} Returns the source code.
80100 */
80101function toSource(func) {
80102 if (func != null) {
80103 try {
80104 return funcToString.call(func);
80105 } catch (e) {}
80106 try {
80107 return (func + '');
80108 } catch (e) {}
80109 }
80110 return '';
80111}
80112
80113module.exports = toSource;
80114
80115},{}],590:[function(require,module,exports){
80116/** Used to compose unicode character classes. */
80117var rsAstralRange = '\\ud800-\\udfff',
80118 rsComboMarksRange = '\\u0300-\\u036f',
80119 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
80120 rsComboSymbolsRange = '\\u20d0-\\u20ff',
80121 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
80122 rsVarRange = '\\ufe0e\\ufe0f';
80123
80124/** Used to compose unicode capture groups. */
80125var rsAstral = '[' + rsAstralRange + ']',
80126 rsCombo = '[' + rsComboRange + ']',
80127 rsFitz = '\\ud83c[\\udffb-\\udfff]',
80128 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
80129 rsNonAstral = '[^' + rsAstralRange + ']',
80130 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
80131 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
80132 rsZWJ = '\\u200d';
80133
80134/** Used to compose unicode regexes. */
80135var reOptMod = rsModifier + '?',
80136 rsOptVar = '[' + rsVarRange + ']?',
80137 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
80138 rsSeq = rsOptVar + reOptMod + rsOptJoin,
80139 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
80140
80141/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
80142var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
80143
80144/**
80145 * Gets the size of a Unicode `string`.
80146 *
80147 * @private
80148 * @param {string} string The string inspect.
80149 * @returns {number} Returns the string size.
80150 */
80151function unicodeSize(string) {
80152 var result = reUnicode.lastIndex = 0;
80153 while (reUnicode.test(string)) {
80154 ++result;
80155 }
80156 return result;
80157}
80158
80159module.exports = unicodeSize;
80160
80161},{}],591:[function(require,module,exports){
80162/** Used to compose unicode character classes. */
80163var rsAstralRange = '\\ud800-\\udfff',
80164 rsComboMarksRange = '\\u0300-\\u036f',
80165 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
80166 rsComboSymbolsRange = '\\u20d0-\\u20ff',
80167 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
80168 rsVarRange = '\\ufe0e\\ufe0f';
80169
80170/** Used to compose unicode capture groups. */
80171var rsAstral = '[' + rsAstralRange + ']',
80172 rsCombo = '[' + rsComboRange + ']',
80173 rsFitz = '\\ud83c[\\udffb-\\udfff]',
80174 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
80175 rsNonAstral = '[^' + rsAstralRange + ']',
80176 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
80177 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
80178 rsZWJ = '\\u200d';
80179
80180/** Used to compose unicode regexes. */
80181var reOptMod = rsModifier + '?',
80182 rsOptVar = '[' + rsVarRange + ']?',
80183 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
80184 rsSeq = rsOptVar + reOptMod + rsOptJoin,
80185 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
80186
80187/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
80188var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
80189
80190/**
80191 * Converts a Unicode `string` to an array.
80192 *
80193 * @private
80194 * @param {string} string The string to convert.
80195 * @returns {Array} Returns the converted array.
80196 */
80197function unicodeToArray(string) {
80198 return string.match(reUnicode) || [];
80199}
80200
80201module.exports = unicodeToArray;
80202
80203},{}],592:[function(require,module,exports){
80204var copyObject = require('./_copyObject'),
80205 createAssigner = require('./_createAssigner'),
80206 keysIn = require('./keysIn');
80207
80208/**
80209 * This method is like `_.assign` except that it iterates over own and
80210 * inherited source properties.
80211 *
80212 * **Note:** This method mutates `object`.
80213 *
80214 * @static
80215 * @memberOf _
80216 * @since 4.0.0
80217 * @alias extend
80218 * @category Object
80219 * @param {Object} object The destination object.
80220 * @param {...Object} [sources] The source objects.
80221 * @returns {Object} Returns `object`.
80222 * @see _.assign
80223 * @example
80224 *
80225 * function Foo() {
80226 * this.a = 1;
80227 * }
80228 *
80229 * function Bar() {
80230 * this.c = 3;
80231 * }
80232 *
80233 * Foo.prototype.b = 2;
80234 * Bar.prototype.d = 4;
80235 *
80236 * _.assignIn({ 'a': 0 }, new Foo, new Bar);
80237 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
80238 */
80239var assignIn = createAssigner(function(object, source) {
80240 copyObject(source, keysIn(source), object);
80241});
80242
80243module.exports = assignIn;
80244
80245},{"./_copyObject":512,"./_createAssigner":516,"./keysIn":623}],593:[function(require,module,exports){
80246var baseClone = require('./_baseClone');
80247
80248/** Used to compose bitmasks for cloning. */
80249var CLONE_SYMBOLS_FLAG = 4;
80250
80251/**
80252 * Creates a shallow clone of `value`.
80253 *
80254 * **Note:** This method is loosely based on the
80255 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
80256 * and supports cloning arrays, array buffers, booleans, date objects, maps,
80257 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
80258 * arrays. The own enumerable properties of `arguments` objects are cloned
80259 * as plain objects. An empty object is returned for uncloneable values such
80260 * as error objects, functions, DOM nodes, and WeakMaps.
80261 *
80262 * @static
80263 * @memberOf _
80264 * @since 0.1.0
80265 * @category Lang
80266 * @param {*} value The value to clone.
80267 * @returns {*} Returns the cloned value.
80268 * @see _.cloneDeep
80269 * @example
80270 *
80271 * var objects = [{ 'a': 1 }, { 'b': 2 }];
80272 *
80273 * var shallow = _.clone(objects);
80274 * console.log(shallow[0] === objects[0]);
80275 * // => true
80276 */
80277function clone(value) {
80278 return baseClone(value, CLONE_SYMBOLS_FLAG);
80279}
80280
80281module.exports = clone;
80282
80283},{"./_baseClone":463}],594:[function(require,module,exports){
80284/**
80285 * Creates a function that returns `value`.
80286 *
80287 * @static
80288 * @memberOf _
80289 * @since 2.4.0
80290 * @category Util
80291 * @param {*} value The value to return from the new function.
80292 * @returns {Function} Returns the new constant function.
80293 * @example
80294 *
80295 * var objects = _.times(2, _.constant({ 'a': 1 }));
80296 *
80297 * console.log(objects);
80298 * // => [{ 'a': 1 }, { 'a': 1 }]
80299 *
80300 * console.log(objects[0] === objects[1]);
80301 * // => true
80302 */
80303function constant(value) {
80304 return function() {
80305 return value;
80306 };
80307}
80308
80309module.exports = constant;
80310
80311},{}],595:[function(require,module,exports){
80312module.exports = require('./forEach');
80313
80314},{"./forEach":599}],596:[function(require,module,exports){
80315/**
80316 * Performs a
80317 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
80318 * comparison between two values to determine if they are equivalent.
80319 *
80320 * @static
80321 * @memberOf _
80322 * @since 4.0.0
80323 * @category Lang
80324 * @param {*} value The value to compare.
80325 * @param {*} other The other value to compare.
80326 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
80327 * @example
80328 *
80329 * var object = { 'a': 1 };
80330 * var other = { 'a': 1 };
80331 *
80332 * _.eq(object, object);
80333 * // => true
80334 *
80335 * _.eq(object, other);
80336 * // => false
80337 *
80338 * _.eq('a', 'a');
80339 * // => true
80340 *
80341 * _.eq('a', Object('a'));
80342 * // => false
80343 *
80344 * _.eq(NaN, NaN);
80345 * // => true
80346 */
80347function eq(value, other) {
80348 return value === other || (value !== value && other !== other);
80349}
80350
80351module.exports = eq;
80352
80353},{}],597:[function(require,module,exports){
80354var arrayEvery = require('./_arrayEvery'),
80355 baseEvery = require('./_baseEvery'),
80356 baseIteratee = require('./_baseIteratee'),
80357 isArray = require('./isArray'),
80358 isIterateeCall = require('./_isIterateeCall');
80359
80360/**
80361 * Checks if `predicate` returns truthy for **all** elements of `collection`.
80362 * Iteration is stopped once `predicate` returns falsey. The predicate is
80363 * invoked with three arguments: (value, index|key, collection).
80364 *
80365 * **Note:** This method returns `true` for
80366 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
80367 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
80368 * elements of empty collections.
80369 *
80370 * @static
80371 * @memberOf _
80372 * @since 0.1.0
80373 * @category Collection
80374 * @param {Array|Object} collection The collection to iterate over.
80375 * @param {Function} [predicate=_.identity] The function invoked per iteration.
80376 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
80377 * @returns {boolean} Returns `true` if all elements pass the predicate check,
80378 * else `false`.
80379 * @example
80380 *
80381 * _.every([true, 1, null, 'yes'], Boolean);
80382 * // => false
80383 *
80384 * var users = [
80385 * { 'user': 'barney', 'age': 36, 'active': false },
80386 * { 'user': 'fred', 'age': 40, 'active': false }
80387 * ];
80388 *
80389 * // The `_.matches` iteratee shorthand.
80390 * _.every(users, { 'user': 'barney', 'active': false });
80391 * // => false
80392 *
80393 * // The `_.matchesProperty` iteratee shorthand.
80394 * _.every(users, ['active', false]);
80395 * // => true
80396 *
80397 * // The `_.property` iteratee shorthand.
80398 * _.every(users, 'active');
80399 * // => false
80400 */
80401function every(collection, predicate, guard) {
80402 var func = isArray(collection) ? arrayEvery : baseEvery;
80403 if (guard && isIterateeCall(collection, predicate, guard)) {
80404 predicate = undefined;
80405 }
80406 return func(collection, baseIteratee(predicate, 3));
80407}
80408
80409module.exports = every;
80410
80411},{"./_arrayEvery":450,"./_baseEvery":466,"./_baseIteratee":484,"./_isIterateeCall":547,"./isArray":605}],598:[function(require,module,exports){
80412module.exports = require('./assignIn');
80413
80414},{"./assignIn":592}],599:[function(require,module,exports){
80415var arrayEach = require('./_arrayEach'),
80416 baseEach = require('./_baseEach'),
80417 castFunction = require('./_castFunction'),
80418 isArray = require('./isArray');
80419
80420/**
80421 * Iterates over elements of `collection` and invokes `iteratee` for each element.
80422 * The iteratee is invoked with three arguments: (value, index|key, collection).
80423 * Iteratee functions may exit iteration early by explicitly returning `false`.
80424 *
80425 * **Note:** As with other "Collections" methods, objects with a "length"
80426 * property are iterated like arrays. To avoid this behavior use `_.forIn`
80427 * or `_.forOwn` for object iteration.
80428 *
80429 * @static
80430 * @memberOf _
80431 * @since 0.1.0
80432 * @alias each
80433 * @category Collection
80434 * @param {Array|Object} collection The collection to iterate over.
80435 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
80436 * @returns {Array|Object} Returns `collection`.
80437 * @see _.forEachRight
80438 * @example
80439 *
80440 * _.forEach([1, 2], function(value) {
80441 * console.log(value);
80442 * });
80443 * // => Logs `1` then `2`.
80444 *
80445 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
80446 * console.log(key);
80447 * });
80448 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
80449 */
80450function forEach(collection, iteratee) {
80451 var func = isArray(collection) ? arrayEach : baseEach;
80452 return func(collection, castFunction(iteratee));
80453}
80454
80455module.exports = forEach;
80456
80457},{"./_arrayEach":449,"./_baseEach":465,"./_castFunction":501,"./isArray":605}],600:[function(require,module,exports){
80458/**
80459 * The inverse of `_.toPairs`; this method returns an object composed
80460 * from key-value `pairs`.
80461 *
80462 * @static
80463 * @memberOf _
80464 * @since 4.0.0
80465 * @category Array
80466 * @param {Array} pairs The key-value pairs.
80467 * @returns {Object} Returns the new object.
80468 * @example
80469 *
80470 * _.fromPairs([['a', 1], ['b', 2]]);
80471 * // => { 'a': 1, 'b': 2 }
80472 */
80473function fromPairs(pairs) {
80474 var index = -1,
80475 length = pairs == null ? 0 : pairs.length,
80476 result = {};
80477
80478 while (++index < length) {
80479 var pair = pairs[index];
80480 result[pair[0]] = pair[1];
80481 }
80482 return result;
80483}
80484
80485module.exports = fromPairs;
80486
80487},{}],601:[function(require,module,exports){
80488var baseGet = require('./_baseGet');
80489
80490/**
80491 * Gets the value at `path` of `object`. If the resolved value is
80492 * `undefined`, the `defaultValue` is returned in its place.
80493 *
80494 * @static
80495 * @memberOf _
80496 * @since 3.7.0
80497 * @category Object
80498 * @param {Object} object The object to query.
80499 * @param {Array|string} path The path of the property to get.
80500 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
80501 * @returns {*} Returns the resolved value.
80502 * @example
80503 *
80504 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
80505 *
80506 * _.get(object, 'a[0].b.c');
80507 * // => 3
80508 *
80509 * _.get(object, ['a', '0', 'b', 'c']);
80510 * // => 3
80511 *
80512 * _.get(object, 'a.b.c', 'default');
80513 * // => 'default'
80514 */
80515function get(object, path, defaultValue) {
80516 var result = object == null ? undefined : baseGet(object, path);
80517 return result === undefined ? defaultValue : result;
80518}
80519
80520module.exports = get;
80521
80522},{"./_baseGet":470}],602:[function(require,module,exports){
80523var baseHasIn = require('./_baseHasIn'),
80524 hasPath = require('./_hasPath');
80525
80526/**
80527 * Checks if `path` is a direct or inherited property of `object`.
80528 *
80529 * @static
80530 * @memberOf _
80531 * @since 4.0.0
80532 * @category Object
80533 * @param {Object} object The object to query.
80534 * @param {Array|string} path The path to check.
80535 * @returns {boolean} Returns `true` if `path` exists, else `false`.
80536 * @example
80537 *
80538 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
80539 *
80540 * _.hasIn(object, 'a');
80541 * // => true
80542 *
80543 * _.hasIn(object, 'a.b');
80544 * // => true
80545 *
80546 * _.hasIn(object, ['a', 'b']);
80547 * // => true
80548 *
80549 * _.hasIn(object, 'b');
80550 * // => false
80551 */
80552function hasIn(object, path) {
80553 return object != null && hasPath(object, path, baseHasIn);
80554}
80555
80556module.exports = hasIn;
80557
80558},{"./_baseHasIn":473,"./_hasPath":536}],603:[function(require,module,exports){
80559/**
80560 * This method returns the first argument it receives.
80561 *
80562 * @static
80563 * @since 0.1.0
80564 * @memberOf _
80565 * @category Util
80566 * @param {*} value Any value.
80567 * @returns {*} Returns `value`.
80568 * @example
80569 *
80570 * var object = { 'a': 1 };
80571 *
80572 * console.log(_.identity(object) === object);
80573 * // => true
80574 */
80575function identity(value) {
80576 return value;
80577}
80578
80579module.exports = identity;
80580
80581},{}],604:[function(require,module,exports){
80582var baseIsArguments = require('./_baseIsArguments'),
80583 isObjectLike = require('./isObjectLike');
80584
80585/** Used for built-in method references. */
80586var objectProto = Object.prototype;
80587
80588/** Used to check objects for own properties. */
80589var hasOwnProperty = objectProto.hasOwnProperty;
80590
80591/** Built-in value references. */
80592var propertyIsEnumerable = objectProto.propertyIsEnumerable;
80593
80594/**
80595 * Checks if `value` is likely an `arguments` object.
80596 *
80597 * @static
80598 * @memberOf _
80599 * @since 0.1.0
80600 * @category Lang
80601 * @param {*} value The value to check.
80602 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
80603 * else `false`.
80604 * @example
80605 *
80606 * _.isArguments(function() { return arguments; }());
80607 * // => true
80608 *
80609 * _.isArguments([1, 2, 3]);
80610 * // => false
80611 */
80612var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
80613 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
80614 !propertyIsEnumerable.call(value, 'callee');
80615};
80616
80617module.exports = isArguments;
80618
80619},{"./_baseIsArguments":475,"./isObjectLike":616}],605:[function(require,module,exports){
80620/**
80621 * Checks if `value` is classified as an `Array` object.
80622 *
80623 * @static
80624 * @memberOf _
80625 * @since 0.1.0
80626 * @category Lang
80627 * @param {*} value The value to check.
80628 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
80629 * @example
80630 *
80631 * _.isArray([1, 2, 3]);
80632 * // => true
80633 *
80634 * _.isArray(document.body.children);
80635 * // => false
80636 *
80637 * _.isArray('abc');
80638 * // => false
80639 *
80640 * _.isArray(_.noop);
80641 * // => false
80642 */
80643var isArray = Array.isArray;
80644
80645module.exports = isArray;
80646
80647},{}],606:[function(require,module,exports){
80648var isFunction = require('./isFunction'),
80649 isLength = require('./isLength');
80650
80651/**
80652 * Checks if `value` is array-like. A value is considered array-like if it's
80653 * not a function and has a `value.length` that's an integer greater than or
80654 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
80655 *
80656 * @static
80657 * @memberOf _
80658 * @since 4.0.0
80659 * @category Lang
80660 * @param {*} value The value to check.
80661 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
80662 * @example
80663 *
80664 * _.isArrayLike([1, 2, 3]);
80665 * // => true
80666 *
80667 * _.isArrayLike(document.body.children);
80668 * // => true
80669 *
80670 * _.isArrayLike('abc');
80671 * // => true
80672 *
80673 * _.isArrayLike(_.noop);
80674 * // => false
80675 */
80676function isArrayLike(value) {
80677 return value != null && isLength(value.length) && !isFunction(value);
80678}
80679
80680module.exports = isArrayLike;
80681
80682},{"./isFunction":610,"./isLength":611}],607:[function(require,module,exports){
80683var baseGetTag = require('./_baseGetTag'),
80684 isObjectLike = require('./isObjectLike');
80685
80686/** `Object#toString` result references. */
80687var boolTag = '[object Boolean]';
80688
80689/**
80690 * Checks if `value` is classified as a boolean primitive or object.
80691 *
80692 * @static
80693 * @memberOf _
80694 * @since 0.1.0
80695 * @category Lang
80696 * @param {*} value The value to check.
80697 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
80698 * @example
80699 *
80700 * _.isBoolean(false);
80701 * // => true
80702 *
80703 * _.isBoolean(null);
80704 * // => false
80705 */
80706function isBoolean(value) {
80707 return value === true || value === false ||
80708 (isObjectLike(value) && baseGetTag(value) == boolTag);
80709}
80710
80711module.exports = isBoolean;
80712
80713},{"./_baseGetTag":472,"./isObjectLike":616}],608:[function(require,module,exports){
80714var root = require('./_root'),
80715 stubFalse = require('./stubFalse');
80716
80717/** Detect free variable `exports`. */
80718var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
80719
80720/** Detect free variable `module`. */
80721var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
80722
80723/** Detect the popular CommonJS extension `module.exports`. */
80724var moduleExports = freeModule && freeModule.exports === freeExports;
80725
80726/** Built-in value references. */
80727var Buffer = moduleExports ? root.Buffer : undefined;
80728
80729/* Built-in method references for those with the same name as other `lodash` methods. */
80730var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
80731
80732/**
80733 * Checks if `value` is a buffer.
80734 *
80735 * @static
80736 * @memberOf _
80737 * @since 4.3.0
80738 * @category Lang
80739 * @param {*} value The value to check.
80740 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
80741 * @example
80742 *
80743 * _.isBuffer(new Buffer(2));
80744 * // => true
80745 *
80746 * _.isBuffer(new Uint8Array(2));
80747 * // => false
80748 */
80749var isBuffer = nativeIsBuffer || stubFalse;
80750
80751module.exports = isBuffer;
80752
80753},{"./_root":573,"./stubFalse":629}],609:[function(require,module,exports){
80754var root = require('./_root');
80755
80756/* Built-in method references for those with the same name as other `lodash` methods. */
80757var nativeIsFinite = root.isFinite;
80758
80759/**
80760 * Checks if `value` is a finite primitive number.
80761 *
80762 * **Note:** This method is based on
80763 * [`Number.isFinite`](https://mdn.io/Number/isFinite).
80764 *
80765 * @static
80766 * @memberOf _
80767 * @since 0.1.0
80768 * @category Lang
80769 * @param {*} value The value to check.
80770 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
80771 * @example
80772 *
80773 * _.isFinite(3);
80774 * // => true
80775 *
80776 * _.isFinite(Number.MIN_VALUE);
80777 * // => true
80778 *
80779 * _.isFinite(Infinity);
80780 * // => false
80781 *
80782 * _.isFinite('3');
80783 * // => false
80784 */
80785function isFinite(value) {
80786 return typeof value == 'number' && nativeIsFinite(value);
80787}
80788
80789module.exports = isFinite;
80790
80791},{"./_root":573}],610:[function(require,module,exports){
80792var baseGetTag = require('./_baseGetTag'),
80793 isObject = require('./isObject');
80794
80795/** `Object#toString` result references. */
80796var asyncTag = '[object AsyncFunction]',
80797 funcTag = '[object Function]',
80798 genTag = '[object GeneratorFunction]',
80799 proxyTag = '[object Proxy]';
80800
80801/**
80802 * Checks if `value` is classified as a `Function` object.
80803 *
80804 * @static
80805 * @memberOf _
80806 * @since 0.1.0
80807 * @category Lang
80808 * @param {*} value The value to check.
80809 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
80810 * @example
80811 *
80812 * _.isFunction(_);
80813 * // => true
80814 *
80815 * _.isFunction(/abc/);
80816 * // => false
80817 */
80818function isFunction(value) {
80819 if (!isObject(value)) {
80820 return false;
80821 }
80822 // The use of `Object#toString` avoids issues with the `typeof` operator
80823 // in Safari 9 which returns 'object' for typed arrays and other constructors.
80824 var tag = baseGetTag(value);
80825 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
80826}
80827
80828module.exports = isFunction;
80829
80830},{"./_baseGetTag":472,"./isObject":615}],611:[function(require,module,exports){
80831/** Used as references for various `Number` constants. */
80832var MAX_SAFE_INTEGER = 9007199254740991;
80833
80834/**
80835 * Checks if `value` is a valid array-like length.
80836 *
80837 * **Note:** This method is loosely based on
80838 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
80839 *
80840 * @static
80841 * @memberOf _
80842 * @since 4.0.0
80843 * @category Lang
80844 * @param {*} value The value to check.
80845 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
80846 * @example
80847 *
80848 * _.isLength(3);
80849 * // => true
80850 *
80851 * _.isLength(Number.MIN_VALUE);
80852 * // => false
80853 *
80854 * _.isLength(Infinity);
80855 * // => false
80856 *
80857 * _.isLength('3');
80858 * // => false
80859 */
80860function isLength(value) {
80861 return typeof value == 'number' &&
80862 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
80863}
80864
80865module.exports = isLength;
80866
80867},{}],612:[function(require,module,exports){
80868var baseIsMap = require('./_baseIsMap'),
80869 baseUnary = require('./_baseUnary'),
80870 nodeUtil = require('./_nodeUtil');
80871
80872/* Node.js helper references. */
80873var nodeIsMap = nodeUtil && nodeUtil.isMap;
80874
80875/**
80876 * Checks if `value` is classified as a `Map` object.
80877 *
80878 * @static
80879 * @memberOf _
80880 * @since 4.3.0
80881 * @category Lang
80882 * @param {*} value The value to check.
80883 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
80884 * @example
80885 *
80886 * _.isMap(new Map);
80887 * // => true
80888 *
80889 * _.isMap(new WeakMap);
80890 * // => false
80891 */
80892var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
80893
80894module.exports = isMap;
80895
80896},{"./_baseIsMap":478,"./_baseUnary":498,"./_nodeUtil":569}],613:[function(require,module,exports){
80897/**
80898 * Checks if `value` is `null`.
80899 *
80900 * @static
80901 * @memberOf _
80902 * @since 0.1.0
80903 * @category Lang
80904 * @param {*} value The value to check.
80905 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
80906 * @example
80907 *
80908 * _.isNull(null);
80909 * // => true
80910 *
80911 * _.isNull(void 0);
80912 * // => false
80913 */
80914function isNull(value) {
80915 return value === null;
80916}
80917
80918module.exports = isNull;
80919
80920},{}],614:[function(require,module,exports){
80921var baseGetTag = require('./_baseGetTag'),
80922 isObjectLike = require('./isObjectLike');
80923
80924/** `Object#toString` result references. */
80925var numberTag = '[object Number]';
80926
80927/**
80928 * Checks if `value` is classified as a `Number` primitive or object.
80929 *
80930 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
80931 * classified as numbers, use the `_.isFinite` method.
80932 *
80933 * @static
80934 * @memberOf _
80935 * @since 0.1.0
80936 * @category Lang
80937 * @param {*} value The value to check.
80938 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
80939 * @example
80940 *
80941 * _.isNumber(3);
80942 * // => true
80943 *
80944 * _.isNumber(Number.MIN_VALUE);
80945 * // => true
80946 *
80947 * _.isNumber(Infinity);
80948 * // => true
80949 *
80950 * _.isNumber('3');
80951 * // => false
80952 */
80953function isNumber(value) {
80954 return typeof value == 'number' ||
80955 (isObjectLike(value) && baseGetTag(value) == numberTag);
80956}
80957
80958module.exports = isNumber;
80959
80960},{"./_baseGetTag":472,"./isObjectLike":616}],615:[function(require,module,exports){
80961/**
80962 * Checks if `value` is the
80963 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
80964 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
80965 *
80966 * @static
80967 * @memberOf _
80968 * @since 0.1.0
80969 * @category Lang
80970 * @param {*} value The value to check.
80971 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
80972 * @example
80973 *
80974 * _.isObject({});
80975 * // => true
80976 *
80977 * _.isObject([1, 2, 3]);
80978 * // => true
80979 *
80980 * _.isObject(_.noop);
80981 * // => true
80982 *
80983 * _.isObject(null);
80984 * // => false
80985 */
80986function isObject(value) {
80987 var type = typeof value;
80988 return value != null && (type == 'object' || type == 'function');
80989}
80990
80991module.exports = isObject;
80992
80993},{}],616:[function(require,module,exports){
80994/**
80995 * Checks if `value` is object-like. A value is object-like if it's not `null`
80996 * and has a `typeof` result of "object".
80997 *
80998 * @static
80999 * @memberOf _
81000 * @since 4.0.0
81001 * @category Lang
81002 * @param {*} value The value to check.
81003 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
81004 * @example
81005 *
81006 * _.isObjectLike({});
81007 * // => true
81008 *
81009 * _.isObjectLike([1, 2, 3]);
81010 * // => true
81011 *
81012 * _.isObjectLike(_.noop);
81013 * // => false
81014 *
81015 * _.isObjectLike(null);
81016 * // => false
81017 */
81018function isObjectLike(value) {
81019 return value != null && typeof value == 'object';
81020}
81021
81022module.exports = isObjectLike;
81023
81024},{}],617:[function(require,module,exports){
81025var baseIsSet = require('./_baseIsSet'),
81026 baseUnary = require('./_baseUnary'),
81027 nodeUtil = require('./_nodeUtil');
81028
81029/* Node.js helper references. */
81030var nodeIsSet = nodeUtil && nodeUtil.isSet;
81031
81032/**
81033 * Checks if `value` is classified as a `Set` object.
81034 *
81035 * @static
81036 * @memberOf _
81037 * @since 4.3.0
81038 * @category Lang
81039 * @param {*} value The value to check.
81040 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
81041 * @example
81042 *
81043 * _.isSet(new Set);
81044 * // => true
81045 *
81046 * _.isSet(new WeakSet);
81047 * // => false
81048 */
81049var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
81050
81051module.exports = isSet;
81052
81053},{"./_baseIsSet":482,"./_baseUnary":498,"./_nodeUtil":569}],618:[function(require,module,exports){
81054var baseGetTag = require('./_baseGetTag'),
81055 isArray = require('./isArray'),
81056 isObjectLike = require('./isObjectLike');
81057
81058/** `Object#toString` result references. */
81059var stringTag = '[object String]';
81060
81061/**
81062 * Checks if `value` is classified as a `String` primitive or object.
81063 *
81064 * @static
81065 * @since 0.1.0
81066 * @memberOf _
81067 * @category Lang
81068 * @param {*} value The value to check.
81069 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
81070 * @example
81071 *
81072 * _.isString('abc');
81073 * // => true
81074 *
81075 * _.isString(1);
81076 * // => false
81077 */
81078function isString(value) {
81079 return typeof value == 'string' ||
81080 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
81081}
81082
81083module.exports = isString;
81084
81085},{"./_baseGetTag":472,"./isArray":605,"./isObjectLike":616}],619:[function(require,module,exports){
81086var baseGetTag = require('./_baseGetTag'),
81087 isObjectLike = require('./isObjectLike');
81088
81089/** `Object#toString` result references. */
81090var symbolTag = '[object Symbol]';
81091
81092/**
81093 * Checks if `value` is classified as a `Symbol` primitive or object.
81094 *
81095 * @static
81096 * @memberOf _
81097 * @since 4.0.0
81098 * @category Lang
81099 * @param {*} value The value to check.
81100 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
81101 * @example
81102 *
81103 * _.isSymbol(Symbol.iterator);
81104 * // => true
81105 *
81106 * _.isSymbol('abc');
81107 * // => false
81108 */
81109function isSymbol(value) {
81110 return typeof value == 'symbol' ||
81111 (isObjectLike(value) && baseGetTag(value) == symbolTag);
81112}
81113
81114module.exports = isSymbol;
81115
81116},{"./_baseGetTag":472,"./isObjectLike":616}],620:[function(require,module,exports){
81117var baseIsTypedArray = require('./_baseIsTypedArray'),
81118 baseUnary = require('./_baseUnary'),
81119 nodeUtil = require('./_nodeUtil');
81120
81121/* Node.js helper references. */
81122var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
81123
81124/**
81125 * Checks if `value` is classified as a typed array.
81126 *
81127 * @static
81128 * @memberOf _
81129 * @since 3.0.0
81130 * @category Lang
81131 * @param {*} value The value to check.
81132 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
81133 * @example
81134 *
81135 * _.isTypedArray(new Uint8Array);
81136 * // => true
81137 *
81138 * _.isTypedArray([]);
81139 * // => false
81140 */
81141var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
81142
81143module.exports = isTypedArray;
81144
81145},{"./_baseIsTypedArray":483,"./_baseUnary":498,"./_nodeUtil":569}],621:[function(require,module,exports){
81146/**
81147 * Checks if `value` is `undefined`.
81148 *
81149 * @static
81150 * @since 0.1.0
81151 * @memberOf _
81152 * @category Lang
81153 * @param {*} value The value to check.
81154 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
81155 * @example
81156 *
81157 * _.isUndefined(void 0);
81158 * // => true
81159 *
81160 * _.isUndefined(null);
81161 * // => false
81162 */
81163function isUndefined(value) {
81164 return value === undefined;
81165}
81166
81167module.exports = isUndefined;
81168
81169},{}],622:[function(require,module,exports){
81170var arrayLikeKeys = require('./_arrayLikeKeys'),
81171 baseKeys = require('./_baseKeys'),
81172 isArrayLike = require('./isArrayLike');
81173
81174/**
81175 * Creates an array of the own enumerable property names of `object`.
81176 *
81177 * **Note:** Non-object values are coerced to objects. See the
81178 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
81179 * for more details.
81180 *
81181 * @static
81182 * @since 0.1.0
81183 * @memberOf _
81184 * @category Object
81185 * @param {Object} object The object to query.
81186 * @returns {Array} Returns the array of property names.
81187 * @example
81188 *
81189 * function Foo() {
81190 * this.a = 1;
81191 * this.b = 2;
81192 * }
81193 *
81194 * Foo.prototype.c = 3;
81195 *
81196 * _.keys(new Foo);
81197 * // => ['a', 'b'] (iteration order is not guaranteed)
81198 *
81199 * _.keys('hi');
81200 * // => ['0', '1']
81201 */
81202function keys(object) {
81203 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
81204}
81205
81206module.exports = keys;
81207
81208},{"./_arrayLikeKeys":452,"./_baseKeys":485,"./isArrayLike":606}],623:[function(require,module,exports){
81209var arrayLikeKeys = require('./_arrayLikeKeys'),
81210 baseKeysIn = require('./_baseKeysIn'),
81211 isArrayLike = require('./isArrayLike');
81212
81213/**
81214 * Creates an array of the own and inherited enumerable property names of `object`.
81215 *
81216 * **Note:** Non-object values are coerced to objects.
81217 *
81218 * @static
81219 * @memberOf _
81220 * @since 3.0.0
81221 * @category Object
81222 * @param {Object} object The object to query.
81223 * @returns {Array} Returns the array of property names.
81224 * @example
81225 *
81226 * function Foo() {
81227 * this.a = 1;
81228 * this.b = 2;
81229 * }
81230 *
81231 * Foo.prototype.c = 3;
81232 *
81233 * _.keysIn(new Foo);
81234 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
81235 */
81236function keysIn(object) {
81237 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
81238}
81239
81240module.exports = keysIn;
81241
81242},{"./_arrayLikeKeys":452,"./_baseKeysIn":486,"./isArrayLike":606}],624:[function(require,module,exports){
81243var arrayMap = require('./_arrayMap'),
81244 baseIteratee = require('./_baseIteratee'),
81245 baseMap = require('./_baseMap'),
81246 isArray = require('./isArray');
81247
81248/**
81249 * Creates an array of values by running each element in `collection` thru
81250 * `iteratee`. The iteratee is invoked with three arguments:
81251 * (value, index|key, collection).
81252 *
81253 * Many lodash methods are guarded to work as iteratees for methods like
81254 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
81255 *
81256 * The guarded methods are:
81257 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
81258 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
81259 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
81260 * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
81261 *
81262 * @static
81263 * @memberOf _
81264 * @since 0.1.0
81265 * @category Collection
81266 * @param {Array|Object} collection The collection to iterate over.
81267 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
81268 * @returns {Array} Returns the new mapped array.
81269 * @example
81270 *
81271 * function square(n) {
81272 * return n * n;
81273 * }
81274 *
81275 * _.map([4, 8], square);
81276 * // => [16, 64]
81277 *
81278 * _.map({ 'a': 4, 'b': 8 }, square);
81279 * // => [16, 64] (iteration order is not guaranteed)
81280 *
81281 * var users = [
81282 * { 'user': 'barney' },
81283 * { 'user': 'fred' }
81284 * ];
81285 *
81286 * // The `_.property` iteratee shorthand.
81287 * _.map(users, 'user');
81288 * // => ['barney', 'fred']
81289 */
81290function map(collection, iteratee) {
81291 var func = isArray(collection) ? arrayMap : baseMap;
81292 return func(collection, baseIteratee(iteratee, 3));
81293}
81294
81295module.exports = map;
81296
81297},{"./_arrayMap":453,"./_baseIteratee":484,"./_baseMap":487,"./isArray":605}],625:[function(require,module,exports){
81298var MapCache = require('./_MapCache');
81299
81300/** Error message constants. */
81301var FUNC_ERROR_TEXT = 'Expected a function';
81302
81303/**
81304 * Creates a function that memoizes the result of `func`. If `resolver` is
81305 * provided, it determines the cache key for storing the result based on the
81306 * arguments provided to the memoized function. By default, the first argument
81307 * provided to the memoized function is used as the map cache key. The `func`
81308 * is invoked with the `this` binding of the memoized function.
81309 *
81310 * **Note:** The cache is exposed as the `cache` property on the memoized
81311 * function. Its creation may be customized by replacing the `_.memoize.Cache`
81312 * constructor with one whose instances implement the
81313 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
81314 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
81315 *
81316 * @static
81317 * @memberOf _
81318 * @since 0.1.0
81319 * @category Function
81320 * @param {Function} func The function to have its output memoized.
81321 * @param {Function} [resolver] The function to resolve the cache key.
81322 * @returns {Function} Returns the new memoized function.
81323 * @example
81324 *
81325 * var object = { 'a': 1, 'b': 2 };
81326 * var other = { 'c': 3, 'd': 4 };
81327 *
81328 * var values = _.memoize(_.values);
81329 * values(object);
81330 * // => [1, 2]
81331 *
81332 * values(other);
81333 * // => [3, 4]
81334 *
81335 * object.a = 2;
81336 * values(object);
81337 * // => [1, 2]
81338 *
81339 * // Modify the result cache.
81340 * values.cache.set(object, ['a', 'b']);
81341 * values(object);
81342 * // => ['a', 'b']
81343 *
81344 * // Replace `_.memoize.Cache`.
81345 * _.memoize.Cache = WeakMap;
81346 */
81347function memoize(func, resolver) {
81348 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
81349 throw new TypeError(FUNC_ERROR_TEXT);
81350 }
81351 var memoized = function() {
81352 var args = arguments,
81353 key = resolver ? resolver.apply(this, args) : args[0],
81354 cache = memoized.cache;
81355
81356 if (cache.has(key)) {
81357 return cache.get(key);
81358 }
81359 var result = func.apply(this, args);
81360 memoized.cache = cache.set(key, result) || cache;
81361 return result;
81362 };
81363 memoized.cache = new (memoize.Cache || MapCache);
81364 return memoized;
81365}
81366
81367// Expose `MapCache`.
81368memoize.Cache = MapCache;
81369
81370module.exports = memoize;
81371
81372},{"./_MapCache":440}],626:[function(require,module,exports){
81373var createPadding = require('./_createPadding'),
81374 stringSize = require('./_stringSize'),
81375 toInteger = require('./toInteger'),
81376 toString = require('./toString');
81377
81378/**
81379 * Pads `string` on the right side if it's shorter than `length`. Padding
81380 * characters are truncated if they exceed `length`.
81381 *
81382 * @static
81383 * @memberOf _
81384 * @since 4.0.0
81385 * @category String
81386 * @param {string} [string=''] The string to pad.
81387 * @param {number} [length=0] The padding length.
81388 * @param {string} [chars=' '] The string used as padding.
81389 * @returns {string} Returns the padded string.
81390 * @example
81391 *
81392 * _.padEnd('abc', 6);
81393 * // => 'abc '
81394 *
81395 * _.padEnd('abc', 6, '_-');
81396 * // => 'abc_-_'
81397 *
81398 * _.padEnd('abc', 3);
81399 * // => 'abc'
81400 */
81401function padEnd(string, length, chars) {
81402 string = toString(string);
81403 length = toInteger(length);
81404
81405 var strLength = length ? stringSize(string) : 0;
81406 return (length && strLength < length)
81407 ? (string + createPadding(length - strLength, chars))
81408 : string;
81409}
81410
81411module.exports = padEnd;
81412
81413},{"./_createPadding":519,"./_stringSize":585,"./toInteger":632,"./toString":634}],627:[function(require,module,exports){
81414var baseProperty = require('./_baseProperty'),
81415 basePropertyDeep = require('./_basePropertyDeep'),
81416 isKey = require('./_isKey'),
81417 toKey = require('./_toKey');
81418
81419/**
81420 * Creates a function that returns the value at `path` of a given object.
81421 *
81422 * @static
81423 * @memberOf _
81424 * @since 2.4.0
81425 * @category Util
81426 * @param {Array|string} path The path of the property to get.
81427 * @returns {Function} Returns the new accessor function.
81428 * @example
81429 *
81430 * var objects = [
81431 * { 'a': { 'b': 2 } },
81432 * { 'a': { 'b': 1 } }
81433 * ];
81434 *
81435 * _.map(objects, _.property('a.b'));
81436 * // => [2, 1]
81437 *
81438 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
81439 * // => [1, 2]
81440 */
81441function property(path) {
81442 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
81443}
81444
81445module.exports = property;
81446
81447},{"./_baseProperty":490,"./_basePropertyDeep":491,"./_isKey":548,"./_toKey":588}],628:[function(require,module,exports){
81448/**
81449 * This method returns a new empty array.
81450 *
81451 * @static
81452 * @memberOf _
81453 * @since 4.13.0
81454 * @category Util
81455 * @returns {Array} Returns the new empty array.
81456 * @example
81457 *
81458 * var arrays = _.times(2, _.stubArray);
81459 *
81460 * console.log(arrays);
81461 * // => [[], []]
81462 *
81463 * console.log(arrays[0] === arrays[1]);
81464 * // => false
81465 */
81466function stubArray() {
81467 return [];
81468}
81469
81470module.exports = stubArray;
81471
81472},{}],629:[function(require,module,exports){
81473/**
81474 * This method returns `false`.
81475 *
81476 * @static
81477 * @memberOf _
81478 * @since 4.13.0
81479 * @category Util
81480 * @returns {boolean} Returns `false`.
81481 * @example
81482 *
81483 * _.times(2, _.stubFalse);
81484 * // => [false, false]
81485 */
81486function stubFalse() {
81487 return false;
81488}
81489
81490module.exports = stubFalse;
81491
81492},{}],630:[function(require,module,exports){
81493var baseTimes = require('./_baseTimes'),
81494 castFunction = require('./_castFunction'),
81495 toInteger = require('./toInteger');
81496
81497/** Used as references for various `Number` constants. */
81498var MAX_SAFE_INTEGER = 9007199254740991;
81499
81500/** Used as references for the maximum length and index of an array. */
81501var MAX_ARRAY_LENGTH = 4294967295;
81502
81503/* Built-in method references for those with the same name as other `lodash` methods. */
81504var nativeMin = Math.min;
81505
81506/**
81507 * Invokes the iteratee `n` times, returning an array of the results of
81508 * each invocation. The iteratee is invoked with one argument; (index).
81509 *
81510 * @static
81511 * @since 0.1.0
81512 * @memberOf _
81513 * @category Util
81514 * @param {number} n The number of times to invoke `iteratee`.
81515 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
81516 * @returns {Array} Returns the array of results.
81517 * @example
81518 *
81519 * _.times(3, String);
81520 * // => ['0', '1', '2']
81521 *
81522 * _.times(4, _.constant(0));
81523 * // => [0, 0, 0, 0]
81524 */
81525function times(n, iteratee) {
81526 n = toInteger(n);
81527 if (n < 1 || n > MAX_SAFE_INTEGER) {
81528 return [];
81529 }
81530 var index = MAX_ARRAY_LENGTH,
81531 length = nativeMin(n, MAX_ARRAY_LENGTH);
81532
81533 iteratee = castFunction(iteratee);
81534 n -= MAX_ARRAY_LENGTH;
81535
81536 var result = baseTimes(length, iteratee);
81537 while (++index < n) {
81538 iteratee(index);
81539 }
81540 return result;
81541}
81542
81543module.exports = times;
81544
81545},{"./_baseTimes":496,"./_castFunction":501,"./toInteger":632}],631:[function(require,module,exports){
81546var toNumber = require('./toNumber');
81547
81548/** Used as references for various `Number` constants. */
81549var INFINITY = 1 / 0,
81550 MAX_INTEGER = 1.7976931348623157e+308;
81551
81552/**
81553 * Converts `value` to a finite number.
81554 *
81555 * @static
81556 * @memberOf _
81557 * @since 4.12.0
81558 * @category Lang
81559 * @param {*} value The value to convert.
81560 * @returns {number} Returns the converted number.
81561 * @example
81562 *
81563 * _.toFinite(3.2);
81564 * // => 3.2
81565 *
81566 * _.toFinite(Number.MIN_VALUE);
81567 * // => 5e-324
81568 *
81569 * _.toFinite(Infinity);
81570 * // => 1.7976931348623157e+308
81571 *
81572 * _.toFinite('3.2');
81573 * // => 3.2
81574 */
81575function toFinite(value) {
81576 if (!value) {
81577 return value === 0 ? value : 0;
81578 }
81579 value = toNumber(value);
81580 if (value === INFINITY || value === -INFINITY) {
81581 var sign = (value < 0 ? -1 : 1);
81582 return sign * MAX_INTEGER;
81583 }
81584 return value === value ? value : 0;
81585}
81586
81587module.exports = toFinite;
81588
81589},{"./toNumber":633}],632:[function(require,module,exports){
81590var toFinite = require('./toFinite');
81591
81592/**
81593 * Converts `value` to an integer.
81594 *
81595 * **Note:** This method is loosely based on
81596 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
81597 *
81598 * @static
81599 * @memberOf _
81600 * @since 4.0.0
81601 * @category Lang
81602 * @param {*} value The value to convert.
81603 * @returns {number} Returns the converted integer.
81604 * @example
81605 *
81606 * _.toInteger(3.2);
81607 * // => 3
81608 *
81609 * _.toInteger(Number.MIN_VALUE);
81610 * // => 0
81611 *
81612 * _.toInteger(Infinity);
81613 * // => 1.7976931348623157e+308
81614 *
81615 * _.toInteger('3.2');
81616 * // => 3
81617 */
81618function toInteger(value) {
81619 var result = toFinite(value),
81620 remainder = result % 1;
81621
81622 return result === result ? (remainder ? result - remainder : result) : 0;
81623}
81624
81625module.exports = toInteger;
81626
81627},{"./toFinite":631}],633:[function(require,module,exports){
81628var isObject = require('./isObject'),
81629 isSymbol = require('./isSymbol');
81630
81631/** Used as references for various `Number` constants. */
81632var NAN = 0 / 0;
81633
81634/** Used to match leading and trailing whitespace. */
81635var reTrim = /^\s+|\s+$/g;
81636
81637/** Used to detect bad signed hexadecimal string values. */
81638var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
81639
81640/** Used to detect binary string values. */
81641var reIsBinary = /^0b[01]+$/i;
81642
81643/** Used to detect octal string values. */
81644var reIsOctal = /^0o[0-7]+$/i;
81645
81646/** Built-in method references without a dependency on `root`. */
81647var freeParseInt = parseInt;
81648
81649/**
81650 * Converts `value` to a number.
81651 *
81652 * @static
81653 * @memberOf _
81654 * @since 4.0.0
81655 * @category Lang
81656 * @param {*} value The value to process.
81657 * @returns {number} Returns the number.
81658 * @example
81659 *
81660 * _.toNumber(3.2);
81661 * // => 3.2
81662 *
81663 * _.toNumber(Number.MIN_VALUE);
81664 * // => 5e-324
81665 *
81666 * _.toNumber(Infinity);
81667 * // => Infinity
81668 *
81669 * _.toNumber('3.2');
81670 * // => 3.2
81671 */
81672function toNumber(value) {
81673 if (typeof value == 'number') {
81674 return value;
81675 }
81676 if (isSymbol(value)) {
81677 return NAN;
81678 }
81679 if (isObject(value)) {
81680 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
81681 value = isObject(other) ? (other + '') : other;
81682 }
81683 if (typeof value != 'string') {
81684 return value === 0 ? value : +value;
81685 }
81686 value = value.replace(reTrim, '');
81687 var isBinary = reIsBinary.test(value);
81688 return (isBinary || reIsOctal.test(value))
81689 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
81690 : (reIsBadHex.test(value) ? NAN : +value);
81691}
81692
81693module.exports = toNumber;
81694
81695},{"./isObject":615,"./isSymbol":619}],634:[function(require,module,exports){
81696var baseToString = require('./_baseToString');
81697
81698/**
81699 * Converts `value` to a string. An empty string is returned for `null`
81700 * and `undefined` values. The sign of `-0` is preserved.
81701 *
81702 * @static
81703 * @memberOf _
81704 * @since 4.0.0
81705 * @category Lang
81706 * @param {*} value The value to convert.
81707 * @returns {string} Returns the converted string.
81708 * @example
81709 *
81710 * _.toString(null);
81711 * // => ''
81712 *
81713 * _.toString(-0);
81714 * // => '-0'
81715 *
81716 * _.toString([1, 2, 3]);
81717 * // => '1,2,3'
81718 */
81719function toString(value) {
81720 return value == null ? '' : baseToString(value);
81721}
81722
81723module.exports = toString;
81724
81725},{"./_baseToString":497}],635:[function(require,module,exports){
81726var baseToString = require('./_baseToString'),
81727 castSlice = require('./_castSlice'),
81728 charsEndIndex = require('./_charsEndIndex'),
81729 stringToArray = require('./_stringToArray'),
81730 toString = require('./toString');
81731
81732/** Used to match leading and trailing whitespace. */
81733var reTrimEnd = /\s+$/;
81734
81735/**
81736 * Removes trailing whitespace or specified characters from `string`.
81737 *
81738 * @static
81739 * @memberOf _
81740 * @since 4.0.0
81741 * @category String
81742 * @param {string} [string=''] The string to trim.
81743 * @param {string} [chars=whitespace] The characters to trim.
81744 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
81745 * @returns {string} Returns the trimmed string.
81746 * @example
81747 *
81748 * _.trimEnd(' abc ');
81749 * // => ' abc'
81750 *
81751 * _.trimEnd('-_-abc-_-', '_-');
81752 * // => '-_-abc'
81753 */
81754function trimEnd(string, chars, guard) {
81755 string = toString(string);
81756 if (string && (guard || chars === undefined)) {
81757 return string.replace(reTrimEnd, '');
81758 }
81759 if (!string || !(chars = baseToString(chars))) {
81760 return string;
81761 }
81762 var strSymbols = stringToArray(string),
81763 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
81764
81765 return castSlice(strSymbols, 0, end).join('');
81766}
81767
81768module.exports = trimEnd;
81769
81770},{"./_baseToString":497,"./_castSlice":503,"./_charsEndIndex":504,"./_stringToArray":586,"./toString":634}],636:[function(require,module,exports){
81771var baseValues = require('./_baseValues'),
81772 keys = require('./keys');
81773
81774/**
81775 * Creates an array of the own enumerable string keyed property values of `object`.
81776 *
81777 * **Note:** Non-object values are coerced to objects.
81778 *
81779 * @static
81780 * @since 0.1.0
81781 * @memberOf _
81782 * @category Object
81783 * @param {Object} object The object to query.
81784 * @returns {Array} Returns the array of property values.
81785 * @example
81786 *
81787 * function Foo() {
81788 * this.a = 1;
81789 * this.b = 2;
81790 * }
81791 *
81792 * Foo.prototype.c = 3;
81793 *
81794 * _.values(new Foo);
81795 * // => [1, 2] (iteration order is not guaranteed)
81796 *
81797 * _.values('hi');
81798 * // => ['h', 'i']
81799 */
81800function values(object) {
81801 return object == null ? [] : baseValues(object, keys(object));
81802}
81803
81804module.exports = values;
81805
81806},{"./_baseValues":499,"./keys":622}],637:[function(require,module,exports){
81807'use strict'
81808var inherits = require('inherits')
81809var HashBase = require('hash-base')
81810var Buffer = require('safe-buffer').Buffer
81811
81812var ARRAY16 = new Array(16)
81813
81814function MD5 () {
81815 HashBase.call(this, 64)
81816
81817 // state
81818 this._a = 0x67452301
81819 this._b = 0xefcdab89
81820 this._c = 0x98badcfe
81821 this._d = 0x10325476
81822}
81823
81824inherits(MD5, HashBase)
81825
81826MD5.prototype._update = function () {
81827 var M = ARRAY16
81828 for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
81829
81830 var a = this._a
81831 var b = this._b
81832 var c = this._c
81833 var d = this._d
81834
81835 a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
81836 d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
81837 c = fnF(c, d, a, b, M[2], 0x242070db, 17)
81838 b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
81839 a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
81840 d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
81841 c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
81842 b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
81843 a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
81844 d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
81845 c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
81846 b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
81847 a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
81848 d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
81849 c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
81850 b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
81851
81852 a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
81853 d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
81854 c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
81855 b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
81856 a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
81857 d = fnG(d, a, b, c, M[10], 0x02441453, 9)
81858 c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
81859 b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
81860 a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
81861 d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
81862 c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
81863 b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
81864 a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
81865 d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
81866 c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
81867 b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
81868
81869 a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
81870 d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
81871 c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
81872 b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
81873 a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
81874 d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
81875 c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
81876 b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
81877 a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
81878 d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
81879 c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
81880 b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
81881 a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
81882 d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
81883 c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
81884 b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
81885
81886 a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
81887 d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
81888 c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
81889 b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
81890 a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
81891 d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
81892 c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
81893 b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
81894 a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
81895 d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
81896 c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
81897 b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
81898 a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
81899 d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
81900 c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
81901 b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
81902
81903 this._a = (this._a + a) | 0
81904 this._b = (this._b + b) | 0
81905 this._c = (this._c + c) | 0
81906 this._d = (this._d + d) | 0
81907}
81908
81909MD5.prototype._digest = function () {
81910 // create padding and handle blocks
81911 this._block[this._blockOffset++] = 0x80
81912 if (this._blockOffset > 56) {
81913 this._block.fill(0, this._blockOffset, 64)
81914 this._update()
81915 this._blockOffset = 0
81916 }
81917
81918 this._block.fill(0, this._blockOffset, 56)
81919 this._block.writeUInt32LE(this._length[0], 56)
81920 this._block.writeUInt32LE(this._length[1], 60)
81921 this._update()
81922
81923 // produce result
81924 var buffer = Buffer.allocUnsafe(16)
81925 buffer.writeInt32LE(this._a, 0)
81926 buffer.writeInt32LE(this._b, 4)
81927 buffer.writeInt32LE(this._c, 8)
81928 buffer.writeInt32LE(this._d, 12)
81929 return buffer
81930}
81931
81932function rotl (x, n) {
81933 return (x << n) | (x >>> (32 - n))
81934}
81935
81936function fnF (a, b, c, d, m, k, s) {
81937 return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0
81938}
81939
81940function fnG (a, b, c, d, m, k, s) {
81941 return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0
81942}
81943
81944function fnH (a, b, c, d, m, k, s) {
81945 return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0
81946}
81947
81948function fnI (a, b, c, d, m, k, s) {
81949 return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0
81950}
81951
81952module.exports = MD5
81953
81954},{"hash-base":380,"inherits":396,"safe-buffer":742}],638:[function(require,module,exports){
81955(function (Buffer){
81956// constant-space merkle root calculation algorithm
81957module.exports = function fastRoot (values, digestFn) {
81958 if (!Array.isArray(values)) throw TypeError('Expected values Array')
81959 if (typeof digestFn !== 'function') throw TypeError('Expected digest Function')
81960
81961 var length = values.length
81962 var results = values.concat()
81963
81964 while (length > 1) {
81965 var j = 0
81966
81967 for (var i = 0; i < length; i += 2, ++j) {
81968 var left = results[i]
81969 var right = i + 1 === length ? left : results[i + 1]
81970 var data = Buffer.concat([left, right])
81971
81972 results[j] = digestFn(data)
81973 }
81974
81975 length = j
81976 }
81977
81978 return results[0]
81979}
81980
81981}).call(this,require("buffer").Buffer)
81982},{"buffer":146}],639:[function(require,module,exports){
81983var bn = require('bn.js');
81984var brorand = require('brorand');
81985
81986function MillerRabin(rand) {
81987 this.rand = rand || new brorand.Rand();
81988}
81989module.exports = MillerRabin;
81990
81991MillerRabin.create = function create(rand) {
81992 return new MillerRabin(rand);
81993};
81994
81995MillerRabin.prototype._randbelow = function _randbelow(n) {
81996 var len = n.bitLength();
81997 var min_bytes = Math.ceil(len / 8);
81998
81999 // Generage random bytes until a number less than n is found.
82000 // This ensures that 0..n-1 have an equal probability of being selected.
82001 do
82002 var a = new bn(this.rand.generate(min_bytes));
82003 while (a.cmp(n) >= 0);
82004
82005 return a;
82006};
82007
82008MillerRabin.prototype._randrange = function _randrange(start, stop) {
82009 // Generate a random number greater than or equal to start and less than stop.
82010 var size = stop.sub(start);
82011 return start.add(this._randbelow(size));
82012};
82013
82014MillerRabin.prototype.test = function test(n, k, cb) {
82015 var len = n.bitLength();
82016 var red = bn.mont(n);
82017 var rone = new bn(1).toRed(red);
82018
82019 if (!k)
82020 k = Math.max(1, (len / 48) | 0);
82021
82022 // Find d and s, (n - 1) = (2 ^ s) * d;
82023 var n1 = n.subn(1);
82024 for (var s = 0; !n1.testn(s); s++) {}
82025 var d = n.shrn(s);
82026
82027 var rn1 = n1.toRed(red);
82028
82029 var prime = true;
82030 for (; k > 0; k--) {
82031 var a = this._randrange(new bn(2), n1);
82032 if (cb)
82033 cb(a);
82034
82035 var x = a.toRed(red).redPow(d);
82036 if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
82037 continue;
82038
82039 for (var i = 1; i < s; i++) {
82040 x = x.redSqr();
82041
82042 if (x.cmp(rone) === 0)
82043 return false;
82044 if (x.cmp(rn1) === 0)
82045 break;
82046 }
82047
82048 if (i === s)
82049 return false;
82050 }
82051
82052 return prime;
82053};
82054
82055MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
82056 var len = n.bitLength();
82057 var red = bn.mont(n);
82058 var rone = new bn(1).toRed(red);
82059
82060 if (!k)
82061 k = Math.max(1, (len / 48) | 0);
82062
82063 // Find d and s, (n - 1) = (2 ^ s) * d;
82064 var n1 = n.subn(1);
82065 for (var s = 0; !n1.testn(s); s++) {}
82066 var d = n.shrn(s);
82067
82068 var rn1 = n1.toRed(red);
82069
82070 for (; k > 0; k--) {
82071 var a = this._randrange(new bn(2), n1);
82072
82073 var g = n.gcd(a);
82074 if (g.cmpn(1) !== 0)
82075 return g;
82076
82077 var x = a.toRed(red).redPow(d);
82078 if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
82079 continue;
82080
82081 for (var i = 1; i < s; i++) {
82082 x = x.redSqr();
82083
82084 if (x.cmp(rone) === 0)
82085 return x.fromRed().subn(1).gcd(n);
82086 if (x.cmp(rn1) === 0)
82087 break;
82088 }
82089
82090 if (i === s) {
82091 x = x.redSqr();
82092 return x.fromRed().subn(1).gcd(n);
82093 }
82094 }
82095
82096 return false;
82097};
82098
82099},{"bn.js":108,"brorand":109}],640:[function(require,module,exports){
82100module.exports = assert;
82101
82102function assert(val, msg) {
82103 if (!val)
82104 throw new Error(msg || 'Assertion failed');
82105}
82106
82107assert.equal = function assertEqual(l, r, msg) {
82108 if (l != r)
82109 throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
82110};
82111
82112},{}],641:[function(require,module,exports){
82113'use strict';
82114
82115var utils = exports;
82116
82117function toArray(msg, enc) {
82118 if (Array.isArray(msg))
82119 return msg.slice();
82120 if (!msg)
82121 return [];
82122 var res = [];
82123 if (typeof msg !== 'string') {
82124 for (var i = 0; i < msg.length; i++)
82125 res[i] = msg[i] | 0;
82126 return res;
82127 }
82128 if (enc === 'hex') {
82129 msg = msg.replace(/[^a-z0-9]+/ig, '');
82130 if (msg.length % 2 !== 0)
82131 msg = '0' + msg;
82132 for (var i = 0; i < msg.length; i += 2)
82133 res.push(parseInt(msg[i] + msg[i + 1], 16));
82134 } else {
82135 for (var i = 0; i < msg.length; i++) {
82136 var c = msg.charCodeAt(i);
82137 var hi = c >> 8;
82138 var lo = c & 0xff;
82139 if (hi)
82140 res.push(hi, lo);
82141 else
82142 res.push(lo);
82143 }
82144 }
82145 return res;
82146}
82147utils.toArray = toArray;
82148
82149function zero2(word) {
82150 if (word.length === 1)
82151 return '0' + word;
82152 else
82153 return word;
82154}
82155utils.zero2 = zero2;
82156
82157function toHex(msg) {
82158 var res = '';
82159 for (var i = 0; i < msg.length; i++)
82160 res += zero2(msg[i].toString(16));
82161 return res;
82162}
82163utils.toHex = toHex;
82164
82165utils.encode = function encode(arr, enc) {
82166 if (enc === 'hex')
82167 return toHex(arr);
82168 else
82169 return arr;
82170};
82171
82172},{}],642:[function(require,module,exports){
82173var HttpRequest = require("./lib/httprequest");
82174var Neb = require('./lib/neb');
82175var Account = require('./lib/account');
82176var Transaction = require('./lib/transaction');
82177var Utils = require('./lib/utils/utils');
82178var CryptoUtils = require('./lib/utils/crypto-utils');
82179var Unit = require('./lib/utils/unit');
82180var NVM = require('./lib/nvm/nvm');
82181
82182// dont override global variable
82183if (typeof window !== 'undefined' && typeof window.Neb === 'undefined') {
82184 window.Neb = Neb;
82185}
82186
82187module.exports = {
82188 HttpRequest: HttpRequest,
82189 Neb: Neb,
82190 Account: Account,
82191 Transaction: Transaction,
82192 Utils: Utils,
82193 CryptoUtils: CryptoUtils,
82194 Unit: Unit,
82195 NVM: NVM
82196};
82197
82198},{"./lib/account":643,"./lib/httprequest":646,"./lib/neb":647,"./lib/nvm/nvm":659,"./lib/transaction":661,"./lib/utils/crypto-utils":662,"./lib/utils/unit":663,"./lib/utils/utils":664}],643:[function(require,module,exports){
82199"use strict";
82200
82201var Buffer = require('safe-buffer').Buffer;
82202var Base58 = require('bs58');
82203var cryptoUtils = require('./utils/crypto-utils.js');
82204var utils = require('./utils/utils.js');
82205
82206var AddressLength = 26;
82207var AddressPrefix = 25;
82208var NormalType = 87;
82209var ContractType = 88;
82210
82211var KeyVersion3 = 3;
82212var KeyCurrentVersion = 4;
82213
82214/**
82215 * @typedef {Object} KeyOptions
82216 * @property {Buffer} salt
82217 * @property {Buffer} iv
82218 * @property {String} kdf
82219 * @property {Number} dklen
82220 * @property {Number} c
82221 * @property {Number} n
82222 * @property {Number} r
82223 * @property {Number} p
82224 * @property {String} cipher
82225 * @property {Buffer} uuid
82226 * @global
82227 */
82228
82229/**
82230 * Key Object.
82231 * @typedef {Object} Key
82232 * @property {Number} version
82233 * @property {Buffer} id
82234 * @property {HexString} address
82235 * @property {Object} crypto
82236 * @global
82237 */
82238
82239/**
82240 * Account constructor.
82241 * Class encapsulate main operation with account entity.
82242 * @constructor
82243 *
82244 * @param {Hash} priv Account private key.
82245 * @param {String} path
82246 *
82247 * @example var account = new Account(new Buffer("ac3773e06ae74c0fa566b0e421d4e391333f31aef90b383f0c0e83e4873609d6", "hex") );
82248 *
82249 */
82250var Account = function (priv, path) {
82251 priv = priv || cryptoUtils.crypto.randomBytes(32);
82252 this.setPrivateKey(priv);
82253 this.path = path;
82254};
82255
82256/**
82257 * Account factory method.
82258 * Create random account.
82259 * @static
82260 *
82261 * @return {Account} Instance of Account constructor.
82262 *
82263 * @example var account = Account.NewAccount();
82264 */
82265Account.NewAccount = function () {
82266 return new Account(cryptoUtils.crypto.randomBytes(32));
82267};
82268
82269/**
82270 * Address validation method.
82271 *
82272 * @static
82273 * @param {String/Hash} addr - Account address.
82274 * @param {Number} type - NormalType / ContractType
82275 *
82276 * @return {Boolean} Is address has correct format.
82277 *
82278 * @example
82279 * if ( Account.isValidAddress("n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5") ) {
82280 * // some code
82281 * };
82282 */
82283Account.isValidAddress = function (addr, type) {
82284 /*jshint maxcomplexity:10 */
82285
82286 if (utils.isString(addr)) {
82287 try {
82288 addr = Base58.decode(addr);
82289 } catch (e) {
82290 console.log("invalid address.");
82291 // if address can't be base58 decode, return false.
82292 return false;
82293 }
82294 } else if (!Buffer.isBuffer(addr)) {
82295 return false;
82296 }
82297 // address not equal to 26
82298 if (addr.length !== AddressLength) {
82299 return false;
82300 }
82301
82302 // check if address start with AddressPrefix
82303 var buff = Buffer.from(addr);
82304 if (buff.readUIntBE(0, 1) !== AddressPrefix) {
82305 return false;
82306 }
82307
82308 // check if address type is NormalType or ContractType
82309 var t = buff.readUIntBE(1, 1);
82310 if (utils.isNumber(type) && (type === NormalType || type === ContractType)) {
82311 if (t !== type) {
82312 return false;
82313 }
82314 } else if (t !== NormalType && t !== ContractType) {
82315 return false;
82316 }
82317 var content = addr.slice(0, 22);
82318 var checksum = addr.slice(-4);
82319 return Buffer.compare(cryptoUtils.sha3(content).slice(0, 4), checksum) === 0;
82320};
82321
82322/**
82323 * Restore account from address.
82324 * Receive addr or Account instance.
82325 * If addr is Account instance return new Account instance with same PrivateKey.
82326 *
82327 * @static
82328 * @param {(Hash|Object)} - Client address or Account instance.
82329 *
82330 * @return {Account} Instance of Account restored from address.
82331 *
82332 * @example var account = Account.fromAddress("n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5");
82333 */
82334Account.fromAddress = function (addr) {
82335 var acc = new Account();
82336 if (addr instanceof Account) {
82337 acc.setPrivateKey(addr.getPrivateKey());
82338 return acc;
82339 }
82340 if (utils.isString(addr) && this.isValidAddress(addr)) {
82341 acc.address = Base58.decode(addr);
82342 return acc;
82343 }
82344
82345 var buf = cryptoUtils.toBuffer(addr);
82346 if (this.isValidAddress(buf)) {
82347 acc.address = buf;
82348 return acc;
82349 }
82350 throw new Error("invalid address");
82351};
82352
82353/**
82354 * Restore account from public key.
82355 *
82356 * @static
82357 * @param {(String/Hash)} - Public key.
82358 *
82359 * @return {Account} Instance of Account restored from address.
82360 *
82361 * @example var account = Account.fromPubKey("f18ec04019dd131bbcfada4020b001d547244d768f144ef947577ce53a13ad690eb43e4b02a8daa3c168045cd122c0685f083e1656756ba7982721322ebe4da7");
82362 */
82363Account.fromPubKey = function (publicKey) {
82364 var acc = new Account();
82365 acc.pubKey = cryptoUtils.toBuffer(publicKey);
82366 return acc;
82367};
82368
82369
82370Account.getNormalType = function () {
82371 return NormalType;
82372};
82373
82374Account.getContractType = function () {
82375 return ContractType;
82376};
82377
82378Account.prototype = {
82379 /**
82380 * Private Key setter.
82381 *
82382 * @param {Hash} priv - Account private key.
82383 *
82384 * @example account.setPrivateKey("ac3773e06ae74c0fa566b0e421d4e391333f31aef90b383f0c0e83e4873609d6");
82385 */
82386 setPrivateKey: function (priv) {
82387 if (utils.isString(priv) || Buffer.isBuffer(priv)) {
82388 this.privKey = priv.length === 32 ? priv : Buffer(priv, 'hex');
82389 this.pubKey = null;
82390 this.address = null;
82391 }
82392 },
82393 /**
82394 * Private Key getter.
82395 *
82396 * @return {Buffer} Account private key.
82397 *
82398 * @example var privKey = account.getPrivateKey();
82399 * //<Buffer 5b ed 67 f9 9c b3 31 9e 0c 6f 6a 03 54 8b e3 c8 c5 2a 83 64 46 4f 88 6f> 24
82400 */
82401 getPrivateKey: function () {
82402 return this.privKey;
82403 },
82404 /**
82405 * Get Private Key in hex string format.
82406 *
82407 * @return {HexString} Account private key in String format.
82408 *
82409 * @example var privKey = account.getPrivateKeyString();
82410 * //"ac3773e06ae74c0fa566b0e421d4e391333f31aef90b383f0c0e83e4873609d6"
82411 */
82412 getPrivateKeyString: function () {
82413 return this.getPrivateKey().toString('hex');
82414 },
82415 /**
82416 * Public Key getter.
82417 *
82418 * @return {Buffer} Account public key.
82419 *
82420 * @example var publicKey = account.getPublicKey();
82421 * //<Buffer c0 96 aa 4e 66 c7 4a 9a c7 18 31 f1 24 72 2a c1 3e b5 df 7f 97 1b 13 1d 46 a2 8a e6 81 c6 1d 96 f7 07 d0 aa e9 a7 67 436b 68 af a8 f0 96 65 17 24 29 ... >
82422 */
82423 getPublicKey: function () {
82424 if (utils.isNull(this.pubKey)) {
82425 this.pubKey = cryptoUtils.privateToPublic(this.privKey);
82426 }
82427 return this.pubKey;
82428 },
82429 /**
82430 * Get Public Key in hex string format.
82431 *
82432 * @return {HexString} Account public key in String format.
82433 *
82434 * @example var publicKey = account.getPublicKey();
82435 * //"f18ec04019dd131bbcfada4020b001d547244d768f144ef947577ce53a13ad690eb43e4b02a8daa3c168045cd122c0685f083e1656756ba7982721322ebe4da7"
82436 */
82437 getPublicKeyString: function () {
82438 return this.getPublicKey().toString('hex');
82439 },
82440 /**
82441 * Accaunt address getter.
82442 *
82443 * @return {Buffer} Account address.
82444 *
82445 * @example var publicKey = account.getAddress();
82446 * //<Buffer 7f 87 83 58 46 96 12 7d 1a c0 57 1a 42 87 c6 25 36 08 ff 32 61 36 51 7c>
82447 */
82448 getAddress: function () {
82449 if (utils.isNull(this.address)) {
82450
82451 var pubKey = this.getPublicKey();
82452 if (pubKey.length !== 64) {
82453 pubKey = cryptoUtils.secp256k1.publicKeyConvert(pubKey, false).slice(1);
82454 }
82455
82456 // The uncompressed form consists of a 0x04 (in analogy to the DER OCTET STRING tag) plus
82457 // the concatenation of the binary representation of the X coordinate plus the binary
82458 // representation of the y coordinate of the public point.
82459 pubKey = Buffer.concat([cryptoUtils.toBuffer(4), pubKey]);
82460
82461 // Only take the lower 160bits of the hash
82462 var content = cryptoUtils.sha3(pubKey);
82463 content = cryptoUtils.ripemd160(content);
82464 // content = AddressPrefix + NormalType + content(local address only use normal type)
82465 content = Buffer.concat([cryptoUtils.toBuffer(AddressPrefix), cryptoUtils.toBuffer(NormalType), content]);
82466 var checksum = cryptoUtils.sha3(content).slice(0, 4);
82467 this.address = Buffer.concat([content, checksum]);
82468 }
82469 return this.address;
82470 },
82471 /**
82472 * Get account address in hex string format.
82473 *
82474 * @return {HexString} Account address in String format.
82475 *
82476 * @example var publicKey = account.getAddressString();
82477 * //"802d529bf55d6693b3ac72c59b4a7d159da53cae5a7bf99c"
82478 */
82479 getAddressString: function () {
82480 var addr = this.getAddress();
82481 return Base58.encode(addr);
82482 },
82483 /**
82484 * Generate key buy passphrase and options.
82485 *
82486 * @param {Password} password - Provided password.
82487 * @param {KeyOptions} opts - Key options.
82488 *
82489 * @return {Key} Key Object.
82490 *
82491 * @example var key = account.toKey("passphrase");
82492 */
82493 toKey: function (password, opts) {
82494 /*jshint maxcomplexity:17 */
82495
82496 opts = opts || {};
82497 var salt = opts.salt || cryptoUtils.crypto.randomBytes(32);
82498 var iv = opts.iv || cryptoUtils.crypto.randomBytes(16);
82499 var derivedKey;
82500 var kdf = opts.kdf || 'scrypt';
82501 var kdfparams = {
82502 dklen: opts.dklen || 32,
82503 salt: salt.toString('hex')
82504 };
82505 if (kdf === 'pbkdf2') {
82506 kdfparams.c = opts.c || 262144;
82507 kdfparams.prf = 'hmac-sha256';
82508 derivedKey = cryptoUtils.crypto.pbkdf2Sync(new Buffer(password), salt, kdfparams.c, kdfparams.dklen, 'sha256');
82509 } else if (kdf === 'scrypt') {
82510 kdfparams.n = opts.n || 4096;
82511 kdfparams.r = opts.r || 8;
82512 kdfparams.p = opts.p || 1;
82513 derivedKey = cryptoUtils.scrypt(new Buffer(password), salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
82514 } else {
82515 throw new Error('Unsupported kdf');
82516 }
82517 var cipher = cryptoUtils.crypto.createCipheriv(opts.cipher || 'aes-128-ctr', derivedKey.slice(0, 16), iv);
82518 if (!cipher) {
82519 throw new Error('Unsupported cipher');
82520 }
82521 var ciphertext = Buffer.concat([cipher.update(this.privKey), cipher.final()]);
82522 // var mac = cryptoUtils.sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex')])); // KeyVersion3 deprecated
82523 var mac = cryptoUtils.sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex'), iv, new Buffer(opts.cipher || 'aes-128-ctr')]));
82524 return {
82525 version: KeyCurrentVersion,
82526 id: cryptoUtils.uuid.v4({
82527 random: opts.uuid || cryptoUtils.crypto.randomBytes(16)
82528 }),
82529 address: this.getAddressString(),
82530 crypto: {
82531 ciphertext: ciphertext.toString('hex'),
82532 cipherparams: {
82533 iv: iv.toString('hex')
82534 },
82535 cipher: opts.cipher || 'aes-128-ctr',
82536 kdf: kdf,
82537 kdfparams: kdfparams,
82538 mac: mac.toString('hex'),
82539 machash: "sha3256"
82540 }
82541 };
82542 },
82543 /**
82544 * Generate key buy passphrase and options.
82545 * Return in JSON format.
82546 *
82547 * @param {Password} password - Provided password.
82548 * @param {KeyOptions} opts - Key options.
82549 *
82550 * @return {String} JSON stringify Key.
82551 *
82552 * @example var key = account.toKeyString("passphrase");
82553 */
82554 toKeyString: function (password, opts) {
82555 return JSON.stringify(this.toKey(password, opts));
82556 },
82557 /**
82558 * Restore account from key and passphrase.
82559 *
82560 * @param {Key} input - Key Object.
82561 * @param {Password} password - Provided password.
82562 * @param {Boolean} nonStrict - Strict сase sensitivity flag.
82563 *
82564 * @return {@link Account} - Instance of Account restored from key and passphrase.
82565 */
82566 fromKey: function (input, password, nonStrict) {
82567 /*jshint maxcomplexity:10 */
82568
82569 var json = (typeof input === 'object') ? input : JSON.parse(nonStrict ? input.toLowerCase() : input);
82570 if (json.version !== KeyVersion3 && json.version !== KeyCurrentVersion) {
82571 throw new Error('Not supported wallet version');
82572 }
82573 var derivedKey;
82574 var kdfparams;
82575 if (json.crypto.kdf === 'scrypt') {
82576 kdfparams = json.crypto.kdfparams;
82577 derivedKey = cryptoUtils.scrypt(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
82578 } else if (json.crypto.kdf === 'pbkdf2') {
82579 kdfparams = json.crypto.kdfparams;
82580 if (kdfparams.prf !== 'hmac-sha256') {
82581 throw new Error('Unsupported parameters to PBKDF2');
82582 }
82583 derivedKey = cryptoUtils.crypto.pbkdf2Sync(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256');
82584 } else {
82585 throw new Error('Unsupported key derivation scheme');
82586 }
82587 var ciphertext = new Buffer(json.crypto.ciphertext, 'hex');
82588 var mac;
82589
82590 if (json.version === KeyCurrentVersion) {
82591 mac = cryptoUtils.sha3(Buffer.concat([derivedKey.slice(16, 32), ciphertext,
82592 new Buffer(json.crypto.cipherparams.iv, 'hex'), new Buffer(json.crypto.cipher)]));
82593 } else {
82594 // KeyVersion3
82595 mac = cryptoUtils.sha3(Buffer.concat([derivedKey.slice(16, 32), ciphertext]));
82596 }
82597
82598 if (mac.toString('hex') !== json.crypto.mac) {
82599 throw new Error('Key derivation failed - possibly wrong passphrase');
82600 }
82601 var decipher = cryptoUtils.crypto.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex'));
82602 var seed = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
82603 while (seed.length < 32) {
82604 var nullBuff = new Buffer([0x00]);
82605 seed = Buffer.concat([nullBuff, seed]);
82606 }
82607 this.setPrivateKey(seed);
82608 return this;
82609 }
82610
82611};
82612
82613
82614module.exports = Account;
82615
82616},{"./utils/crypto-utils.js":662,"./utils/utils.js":664,"bs58":138,"safe-buffer":742}],644:[function(require,module,exports){
82617
82618"use strict";
82619
82620var utils = require('./utils/utils.js');
82621
82622/**
82623 * Admin API constructor.
82624 * Class encapsulate methods for admin APIs commands.
82625 * @see [Admin API documentation:]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md}.
82626 * @constructor
82627 *
82628 * @param {Neb} neb - Instance of Neb library.
82629 *
82630 * @example
82631 * var admin = new Admin( new Neb() );
82632 * // or just
82633 * var admin = new Neb().admin;
82634 */
82635var Admin = function (neb) {
82636 this._setRequest(neb._request);
82637};
82638
82639/**
82640 * @private
82641 * @param {Request} request - transport wrapper.
82642 */
82643Admin.prototype._setRequest = function (request) {
82644 this._request = request;
82645 this._path = '/admin';
82646};
82647
82648/**
82649 * Method get info about nodes in Nebulas Network.
82650 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#nodeinfo}
82651 *
82652 * @return [nodeInfoObject]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#nodeinfo}
82653 *
82654 * @example
82655 * var admin = new Neb().admin;
82656 * admin.nodeInfo().then(function(info) {
82657 * //code
82658 * });
82659 */
82660Admin.prototype.nodeInfo = function () {
82661 return this._sendRequest("get", "/nodeinfo", null);
82662};
82663
82664/**
82665 * Method get list of available addresses.
82666 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#accounts}
82667 *
82668 * @return [accountsList]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#accounts}
82669 *
82670 * @example
82671 * var admin = new Neb().admin;
82672 * admin.accounts().then(function(accounts) {
82673 * //code
82674 * });
82675 */
82676Admin.prototype.accounts = function () {
82677 return this._sendRequest("get", "/accounts", null);
82678};
82679
82680/**
82681 * Method create a new account in Nebulas network with provided passphrase.
82682 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#newaccount}
82683 *
82684 * @param {Object} options
82685 * @param {Password} options.passphrase
82686 *
82687 * @return [address]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#newaccount}
82688 *
82689 * @example
82690 * var admin = new Neb().admin;
82691 * admin.newAccount({passphrase: "passphrase"}).then(function(address) {
82692 * //code
82693 * });
82694 */
82695Admin.prototype.newAccount = function (options) {
82696 options = utils.argumentsToObject(['passphrase'], arguments);
82697 var params = { "passphrase": options.passphrase };
82698 return this._sendRequest("post", "/account/new", params);
82699};
82700
82701/**
82702 * Method unlock account with provided passphrase.
82703 * After the default unlock time, the account will be locked.
82704 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#unlockaccount}
82705 *
82706 * @param {Object} options
82707 * @param {HexString} options.address
82708 * @param {Password} options.passphrase
82709 * @param {Number} options.duration
82710 *
82711 * @return [isUnLocked]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#unlockaccount}
82712 *
82713 * @example
82714 * var admin = new Neb().admin;
82715 * admin.unlockAccount({
82716 * address: "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh",
82717 * passphrase: "passphrase",
82718 * duration: 1000000000
82719 * }).then(function(isUnLocked) {
82720 * //code
82721 * });
82722 */
82723Admin.prototype.unlockAccount = function (options) {
82724 options = utils.argumentsToObject(['address', 'passphrase', 'duration'], arguments);
82725 var params = {
82726 "address": options.address,
82727 "passphrase": options.passphrase,
82728 "duration": options.duration
82729 };
82730 return this._sendRequest("post", "/account/unlock", params);
82731};
82732
82733/**
82734 * Method lock account.
82735 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#lockaccount}
82736 *
82737 * @param {Object} options
82738 * @param {HexString} options.address
82739 *
82740 * @return [isLocked]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#lockaccount}
82741 *
82742 * @example
82743 * var admin = new Neb().admin;
82744 * admin.lockAccount({address: "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh"}).then(function(isLocked) {
82745 * //code
82746 * });
82747 */
82748Admin.prototype.lockAccount = function (options) {
82749 options = utils.argumentsToObject(['address'], arguments);
82750 var params = { "address": options.address };
82751 return this._sendRequest("post", "/account/lock", params);
82752};
82753
82754/**
82755 * Method wrap transaction sending functionality.
82756 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#sendtransaction}
82757 *
82758 * @param {TransactionOptions} options
82759 *
82760 * @return [Transcation hash and contract address]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#sendtransaction}
82761 *
82762 * @example
82763 * var admin = new Neb().admin;
82764 * admin.sendTransaction({
82765 * from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
82766 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
82767 * value: 10,
82768 * nonce: 12,
82769 * gasPrice: 1000000,
82770 * gasLimit: 2000000
82771 * }).then(function(tx) {
82772 * //code
82773 * });
82774 */
82775Admin.prototype.sendTransaction = function (options) {
82776 options = utils.argumentsToObject(['from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract', 'binary'], arguments);
82777 var params = {
82778 "from": options.from,
82779 "to": options.to,
82780 "value": utils.toString(options.value),
82781 "nonce": options.nonce,
82782 "gasPrice": utils.toString(options.gasPrice),
82783 "gasLimit": utils.toString(options.gasLimit),
82784 "contract": options.contract,
82785 "binary": options.binary
82786 };
82787 return this._sendRequest("post", "/transaction", params);
82788};
82789
82790/**
82791 * Method sign hash.
82792 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#signhash}
82793 *
82794 * @param {Object} options
82795 * @param {HexString} options.address
82796 * @param {Base64} options.hash of hash bytes with base64 encode.
82797 * @param {UInt32} options.alg
82798 *
82799 * @return [data]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#signhash}
82800 *
82801 * @example
82802 * var admin = new Neb().admin;
82803 * admin.SignHash({
82804 * address: "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh",
82805 * hash: "OGQ5NjllZWY2ZWNhZDNjMjlhM2E2MjkyODBlNjg2Y2YwYzNmNWQ1YTg2YWZmM2NhMTIwMjBjOTIzYWRjNmM5Mg==",
82806 * alg: 1
82807 * }).then(function(data) {
82808 * //code
82809 * });
82810 */
82811Admin.prototype.signHash = function (options) {
82812 options = utils.argumentsToObject(['address', 'hash', 'alg'], arguments);
82813 var params = {
82814 "address": options.address,
82815 "hash": options.hash,
82816 "alg": options.alg
82817 };
82818 return this._sendRequest("post", "/sign/hash", params);
82819};
82820
82821/**
82822 * Method sign transaction with passphrase.
82823 * The transaction's from addrees must be unlock before sign call.
82824 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#signtransactionwithpassphrase}
82825 *
82826 * @param {TransactionOptions} options
82827 * @param {Password} options.passphrase
82828 *
82829 * @return [Transcation hash and contract address]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#signtransactionwithpassphrase}
82830 *
82831 * @example
82832 * var admin = new Neb().admin;
82833 * admin.signTransactionWithPassphrase({
82834 * from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
82835 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
82836 * value: 10,
82837 * nonce: 12,
82838 * gasPrice: 1000000,
82839 * gasLimit: 2000000,
82840 * passphrase: "passphrase"
82841 * }).then(function(tx) {
82842 * //code
82843 * });
82844 */
82845Admin.prototype.signTransactionWithPassphrase = function (options) {
82846 options = utils.argumentsToObject(['from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract', 'binary', 'passphrase'], arguments);
82847 var tx = {
82848 "from": options.from,
82849 "to": options.to,
82850 "value": utils.toString(options.value),
82851 "nonce": options.nonce,
82852 "gasPrice": utils.toString(options.gasPrice),
82853 "gasLimit": utils.toString(options.gasLimit),
82854 "contract": options.contract,
82855 "binary": options.binary
82856 };
82857 var params = {
82858 "transaction": tx,
82859 "passphrase": options.passphrase
82860 };
82861 return this._sendRequest("post", "/sign", params);
82862};
82863
82864/**
82865 * Method send transaction with passphrase.
82866 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#sendtransactionwithpassphrase}
82867 *
82868 * @param {TransactionOptions} options
82869 * @param {Password} options.passphrase
82870 *
82871 * @return [data]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#sendtransactionwithpassphrase}
82872 *
82873 * @example
82874 * var admin = new Neb().admin;
82875 * admin.sendTransactionWithPassphrase({
82876 * from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
82877 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
82878 * value: 10,
82879 * nonce: 12,
82880 * gasPrice: 1000000,
82881 * gasLimit: 2000000,
82882 * passphrase: "passphrase"
82883 * }).then(function(tx) {
82884 * //code
82885 * });
82886 */
82887Admin.prototype.sendTransactionWithPassphrase = function (options) {
82888 options = utils.argumentsToObject(['from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract', 'binary', 'passphrase'], arguments);
82889 var tx = {
82890 "from": options.from,
82891 "to": options.to,
82892 "value": utils.toString(options.value),
82893 "nonce": options.nonce,
82894 "gasPrice": utils.toString(options.gasPrice),
82895 "gasLimit": utils.toString(options.gasLimit),
82896 "contract": options.contract,
82897 "binary": options.binary
82898 };
82899 var params = {
82900 "transaction": tx,
82901 "passphrase": options.passphrase
82902 };
82903 return this._sendRequest("post", "/transactionWithPassphrase", params);
82904};
82905
82906/**
82907 * Method start listen provided port.
82908 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#startpprof}
82909 *
82910 * @param {Object} options
82911 * @param {String} options.listen - Listen port.
82912 *
82913 * @return [isListenStrted]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#startpprof}
82914 *
82915 * @example
82916 * var admin = new Neb().admin;
82917 * admin.startPprof({listen: '8080'}).then(function(isListenStrted) {
82918 * //code
82919 * });
82920 */
82921Admin.prototype.startPprof = function (options) {
82922 options = utils.argumentsToObject(['listen'], arguments);
82923 var params = { "listen": options.listen };
82924 return this._sendRequest("post", "/pprof", params);
82925};
82926
82927/**
82928 * Method get config of node in Nebulas Network.
82929 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#getConfig}
82930 *
82931 * @return [config]{@link https://github.com/nebulasio/wiki/blob/master/rpc_admin.md#getConfig}
82932 *
82933 * @example
82934 * var admin = new Neb().admin;
82935 * admin.getConfig().then(function(info) {
82936 * //code
82937 * });
82938 */
82939Admin.prototype.getConfig = function () {
82940 return this._sendRequest("get", "/getConfig", null);
82941};
82942
82943Admin.prototype._sendRequest = function (method, api, params, callback) {
82944 var action = this._path + api;
82945 if (typeof callback === "function") {
82946 return this._request.asyncRequest(method, action, params, callback);
82947 } else {
82948 return this._request.request(method, action, params);
82949 }
82950};
82951
82952module.exports = Admin;
82953
82954},{"./utils/utils.js":664}],645:[function(require,module,exports){
82955
82956"use strict";
82957
82958var utils = require('./utils/utils.js');
82959
82960/**
82961 * User API constructor.
82962 * Class encapsulate methods for building distributed applications and services.
82963 *
82964 * @see [API documentation]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md}
82965 * @constructor
82966 *
82967 * @param {Neb} neb - Instance of Neb library.
82968 *
82969 * @example
82970 * var api = new API ( new Neb() );
82971 * // or just
82972 * var api = new Neb().api;
82973 */
82974var API = function (neb) {
82975 this._setRequest(neb._request);
82976};
82977
82978/**
82979 * @private
82980 * @param {Request} request - transport wrapper.
82981 */
82982API.prototype._setRequest = function (request) {
82983 this._request = request;
82984 this._path = '/user';
82985};
82986
82987/**
82988 * Method get state of Nebulas Network.
82989 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getnebstate}
82990 *
82991 * @return [NebStateObject]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getnebstate}
82992 *
82993 * @example
82994 * var api = new Neb().api;
82995 * api.getNebState().then(function(state) {
82996 * //code
82997 * });
82998 */
82999API.prototype.getNebState = function () {
83000 return this._sendRequest("get", "/nebstate", null);
83001};
83002
83003/**
83004 * Method get latest irreversible block of Nebulas Network.
83005 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#latestirreversibleblock}
83006 *
83007 * @return [dataBlockInfo.]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#latestirreversibleblock}
83008 *
83009 * @example
83010 * var api = new Neb().api;
83011 * api.latestIrreversibleBlock().then(function(blockData) {
83012 * //code
83013 * });
83014 */
83015API.prototype.latestIrreversibleBlock = function () {
83016 return this._sendRequest("get", "/lib", null);
83017
83018};
83019
83020/**
83021 * Method return the state of the account. Balance and nonce.
83022 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getaccountstate}
83023 *
83024 * @param {Object} options
83025 * @param {HexString} options.address
83026 * @param {String} options.height
83027 *
83028 * @return [accaountStateObject]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getaccountstate}
83029 *
83030 * @example
83031 * var api = new Neb().api;
83032 * api.getAccountState({address: "n1QsosVXKxiV3B4iDWNmxfN4VqpHn2TeUcn"}).then(function(state) {
83033 * //code
83034 * });
83035 */
83036API.prototype.getAccountState = function (options) {
83037 options = utils.argumentsToObject(['address', 'height'], arguments);
83038 var params = { "address": options.address, "height": options.height };
83039 return this._sendRequest("post", "/accountstate", params);
83040};
83041
83042/**
83043 * Method wrap smart contract call functionality.
83044 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#call}
83045 *
83046 * @param {TransactionOptions} options
83047 *
83048 * @return [Transcation hash]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#call}
83049 *
83050 * @example
83051 * var api = new Neb().api;
83052 * api.call({
83053 * chainID: 1,
83054 * from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
83055 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
83056 * value: 10,
83057 * nonce: 12,
83058 * gasPrice: 1000000,
83059 * gasLimit: 2000000,
83060 * contract: {
83061 * function: "save",
83062 * args: "[0]"
83063 * }
83064 * }).then(function(tx) {
83065 * //code
83066 * });
83067 */
83068API.prototype.call = function (options) {
83069 options = utils.argumentsToObject(['from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract'], arguments);
83070 var params = {
83071 "from": options.from,
83072 "to": options.to,
83073 "value": utils.toString(options.value),
83074 "nonce": options.nonce,
83075 "gasPrice": utils.toString(options.gasPrice),
83076 "gasLimit": utils.toString(options.gasLimit),
83077 "contract": options.contract
83078 };
83079 return this._sendRequest("post", "/call", params);
83080};
83081
83082/**
83083 * Method wrap submit the signed transaction.
83084 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#sendrawtransaction}
83085 *
83086 * @param {Object} options
83087 * @param {String} options.data
83088 *
83089 * @return [Transcation hash]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#sendrawtransaction}
83090 *
83091 * @example
83092 * var api = new Neb().api;
83093 * var tx = new Transaction({
83094 * chainID: 1,
83095 * from: acc1,
83096 * to: acc2,
83097 * value: 10,
83098 * nonce: 12,
83099 * gasPrice: 1000000,
83100 * gasLimit: 2000000
83101 * });
83102 * tx.signTransaction();
83103 * api.sendRawTransaction( {data: tx.toProtoString()} ).then(function(hash) {
83104 * //code
83105 * });
83106 */
83107API.prototype.sendRawTransaction = function (options) {
83108 options = utils.argumentsToObject(['data'], arguments);
83109 var params = { "data": options.data };
83110 return this._sendRequest("post", "/rawtransaction", params);
83111};
83112
83113/**
83114 * Get block header info by the block hash.
83115 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getblockbyhash}
83116 *
83117 * @param {Object} options
83118 * @param {HexString} options.hash
83119 * @param {Boolean} options.fullTransaction
83120 *
83121 * @return [Block]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getblockbyhash}
83122 *
83123 * @example
83124 * var api = new Neb().api;
83125 * api.getBlockByHash({
83126 * hash: "00000658397a90df6459b8e7e63ad3f4ce8f0a40b8803ff2f29c611b2e0190b8",
83127 * fullTransaction: true
83128 * }).then(function(block) {
83129 * //code
83130 * });
83131 */
83132API.prototype.getBlockByHash = function (options) {
83133 options = utils.argumentsToObject(['hash', 'fullTransaction'], arguments);
83134 var params = { "hash": options.hash, "full_fill_transaction": options.fullTransaction };
83135 return this._sendRequest("post", "/getBlockByHash", params);
83136};
83137
83138/**
83139 * Get block header info by the block height.
83140 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getblockbyheight}
83141 *
83142 * @param {Object} options
83143 * @param {Number} options.height
83144 * @param {Boolean} options.fullTransaction
83145 *
83146 * @return [Block]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getblockbyheight}
83147 *
83148 * @example
83149 * var api = new Neb().api;
83150 * api.getBlockByHeight({height:2, fullTransaction:true}).then(function(block) {
83151 * //code
83152 * });
83153 */
83154API.prototype.getBlockByHeight = function (options) {
83155 options = utils.argumentsToObject(['height', 'fullTransaction'], arguments);
83156 var params = { "height": options.height, "full_fill_transaction": options.fullTransaction };
83157 return this._sendRequest("post", "/getBlockByHeight", params);
83158};
83159
83160/**
83161 * Get transactionReceipt info by tansaction hash.
83162 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#gettransactionreceipt}
83163 *
83164 * @param {Object} options
83165 * @param {HexString} options.hash
83166 *
83167 * @return [TransactionReceipt]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#gettransactionreceipt}
83168 *
83169 * @example
83170 * var api = new Neb().api;
83171 * api.getTransactionReceipt({hash: "cc7133643a9ae90ec9fa222871b85349ccb6f04452b835851280285ed72b008c"}).then(function(receipt) {
83172 * //code
83173 * });
83174 */
83175API.prototype.getTransactionReceipt = function (options) {
83176 options = utils.argumentsToObject(['hash'], arguments);
83177 var params = { "hash": options.hash };
83178 return this._sendRequest("post", "/getTransactionReceipt", params);
83179};
83180
83181/**
83182 * Get transactionReceipt info by contract address.
83183 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#gettransactionbycontract}
83184 *
83185 * @param {Object} options
83186 * @param {HexString} options.address contract address
83187 *
83188 * @returns the same as [TransactionReceipt]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#gettransactionreceipt}
83189 *
83190 * @example
83191 * var api = new Neb().api;
83192 * api.getTransactionByContract({address: "n1sqDHGjYtX6rMqFoq5Tow3s3LqF4ZxBvE3"}).then(function(receipt) {
83193 * //code
83194 * });
83195 */
83196API.prototype.getTransactionByContract = function (options) {
83197 options = utils.argumentsToObject(['address'], arguments);
83198 var params = { "address": options.address };
83199 return this._sendRequest("post", "/getTransactionByContract", params);
83200};
83201
83202/**
83203 * Return the subscribed events of transaction & block.
83204 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#subscribe}
83205 *
83206 * @param {Object} options
83207 * @param {Array|String} options.topics
83208 * @param {Function} options.onDownloadProgress - On progress callback function. Recive chunk.
83209 *
83210 * @return [eventData]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#subscribe}
83211 *
83212 * @example
83213 * var api = new Neb().api;
83214 * api.subscribe({topics: ["chain.linkBlock", "chain.pendingTransaction"]}).then(function(eventData) {
83215 * //code
83216 * });
83217 */
83218API.prototype.subscribe = function (options) {
83219 options = utils.argumentsToObject(['topics', 'onDownloadProgress'], arguments);
83220 var params = { "topics": options.topics };
83221 var axiosOptions;
83222 if (typeof options.onDownloadProgress === 'function') {
83223 axiosOptions = {
83224 onDownloadProgress: function(e) {
83225 if (typeof e.target._readLength === 'undefined') {
83226 e.target._readLength = 0;
83227 }
83228 var chunk = e.target.responseText.substr(e.target._readLength);
83229 // TODO check and split multi events
83230 if (chunk && chunk.trim().length > 0) {
83231 e.target._readLength += chunk.length;
83232 options.onDownloadProgress(chunk);
83233 }
83234 }
83235 };
83236 }
83237 return this._sendRequest("post", "/subscribe", params, null, axiosOptions);
83238};
83239
83240/**
83241 * Return current gasPrice.
83242 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getgasprice}
83243 *
83244 * @return [Gas Price]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getgasprice}
83245 *
83246 * @example
83247 * var api = new Neb().api;
83248 * api.gasPrice().then(function(gasPrice) {
83249 * //code
83250 * });
83251 */
83252API.prototype.gasPrice = function () {
83253 return this._sendRequest("get", "/getGasPrice", null);
83254};
83255
83256/**
83257 * Return the estimate gas of transaction.
83258 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#estimategas}
83259 *
83260 * @param {TransactionOptions} options
83261 *
83262 * @return [Gas]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#estimategas}
83263 *
83264 * @example
83265 * var api = new Neb().api;
83266 * api.estimateGas({
83267 * chainID: 1,
83268 * from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
83269 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
83270 * value: 10,
83271 * nonce: 12,
83272 * gasPrice: 1000000,
83273 * gasLimit: 2000000
83274 * }).then(function(gas) {
83275 * //code
83276 * });
83277 */
83278API.prototype.estimateGas = function (options) {
83279 options = utils.argumentsToObject(['from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract', 'binary'], arguments);
83280 var params = {
83281 "from": options.from,
83282 "to": options.to,
83283 "value": utils.toString(options.value),
83284 "nonce": options.nonce,
83285 "gasPrice": utils.toString(options.gasPrice),
83286 "gasLimit": utils.toString(options.gasLimit),
83287 "contract": options.contract,
83288 "binary": options.binary
83289 };
83290 return this._sendRequest("post", "/estimateGas", params);
83291};
83292
83293/**
83294 * Return the events list of transaction.
83295 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#geteventsbyhash}
83296 *
83297 * @param {Object} options
83298 * @param {HexString} options.hash
83299 *
83300 * @return [Events]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#geteventsbyhash}
83301 *
83302 * @example
83303 * var api = new Neb().api;
83304 * api.getEventsByHash({hash: "ec239d532249f84f158ef8ec9262e1d3d439709ebf4dd5f7c1036b26c6fe8073"}).then(function(events) {
83305 * //code
83306 * });
83307 */
83308API.prototype.getEventsByHash = function (options) {
83309 options = utils.argumentsToObject(['hash'], arguments);
83310 var params = { "hash": options.hash };
83311 return this._sendRequest("post", "/getEventsByHash", params);
83312};
83313
83314/**
83315 * Method getter for dpos dynasty.
83316 * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getdynasty}
83317 *
83318 * @param {Object} options
83319 * @param {Number} options.height
83320 *
83321 * @return [delegatees]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#getdynasty}
83322 *
83323 * @example
83324 * var api = new Neb().api;
83325 * api.getDynasty({height: 1}).then(function(delegatees) {
83326 * //code
83327 * });
83328 */
83329API.prototype.getDynasty = function (options) {
83330 options = utils.argumentsToObject(['height'], arguments);
83331 var params = {"height": options.height};
83332 return this._sendRequest("post", "/dynasty", params);
83333};
83334
83335API.prototype._sendRequest = function (method, api, params, callback, axiosOptions) {
83336 var action = this._path + api;
83337 if (typeof callback === "function") {
83338 return this._request.asyncRequest(method, action, params, callback);
83339 } else {
83340 return this._request.request(method, action, params, axiosOptions);
83341 }
83342};
83343
83344module.exports = API;
83345
83346},{"./utils/utils.js":664}],646:[function(require,module,exports){
83347"use strict";
83348
83349var axios = require("axios");
83350
83351var debugLog = false;
83352
83353var HttpRequest = function (host, timeout, apiVersion) {
83354 this.host = host || "http://localhost:8685";
83355 this.timeout = timeout || 0;
83356 this.apiVersion = apiVersion || "v1";
83357};
83358
83359HttpRequest.prototype.setHost = function (host) {
83360 this.host = host;
83361};
83362
83363HttpRequest.prototype.setAPIVersion = function (apiVersion) {
83364 this.apiVersion = apiVersion;
83365};
83366
83367HttpRequest.prototype.createUrl = function (api) {
83368 return this.host + "/" + this.apiVersion + api;
83369};
83370
83371HttpRequest.prototype.request = function (method, api, payload, axiosOptions) {
83372 if (debugLog) {
83373 console.log("[debug] HttpRequest: " + method + " " + this.createUrl(api) + " " + JSON.stringify(payload));
83374 }
83375
83376 var axiosParams = {
83377 method: method,
83378 url: this.createUrl(api),
83379 data: payload,
83380 };
83381 if (axiosOptions && typeof axiosOptions.onDownloadProgress === 'function') {
83382 axiosParams.onDownloadProgress = axiosOptions.onDownloadProgress;
83383 }
83384 return axios(axiosParams).then(function (resp) {
83385 if("text/html; charset=UTF-8" === resp.headers['content-type']){
83386 throw new Error(resp.status+' - '+resp.statusText);
83387 }
83388 if(typeof(resp.data) === "string"){
83389 try{
83390 resp.data = JSON.parse(resp.data);
83391 } catch(e){
83392 throw new Error('Response is invalid json');
83393 }
83394 }
83395 return resp.data.result || resp.data;
83396 }).catch(function (e) {
83397 if (typeof e.response !== "undefined") {
83398 if(typeof(e.response.data) === 'object'){ //400 error
83399 throw new Error(e.response.data.error);
83400 }else { //500 error
83401 var err = e.response.status + ' - ' + e.response.statusText;
83402 err += "\n" + api + " " + JSON.stringify(payload);
83403 throw new Error(err);
83404 }
83405
83406 } else {
83407 throw new Error(e.message);
83408 }
83409 });
83410};
83411
83412HttpRequest.prototype.asyncRequest = function (method, api, payload, callback) {
83413 return this.request(method, api, payload).then(function (data) {
83414 callback(data);
83415 }).catch(function (err) {
83416 callback(err);
83417 });
83418};
83419
83420module.exports = HttpRequest;
83421
83422},{"axios":30}],647:[function(require,module,exports){
83423
83424"use strict";
83425
83426var API = require("./api.js");
83427var Admin = require("./admin.js");
83428
83429var Unit = require("./utils/unit.js");
83430
83431/**
83432 * Neb API library constructor.
83433 * @constructor
83434 * @param {Request} request - transport wrapper.
83435 */
83436var Neb = function (request) {
83437 if (request) {
83438 this._request = request;
83439 }
83440
83441 this.api = new API(this);
83442 this.admin = new Admin(this);
83443};
83444
83445Neb.prototype.setRequest = function (request) {
83446 this._request = request;
83447 this.api._setRequest(request);
83448 this.admin._setRequest(request);
83449};
83450
83451Neb.prototype.toBasic = Unit.toBasic;
83452Neb.prototype.fromBasic = Unit.fromBasic;
83453Neb.prototype.nasToBasic = Unit.nasToBasic;
83454
83455module.exports = Neb;
83456
83457},{"./admin.js":644,"./api.js":645,"./utils/unit.js":663}],648:[function(require,module,exports){
83458"use strict";
83459
83460var block = {
83461 timestamp: 0,
83462 height: 1,
83463 seed: "s"
83464};
83465
83466var transaction = {
83467 hash: "",
83468 from: "",
83469 to: "",
83470 value: "0",
83471 nonce: 1,
83472 timestamp: 0,
83473 gasPrice: "0",
83474 gasLimit: "0"
83475};
83476
83477var state = function() {
83478};
83479
83480module.exports = {
83481 block: block,
83482 transaction: transaction,
83483 state: state
83484};
83485},{}],649:[function(require,module,exports){
83486// Copyright (C) 2017 go-nebulas authors
83487//
83488// This file is part of the go-nebulas library.
83489//
83490// the go-nebulas library is free software: you can redistribute it and/or modify
83491// it under the terms of the GNU General Public License as published by
83492// the Free Software Foundation, either version 3 of the License, or
83493// (at your option) any later version.
83494//
83495// the go-nebulas library is distributed in the hope that it will be useful,
83496// but WITHOUT ANY WARRANTY; without even the implied warranty of
83497// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83498// GNU General Public License for more details.
83499//
83500// You should have received a copy of the GNU General Public License
83501// along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>.
83502//
83503
83504'use strict';
83505
83506var Blockchain = function () {
83507 Object.defineProperty(this, "nativeBlockchain", {
83508 configurable: false,
83509 enumerable: false,
83510 get: function(){
83511 return _native_blockchain;
83512 }
83513 });
83514};
83515
83516Blockchain.prototype = {
83517 AccountAddress: 0x57,
83518 ContractAddress: 0x58,
83519
83520 blockParse: function (str) {
83521 this.block = JSON.parse(str);
83522 },
83523 transactionParse: function (str) {
83524 var tx = JSON.parse(str);
83525 if (tx != null) {
83526 var value = tx.value === undefined || tx.value.length === 0 ? "0" : tx.value;
83527 tx.value = new BigNumber(value);
83528 var gasPrice = tx.gasPrice === undefined || tx.gasPrice.length === 0 ? "0" : tx.gasPrice;
83529 tx.gasPrice = new BigNumber(gasPrice);
83530 var gasLimit = tx.gasLimit === undefined || tx.gasLimit.length === 0 ? "0" : tx.gasLimit;
83531 tx.gasLimit = new BigNumber(gasLimit);
83532 this.transaction = tx;
83533 }
83534 },
83535 transfer: function (address, value) {
83536 if (!(value instanceof BigNumber)) {
83537 value = new BigNumber(value);
83538 }
83539 var ret = this.nativeBlockchain.transfer(address, value.toString(10));
83540 return ret == 0;
83541 },
83542 verifyAddress: function (address) {
83543 return this.nativeBlockchain.verifyAddress(address);
83544 }
83545};
83546module.exports = new Blockchain();
83547
83548},{}],650:[function(require,module,exports){
83549// Copyright (C) 2017 go-nebulas authors
83550//
83551// This file is part of the go-nebulas library.
83552//
83553// the go-nebulas library is free software: you can redistribute it and/or modify
83554// it under the terms of the GNU General Public License as published by
83555// the Free Software Foundation, either version 3 of the License, or
83556// (at your option) any later version.
83557//
83558// the go-nebulas library is distributed in the hope that it will be useful,
83559// but WITHOUT ANY WARRANTY; without even the implied warranty of
83560// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83561// GNU General Public License for more details.
83562//
83563// You should have received a copy of the GNU General Public License
83564// along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>.
83565//
83566
83567'use strict';
83568
83569function Console() {}
83570
83571function log(...args) {
83572 var level = args.shift();
83573 if (typeof (level) != 'number') {
83574 throw 'level must be number.';
83575 }
83576
83577 var msg = '';
83578 for (var i = 0; i < args.length - 1; i++) {
83579 msg += format(args[i]) + ' ';
83580 }
83581 msg += format(args[args.length - 1]);
83582
83583 _native_log(level, msg);
83584}
83585
83586function format(obj) {
83587 if (typeof (obj) == 'object') {
83588 return JSON.stringify(obj);
83589 }
83590 return obj;
83591}
83592
83593[
83594 ['debug', 1],
83595 ['warn', 2],
83596 ['info', 3],
83597 ['log', 3],
83598 ['error', 4]
83599].forEach(function (val) {
83600 Console.prototype[val[0]] = log.bind(null, val[1]);
83601});
83602
83603module.exports = new Console();
83604module.exports.Console = Console;
83605
83606},{}],651:[function(require,module,exports){
83607// Copyright (C) 2017 go-nebulas authors
83608//
83609// This file is part of the go-nebulas library.
83610//
83611// the go-nebulas library is free software: you can redistribute it and/or modify
83612// it under the terms of the GNU General Public License as published by
83613// the Free Software Foundation, either version 3 of the License, or
83614// (at your option) any later version.
83615//
83616// the go-nebulas library is distributed in the hope that it will be useful,
83617// but WITHOUT ANY WARRANTY; without even the implied warranty of
83618// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83619// GNU General Public License for more details.
83620//
83621// You should have received a copy of the GNU General Public License
83622// along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>.
83623//
83624
83625'use strict';
83626
83627exports["Trigger"] = function (topic, data) {
83628 _native_event_trigger(topic, JSON.stringify(data));
83629};
83630},{}],652:[function(require,module,exports){
83631// Copyright (C) 2017 go-nebulas authors
83632//
83633// This file is part of the go-nebulas library.
83634//
83635// the go-nebulas library is free software: you can redistribute it and/or modify
83636// it under the terms of the GNU General Public License as published by
83637// the Free Software Foundation, either version 3 of the License, or
83638// (at your option) any later version.
83639//
83640// the go-nebulas library is distributed in the hope that it will be useful,
83641// but WITHOUT ANY WARRANTY; without even the implied warranty of
83642// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83643// GNU General Public License for more details.
83644//
83645// You should have received a copy of the GNU General Public License
83646// along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>.
83647//
83648
83649'use strict';
83650
83651var fieldNameRe = /^[a-zA-Z_$][a-zA-Z0-9_]+$/;
83652
83653var combineStorageMapKey = function (fieldName, key) {
83654 return "@" + fieldName + "[" + key + "]";
83655};
83656
83657var applyMapDescriptor = function (obj, descriptor) {
83658 descriptor = Object.assign({
83659 stringify: JSON.stringify,
83660 parse: JSON.parse
83661 }, descriptor || {});
83662
83663 if (typeof descriptor.stringify !== 'function' || typeof descriptor.parse !== 'function') {
83664 throw new Error("descriptor.stringify and descriptor.parse must be function.");
83665 }
83666
83667 Object.defineProperty(obj, "stringify", {
83668 configurable: false,
83669 enumerable: false,
83670 get: function () {
83671 return descriptor.stringify;
83672 }
83673 });
83674
83675 Object.defineProperty(obj, "parse", {
83676 configurable: false,
83677 enumerable: false,
83678 get: function () {
83679 return descriptor.parse;
83680 }
83681 });
83682};
83683
83684var applyFieldDescriptor = function (obj, fieldName, descriptor) {
83685 descriptor = Object.assign({
83686 stringify: JSON.stringify,
83687 parse: JSON.parse
83688 }, descriptor || {});
83689
83690 if (typeof descriptor.stringify !== 'function' || typeof descriptor.parse !== 'function') {
83691 throw new Error("descriptor.stringify and descriptor.parse must be function.");
83692 }
83693
83694 Object.defineProperty(obj, "__stringify__" + fieldName, {
83695 configurable: false,
83696 enumerable: false,
83697 get: function () {
83698 return descriptor.stringify;
83699 }
83700 });
83701
83702 Object.defineProperty(obj, "__parse__" + fieldName, {
83703 configurable: false,
83704 enumerable: false,
83705 get: function () {
83706 return descriptor.parse;
83707 }
83708 });
83709};
83710
83711var ContractStorage = function (handler) {
83712 var ns = new NativeStorage(handler);
83713 Object.defineProperty(this, "nativeStorage", {
83714 configurable: false,
83715 enumerable: false,
83716 get: function () {
83717 return ns;
83718 }
83719 });
83720};
83721
83722var StorageMap = function (contractStorage, fieldName, descriptor) {
83723 if (!contractStorage instanceof ContractStorage) {
83724 throw new Error("StorageMap only accept instance of ContractStorage");
83725 }
83726
83727 if (typeof fieldName !== "string" || fieldNameRe.exec(fieldName) == null) {
83728 throw new Error("StorageMap fieldName must match regex /^[a-zA-Z_$].*$/");
83729 }
83730
83731 Object.defineProperty(this, "contractStorage", {
83732 configurable: false,
83733 enumerable: false,
83734 get: function () {
83735 return contractStorage;
83736 }
83737 });
83738 Object.defineProperty(this, "fieldName", {
83739 configurable: false,
83740 enumerable: false,
83741 get: function () {
83742 return fieldName;
83743 }
83744 });
83745
83746 applyMapDescriptor(this, descriptor);
83747};
83748
83749
83750StorageMap.prototype = {
83751 del: function (key) {
83752 return this.contractStorage.del(combineStorageMapKey(this.fieldName, key));
83753 },
83754 get: function (key) {
83755 var val = this.contractStorage.rawGet(combineStorageMapKey(this.fieldName, key));
83756 if (val != null) {
83757 val = this.parse(val);
83758 }
83759 return val;
83760 },
83761 set: function (key, value) {
83762 var val = this.stringify(value);
83763 return this.contractStorage.rawSet(combineStorageMapKey(this.fieldName, key), val);
83764 }
83765};
83766StorageMap.prototype.put = StorageMap.prototype.set;
83767StorageMap.prototype.delete = StorageMap.prototype.del;
83768
83769
83770ContractStorage.prototype = {
83771 rawGet: function (key) {
83772 return this.nativeStorage.get(key);
83773 },
83774 rawSet: function (key, value) {
83775 var ret = this.nativeStorage.set(key, value);
83776 if (ret != 0) {
83777 throw new Error("set key " + key + " failed.");
83778 }
83779 return ret;
83780 },
83781 del: function (key) {
83782 var ret = this.nativeStorage.del(key);
83783 if (ret != 0) {
83784 throw new Error("del key " + key + " failed.");
83785 }
83786 return ret;
83787 },
83788 get: function (key) {
83789 var val = this.rawGet(key);
83790 if (val != null) {
83791 val = JSON.parse(val);
83792 }
83793 return val;
83794 },
83795 set: function (key, value) {
83796 return this.rawSet(key, JSON.stringify(value));
83797 },
83798 defineProperty: function (obj, fieldName, descriptor) {
83799 if (!obj || !fieldName) {
83800 throw new Error("defineProperty requires at least two parameters.");
83801 }
83802 var $this = this;
83803 Object.defineProperty(obj, fieldName, {
83804 configurable: false,
83805 enumerable: true,
83806 get: function () {
83807 var val = $this.rawGet(fieldName);
83808 if (val != null) {
83809 val = obj["__parse__" + fieldName](val);
83810 }
83811 return val;
83812 },
83813 set: function (val) {
83814 val = obj["__stringify__" + fieldName](val);
83815 return $this.rawSet(fieldName, val);
83816 }
83817 });
83818 applyFieldDescriptor(obj, fieldName, descriptor);
83819 return this;
83820 },
83821 defineProperties: function (obj, props) {
83822 if (!obj || !props) {
83823 throw new Error("defineProperties requires two parameters.");
83824 }
83825
83826 for (const fieldName in props) {
83827 this.defineProperty(obj, fieldName, props[fieldName]);
83828 }
83829 return this;
83830 },
83831 defineMapProperty: function (obj, fieldName, descriptor) {
83832 if (!obj || !fieldName) {
83833 throw new Error("defineMapProperty requires two parameters.");
83834 }
83835
83836 var mapObj = new StorageMap(this, fieldName, descriptor);
83837 Object.defineProperty(obj, fieldName, {
83838 configurable: false,
83839 enumerable: true,
83840 get: function () {
83841 return mapObj;
83842 }
83843 });
83844 return this;
83845 },
83846 defineMapProperties: function (obj, props) {
83847 if (!obj || !props) {
83848 throw new Error("defineMapProperties requires two parameters.");
83849 }
83850
83851 for (const fieldName in props) {
83852 this.defineMapProperty(obj, fieldName, props[fieldName]);
83853 }
83854 return this;
83855 }
83856};
83857
83858ContractStorage.prototype.put = ContractStorage.prototype.set;
83859ContractStorage.prototype.delete = ContractStorage.prototype.del;
83860
83861var lcs = new ContractStorage(_native_storage_handlers.lcs);
83862var gcs = new ContractStorage(_native_storage_handlers.gcs);
83863var obj = {ContractStorage: ContractStorage};
83864Object.defineProperty(obj, "lcs", {
83865 configurable: false,
83866 enumerable: false,
83867 get: function () {
83868 return lcs;
83869 }
83870});
83871
83872Object.defineProperty(obj, "gcs", {
83873 configurable: false,
83874 enumerable: false,
83875 get: function () {
83876 return gcs;
83877 }
83878});
83879
83880module.exports = Object.freeze(obj);
83881},{}],653:[function(require,module,exports){
83882(function (global,__dirname){
83883
83884
83885global;
83886
83887if (typeof window !== "undefined") {
83888 global = window;
83889}
83890
83891if (typeof localStorage === "undefined" || localStorage === null) {
83892 var path = require("path");
83893 var storageFile = path.join(__dirname, "./.storage");
83894 var LocalStorage = require('node-localstorage').LocalStorage;
83895 global.localStorage = new LocalStorage(storageFile);
83896}
83897
83898global.context = require("./context");
83899global._native_blockchain = require("./native/blockchain");
83900global._native_log = require("./native/log");
83901global._native_event_trigger = require("./native/event");
83902global._native_storage_handlers = require("./native/storage").handlers;
83903global.NativeStorage = require("./native/storage").NativeStorage;
83904
83905global.nativeConsole = global.console;
83906global.console = require("./libs/console");
83907global.ContractStorage = require("./libs/storage");
83908global.LocalContractStorage = global.ContractStorage.lcs;
83909// global.GlobalContractStorage = ContractStorage.gcs;
83910global.BigNumber = require("bignumber.js");
83911global.Blockchain = require("./libs/blockchain");
83912global.Event = require("./libs/event");
83913
83914// global.Date = require('./libs/date');
83915// global.Math.random = require('./libs/random');
83916// global.BigNumber.random = global.Math.random;
83917
83918module.exports = {
83919 context: global.context
83920};
83921
83922
83923}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},"/node_modules/nebulas/lib/nvm")
83924},{"./context":648,"./libs/blockchain":649,"./libs/console":650,"./libs/event":651,"./libs/storage":652,"./native/blockchain":654,"./native/event":656,"./native/log":657,"./native/storage":658,"bignumber.js":65,"node-localstorage":655,"path":671}],654:[function(require,module,exports){
83925"use strict";
83926
83927var Account = require("../../account");
83928
83929var transfer = function(to, value) {
83930 // TODO: mock the transfer func in nebulas
83931 return 0;
83932};
83933
83934var verifyAddress = function(address) {
83935 return Account.isValidAddress(address);
83936};
83937
83938module.exports = {
83939 transfer: transfer,
83940 verifyAddress: verifyAddress
83941};
83942},{"../../account":643}],655:[function(require,module,exports){
83943'use strict';
83944
83945// go env doesn't have and need localStorage
83946if (typeof localStorage === 'undefined') {
83947 exports.localStorage = {};
83948} else {
83949 exports.localStorage = localStorage; // jshint ignore:line
83950}
83951},{}],656:[function(require,module,exports){
83952"use strict";
83953
83954var trigger = function(topic, data) {
83955 var event = {
83956 Topic: topic,
83957 Data: data
83958 };
83959 var key = context.transaction.hash;
83960 var events = localStorage.getItem(key);
83961 if (events === null || typeof events === "undefined") {
83962 events = new Array();
83963 } else {
83964 events = Array.from(events);
83965 }
83966 events.push(event);
83967 localStorage.setItem(key, events);
83968};
83969
83970module.exports = trigger;
83971},{}],657:[function(require,module,exports){
83972"use strict";
83973
83974var log = function(level, msg) {
83975 var levelStr;
83976 switch(level) {
83977 case 1:
83978 levelStr = "debug";
83979 case 2:
83980 levelStr = "warn";
83981 case 3:
83982 levelStr = "info";
83983 case 4:
83984 levelStr = "error";
83985 default:
83986 levelStr = "info";
83987 }
83988 var log = levelStr + ":" + msg;
83989 nativeConsole.log(log);
83990};
83991
83992module.exports = log;
83993},{}],658:[function(require,module,exports){
83994"use strict";
83995
83996var handlers = {
83997 lcs: 1,
83998 gcs: 2
83999};
84000
84001var NativeStorage = function (handler) {
84002 this.handler = handler;
84003};
84004
84005NativeStorage.prototype = {
84006 get: function(key) {
84007 return localStorage.getItem(key);
84008 },
84009 set: function(key, value) {
84010 localStorage.setItem(key, value);
84011 return 0;
84012 },
84013 del: function(key) {
84014 localStorage.removeItem(key);
84015 return 0;
84016 }
84017};
84018
84019module.exports = {
84020 handlers: handlers,
84021 NativeStorage: NativeStorage
84022};
84023},{}],659:[function(require,module,exports){
84024"use strict";
84025
84026var extend = require('extend');
84027var native = require("./native");
84028
84029var funcRegex = new RegExp("^[a-zA-Z$][A-Za-z0-9_$]*$");
84030
84031var NVM = function (block, transaction) {
84032 extend(native.context.block, block);
84033 extend(native.context.transaction, transaction);
84034 // console.log("block:", native.context.block);
84035 // console.log("tx:", native.context.transaction);
84036};
84037
84038NVM.prototype = {
84039 deploy: function(source, args) {
84040 return this.run(source, "init", args);
84041 },
84042 call: function(source, func, args) {
84043 if (funcRegex.test(func)) {
84044 return this.run(source, func, args);
84045 } else {
84046 throw new Error("invalid func");
84047 }
84048 },
84049 run: function(source, func, args) {
84050 Blockchain.blockParse(JSON.stringify(native.context.block));
84051 Blockchain.transactionParse(JSON.stringify(native.context.transaction));
84052 var Contract = eval(source);
84053 // console.log("contract:", Contract);
84054 var contract = new Contract();
84055 if (args === undefined || args.length === 0) {
84056 args = "[]";
84057 }
84058 if (contract[func] != undefined) {
84059 return contract[func].apply(contract, JSON.parse(args));
84060 } else {
84061 throw new Error("function not found");
84062 }
84063 }
84064};
84065
84066module.exports = NVM;
84067},{"./native":653,"extend":337}],660:[function(require,module,exports){
84068module.exports={
84069 "nested": {
84070 "corepb": {
84071 "nested": {
84072 "Data": {
84073 "fields": {
84074 "type": {
84075 "type": "string",
84076 "id": 1
84077 },
84078 "payload": {
84079 "type": "bytes",
84080 "id": 2
84081 }
84082 }
84083 },
84084 "Transaction": {
84085 "fields": {
84086 "hash": {
84087 "type": "bytes",
84088 "id": 1
84089 },
84090 "from": {
84091 "type": "bytes",
84092 "id": 2
84093 },
84094 "to": {
84095 "type": "bytes",
84096 "id": 3
84097 },
84098 "value": {
84099 "type": "bytes",
84100 "id": 4
84101 },
84102 "nonce": {
84103 "type": "uint64",
84104 "id": 5
84105 },
84106 "timestamp": {
84107 "type": "int64",
84108 "id": 6
84109 },
84110 "data": {
84111 "type": "Data",
84112 "id": 7
84113 },
84114 "chainId": {
84115 "type": "uint32",
84116 "id": 8
84117 },
84118 "gasPrice": {
84119 "type": "bytes",
84120 "id": 9
84121 },
84122 "gasLimit": {
84123 "type": "bytes",
84124 "id": 10
84125 },
84126 "alg": {
84127 "type": "uint32",
84128 "id": 11
84129 },
84130 "sign": {
84131 "type": "bytes",
84132 "id": 12
84133 }
84134 }
84135 }
84136 }
84137 }
84138 }
84139}
84140},{}],661:[function(require,module,exports){
84141"use strict";
84142
84143var protobuf = require('protobufjs');
84144var utils = require('./utils/utils.js');
84145var cryptoUtils = require('./utils/crypto-utils.js');
84146var account = require("./account.js");
84147var htmlescape = require('htmlescape');
84148var BigNumber = require('bignumber.js');
84149
84150var SECP256K1 = 1;
84151var root = protobuf.Root.fromJSON(require("./transaction.json"));
84152
84153var TxPayloadBinaryType = "binary";
84154var TxPayloadDeployType = "deploy";
84155var TxPayloadCallType = "call";
84156
84157/**
84158 * @typedef TransactionInit
84159 * @example
84160 * var acc = Account.NewAccount();
84161 *
84162 * var tx = new Transaction({
84163 * chainID: 1,
84164 * from: acc,
84165 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84166 * value: 10,
84167 * nonce: 12,
84168 * gasPrice: 1000000,
84169 * gasLimit: 2000000
84170 * });
84171 */
84172
84173/**
84174 * Represent of smart contract payload data.
84175 *
84176 * @typedef {Object} Contract
84177 * @property {String} source - Contract source code for deploy contract.
84178 * @property {String} sourceType - Contract source type for deploy contract. Currently support js and ts.
84179 * @property {String} args - The params of contract. The args content is JSON string of parameters array.
84180 * @property {String} function - The contract call function.
84181 * @property {Buffer} binary - Binary contract representation.
84182 *
84183 * @see [Create own smart contract in Nebulas.]{@link https://github.com/nebulasio/wiki/blob/master/tutorials/%5BEnglish%5D%20Nebulas%20101%20-%2003%20Smart%20Contracts%20JavaScript.md}
84184 * @see [More about transaction parameters.]{@link https://github.com/nebulasio/wiki/blob/c3f5ce8908c80e9104e3b512a7fdfd75f16ac38c/rpc.md#sendtransaction}
84185 *
84186 * @example
84187 * // It's example of possible fields values.
84188 * // For deploy, and execute smart contracts follow this link - https://github.com/nebulasio/wiki/blob/master/tutorials/%5BEnglish%5D%20Nebulas%20101%20-%2003%20Smart%20Contracts%20JavaScript.md
84189 * {
84190 * 'source': '"use strict";var DepositeContent=function(t){if(t){let n=JSON.parse(t);' +
84191 * 'this.balance=new BigNumber(n.balance),this.expiryHeight=new BigNumber(n.expiryHeight)' +
84192 * '}else this.balance=new BigNumber(0),this.expiryHeight=new BigNumber(0)};' +
84193 * 'DepositeContent.prototype={toString:function(){return JSON.stringify(this)}};' +
84194 * 'var BankVaultContract=function(){LocalContractStorage.defineMapProperty(this,"bankVault",' +
84195 * '{parse:function(t){return new DepositeContent(t)},stringify:function(t){return t.toString()}})};' +
84196 * 'BankVaultContract.prototype={init:function(){},save:function(t){var n=Blockchain.transaction.from,' +
84197 * 'e=Blockchain.transaction.value,a=new BigNumber(Blockchain.block.height),r=this.bankVault.get(n);' +
84198 * 'r&&(e=e.plus(r.balance));var i=new DepositeContent;i.balance=e,i.expiryHeight=a.plus(t),' +
84199 * 'this.bankVault.put(n,i)},takeout:function(t){var n=Blockchain.transaction.from,' +
84200 * 'e=new BigNumber(Blockchain.block.height),a=new BigNumber(t),r=this.bankVault.get(n);' +
84201 * 'if(!r)throw new Error("No deposit before.");if(e.lt(r.expiryHeight))throw new Error("Can't takeout before expiryHeight.");' +
84202 * 'if(a.gt(r.balance))throw new Error("Insufficient balance.");if(0!=Blockchain.transfer(n,a))throw new Error("transfer failed.");' +
84203 * 'Event.Trigger("BankVault",{Transfer:{from:Blockchain.transaction.to,to:n,value:a.toString()}}),' +
84204 * 'r.balance=r.balance.sub(a),this.bankVault.put(n,r)},balanceOf:function(){var t=Blockchain.transaction.from;' +
84205 * 'return this.bankVault.get(t)}},module.exports=BankVaultContract;',
84206 * 'sourceType': 'js',
84207 * 'args': '[0]',
84208 * 'function': 'save'
84209 * }
84210 */
84211
84212 /**
84213 * Represent Transaction parameters
84214 *
84215 * @typedef {Object} TransactionOptions
84216 * @property {Number} options.chainID - Transaction chain id.
84217 * @property {HexString} options.from - Hex string of the sender account addresss..
84218 * @property {HexString} options.to - Hex string of the receiver account addresss..
84219 * @property {Number} options.value - Value of transaction.
84220 * @property {Number} options.nonce - Transaction nonce.
84221 * @property {Number} options.gasPrice - Gas price. The unit is 10^-18 NAS.
84222 * @property {Number} options.gasLimit - Transaction gas limit.
84223 * @property {Contract} [options.contract]
84224 *
84225 * @example
84226 * {
84227 * chainID: 1,
84228 * from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
84229 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84230 * value: 10,
84231 * nonce: 12,
84232 * gasPrice: 1000000,
84233 * gasLimit: 2000000
84234 * }
84235 */
84236
84237/**
84238 * Transaction constructor.
84239 * Class encapsulate main operation with transactions.
84240 * @see [For more information about parameters, follow this link]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#sendrawtransaction}
84241 * @constructor
84242 *
84243 * @param {TransactionOptions} options - Transaction options.
84244 *
84245 * @see [Transaction tutorial.]{@link https://github.com/nebulasio/wiki/blob/master/tutorials/%5BEnglish%5D%20Nebulas%20101%20-%2002%20Transaction.md}
84246 * @see [Create own smart contract in Nebulas.]{@link https://github.com/nebulasio/wiki/blob/master/tutorials/%5BEnglish%5D%20Nebulas%20101%20-%2003%20Smart%20Contracts%20JavaScript.md}
84247 * @see [More about transaction parameters.]{@link https://github.com/nebulasio/wiki/blob/c3f5ce8908c80e9104e3b512a7fdfd75f16ac38c/rpc.md#sendtransaction}
84248 *
84249 * @example
84250 * var acc = Account.NewAccount();
84251 *
84252 * var tx = new Transaction({
84253 * chainID: 1,
84254 * from: acc,
84255 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84256 * value: 10,
84257 * nonce: 12,
84258 * gasPrice: 1000000,
84259 * gasLimit: 2000000,
84260 * contract: {
84261 * function: "save",
84262 * args: "[0]"
84263 * }
84264 * });
84265 *
84266 */
84267var Transaction = function (options) {
84268 if (arguments.length > 0) {
84269 options = utils.argumentsToObject(['chainID', 'from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract'], arguments);
84270
84271 this.chainID = options.chainID;
84272 this.from = account.fromAddress(options.from);
84273 this.to = account.fromAddress(options.to);
84274 this.value = utils.toBigNumber(options.value);
84275 if(!this.value.isInteger())
84276 throw new Error("Invalid value! The minimum unit is wei (1^-18nas)");
84277 this.nonce = parseInt(options.nonce); // An error will be thrown is nonce is string. Error: "nonce: integer|Long expected"
84278 this.timestamp = Math.floor(new Date().getTime()/1000);
84279 this.contract = options.contract;
84280 this.gasPrice = utils.toBigNumber(options.gasPrice);
84281 this.gasLimit = utils.toBigNumber(options.gasLimit);
84282
84283 this.data = parseContract(this.contract);
84284 if (this.gasPrice.lessThanOrEqualTo(0)) {
84285 this.gasPrice = new BigNumber(1000000);
84286 }
84287
84288 if (this.gasLimit.lessThanOrEqualTo(0)) {
84289 this.gasLimit = new BigNumber(20000);
84290 }
84291 }
84292 this.signErrorMessage = "You should sign transaction before this operation.";
84293};
84294
84295var parseContract = function (obj) {
84296 /*jshint maxcomplexity:7 */
84297
84298 var payloadType, payload;
84299 if (obj && utils.isString(obj.source) && obj.source.length > 0) {
84300 payloadType = TxPayloadDeployType;
84301 payload = {
84302 SourceType: obj.sourceType,
84303 Source: obj.source,
84304 Args: obj.args
84305 };
84306 } else if (obj && utils.isString(obj.function) && obj.function.length > 0) {
84307 payloadType = TxPayloadCallType;
84308 payload = {
84309 Function: obj.function,
84310 Args: obj.args
84311 };
84312 } else {
84313 payloadType = TxPayloadBinaryType;
84314 if (obj) {
84315 payload = {
84316 Data: cryptoUtils.toBuffer(obj.binary)
84317 };
84318 }
84319 }
84320 var payloadData = utils.isNull(payload) ? null : cryptoUtils.toBuffer(htmlescape(payload));
84321
84322 return {type: payloadType, payload: payloadData};
84323};
84324
84325/**
84326 * Transaction recover method.
84327 *
84328 * @static
84329 * @param {String/Hash} message - Transaction hash.
84330 * @param {String/Hash} signature - Transaction sign
84331 *
84332 * @return {Hash} Transaction from address public key.
84333 *
84334 * @example
84335 * var pubKey = Transaction.recover("82bc718bfd24392b3872eb5a874927a327ab19b156c5584bd5f93b08fab5b1a2", "003d4064f16cbc72367b0fa3870bdcd1044bdb166019d87cdaac6dcfb8c09ac9471570e5b2e1dc249a8642ba67e585e3f43e6383c3b87532f5eb1fe2e718a5ab00");
84336 */
84337Transaction.recover = function(message, signature) {
84338 message = cryptoUtils.toBuffer(message);
84339 var signBuf = cryptoUtils.toBuffer(signature);
84340 var sign = signBuf.slice(0, 64);
84341 var recovery = signBuf.readUIntBE(64, 1);
84342 if(recovery > 27) {
84343 recovery = recovery - 27;
84344 }
84345 var compressed = false;
84346 var pub = cryptoUtils.recover(message, sign, recovery, compressed);
84347 return pub;
84348};
84349
84350/**
84351 * Transaction fromProto method, parse rawData to transaction object.
84352 *
84353 * @static
84354 * @param {String/Hash} data - Transaction raw data.
84355 *
84356 * @return {Object} Transaction object.
84357 *
84358 * @example
84359 * var tx = Transaction.fromProto("EhjZTY/gKLhWVVMZ+xoY9GiHOHJcxhc4uxkaGNlNj+AouFZVUxn7Ghj0aIc4clzGFzi7GSIQAAAAAAAAAAAN4Lazp2QAACgBMPCz6tUFOggKBmJpbmFyeUDpB0oQAAAAAAAAAAAAAAAAAA9CQFIQAAAAAAAAAAAAAAAAAABOIA==");
84360 */
84361Transaction.fromProto = function(data) {
84362 var tx = new Transaction();
84363 tx.fromProto(data);
84364 return tx;
84365};
84366
84367Transaction.prototype = {
84368 /**
84369 * Convert transaction to hash by SHA3-256 algorithm.
84370 *
84371 * @return {Hash} hash of Transaction.
84372 *
84373 * @example
84374 * var acc = Account.NewAccount();
84375 *
84376 * var tx = new Transaction({
84377 * chainID: 1,
84378 * from: acc,
84379 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84380 * value: 10,
84381 * nonce: 12,
84382 * gasPrice: 1000000,
84383 * gasLimit: 2000000
84384 * });
84385 * var txHash = tx.hashTransaction();
84386 * //Uint8Array(32) [211, 213, 102, 103, 23, 231, 246, 141, 20, 202, 210, 25, 92, 142, 162, 242, 232, 95, 44, 239, 45, 57, 241, 61, 34, 2, 213, 160, 17, 207, 75, 40]
84387 */
84388 hashTransaction: function () {
84389 var Data = root.lookup("corepb.Data");
84390 var err = Data.verify(this.data);
84391 if (err) {
84392 throw new Error(err);
84393 }
84394 var data = Data.create(this.data);
84395 var dataBuffer = Data.encode(data).finish();
84396 var hash = cryptoUtils.sha3(
84397 this.from.getAddress(),
84398 this.to.getAddress(),
84399 cryptoUtils.padToBigEndian(this.value, 128),
84400 cryptoUtils.padToBigEndian(this.nonce, 64),
84401 cryptoUtils.padToBigEndian(this.timestamp, 64),
84402 dataBuffer,
84403 cryptoUtils.padToBigEndian(this.chainID, 32),
84404 cryptoUtils.padToBigEndian(this.gasPrice, 128),
84405 cryptoUtils.padToBigEndian(this.gasLimit, 128)
84406 );
84407 return hash;
84408 },
84409 /**
84410 * Sign transaction with the specified algorithm.
84411 *
84412 * @example
84413 * var acc = Account.NewAccount();
84414 *
84415 * var tx = new Transaction({
84416 * chainID: 1,
84417 * from: acc,
84418 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84419 * value: 10,
84420 * nonce: 12,
84421 * gasPrice: 1000000,
84422 * gasLimit: 2000000
84423 * });
84424 * tx.signTransaction();
84425 */
84426 signTransaction: function () {
84427 if (this.from.getPrivateKey() !== null) {
84428 this.hash = this.hashTransaction();
84429 this.alg = SECP256K1;
84430 this.sign = cryptoUtils.sign(this.hash, this.from.getPrivateKey());
84431 } else {
84432 throw new Error("transaction from address's private key is invalid");
84433 }
84434 },
84435 /**
84436 * Conver transaction data to plain JavaScript object.
84437 *
84438 * @return {Object} Plain JavaScript object with Transaction fields.
84439 * @example
84440 * var acc = Account.NewAccount();
84441 * var tx = new Transaction({
84442 * chainID: 1,
84443 * from: acc,
84444 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84445 * value: 10,
84446 * nonce: 12,
84447 * gasPrice: 1000000,
84448 * gasLimit: 2000000
84449 * });
84450 * txData = tx.toPlainObject();
84451 * // {chainID: 1001, from: "n1USdDKeZXQYubA44W2ZVUdW1cjiJuqswxp", to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 1000000000000000000, nonce: 1, …}
84452 */
84453 toPlainObject: function() {
84454 return {
84455 chainID: this.chainID,
84456 from: this.from.getAddressString(),
84457 to: this.to.getAddressString(),
84458 value: utils.isBigNumber(this.value) ? this.value.toNumber() : this.value,
84459 nonce: this.nonce,
84460 gasPrice: utils.isBigNumber(this.gasPrice) ? this.gasPrice.toNumber() : this.gasPrice,
84461 gasLimit: utils.isBigNumber(this.gasLimit) ? this.gasLimit.toNumber() : this.gasLimit,
84462 contract: this.contract
84463 };
84464 },
84465 /**
84466 * Convert transaction to JSON string.
84467 * </br><b>Note:</b> Transaction should be [sign]{@link Transaction#signTransaction} before converting.
84468 *
84469 * @return {String} JSON stringify of transaction data.
84470 * @example
84471 * var acc = Account.NewAccount();
84472 *
84473 * var tx = new Transaction({
84474 * chainID: 1,
84475 * from: acc,
84476 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84477 * value: 10,
84478 * nonce: 12,
84479 * gasPrice: 1000000,
84480 * gasLimit: 2000000
84481 * });
84482 * tx.signTransaction();
84483 * var txHash = tx.toString();
84484 * // "{"chainID":1001,"from":"n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5","to":"n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17","value":"1000000000000000000","nonce":1,"timestamp":1521905294,"data":{"payloadType":"binary","payload":null},"gasPrice":"1000000","gasLimit":"20000","hash":"f52668b853dd476fd309f21b22ade6bb468262f55402965c3460175b10cb2f20","alg":1,"sign":"cf30d5f61e67bbeb73bb9724ba5ba3744dcbc995521c62f9b5f43efabd9b82f10aaadf19a9cdb05f039d8bf074849ef4b508905bcdea76ae57e464e79c958fa900"}"
84485 */
84486 toString: function () {
84487 if(!this.sign) {
84488 throw new Error(this.signErrorMessage);
84489 }
84490 var payload = utils.isNull(this.data.payload) ? null : JSON.parse(this.data.payload.toString());
84491 var tx = {
84492 chainID: this.chainID,
84493 from: this.from.getAddressString(),
84494 to: this.to.getAddressString(),
84495 value: this.value.toString(10),
84496 nonce: this.nonce,
84497 timestamp: this.timestamp,
84498 data: {payloadType: this.data.type, payload:payload},
84499 gasPrice: this.gasPrice.toString(10),
84500 gasLimit: this.gasLimit.toString(10),
84501 hash: this.hash.toString("hex"),
84502 alg: this.alg,
84503 sign: this.sign.toString("hex")
84504
84505 };
84506 return JSON.stringify(tx);
84507 },
84508 /**
84509 * Convert transaction to Protobuf format.
84510 * </br><b>Note:</b> Transaction should be [sign]{@link Transaction#signTransaction} before converting.
84511 *
84512 * @return {Buffer} Transaction data in Protobuf format
84513 *
84514 * @example
84515 * var acc = Account.NewAccount();
84516 *
84517 * var tx = new Transaction({
84518 * chainID: 1,
84519 * from: acc,
84520 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84521 * value: 10,
84522 * nonce: 12,
84523 * gasPrice: 1000000,
84524 * gasLimit: 2000000
84525 * });
84526 * tx.signTransaction();
84527 * var txHash = tx.toProto();
84528 * // Uint8Array(127)
84529 */
84530 toProto: function () {
84531 if(!this.sign) {
84532 throw new Error(this.signErrorMessage);
84533 }
84534 var Data = root.lookup("corepb.Data");
84535 var err = Data.verify(this.data);
84536 if (err) {
84537 throw err;
84538 }
84539 var data = Data.create(this.data);
84540
84541 var TransactionProto = root.lookup("corepb.Transaction");
84542
84543 var txData = {
84544 hash: this.hash,
84545 from: this.from.getAddress(),
84546 to: this.to.getAddress(),
84547 value: cryptoUtils.padToBigEndian(this.value, 128),
84548 nonce: this.nonce,
84549 timestamp: this.timestamp,
84550 data: data,
84551 chainId: this.chainID,
84552 gasPrice: cryptoUtils.padToBigEndian(this.gasPrice, 128),
84553 gasLimit: cryptoUtils.padToBigEndian(this.gasLimit, 128),
84554 alg: this.alg,
84555 sign: this.sign
84556 };
84557
84558 err = TransactionProto.verify(txData);
84559 if (err) {
84560 throw err;
84561 }
84562 var tx = TransactionProto.create(txData);
84563
84564 var txBuffer = TransactionProto.encode(tx).finish();
84565 return txBuffer;
84566 },
84567 /**
84568 * Convert transaction to Protobuf hash string.
84569 * </br><b>Note:</b> Transaction should be [sign]{@link Transaction#signTransaction} before converting.
84570 *
84571 * @return {Base64} Transaction string.
84572 *
84573 * @example
84574 * var acc = Account.NewAccount();
84575 *
84576 * var tx = new Transaction({
84577 * chainID: 1,
84578 * from: acc,
84579 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84580 * value: 10,
84581 * nonce: 12,
84582 * gasPrice: 1000000,
84583 * gasLimit: 2000000
84584 * });
84585 * tx.signTransaction();
84586 * var txHash = tx.toProtoString();
84587 * // "EhjZTY/gKLhWVVMZ+xoY9GiHOHJcxhc4uxkaGNlNj+AouFZVUxn7Ghj0aIc4clzGFzi7GSIQAAAAAAAAAAAN4Lazp2QAACgBMPCz6tUFOggKBmJpbmFyeUDpB0oQAAAAAAAAAAAAAAAAAA9CQFIQAAAAAAAAAAAAAAAAAABOIA=="
84588 */
84589 toProtoString: function () {
84590 var txBuffer = this.toProto();
84591 return protobuf.util.base64.encode(txBuffer, 0, txBuffer.length);
84592 },
84593 /**
84594 * Restore Transaction from Protobuf format.
84595 * @property {Buffer|String} data - Buffer or stringify Buffer.
84596 *
84597 * @return {Transaction} Restored transaction.
84598 *
84599 * @example
84600 * var acc = Account.NewAccount();
84601 *
84602 * var tx = new Transaction({
84603 * chainID: 1,
84604 * from: acc,
84605 * to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
84606 * value: 10,
84607 * nonce: 12,
84608 * gasPrice: 1000000,
84609 * gasLimit: 2000000
84610 * });
84611 * var tx = tx.fromProto("EhjZTY/gKLhWVVMZ+xoY9GiHOHJcxhc4uxkaGNlNj+AouFZVUxn7Ghj0aIc4clzGFzi7GSIQAAAAAAAAAAAN4Lazp2QAACgBMPCz6tUFOggKBmJpbmFyeUDpB0oQAAAAAAAAAAAAAAAAAA9CQFIQAAAAAAAAAAAAAAAAAABOIA==");
84612 */
84613 fromProto: function (data) {
84614
84615 var txBuffer;
84616 if (utils.isString(data)) {
84617 txBuffer = new Array(protobuf.util.base64.length(data));
84618 protobuf.util.base64.decode(data, txBuffer, 0);
84619 } else {
84620 txBuffer = data;
84621 }
84622
84623 var TransactionProto = root.lookup("corepb.Transaction");
84624 var txProto = TransactionProto.decode(txBuffer);
84625
84626 this.hash = cryptoUtils.toBuffer(txProto.hash);
84627 this.from = account.fromAddress(txProto.from);
84628 this.to = account.fromAddress(txProto.to);
84629 this.value = utils.toBigNumber("0x" + cryptoUtils.toBuffer(txProto.value).toString("hex"));
84630 // long number is object, should convert to int
84631 this.nonce = parseInt(txProto.nonce.toString());
84632 this.timestamp = parseInt(txProto.timestamp.toString());
84633 this.data = txProto.data;
84634 if (this.data.payload.length === 0) {
84635 this.data.payload = null;
84636 }
84637 this.chainID = txProto.chainId;
84638 this.gasPrice = utils.toBigNumber("0x" + cryptoUtils.toBuffer(txProto.gasPrice).toString("hex"));
84639 this.gasLimit = utils.toBigNumber("0x" + cryptoUtils.toBuffer(txProto.gasLimit).toString("hex"));
84640 this.alg = txProto.alg;
84641 this.sign = cryptoUtils.toBuffer(txProto.sign);
84642
84643 return this;
84644 }
84645};
84646
84647module.exports = Transaction;
84648
84649},{"./account.js":643,"./transaction.json":660,"./utils/crypto-utils.js":662,"./utils/utils.js":664,"bignumber.js":65,"htmlescape":394,"protobufjs":679}],662:[function(require,module,exports){
84650
84651"use strict";
84652
84653var Buffer = require('safe-buffer').Buffer;
84654
84655var jsSHA = require('jssha');
84656var createKeccakHash = require('keccak');
84657var secp256k1 = require('secp256k1');
84658var crypto = require('crypto');
84659var scrypt = require('scryptsy');
84660var RIPEMD160 = require('ripemd160');
84661
84662var uuid = require('uuid');
84663
84664var utils = require('./utils.js');
84665
84666var keccak = function (a, bits) {
84667 a = toBuffer(a);
84668 if (!bits) bits = 256;
84669
84670 return createKeccakHash('keccak' + bits).update(a).digest();
84671};
84672
84673var sha3 = function () {
84674 var shaObj = new jsSHA("SHA3-256", "HEX");
84675 for (var i = 0; i < arguments.length; i++) {
84676 var v = toBuffer(arguments[i]);
84677 shaObj.update(v.toString("hex"));
84678 }
84679 return Buffer.from(shaObj.getHash("HEX"), "hex");
84680};
84681
84682var ripemd160 = function () {
84683 var ripemd160stream = new RIPEMD160();
84684 for (var i = 0; i < arguments.length; i++) {
84685 var v = toBuffer(arguments[i]);
84686 ripemd160stream.update(v);
84687 }
84688 return ripemd160stream.digest();
84689};
84690
84691// check if hex string
84692var isHexPrefixed = function (str) {
84693 if (typeof str !== 'string') {
84694 throw new Error("[is-hex-prefixed] value must be type 'string', is currently type " + (typeof str) + ", while checking isHexPrefixed.");
84695 }
84696
84697 return str.slice(0, 2) === '0x';
84698};
84699
84700// returns hex string without 0x
84701var stripHexPrefix = function (str) {
84702 if (typeof str !== 'string') {
84703 return str;
84704 }
84705 return isHexPrefixed(str) ? str.slice(2) : str;
84706};
84707
84708function isHexString(value, length) {
84709 if (typeof(value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {
84710 return false;
84711 }
84712
84713 if (length && value.length !== 2 + 2 * length) { return false; }
84714
84715 return true;
84716}
84717
84718// returns hex string from int
84719function intToHex(i) {
84720 var hex = i.toString(16); // eslint-disable-line
84721
84722 return '0x' + padToEven(hex);
84723}
84724
84725// returns buffer from int
84726function intToBuffer(i) {
84727 var hex = intToHex(i);
84728
84729 return new Buffer(hex.slice(2), 'hex');
84730}
84731
84732// returns a buffer filled with 0
84733var zeros = function (bytes) {
84734 return Buffer.allocUnsafe(bytes).fill(0);
84735};
84736
84737var padToEven = function (value) {
84738 var a = value; // eslint-disable-line
84739
84740 if (typeof a !== 'string') {
84741 throw new Error('padToEven only support string');
84742 }
84743
84744 if (a.length % 2) {
84745 a = '0' + a;
84746 }
84747
84748 return a;
84749};
84750
84751// convert value to digit/8 buffer with BigEndian.
84752var padToBigEndian = function (value, digit) {
84753 value = toBuffer(value);
84754 var buff = Buffer.alloc(digit/8);
84755 for (var i = 0; i < value.length; i++) {
84756 var start = buff.length - value.length + i;
84757 if ( start >= 0) {
84758 buff[start] = value[i];
84759 }
84760 }
84761 return buff;
84762};
84763
84764// attempts to turn a value to buffer, the input can be buffer, string,number
84765var toBuffer = function (v) {
84766 /*jshint maxcomplexity:13 */
84767 if (!Buffer.isBuffer(v)) {
84768 if (Array.isArray(v)) {
84769 v = Buffer.from(v);
84770 } else if (typeof v === 'string') {
84771 if (isHexString(v)) {
84772 v = Buffer.from(padToEven(stripHexPrefix(v)), 'hex');
84773 } else {
84774 v = Buffer.from(v);
84775 }
84776 } else if (typeof v === 'number') {
84777 v = intToBuffer(v);
84778 } else if (v === null || v === undefined) {
84779 v = Buffer.allocUnsafe(0);
84780 } else if (utils.isBigNumber(v)) {
84781 // TODO: neb number is a big int, not support if v is decimal, later fix it.
84782 v = Buffer.from(padToEven(v.toString(16)), 'hex');
84783 } else if (v.toArray) {
84784 v = Buffer.from(v.toArray());
84785 } else if (v.subarray) {
84786 v = Buffer.from(v);
84787 } else if (v === null || typeof v === "undefined") {
84788 v = Buffer.allocUnsafe(0);
84789 } else {
84790 throw new Error('invalid type');
84791 }
84792 }
84793 return v;
84794};
84795
84796var bufferToHex = function (buf) {
84797 buf = toBuffer(buf);
84798 return '0x' + buf.toString('hex');
84799};
84800
84801// convert secp256k1 private key to public key
84802var privateToPublic = function (privateKey) {
84803 privateKey = toBuffer(privateKey);
84804 // skip the type flag and use the X, Y points
84805 return secp256k1.publicKeyCreate(privateKey, false).slice(1);
84806};
84807
84808var isValidPublic = function (publicKey, sanitize) {
84809 if (publicKey.length === 64) {
84810 // Convert to SEC1 for secp256k1
84811 return secp256k1.publicKeyVerify(Buffer.concat([ Buffer.from([4]), publicKey ]));
84812 }
84813
84814 if (!sanitize) {
84815 return false;
84816 }
84817
84818 return secp256k1.publicKeyVerify(publicKey);
84819};
84820
84821// sign transaction hash
84822var sign = function (msgHash, privateKey) {
84823
84824 var sig = secp256k1.sign(toBuffer(msgHash), toBuffer(privateKey));
84825 // var ret = {}
84826 // ret.r = sig.signature.slice(0, 32)
84827 // ret.s = sig.signature.slice(32, 64)
84828 // ret.v = sig.recovery
84829 return Buffer.concat([toBuffer(sig.signature), toBuffer(sig.recovery)]);
84830};
84831
84832var verify = function (message, signature, publicKey) {
84833 signature = signature.slice(0,-1); //remove the sig.recovery byte
84834 publicKey = Buffer.concat([toBuffer([0x04]), toBuffer(publicKey)]); //add 0x04 before publicKey
84835 return secp256k1.verify(toBuffer(message), toBuffer(signature), toBuffer(publicKey));
84836};
84837
84838var recover = function(message, signature, recovery, compressed) {
84839 return secp256k1.recover(toBuffer(message), toBuffer(signature), recovery, compressed);
84840};
84841
84842module.exports = {
84843 secp256k1: secp256k1,
84844 keccak: keccak,
84845 sha3: sha3,
84846 ripemd160: ripemd160,
84847 crypto: crypto,
84848 scrypt: scrypt,
84849 uuid: uuid,
84850
84851 zeros: zeros,
84852 isHexPrefixed: isHexPrefixed,
84853 padToBigEndian: padToBigEndian,
84854 toBuffer: toBuffer,
84855 bufferToHex: bufferToHex,
84856 privateToPublic: privateToPublic,
84857 isValidPublic: isValidPublic,
84858 sign: sign,
84859 verify: verify,
84860 recover: recover
84861};
84862
84863},{"./utils.js":664,"crypto":243,"jssha":428,"keccak":429,"ripemd160":740,"safe-buffer":742,"scryptsy":743,"secp256k1":747,"uuid":825}],663:[function(require,module,exports){
84864
84865"use strict";
84866
84867var BigNumber = require('bignumber.js');
84868var utils = require('./utils.js');
84869
84870var unitMap = {
84871 'none': '0',
84872 'None': '0',
84873 'wei': '1',
84874 'Wei': '1',
84875 'kwei': '1000',
84876 'Kwei': '1000',
84877 'mwei': '1000000',
84878 'Mwei': '1000000',
84879 'gwei': '1000000000',
84880 'Gwei': '1000000000',
84881 'nas': '1000000000000000000',
84882 'NAS': '1000000000000000000',
84883 };
84884
84885var unitValue = function (unit) {
84886 unit = unit ? unit.toLowerCase() : 'nas';
84887 var unitValue = unitMap[unit];
84888 if (unitValue === undefined) {
84889 throw new Error('The unit undefined, please use the following units:' + JSON.stringify(unitMap, null, 2));
84890 }
84891 return new BigNumber(unitValue, 10);
84892};
84893
84894var toBasic = function (number, unit) {
84895 return utils.toBigNumber(number).times(unitValue(unit));
84896};
84897
84898var fromBasic = function (number, unit) {
84899 return utils.toBigNumber(number).dividedBy(unitValue(unit));
84900};
84901
84902var nasToBasic = function (number) {
84903 return utils.toBigNumber(number).times(unitValue("nas"));
84904};
84905
84906module.exports = {
84907 toBasic: toBasic,
84908 fromBasic: fromBasic,
84909 nasToBasic: nasToBasic
84910};
84911
84912},{"./utils.js":664,"bignumber.js":65}],664:[function(require,module,exports){
84913
84914"use strict";
84915
84916var BigNumber = require('bignumber.js');
84917
84918var isNull = function (v) {
84919 return v === null || typeof v === "undefined";
84920};
84921
84922var isBrowser = function () {
84923 return (typeof window !== "undefined");
84924};
84925
84926var isBigNumber = function (obj) {
84927 return obj instanceof BigNumber ||
84928 (obj && obj.constructor && obj.constructor.name === 'BigNumber');
84929};
84930
84931var isString = function (obj) {
84932 return typeof obj === 'string' && obj.constructor === String;
84933};
84934
84935var isObject = function (obj) {
84936 return obj !== null && typeof obj === 'object';
84937};
84938
84939var isFunction = function (object) {
84940 return typeof object === 'function';
84941};
84942
84943var isNumber = function (object) {
84944 return typeof object === 'number';
84945};
84946
84947var toBigNumber = function (number) {
84948 number = number || 0;
84949 if (isBigNumber(number)) {
84950 return number;
84951 }
84952 if (isString(number) && number.indexOf('0x') === 0) {
84953 return new BigNumber(number.replace('0x',''), 16);
84954 }
84955 return new BigNumber(number.toString(10), 10);
84956};
84957
84958var toString = function (obj) {
84959 if (isString(obj)) {
84960 return obj;
84961 } else if (isBigNumber(obj)) {
84962 return obj.toString(10);
84963 } else if (isObject(obj)) {
84964 return JSON.stringify(obj);
84965 } else {
84966 return obj + "";
84967 }
84968};
84969
84970// Transform Array-like arguments object to common array.
84971var argumentsToArray = function(args) {
84972 var len = args.length,
84973 resultArray = new Array(len);
84974
84975 for (var i = 0; i < len; i += 1) {
84976 resultArray[i] = args[i];
84977 }
84978 return resultArray;
84979};
84980
84981// Create object based on provided arrays
84982var zipArraysToObject = function(keysArr, valuesArr) {
84983 var resultObject = {};
84984
84985 for (var i = 0; i < keysArr.length; i += 1) {
84986 resultObject[keysArr[i]] = valuesArr[i];
84987 }
84988 return resultObject;
84989};
84990
84991// Function what make overall view for arguments.
84992// If arguments was provided separated by commas like "func(arg1 ,arg2)" we create
84993// ArgumentsObject and write keys from argsNames and value from args.
84994// in case wheare we provide args in object like "func({arg1: value})"
84995// we just return that object
84996var argumentsToObject = function(keys, args) {
84997 var ArgumentsObject = {};
84998
84999 args = argumentsToArray(args);
85000 if ( isObject(args[0]) ) {
85001 ArgumentsObject = args[0];
85002 } else {
85003 ArgumentsObject = zipArraysToObject(keys, args);
85004 }
85005
85006 return ArgumentsObject;
85007};
85008
85009module.exports = {
85010 isNull: isNull,
85011 isBrowser: isBrowser,
85012 isBigNumber: isBigNumber,
85013 isString: isString,
85014 isObject: isObject,
85015 isFunction: isFunction,
85016 isNumber: isNumber,
85017 toBigNumber: toBigNumber,
85018 toString: toString,
85019 argumentsToObject: argumentsToObject,
85020 zipArraysToObject: zipArraysToObject
85021};
85022
85023},{"bignumber.js":65}],665:[function(require,module,exports){
85024/*
85025object-assign
85026(c) Sindre Sorhus
85027@license MIT
85028*/
85029
85030'use strict';
85031/* eslint-disable no-unused-vars */
85032var getOwnPropertySymbols = Object.getOwnPropertySymbols;
85033var hasOwnProperty = Object.prototype.hasOwnProperty;
85034var propIsEnumerable = Object.prototype.propertyIsEnumerable;
85035
85036function toObject(val) {
85037 if (val === null || val === undefined) {
85038 throw new TypeError('Object.assign cannot be called with null or undefined');
85039 }
85040
85041 return Object(val);
85042}
85043
85044function shouldUseNative() {
85045 try {
85046 if (!Object.assign) {
85047 return false;
85048 }
85049
85050 // Detect buggy property enumeration order in older V8 versions.
85051
85052 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
85053 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
85054 test1[5] = 'de';
85055 if (Object.getOwnPropertyNames(test1)[0] === '5') {
85056 return false;
85057 }
85058
85059 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
85060 var test2 = {};
85061 for (var i = 0; i < 10; i++) {
85062 test2['_' + String.fromCharCode(i)] = i;
85063 }
85064 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
85065 return test2[n];
85066 });
85067 if (order2.join('') !== '0123456789') {
85068 return false;
85069 }
85070
85071 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
85072 var test3 = {};
85073 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
85074 test3[letter] = letter;
85075 });
85076 if (Object.keys(Object.assign({}, test3)).join('') !==
85077 'abcdefghijklmnopqrst') {
85078 return false;
85079 }
85080
85081 return true;
85082 } catch (err) {
85083 // We don't expect any of the above to throw, but better to be safe.
85084 return false;
85085 }
85086}
85087
85088module.exports = shouldUseNative() ? Object.assign : function (target, source) {
85089 var from;
85090 var to = toObject(target);
85091 var symbols;
85092
85093 for (var s = 1; s < arguments.length; s++) {
85094 from = Object(arguments[s]);
85095
85096 for (var key in from) {
85097 if (hasOwnProperty.call(from, key)) {
85098 to[key] = from[key];
85099 }
85100 }
85101
85102 if (getOwnPropertySymbols) {
85103 symbols = getOwnPropertySymbols(from);
85104 for (var i = 0; i < symbols.length; i++) {
85105 if (propIsEnumerable.call(from, symbols[i])) {
85106 to[symbols[i]] = from[symbols[i]];
85107 }
85108 }
85109 }
85110 }
85111
85112 return to;
85113};
85114
85115},{}],666:[function(require,module,exports){
85116module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb",
85117"2.16.840.1.101.3.4.1.2": "aes-128-cbc",
85118"2.16.840.1.101.3.4.1.3": "aes-128-ofb",
85119"2.16.840.1.101.3.4.1.4": "aes-128-cfb",
85120"2.16.840.1.101.3.4.1.21": "aes-192-ecb",
85121"2.16.840.1.101.3.4.1.22": "aes-192-cbc",
85122"2.16.840.1.101.3.4.1.23": "aes-192-ofb",
85123"2.16.840.1.101.3.4.1.24": "aes-192-cfb",
85124"2.16.840.1.101.3.4.1.41": "aes-256-ecb",
85125"2.16.840.1.101.3.4.1.42": "aes-256-cbc",
85126"2.16.840.1.101.3.4.1.43": "aes-256-ofb",
85127"2.16.840.1.101.3.4.1.44": "aes-256-cfb"
85128}
85129},{}],667:[function(require,module,exports){
85130// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
85131// Fedor, you are amazing.
85132'use strict'
85133
85134var asn1 = require('asn1.js')
85135
85136exports.certificate = require('./certificate')
85137
85138var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
85139 this.seq().obj(
85140 this.key('version').int(),
85141 this.key('modulus').int(),
85142 this.key('publicExponent').int(),
85143 this.key('privateExponent').int(),
85144 this.key('prime1').int(),
85145 this.key('prime2').int(),
85146 this.key('exponent1').int(),
85147 this.key('exponent2').int(),
85148 this.key('coefficient').int()
85149 )
85150})
85151exports.RSAPrivateKey = RSAPrivateKey
85152
85153var RSAPublicKey = asn1.define('RSAPublicKey', function () {
85154 this.seq().obj(
85155 this.key('modulus').int(),
85156 this.key('publicExponent').int()
85157 )
85158})
85159exports.RSAPublicKey = RSAPublicKey
85160
85161var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
85162 this.seq().obj(
85163 this.key('algorithm').use(AlgorithmIdentifier),
85164 this.key('subjectPublicKey').bitstr()
85165 )
85166})
85167exports.PublicKey = PublicKey
85168
85169var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
85170 this.seq().obj(
85171 this.key('algorithm').objid(),
85172 this.key('none').null_().optional(),
85173 this.key('curve').objid().optional(),
85174 this.key('params').seq().obj(
85175 this.key('p').int(),
85176 this.key('q').int(),
85177 this.key('g').int()
85178 ).optional()
85179 )
85180})
85181
85182var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
85183 this.seq().obj(
85184 this.key('version').int(),
85185 this.key('algorithm').use(AlgorithmIdentifier),
85186 this.key('subjectPrivateKey').octstr()
85187 )
85188})
85189exports.PrivateKey = PrivateKeyInfo
85190var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
85191 this.seq().obj(
85192 this.key('algorithm').seq().obj(
85193 this.key('id').objid(),
85194 this.key('decrypt').seq().obj(
85195 this.key('kde').seq().obj(
85196 this.key('id').objid(),
85197 this.key('kdeparams').seq().obj(
85198 this.key('salt').octstr(),
85199 this.key('iters').int()
85200 )
85201 ),
85202 this.key('cipher').seq().obj(
85203 this.key('algo').objid(),
85204 this.key('iv').octstr()
85205 )
85206 )
85207 ),
85208 this.key('subjectPrivateKey').octstr()
85209 )
85210})
85211
85212exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
85213
85214var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
85215 this.seq().obj(
85216 this.key('version').int(),
85217 this.key('p').int(),
85218 this.key('q').int(),
85219 this.key('g').int(),
85220 this.key('pub_key').int(),
85221 this.key('priv_key').int()
85222 )
85223})
85224exports.DSAPrivateKey = DSAPrivateKey
85225
85226exports.DSAparam = asn1.define('DSAparam', function () {
85227 this.int()
85228})
85229
85230var ECPrivateKey = asn1.define('ECPrivateKey', function () {
85231 this.seq().obj(
85232 this.key('version').int(),
85233 this.key('privateKey').octstr(),
85234 this.key('parameters').optional().explicit(0).use(ECParameters),
85235 this.key('publicKey').optional().explicit(1).bitstr()
85236 )
85237})
85238exports.ECPrivateKey = ECPrivateKey
85239
85240var ECParameters = asn1.define('ECParameters', function () {
85241 this.choice({
85242 namedCurve: this.objid()
85243 })
85244})
85245
85246exports.signature = asn1.define('signature', function () {
85247 this.seq().obj(
85248 this.key('r').int(),
85249 this.key('s').int()
85250 )
85251})
85252
85253},{"./certificate":668,"asn1.js":12}],668:[function(require,module,exports){
85254// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
85255// thanks to @Rantanen
85256
85257'use strict'
85258
85259var asn = require('asn1.js')
85260
85261var Time = asn.define('Time', function () {
85262 this.choice({
85263 utcTime: this.utctime(),
85264 generalTime: this.gentime()
85265 })
85266})
85267
85268var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
85269 this.seq().obj(
85270 this.key('type').objid(),
85271 this.key('value').any()
85272 )
85273})
85274
85275var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
85276 this.seq().obj(
85277 this.key('algorithm').objid(),
85278 this.key('parameters').optional(),
85279 this.key('curve').objid().optional()
85280 )
85281})
85282
85283var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
85284 this.seq().obj(
85285 this.key('algorithm').use(AlgorithmIdentifier),
85286 this.key('subjectPublicKey').bitstr()
85287 )
85288})
85289
85290var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
85291 this.setof(AttributeTypeValue)
85292})
85293
85294var RDNSequence = asn.define('RDNSequence', function () {
85295 this.seqof(RelativeDistinguishedName)
85296})
85297
85298var Name = asn.define('Name', function () {
85299 this.choice({
85300 rdnSequence: this.use(RDNSequence)
85301 })
85302})
85303
85304var Validity = asn.define('Validity', function () {
85305 this.seq().obj(
85306 this.key('notBefore').use(Time),
85307 this.key('notAfter').use(Time)
85308 )
85309})
85310
85311var Extension = asn.define('Extension', function () {
85312 this.seq().obj(
85313 this.key('extnID').objid(),
85314 this.key('critical').bool().def(false),
85315 this.key('extnValue').octstr()
85316 )
85317})
85318
85319var TBSCertificate = asn.define('TBSCertificate', function () {
85320 this.seq().obj(
85321 this.key('version').explicit(0).int().optional(),
85322 this.key('serialNumber').int(),
85323 this.key('signature').use(AlgorithmIdentifier),
85324 this.key('issuer').use(Name),
85325 this.key('validity').use(Validity),
85326 this.key('subject').use(Name),
85327 this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),
85328 this.key('issuerUniqueID').implicit(1).bitstr().optional(),
85329 this.key('subjectUniqueID').implicit(2).bitstr().optional(),
85330 this.key('extensions').explicit(3).seqof(Extension).optional()
85331 )
85332})
85333
85334var X509Certificate = asn.define('X509Certificate', function () {
85335 this.seq().obj(
85336 this.key('tbsCertificate').use(TBSCertificate),
85337 this.key('signatureAlgorithm').use(AlgorithmIdentifier),
85338 this.key('signatureValue').bitstr()
85339 )
85340})
85341
85342module.exports = X509Certificate
85343
85344},{"asn1.js":12}],669:[function(require,module,exports){
85345// adapted from https://github.com/apatil/pemstrip
85346var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m
85347var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m
85348var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m
85349var evp = require('evp_bytestokey')
85350var ciphers = require('browserify-aes')
85351var Buffer = require('safe-buffer').Buffer
85352module.exports = function (okey, password) {
85353 var key = okey.toString()
85354 var match = key.match(findProc)
85355 var decrypted
85356 if (!match) {
85357 var match2 = key.match(fullRegex)
85358 decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64')
85359 } else {
85360 var suite = 'aes' + match[1]
85361 var iv = Buffer.from(match[2], 'hex')
85362 var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64')
85363 var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
85364 var out = []
85365 var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
85366 out.push(cipher.update(cipherText))
85367 out.push(cipher.final())
85368 decrypted = Buffer.concat(out)
85369 }
85370 var tag = key.match(startRegex)[1]
85371 return {
85372 tag: tag,
85373 data: decrypted
85374 }
85375}
85376
85377},{"browserify-aes":113,"evp_bytestokey":336,"safe-buffer":742}],670:[function(require,module,exports){
85378var asn1 = require('./asn1')
85379var aesid = require('./aesid.json')
85380var fixProc = require('./fixProc')
85381var ciphers = require('browserify-aes')
85382var compat = require('pbkdf2')
85383var Buffer = require('safe-buffer').Buffer
85384module.exports = parseKeys
85385
85386function parseKeys (buffer) {
85387 var password
85388 if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
85389 password = buffer.passphrase
85390 buffer = buffer.key
85391 }
85392 if (typeof buffer === 'string') {
85393 buffer = Buffer.from(buffer)
85394 }
85395
85396 var stripped = fixProc(buffer, password)
85397
85398 var type = stripped.tag
85399 var data = stripped.data
85400 var subtype, ndata
85401 switch (type) {
85402 case 'CERTIFICATE':
85403 ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
85404 // falls through
85405 case 'PUBLIC KEY':
85406 if (!ndata) {
85407 ndata = asn1.PublicKey.decode(data, 'der')
85408 }
85409 subtype = ndata.algorithm.algorithm.join('.')
85410 switch (subtype) {
85411 case '1.2.840.113549.1.1.1':
85412 return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
85413 case '1.2.840.10045.2.1':
85414 ndata.subjectPrivateKey = ndata.subjectPublicKey
85415 return {
85416 type: 'ec',
85417 data: ndata
85418 }
85419 case '1.2.840.10040.4.1':
85420 ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
85421 return {
85422 type: 'dsa',
85423 data: ndata.algorithm.params
85424 }
85425 default: throw new Error('unknown key id ' + subtype)
85426 }
85427 throw new Error('unknown key type ' + type)
85428 case 'ENCRYPTED PRIVATE KEY':
85429 data = asn1.EncryptedPrivateKey.decode(data, 'der')
85430 data = decrypt(data, password)
85431 // falls through
85432 case 'PRIVATE KEY':
85433 ndata = asn1.PrivateKey.decode(data, 'der')
85434 subtype = ndata.algorithm.algorithm.join('.')
85435 switch (subtype) {
85436 case '1.2.840.113549.1.1.1':
85437 return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
85438 case '1.2.840.10045.2.1':
85439 return {
85440 curve: ndata.algorithm.curve,
85441 privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
85442 }
85443 case '1.2.840.10040.4.1':
85444 ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
85445 return {
85446 type: 'dsa',
85447 params: ndata.algorithm.params
85448 }
85449 default: throw new Error('unknown key id ' + subtype)
85450 }
85451 throw new Error('unknown key type ' + type)
85452 case 'RSA PUBLIC KEY':
85453 return asn1.RSAPublicKey.decode(data, 'der')
85454 case 'RSA PRIVATE KEY':
85455 return asn1.RSAPrivateKey.decode(data, 'der')
85456 case 'DSA PRIVATE KEY':
85457 return {
85458 type: 'dsa',
85459 params: asn1.DSAPrivateKey.decode(data, 'der')
85460 }
85461 case 'EC PRIVATE KEY':
85462 data = asn1.ECPrivateKey.decode(data, 'der')
85463 return {
85464 curve: data.parameters.value,
85465 privateKey: data.privateKey
85466 }
85467 default: throw new Error('unknown key type ' + type)
85468 }
85469}
85470parseKeys.signature = asn1.signature
85471function decrypt (data, password) {
85472 var salt = data.algorithm.decrypt.kde.kdeparams.salt
85473 var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
85474 var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
85475 var iv = data.algorithm.decrypt.cipher.iv
85476 var cipherText = data.subjectPrivateKey
85477 var keylen = parseInt(algo.split('-')[1], 10) / 8
85478 var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')
85479 var cipher = ciphers.createDecipheriv(algo, key, iv)
85480 var out = []
85481 out.push(cipher.update(cipherText))
85482 out.push(cipher.final())
85483 return Buffer.concat(out)
85484}
85485
85486},{"./aesid.json":666,"./asn1":667,"./fixProc":669,"browserify-aes":113,"pbkdf2":672,"safe-buffer":742}],671:[function(require,module,exports){
85487(function (process){
85488// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
85489// backported and transplited with Babel, with backwards-compat fixes
85490
85491// Copyright Joyent, Inc. and other Node contributors.
85492//
85493// Permission is hereby granted, free of charge, to any person obtaining a
85494// copy of this software and associated documentation files (the
85495// "Software"), to deal in the Software without restriction, including
85496// without limitation the rights to use, copy, modify, merge, publish,
85497// distribute, sublicense, and/or sell copies of the Software, and to permit
85498// persons to whom the Software is furnished to do so, subject to the
85499// following conditions:
85500//
85501// The above copyright notice and this permission notice shall be included
85502// in all copies or substantial portions of the Software.
85503//
85504// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
85505// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
85506// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
85507// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
85508// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
85509// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
85510// USE OR OTHER DEALINGS IN THE SOFTWARE.
85511
85512// resolves . and .. elements in a path array with directory names there
85513// must be no slashes, empty elements, or device names (c:\) in the array
85514// (so also no leading and trailing slashes - it does not distinguish
85515// relative and absolute paths)
85516function normalizeArray(parts, allowAboveRoot) {
85517 // if the path tries to go above the root, `up` ends up > 0
85518 var up = 0;
85519 for (var i = parts.length - 1; i >= 0; i--) {
85520 var last = parts[i];
85521 if (last === '.') {
85522 parts.splice(i, 1);
85523 } else if (last === '..') {
85524 parts.splice(i, 1);
85525 up++;
85526 } else if (up) {
85527 parts.splice(i, 1);
85528 up--;
85529 }
85530 }
85531
85532 // if the path is allowed to go above the root, restore leading ..s
85533 if (allowAboveRoot) {
85534 for (; up--; up) {
85535 parts.unshift('..');
85536 }
85537 }
85538
85539 return parts;
85540}
85541
85542// path.resolve([from ...], to)
85543// posix version
85544exports.resolve = function() {
85545 var resolvedPath = '',
85546 resolvedAbsolute = false;
85547
85548 for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
85549 var path = (i >= 0) ? arguments[i] : process.cwd();
85550
85551 // Skip empty and invalid entries
85552 if (typeof path !== 'string') {
85553 throw new TypeError('Arguments to path.resolve must be strings');
85554 } else if (!path) {
85555 continue;
85556 }
85557
85558 resolvedPath = path + '/' + resolvedPath;
85559 resolvedAbsolute = path.charAt(0) === '/';
85560 }
85561
85562 // At this point the path should be resolved to a full absolute path, but
85563 // handle relative paths to be safe (might happen when process.cwd() fails)
85564
85565 // Normalize the path
85566 resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
85567 return !!p;
85568 }), !resolvedAbsolute).join('/');
85569
85570 return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
85571};
85572
85573// path.normalize(path)
85574// posix version
85575exports.normalize = function(path) {
85576 var isAbsolute = exports.isAbsolute(path),
85577 trailingSlash = substr(path, -1) === '/';
85578
85579 // Normalize the path
85580 path = normalizeArray(filter(path.split('/'), function(p) {
85581 return !!p;
85582 }), !isAbsolute).join('/');
85583
85584 if (!path && !isAbsolute) {
85585 path = '.';
85586 }
85587 if (path && trailingSlash) {
85588 path += '/';
85589 }
85590
85591 return (isAbsolute ? '/' : '') + path;
85592};
85593
85594// posix version
85595exports.isAbsolute = function(path) {
85596 return path.charAt(0) === '/';
85597};
85598
85599// posix version
85600exports.join = function() {
85601 var paths = Array.prototype.slice.call(arguments, 0);
85602 return exports.normalize(filter(paths, function(p, index) {
85603 if (typeof p !== 'string') {
85604 throw new TypeError('Arguments to path.join must be strings');
85605 }
85606 return p;
85607 }).join('/'));
85608};
85609
85610
85611// path.relative(from, to)
85612// posix version
85613exports.relative = function(from, to) {
85614 from = exports.resolve(from).substr(1);
85615 to = exports.resolve(to).substr(1);
85616
85617 function trim(arr) {
85618 var start = 0;
85619 for (; start < arr.length; start++) {
85620 if (arr[start] !== '') break;
85621 }
85622
85623 var end = arr.length - 1;
85624 for (; end >= 0; end--) {
85625 if (arr[end] !== '') break;
85626 }
85627
85628 if (start > end) return [];
85629 return arr.slice(start, end - start + 1);
85630 }
85631
85632 var fromParts = trim(from.split('/'));
85633 var toParts = trim(to.split('/'));
85634
85635 var length = Math.min(fromParts.length, toParts.length);
85636 var samePartsLength = length;
85637 for (var i = 0; i < length; i++) {
85638 if (fromParts[i] !== toParts[i]) {
85639 samePartsLength = i;
85640 break;
85641 }
85642 }
85643
85644 var outputParts = [];
85645 for (var i = samePartsLength; i < fromParts.length; i++) {
85646 outputParts.push('..');
85647 }
85648
85649 outputParts = outputParts.concat(toParts.slice(samePartsLength));
85650
85651 return outputParts.join('/');
85652};
85653
85654exports.sep = '/';
85655exports.delimiter = ':';
85656
85657exports.dirname = function (path) {
85658 if (typeof path !== 'string') path = path + '';
85659 if (path.length === 0) return '.';
85660 var code = path.charCodeAt(0);
85661 var hasRoot = code === 47 /*/*/;
85662 var end = -1;
85663 var matchedSlash = true;
85664 for (var i = path.length - 1; i >= 1; --i) {
85665 code = path.charCodeAt(i);
85666 if (code === 47 /*/*/) {
85667 if (!matchedSlash) {
85668 end = i;
85669 break;
85670 }
85671 } else {
85672 // We saw the first non-path separator
85673 matchedSlash = false;
85674 }
85675 }
85676
85677 if (end === -1) return hasRoot ? '/' : '.';
85678 if (hasRoot && end === 1) {
85679 // return '//';
85680 // Backwards-compat fix:
85681 return '/';
85682 }
85683 return path.slice(0, end);
85684};
85685
85686function basename(path) {
85687 if (typeof path !== 'string') path = path + '';
85688
85689 var start = 0;
85690 var end = -1;
85691 var matchedSlash = true;
85692 var i;
85693
85694 for (i = path.length - 1; i >= 0; --i) {
85695 if (path.charCodeAt(i) === 47 /*/*/) {
85696 // If we reached a path separator that was not part of a set of path
85697 // separators at the end of the string, stop now
85698 if (!matchedSlash) {
85699 start = i + 1;
85700 break;
85701 }
85702 } else if (end === -1) {
85703 // We saw the first non-path separator, mark this as the end of our
85704 // path component
85705 matchedSlash = false;
85706 end = i + 1;
85707 }
85708 }
85709
85710 if (end === -1) return '';
85711 return path.slice(start, end);
85712}
85713
85714// Uses a mixed approach for backwards-compatibility, as ext behavior changed
85715// in new Node.js versions, so only basename() above is backported here
85716exports.basename = function (path, ext) {
85717 var f = basename(path);
85718 if (ext && f.substr(-1 * ext.length) === ext) {
85719 f = f.substr(0, f.length - ext.length);
85720 }
85721 return f;
85722};
85723
85724exports.extname = function (path) {
85725 if (typeof path !== 'string') path = path + '';
85726 var startDot = -1;
85727 var startPart = 0;
85728 var end = -1;
85729 var matchedSlash = true;
85730 // Track the state of characters (if any) we see before our first dot and
85731 // after any path separator we find
85732 var preDotState = 0;
85733 for (var i = path.length - 1; i >= 0; --i) {
85734 var code = path.charCodeAt(i);
85735 if (code === 47 /*/*/) {
85736 // If we reached a path separator that was not part of a set of path
85737 // separators at the end of the string, stop now
85738 if (!matchedSlash) {
85739 startPart = i + 1;
85740 break;
85741 }
85742 continue;
85743 }
85744 if (end === -1) {
85745 // We saw the first non-path separator, mark this as the end of our
85746 // extension
85747 matchedSlash = false;
85748 end = i + 1;
85749 }
85750 if (code === 46 /*.*/) {
85751 // If this is our first dot, mark it as the start of our extension
85752 if (startDot === -1)
85753 startDot = i;
85754 else if (preDotState !== 1)
85755 preDotState = 1;
85756 } else if (startDot !== -1) {
85757 // We saw a non-dot and non-path separator before our dot, so we should
85758 // have a good chance at having a non-empty extension
85759 preDotState = -1;
85760 }
85761 }
85762
85763 if (startDot === -1 || end === -1 ||
85764 // We saw a non-dot character immediately before the dot
85765 preDotState === 0 ||
85766 // The (right-most) trimmed path component is exactly '..'
85767 preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
85768 return '';
85769 }
85770 return path.slice(startDot, end);
85771};
85772
85773function filter (xs, f) {
85774 if (xs.filter) return xs.filter(f);
85775 var res = [];
85776 for (var i = 0; i < xs.length; i++) {
85777 if (f(xs[i], i, xs)) res.push(xs[i]);
85778 }
85779 return res;
85780}
85781
85782// String.prototype.substr - negative index don't work in IE8
85783var substr = 'ab'.substr(-1) === 'b'
85784 ? function (str, start, len) { return str.substr(start, len) }
85785 : function (str, start, len) {
85786 if (start < 0) start = str.length + start;
85787 return str.substr(start, len);
85788 }
85789;
85790
85791}).call(this,require('_process'))
85792},{"_process":678}],672:[function(require,module,exports){
85793exports.pbkdf2 = require('./lib/async')
85794exports.pbkdf2Sync = require('./lib/sync')
85795
85796},{"./lib/async":673,"./lib/sync":676}],673:[function(require,module,exports){
85797(function (process,global){
85798var checkParameters = require('./precondition')
85799var defaultEncoding = require('./default-encoding')
85800var sync = require('./sync')
85801var Buffer = require('safe-buffer').Buffer
85802
85803var ZERO_BUF
85804var subtle = global.crypto && global.crypto.subtle
85805var toBrowser = {
85806 'sha': 'SHA-1',
85807 'sha-1': 'SHA-1',
85808 'sha1': 'SHA-1',
85809 'sha256': 'SHA-256',
85810 'sha-256': 'SHA-256',
85811 'sha384': 'SHA-384',
85812 'sha-384': 'SHA-384',
85813 'sha-512': 'SHA-512',
85814 'sha512': 'SHA-512'
85815}
85816var checks = []
85817function checkNative (algo) {
85818 if (global.process && !global.process.browser) {
85819 return Promise.resolve(false)
85820 }
85821 if (!subtle || !subtle.importKey || !subtle.deriveBits) {
85822 return Promise.resolve(false)
85823 }
85824 if (checks[algo] !== undefined) {
85825 return checks[algo]
85826 }
85827 ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
85828 var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
85829 .then(function () {
85830 return true
85831 }).catch(function () {
85832 return false
85833 })
85834 checks[algo] = prom
85835 return prom
85836}
85837
85838function browserPbkdf2 (password, salt, iterations, length, algo) {
85839 return subtle.importKey(
85840 'raw', password, {name: 'PBKDF2'}, false, ['deriveBits']
85841 ).then(function (key) {
85842 return subtle.deriveBits({
85843 name: 'PBKDF2',
85844 salt: salt,
85845 iterations: iterations,
85846 hash: {
85847 name: algo
85848 }
85849 }, key, length << 3)
85850 }).then(function (res) {
85851 return Buffer.from(res)
85852 })
85853}
85854
85855function resolvePromise (promise, callback) {
85856 promise.then(function (out) {
85857 process.nextTick(function () {
85858 callback(null, out)
85859 })
85860 }, function (e) {
85861 process.nextTick(function () {
85862 callback(e)
85863 })
85864 })
85865}
85866module.exports = function (password, salt, iterations, keylen, digest, callback) {
85867 if (typeof digest === 'function') {
85868 callback = digest
85869 digest = undefined
85870 }
85871
85872 digest = digest || 'sha1'
85873 var algo = toBrowser[digest.toLowerCase()]
85874
85875 if (!algo || typeof global.Promise !== 'function') {
85876 return process.nextTick(function () {
85877 var out
85878 try {
85879 out = sync(password, salt, iterations, keylen, digest)
85880 } catch (e) {
85881 return callback(e)
85882 }
85883 callback(null, out)
85884 })
85885 }
85886
85887 checkParameters(password, salt, iterations, keylen)
85888 if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
85889 if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding)
85890 if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding)
85891
85892 resolvePromise(checkNative(algo).then(function (resp) {
85893 if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
85894
85895 return sync(password, salt, iterations, keylen, digest)
85896 }), callback)
85897}
85898
85899}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
85900},{"./default-encoding":674,"./precondition":675,"./sync":676,"_process":678,"safe-buffer":742}],674:[function(require,module,exports){
85901(function (process){
85902var defaultEncoding
85903/* istanbul ignore next */
85904if (process.browser) {
85905 defaultEncoding = 'utf-8'
85906} else {
85907 var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
85908
85909 defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
85910}
85911module.exports = defaultEncoding
85912
85913}).call(this,require('_process'))
85914},{"_process":678}],675:[function(require,module,exports){
85915(function (Buffer){
85916var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
85917
85918function checkBuffer (buf, name) {
85919 if (typeof buf !== 'string' && !Buffer.isBuffer(buf)) {
85920 throw new TypeError(name + ' must be a buffer or string')
85921 }
85922}
85923
85924module.exports = function (password, salt, iterations, keylen) {
85925 checkBuffer(password, 'Password')
85926 checkBuffer(salt, 'Salt')
85927
85928 if (typeof iterations !== 'number') {
85929 throw new TypeError('Iterations not a number')
85930 }
85931
85932 if (iterations < 0) {
85933 throw new TypeError('Bad iterations')
85934 }
85935
85936 if (typeof keylen !== 'number') {
85937 throw new TypeError('Key length not a number')
85938 }
85939
85940 if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
85941 throw new TypeError('Bad key length')
85942 }
85943}
85944
85945}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")})
85946},{"../../insert-module-globals/node_modules/is-buffer/index.js":397}],676:[function(require,module,exports){
85947var md5 = require('create-hash/md5')
85948var RIPEMD160 = require('ripemd160')
85949var sha = require('sha.js')
85950
85951var checkParameters = require('./precondition')
85952var defaultEncoding = require('./default-encoding')
85953var Buffer = require('safe-buffer').Buffer
85954var ZEROS = Buffer.alloc(128)
85955var sizes = {
85956 md5: 16,
85957 sha1: 20,
85958 sha224: 28,
85959 sha256: 32,
85960 sha384: 48,
85961 sha512: 64,
85962 rmd160: 20,
85963 ripemd160: 20
85964}
85965
85966function Hmac (alg, key, saltLen) {
85967 var hash = getDigest(alg)
85968 var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
85969
85970 if (key.length > blocksize) {
85971 key = hash(key)
85972 } else if (key.length < blocksize) {
85973 key = Buffer.concat([key, ZEROS], blocksize)
85974 }
85975
85976 var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
85977 var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
85978 for (var i = 0; i < blocksize; i++) {
85979 ipad[i] = key[i] ^ 0x36
85980 opad[i] = key[i] ^ 0x5C
85981 }
85982
85983 var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
85984 ipad.copy(ipad1, 0, 0, blocksize)
85985 this.ipad1 = ipad1
85986 this.ipad2 = ipad
85987 this.opad = opad
85988 this.alg = alg
85989 this.blocksize = blocksize
85990 this.hash = hash
85991 this.size = sizes[alg]
85992}
85993
85994Hmac.prototype.run = function (data, ipad) {
85995 data.copy(ipad, this.blocksize)
85996 var h = this.hash(ipad)
85997 h.copy(this.opad, this.blocksize)
85998 return this.hash(this.opad)
85999}
86000
86001function getDigest (alg) {
86002 function shaFunc (data) {
86003 return sha(alg).update(data).digest()
86004 }
86005 function rmd160Func (data) {
86006 return new RIPEMD160().update(data).digest()
86007 }
86008
86009 if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func
86010 if (alg === 'md5') return md5
86011 return shaFunc
86012}
86013
86014function pbkdf2 (password, salt, iterations, keylen, digest) {
86015 checkParameters(password, salt, iterations, keylen)
86016
86017 if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding)
86018 if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding)
86019
86020 digest = digest || 'sha1'
86021
86022 var hmac = new Hmac(digest, password, salt.length)
86023
86024 var DK = Buffer.allocUnsafe(keylen)
86025 var block1 = Buffer.allocUnsafe(salt.length + 4)
86026 salt.copy(block1, 0, 0, salt.length)
86027
86028 var destPos = 0
86029 var hLen = sizes[digest]
86030 var l = Math.ceil(keylen / hLen)
86031
86032 for (var i = 1; i <= l; i++) {
86033 block1.writeUInt32BE(i, salt.length)
86034
86035 var T = hmac.run(block1, hmac.ipad1)
86036 var U = T
86037
86038 for (var j = 1; j < iterations; j++) {
86039 U = hmac.run(U, hmac.ipad2)
86040 for (var k = 0; k < hLen; k++) T[k] ^= U[k]
86041 }
86042
86043 T.copy(DK, destPos)
86044 destPos += hLen
86045 }
86046
86047 return DK
86048}
86049
86050module.exports = pbkdf2
86051
86052},{"./default-encoding":674,"./precondition":675,"create-hash/md5":240,"ripemd160":740,"safe-buffer":742,"sha.js":770}],677:[function(require,module,exports){
86053(function (process){
86054'use strict';
86055
86056if (typeof process === 'undefined' ||
86057 !process.version ||
86058 process.version.indexOf('v0.') === 0 ||
86059 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
86060 module.exports = { nextTick: nextTick };
86061} else {
86062 module.exports = process
86063}
86064
86065function nextTick(fn, arg1, arg2, arg3) {
86066 if (typeof fn !== 'function') {
86067 throw new TypeError('"callback" argument must be a function');
86068 }
86069 var len = arguments.length;
86070 var args, i;
86071 switch (len) {
86072 case 0:
86073 case 1:
86074 return process.nextTick(fn);
86075 case 2:
86076 return process.nextTick(function afterTickOne() {
86077 fn.call(null, arg1);
86078 });
86079 case 3:
86080 return process.nextTick(function afterTickTwo() {
86081 fn.call(null, arg1, arg2);
86082 });
86083 case 4:
86084 return process.nextTick(function afterTickThree() {
86085 fn.call(null, arg1, arg2, arg3);
86086 });
86087 default:
86088 args = new Array(len - 1);
86089 i = 0;
86090 while (i < args.length) {
86091 args[i++] = arguments[i];
86092 }
86093 return process.nextTick(function afterTick() {
86094 fn.apply(null, args);
86095 });
86096 }
86097}
86098
86099
86100}).call(this,require('_process'))
86101},{"_process":678}],678:[function(require,module,exports){
86102// shim for using process in browser
86103var process = module.exports = {};
86104
86105// cached from whatever global is present so that test runners that stub it
86106// don't break things. But we need to wrap it in a try catch in case it is
86107// wrapped in strict mode code which doesn't define any globals. It's inside a
86108// function because try/catches deoptimize in certain engines.
86109
86110var cachedSetTimeout;
86111var cachedClearTimeout;
86112
86113function defaultSetTimout() {
86114 throw new Error('setTimeout has not been defined');
86115}
86116function defaultClearTimeout () {
86117 throw new Error('clearTimeout has not been defined');
86118}
86119(function () {
86120 try {
86121 if (typeof setTimeout === 'function') {
86122 cachedSetTimeout = setTimeout;
86123 } else {
86124 cachedSetTimeout = defaultSetTimout;
86125 }
86126 } catch (e) {
86127 cachedSetTimeout = defaultSetTimout;
86128 }
86129 try {
86130 if (typeof clearTimeout === 'function') {
86131 cachedClearTimeout = clearTimeout;
86132 } else {
86133 cachedClearTimeout = defaultClearTimeout;
86134 }
86135 } catch (e) {
86136 cachedClearTimeout = defaultClearTimeout;
86137 }
86138} ())
86139function runTimeout(fun) {
86140 if (cachedSetTimeout === setTimeout) {
86141 //normal enviroments in sane situations
86142 return setTimeout(fun, 0);
86143 }
86144 // if setTimeout wasn't available but was latter defined
86145 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
86146 cachedSetTimeout = setTimeout;
86147 return setTimeout(fun, 0);
86148 }
86149 try {
86150 // when when somebody has screwed with setTimeout but no I.E. maddness
86151 return cachedSetTimeout(fun, 0);
86152 } catch(e){
86153 try {
86154 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
86155 return cachedSetTimeout.call(null, fun, 0);
86156 } catch(e){
86157 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
86158 return cachedSetTimeout.call(this, fun, 0);
86159 }
86160 }
86161
86162
86163}
86164function runClearTimeout(marker) {
86165 if (cachedClearTimeout === clearTimeout) {
86166 //normal enviroments in sane situations
86167 return clearTimeout(marker);
86168 }
86169 // if clearTimeout wasn't available but was latter defined
86170 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
86171 cachedClearTimeout = clearTimeout;
86172 return clearTimeout(marker);
86173 }
86174 try {
86175 // when when somebody has screwed with setTimeout but no I.E. maddness
86176 return cachedClearTimeout(marker);
86177 } catch (e){
86178 try {
86179 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
86180 return cachedClearTimeout.call(null, marker);
86181 } catch (e){
86182 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
86183 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
86184 return cachedClearTimeout.call(this, marker);
86185 }
86186 }
86187
86188
86189
86190}
86191var queue = [];
86192var draining = false;
86193var currentQueue;
86194var queueIndex = -1;
86195
86196function cleanUpNextTick() {
86197 if (!draining || !currentQueue) {
86198 return;
86199 }
86200 draining = false;
86201 if (currentQueue.length) {
86202 queue = currentQueue.concat(queue);
86203 } else {
86204 queueIndex = -1;
86205 }
86206 if (queue.length) {
86207 drainQueue();
86208 }
86209}
86210
86211function drainQueue() {
86212 if (draining) {
86213 return;
86214 }
86215 var timeout = runTimeout(cleanUpNextTick);
86216 draining = true;
86217
86218 var len = queue.length;
86219 while(len) {
86220 currentQueue = queue;
86221 queue = [];
86222 while (++queueIndex < len) {
86223 if (currentQueue) {
86224 currentQueue[queueIndex].run();
86225 }
86226 }
86227 queueIndex = -1;
86228 len = queue.length;
86229 }
86230 currentQueue = null;
86231 draining = false;
86232 runClearTimeout(timeout);
86233}
86234
86235process.nextTick = function (fun) {
86236 var args = new Array(arguments.length - 1);
86237 if (arguments.length > 1) {
86238 for (var i = 1; i < arguments.length; i++) {
86239 args[i - 1] = arguments[i];
86240 }
86241 }
86242 queue.push(new Item(fun, args));
86243 if (queue.length === 1 && !draining) {
86244 runTimeout(drainQueue);
86245 }
86246};
86247
86248// v8 likes predictible objects
86249function Item(fun, array) {
86250 this.fun = fun;
86251 this.array = array;
86252}
86253Item.prototype.run = function () {
86254 this.fun.apply(null, this.array);
86255};
86256process.title = 'browser';
86257process.browser = true;
86258process.env = {};
86259process.argv = [];
86260process.version = ''; // empty string to avoid regexp issues
86261process.versions = {};
86262
86263function noop() {}
86264
86265process.on = noop;
86266process.addListener = noop;
86267process.once = noop;
86268process.off = noop;
86269process.removeListener = noop;
86270process.removeAllListeners = noop;
86271process.emit = noop;
86272process.prependListener = noop;
86273process.prependOnceListener = noop;
86274
86275process.listeners = function (name) { return [] }
86276
86277process.binding = function (name) {
86278 throw new Error('process.binding is not supported');
86279};
86280
86281process.cwd = function () { return '/' };
86282process.chdir = function (dir) {
86283 throw new Error('process.chdir is not supported');
86284};
86285process.umask = function() { return 0; };
86286
86287},{}],679:[function(require,module,exports){
86288// full library entry point.\r
86289\r
86290"use strict";\r
86291module.exports = require("./src/index");\r
86292
86293},{"./src/index":688}],680:[function(require,module,exports){
86294"use strict";\r
86295module.exports = common;\r
86296\r
86297var commonRe = /\/|\./;\r
86298\r
86299/**\r
86300 * Provides common type definitions.\r
86301 * Can also be used to provide additional google types or your own custom types.\r
86302 * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name\r
86303 * @param {Object.<string,*>} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition\r
86304 * @returns {undefined}\r
86305 * @property {INamespace} google/protobuf/any.proto Any\r
86306 * @property {INamespace} google/protobuf/duration.proto Duration\r
86307 * @property {INamespace} google/protobuf/empty.proto Empty\r
86308 * @property {INamespace} google/protobuf/field_mask.proto FieldMask\r
86309 * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue\r
86310 * @property {INamespace} google/protobuf/timestamp.proto Timestamp\r
86311 * @property {INamespace} google/protobuf/wrappers.proto Wrappers\r
86312 * @example\r
86313 * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension)\r
86314 * protobuf.common("descriptor", descriptorJson);\r
86315 *\r
86316 * // manually provides a custom definition (uses my.foo namespace)\r
86317 * protobuf.common("my/foo/bar.proto", myFooBarJson);\r
86318 */\r
86319function common(name, json) {\r
86320 if (!commonRe.test(name)) {\r
86321 name = "google/protobuf/" + name + ".proto";\r
86322 json = { nested: { google: { nested: { protobuf: { nested: json } } } } };\r
86323 }\r
86324 common[name] = json;\r
86325}\r
86326\r
86327// Not provided because of limited use (feel free to discuss or to provide yourself):\r
86328//\r
86329// google/protobuf/descriptor.proto\r
86330// google/protobuf/source_context.proto\r
86331// google/protobuf/type.proto\r
86332//\r
86333// Stripped and pre-parsed versions of these non-bundled files are instead available as part of\r
86334// the repository or package within the google/protobuf directory.\r
86335\r
86336common("any", {\r
86337\r
86338 /**\r
86339 * Properties of a google.protobuf.Any message.\r
86340 * @interface IAny\r
86341 * @type {Object}\r
86342 * @property {string} [typeUrl]\r
86343 * @property {Uint8Array} [bytes]\r
86344 * @memberof common\r
86345 */\r
86346 Any: {\r
86347 fields: {\r
86348 type_url: {\r
86349 type: "string",\r
86350 id: 1\r
86351 },\r
86352 value: {\r
86353 type: "bytes",\r
86354 id: 2\r
86355 }\r
86356 }\r
86357 }\r
86358});\r
86359\r
86360var timeType;\r
86361\r
86362common("duration", {\r
86363\r
86364 /**\r
86365 * Properties of a google.protobuf.Duration message.\r
86366 * @interface IDuration\r
86367 * @type {Object}\r
86368 * @property {number|Long} [seconds]\r
86369 * @property {number} [nanos]\r
86370 * @memberof common\r
86371 */\r
86372 Duration: timeType = {\r
86373 fields: {\r
86374 seconds: {\r
86375 type: "int64",\r
86376 id: 1\r
86377 },\r
86378 nanos: {\r
86379 type: "int32",\r
86380 id: 2\r
86381 }\r
86382 }\r
86383 }\r
86384});\r
86385\r
86386common("timestamp", {\r
86387\r
86388 /**\r
86389 * Properties of a google.protobuf.Timestamp message.\r
86390 * @interface ITimestamp\r
86391 * @type {Object}\r
86392 * @property {number|Long} [seconds]\r
86393 * @property {number} [nanos]\r
86394 * @memberof common\r
86395 */\r
86396 Timestamp: timeType\r
86397});\r
86398\r
86399common("empty", {\r
86400\r
86401 /**\r
86402 * Properties of a google.protobuf.Empty message.\r
86403 * @interface IEmpty\r
86404 * @memberof common\r
86405 */\r
86406 Empty: {\r
86407 fields: {}\r
86408 }\r
86409});\r
86410\r
86411common("struct", {\r
86412\r
86413 /**\r
86414 * Properties of a google.protobuf.Struct message.\r
86415 * @interface IStruct\r
86416 * @type {Object}\r
86417 * @property {Object.<string,IValue>} [fields]\r
86418 * @memberof common\r
86419 */\r
86420 Struct: {\r
86421 fields: {\r
86422 fields: {\r
86423 keyType: "string",\r
86424 type: "Value",\r
86425 id: 1\r
86426 }\r
86427 }\r
86428 },\r
86429\r
86430 /**\r
86431 * Properties of a google.protobuf.Value message.\r
86432 * @interface IValue\r
86433 * @type {Object}\r
86434 * @property {string} [kind]\r
86435 * @property {0} [nullValue]\r
86436 * @property {number} [numberValue]\r
86437 * @property {string} [stringValue]\r
86438 * @property {boolean} [boolValue]\r
86439 * @property {IStruct} [structValue]\r
86440 * @property {IListValue} [listValue]\r
86441 * @memberof common\r
86442 */\r
86443 Value: {\r
86444 oneofs: {\r
86445 kind: {\r
86446 oneof: [\r
86447 "nullValue",\r
86448 "numberValue",\r
86449 "stringValue",\r
86450 "boolValue",\r
86451 "structValue",\r
86452 "listValue"\r
86453 ]\r
86454 }\r
86455 },\r
86456 fields: {\r
86457 nullValue: {\r
86458 type: "NullValue",\r
86459 id: 1\r
86460 },\r
86461 numberValue: {\r
86462 type: "double",\r
86463 id: 2\r
86464 },\r
86465 stringValue: {\r
86466 type: "string",\r
86467 id: 3\r
86468 },\r
86469 boolValue: {\r
86470 type: "bool",\r
86471 id: 4\r
86472 },\r
86473 structValue: {\r
86474 type: "Struct",\r
86475 id: 5\r
86476 },\r
86477 listValue: {\r
86478 type: "ListValue",\r
86479 id: 6\r
86480 }\r
86481 }\r
86482 },\r
86483\r
86484 NullValue: {\r
86485 values: {\r
86486 NULL_VALUE: 0\r
86487 }\r
86488 },\r
86489\r
86490 /**\r
86491 * Properties of a google.protobuf.ListValue message.\r
86492 * @interface IListValue\r
86493 * @type {Object}\r
86494 * @property {Array.<IValue>} [values]\r
86495 * @memberof common\r
86496 */\r
86497 ListValue: {\r
86498 fields: {\r
86499 values: {\r
86500 rule: "repeated",\r
86501 type: "Value",\r
86502 id: 1\r
86503 }\r
86504 }\r
86505 }\r
86506});\r
86507\r
86508common("wrappers", {\r
86509\r
86510 /**\r
86511 * Properties of a google.protobuf.DoubleValue message.\r
86512 * @interface IDoubleValue\r
86513 * @type {Object}\r
86514 * @property {number} [value]\r
86515 * @memberof common\r
86516 */\r
86517 DoubleValue: {\r
86518 fields: {\r
86519 value: {\r
86520 type: "double",\r
86521 id: 1\r
86522 }\r
86523 }\r
86524 },\r
86525\r
86526 /**\r
86527 * Properties of a google.protobuf.FloatValue message.\r
86528 * @interface IFloatValue\r
86529 * @type {Object}\r
86530 * @property {number} [value]\r
86531 * @memberof common\r
86532 */\r
86533 FloatValue: {\r
86534 fields: {\r
86535 value: {\r
86536 type: "float",\r
86537 id: 1\r
86538 }\r
86539 }\r
86540 },\r
86541\r
86542 /**\r
86543 * Properties of a google.protobuf.Int64Value message.\r
86544 * @interface IInt64Value\r
86545 * @type {Object}\r
86546 * @property {number|Long} [value]\r
86547 * @memberof common\r
86548 */\r
86549 Int64Value: {\r
86550 fields: {\r
86551 value: {\r
86552 type: "int64",\r
86553 id: 1\r
86554 }\r
86555 }\r
86556 },\r
86557\r
86558 /**\r
86559 * Properties of a google.protobuf.UInt64Value message.\r
86560 * @interface IUInt64Value\r
86561 * @type {Object}\r
86562 * @property {number|Long} [value]\r
86563 * @memberof common\r
86564 */\r
86565 UInt64Value: {\r
86566 fields: {\r
86567 value: {\r
86568 type: "uint64",\r
86569 id: 1\r
86570 }\r
86571 }\r
86572 },\r
86573\r
86574 /**\r
86575 * Properties of a google.protobuf.Int32Value message.\r
86576 * @interface IInt32Value\r
86577 * @type {Object}\r
86578 * @property {number} [value]\r
86579 * @memberof common\r
86580 */\r
86581 Int32Value: {\r
86582 fields: {\r
86583 value: {\r
86584 type: "int32",\r
86585 id: 1\r
86586 }\r
86587 }\r
86588 },\r
86589\r
86590 /**\r
86591 * Properties of a google.protobuf.UInt32Value message.\r
86592 * @interface IUInt32Value\r
86593 * @type {Object}\r
86594 * @property {number} [value]\r
86595 * @memberof common\r
86596 */\r
86597 UInt32Value: {\r
86598 fields: {\r
86599 value: {\r
86600 type: "uint32",\r
86601 id: 1\r
86602 }\r
86603 }\r
86604 },\r
86605\r
86606 /**\r
86607 * Properties of a google.protobuf.BoolValue message.\r
86608 * @interface IBoolValue\r
86609 * @type {Object}\r
86610 * @property {boolean} [value]\r
86611 * @memberof common\r
86612 */\r
86613 BoolValue: {\r
86614 fields: {\r
86615 value: {\r
86616 type: "bool",\r
86617 id: 1\r
86618 }\r
86619 }\r
86620 },\r
86621\r
86622 /**\r
86623 * Properties of a google.protobuf.StringValue message.\r
86624 * @interface IStringValue\r
86625 * @type {Object}\r
86626 * @property {string} [value]\r
86627 * @memberof common\r
86628 */\r
86629 StringValue: {\r
86630 fields: {\r
86631 value: {\r
86632 type: "string",\r
86633 id: 1\r
86634 }\r
86635 }\r
86636 },\r
86637\r
86638 /**\r
86639 * Properties of a google.protobuf.BytesValue message.\r
86640 * @interface IBytesValue\r
86641 * @type {Object}\r
86642 * @property {Uint8Array} [value]\r
86643 * @memberof common\r
86644 */\r
86645 BytesValue: {\r
86646 fields: {\r
86647 value: {\r
86648 type: "bytes",\r
86649 id: 1\r
86650 }\r
86651 }\r
86652 }\r
86653});\r
86654\r
86655common("field_mask", {\r
86656\r
86657 /**\r
86658 * Properties of a google.protobuf.FieldMask message.\r
86659 * @interface IDoubleValue\r
86660 * @type {Object}\r
86661 * @property {number} [value]\r
86662 * @memberof common\r
86663 */\r
86664 FieldMask: {\r
86665 fields: {\r
86666 paths: {\r
86667 rule: "repeated",\r
86668 type: "string",\r
86669 id: 1\r
86670 }\r
86671 }\r
86672 }\r
86673});\r
86674\r
86675/**\r
86676 * Gets the root definition of the specified common proto file.\r
86677 *\r
86678 * Bundled definitions are:\r
86679 * - google/protobuf/any.proto\r
86680 * - google/protobuf/duration.proto\r
86681 * - google/protobuf/empty.proto\r
86682 * - google/protobuf/field_mask.proto\r
86683 * - google/protobuf/struct.proto\r
86684 * - google/protobuf/timestamp.proto\r
86685 * - google/protobuf/wrappers.proto\r
86686 *\r
86687 * @param {string} file Proto file name\r
86688 * @returns {INamespace|null} Root definition or `null` if not defined\r
86689 */\r
86690common.get = function get(file) {\r
86691 return common[file] || null;\r
86692};\r
86693
86694},{}],681:[function(require,module,exports){
86695"use strict";\r
86696/**\r
86697 * Runtime message from/to plain object converters.\r
86698 * @namespace\r
86699 */\r
86700var converter = exports;\r
86701\r
86702var Enum = require("./enum"),\r
86703 util = require("./util");\r
86704\r
86705/**\r
86706 * Generates a partial value fromObject conveter.\r
86707 * @param {Codegen} gen Codegen instance\r
86708 * @param {Field} field Reflected field\r
86709 * @param {number} fieldIndex Field index\r
86710 * @param {string} prop Property reference\r
86711 * @returns {Codegen} Codegen instance\r
86712 * @ignore\r
86713 */\r
86714function genValuePartial_fromObject(gen, field, fieldIndex, prop) {\r
86715 /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86716 if (field.resolvedType) {\r
86717 if (field.resolvedType instanceof Enum) { gen\r
86718 ("switch(d%s){", prop);\r
86719 for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\r
86720 if (field.repeated && values[keys[i]] === field.typeDefault) gen\r
86721 ("default:");\r
86722 gen\r
86723 ("case%j:", keys[i])\r
86724 ("case %i:", values[keys[i]])\r
86725 ("m%s=%j", prop, values[keys[i]])\r
86726 ("break");\r
86727 } gen\r
86728 ("}");\r
86729 } else gen\r
86730 ("if(typeof d%s!==\"object\")", prop)\r
86731 ("throw TypeError(%j)", field.fullName + ": object expected")\r
86732 ("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop);\r
86733 } else {\r
86734 var isUnsigned = false;\r
86735 switch (field.type) {\r
86736 case "double":\r
86737 case "float": gen\r
86738 ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity"\r
86739 break;\r
86740 case "uint32":\r
86741 case "fixed32": gen\r
86742 ("m%s=d%s>>>0", prop, prop);\r
86743 break;\r
86744 case "int32":\r
86745 case "sint32":\r
86746 case "sfixed32": gen\r
86747 ("m%s=d%s|0", prop, prop);\r
86748 break;\r
86749 case "uint64":\r
86750 isUnsigned = true;\r
86751 // eslint-disable-line no-fallthrough\r
86752 case "int64":\r
86753 case "sint64":\r
86754 case "fixed64":\r
86755 case "sfixed64": gen\r
86756 ("if(util.Long)")\r
86757 ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)\r
86758 ("else if(typeof d%s===\"string\")", prop)\r
86759 ("m%s=parseInt(d%s,10)", prop, prop)\r
86760 ("else if(typeof d%s===\"number\")", prop)\r
86761 ("m%s=d%s", prop, prop)\r
86762 ("else if(typeof d%s===\"object\")", prop)\r
86763 ("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : "");\r
86764 break;\r
86765 case "bytes": gen\r
86766 ("if(typeof d%s===\"string\")", prop)\r
86767 ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)\r
86768 ("else if(d%s.length)", prop)\r
86769 ("m%s=d%s", prop, prop);\r
86770 break;\r
86771 case "string": gen\r
86772 ("m%s=String(d%s)", prop, prop);\r
86773 break;\r
86774 case "bool": gen\r
86775 ("m%s=Boolean(d%s)", prop, prop);\r
86776 break;\r
86777 /* default: gen\r
86778 ("m%s=d%s", prop, prop);\r
86779 break; */\r
86780 }\r
86781 }\r
86782 return gen;\r
86783 /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86784}\r
86785\r
86786/**\r
86787 * Generates a plain object to runtime message converter specific to the specified message type.\r
86788 * @param {Type} mtype Message type\r
86789 * @returns {Codegen} Codegen instance\r
86790 */\r
86791converter.fromObject = function fromObject(mtype) {\r
86792 /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86793 var fields = mtype.fieldsArray;\r
86794 var gen = util.codegen(["d"], mtype.name + "$fromObject")\r
86795 ("if(d instanceof this.ctor)")\r
86796 ("return d");\r
86797 if (!fields.length) return gen\r
86798 ("return new this.ctor");\r
86799 gen\r
86800 ("var m=new this.ctor");\r
86801 for (var i = 0; i < fields.length; ++i) {\r
86802 var field = fields[i].resolve(),\r
86803 prop = util.safeProp(field.name);\r
86804\r
86805 // Map fields\r
86806 if (field.map) { gen\r
86807 ("if(d%s){", prop)\r
86808 ("if(typeof d%s!==\"object\")", prop)\r
86809 ("throw TypeError(%j)", field.fullName + ": object expected")\r
86810 ("m%s={}", prop)\r
86811 ("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);\r
86812 genValuePartial_fromObject(gen, field, /* not sorted */ i, prop + "[ks[i]]")\r
86813 ("}")\r
86814 ("}");\r
86815\r
86816 // Repeated fields\r
86817 } else if (field.repeated) { gen\r
86818 ("if(d%s){", prop)\r
86819 ("if(!Array.isArray(d%s))", prop)\r
86820 ("throw TypeError(%j)", field.fullName + ": array expected")\r
86821 ("m%s=[]", prop)\r
86822 ("for(var i=0;i<d%s.length;++i){", prop);\r
86823 genValuePartial_fromObject(gen, field, /* not sorted */ i, prop + "[i]")\r
86824 ("}")\r
86825 ("}");\r
86826\r
86827 // Non-repeated fields\r
86828 } else {\r
86829 if (!(field.resolvedType instanceof Enum)) gen // no need to test for null/undefined if an enum (uses switch)\r
86830 ("if(d%s!=null){", prop); // !== undefined && !== null\r
86831 genValuePartial_fromObject(gen, field, /* not sorted */ i, prop);\r
86832 if (!(field.resolvedType instanceof Enum)) gen\r
86833 ("}");\r
86834 }\r
86835 } return gen\r
86836 ("return m");\r
86837 /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86838};\r
86839\r
86840/**\r
86841 * Generates a partial value toObject converter.\r
86842 * @param {Codegen} gen Codegen instance\r
86843 * @param {Field} field Reflected field\r
86844 * @param {number} fieldIndex Field index\r
86845 * @param {string} prop Property reference\r
86846 * @returns {Codegen} Codegen instance\r
86847 * @ignore\r
86848 */\r
86849function genValuePartial_toObject(gen, field, fieldIndex, prop) {\r
86850 /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86851 if (field.resolvedType) {\r
86852 if (field.resolvedType instanceof Enum) gen\r
86853 ("d%s=o.enums===String?types[%i].values[m%s]:m%s", prop, fieldIndex, prop, prop);\r
86854 else gen\r
86855 ("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);\r
86856 } else {\r
86857 var isUnsigned = false;\r
86858 switch (field.type) {\r
86859 case "double":\r
86860 case "float": gen\r
86861 ("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", prop, prop, prop, prop);\r
86862 break;\r
86863 case "uint64":\r
86864 isUnsigned = true;\r
86865 // eslint-disable-line no-fallthrough\r
86866 case "int64":\r
86867 case "sint64":\r
86868 case "fixed64":\r
86869 case "sfixed64": gen\r
86870 ("if(typeof m%s===\"number\")", prop)\r
86871 ("d%s=o.longs===String?String(m%s):m%s", prop, prop, prop)\r
86872 ("else") // Long-like\r
86873 ("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop);\r
86874 break;\r
86875 case "bytes": gen\r
86876 ("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop);\r
86877 break;\r
86878 default: gen\r
86879 ("d%s=m%s", prop, prop);\r
86880 break;\r
86881 }\r
86882 }\r
86883 return gen;\r
86884 /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86885}\r
86886\r
86887/**\r
86888 * Generates a runtime message to plain object converter specific to the specified message type.\r
86889 * @param {Type} mtype Message type\r
86890 * @returns {Codegen} Codegen instance\r
86891 */\r
86892converter.toObject = function toObject(mtype) {\r
86893 /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86894 var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\r
86895 if (!fields.length)\r
86896 return util.codegen()("return {}");\r
86897 var gen = util.codegen(["m", "o"], mtype.name + "$toObject")\r
86898 ("if(!o)")\r
86899 ("o={}")\r
86900 ("var d={}");\r
86901\r
86902 var repeatedFields = [],\r
86903 mapFields = [],\r
86904 normalFields = [],\r
86905 i = 0;\r
86906 for (; i < fields.length; ++i)\r
86907 if (!fields[i].partOf)\r
86908 ( fields[i].resolve().repeated ? repeatedFields\r
86909 : fields[i].map ? mapFields\r
86910 : normalFields).push(fields[i]);\r
86911\r
86912 if (repeatedFields.length) { gen\r
86913 ("if(o.arrays||o.defaults){");\r
86914 for (i = 0; i < repeatedFields.length; ++i) gen\r
86915 ("d%s=[]", util.safeProp(repeatedFields[i].name));\r
86916 gen\r
86917 ("}");\r
86918 }\r
86919\r
86920 if (mapFields.length) { gen\r
86921 ("if(o.objects||o.defaults){");\r
86922 for (i = 0; i < mapFields.length; ++i) gen\r
86923 ("d%s={}", util.safeProp(mapFields[i].name));\r
86924 gen\r
86925 ("}");\r
86926 }\r
86927\r
86928 if (normalFields.length) { gen\r
86929 ("if(o.defaults){");\r
86930 for (i = 0; i < normalFields.length; ++i) {\r
86931 var field = normalFields[i],\r
86932 prop = util.safeProp(field.name);\r
86933 if (field.resolvedType instanceof Enum) gen\r
86934 ("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\r
86935 else if (field.long) gen\r
86936 ("if(util.Long){")\r
86937 ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\r
86938 ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)\r
86939 ("}else")\r
86940 ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\r
86941 else if (field.bytes) {\r
86942 var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]";\r
86943 gen\r
86944 ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault))\r
86945 ("else{")\r
86946 ("d%s=%s", prop, arrayDefault)\r
86947 ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop)\r
86948 ("}");\r
86949 } else gen\r
86950 ("d%s=%j", prop, field.typeDefault); // also messages (=null)\r
86951 } gen\r
86952 ("}");\r
86953 }\r
86954 var hasKs2 = false;\r
86955 for (i = 0; i < fields.length; ++i) {\r
86956 var field = fields[i],\r
86957 index = mtype._fieldsArray.indexOf(field),\r
86958 prop = util.safeProp(field.name);\r
86959 if (field.map) {\r
86960 if (!hasKs2) { hasKs2 = true; gen\r
86961 ("var ks2");\r
86962 } gen\r
86963 ("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop)\r
86964 ("d%s={}", prop)\r
86965 ("for(var j=0;j<ks2.length;++j){");\r
86966 genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[ks2[j]]")\r
86967 ("}");\r
86968 } else if (field.repeated) { gen\r
86969 ("if(m%s&&m%s.length){", prop, prop)\r
86970 ("d%s=[]", prop)\r
86971 ("for(var j=0;j<m%s.length;++j){", prop);\r
86972 genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")\r
86973 ("}");\r
86974 } else { gen\r
86975 ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null\r
86976 genValuePartial_toObject(gen, field, /* sorted */ index, prop);\r
86977 if (field.partOf) gen\r
86978 ("if(o.oneofs)")\r
86979 ("d%s=%j", util.safeProp(field.partOf.name), field.name);\r
86980 }\r
86981 gen\r
86982 ("}");\r
86983 }\r
86984 return gen\r
86985 ("return d");\r
86986 /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
86987};\r
86988
86989},{"./enum":684,"./util":706}],682:[function(require,module,exports){
86990"use strict";\r
86991module.exports = decoder;\r
86992\r
86993var Enum = require("./enum"),\r
86994 types = require("./types"),\r
86995 util = require("./util");\r
86996\r
86997function missing(field) {\r
86998 return "missing required '" + field.name + "'";\r
86999}\r
87000\r
87001/**\r
87002 * Generates a decoder specific to the specified message type.\r
87003 * @param {Type} mtype Message type\r
87004 * @returns {Codegen} Codegen instance\r
87005 */\r
87006function decoder(mtype) {\r
87007 /* eslint-disable no-unexpected-multiline */\r
87008 var gen = util.codegen(["r", "l"], mtype.name + "$decode")\r
87009 ("if(!(r instanceof Reader))")\r
87010 ("r=Reader.create(r)")\r
87011 ("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k" : ""))\r
87012 ("while(r.pos<c){")\r
87013 ("var t=r.uint32()");\r
87014 if (mtype.group) gen\r
87015 ("if((t&7)===4)")\r
87016 ("break");\r
87017 gen\r
87018 ("switch(t>>>3){");\r
87019\r
87020 var i = 0;\r
87021 for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\r
87022 var field = mtype._fieldsArray[i].resolve(),\r
87023 type = field.resolvedType instanceof Enum ? "int32" : field.type,\r
87024 ref = "m" + util.safeProp(field.name); gen\r
87025 ("case %i:", field.id);\r
87026\r
87027 // Map fields\r
87028 if (field.map) { gen\r
87029 ("r.skip().pos++") // assumes id 1 + key wireType\r
87030 ("if(%s===util.emptyObject)", ref)\r
87031 ("%s={}", ref)\r
87032 ("k=r.%s()", field.keyType)\r
87033 ("r.pos++"); // assumes id 2 + value wireType\r
87034 if (types.long[field.keyType] !== undefined) {\r
87035 if (types.basic[type] === undefined) gen\r
87036 ("%s[typeof k===\"object\"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())", ref, i); // can't be groups\r
87037 else gen\r
87038 ("%s[typeof k===\"object\"?util.longToHash(k):k]=r.%s()", ref, type);\r
87039 } else {\r
87040 if (types.basic[type] === undefined) gen\r
87041 ("%s[k]=types[%i].decode(r,r.uint32())", ref, i); // can't be groups\r
87042 else gen\r
87043 ("%s[k]=r.%s()", ref, type);\r
87044 }\r
87045\r
87046 // Repeated fields\r
87047 } else if (field.repeated) { gen\r
87048\r
87049 ("if(!(%s&&%s.length))", ref, ref)\r
87050 ("%s=[]", ref);\r
87051\r
87052 // Packable (always check for forward and backward compatiblity)\r
87053 if (types.packed[type] !== undefined) gen\r
87054 ("if((t&7)===2){")\r
87055 ("var c2=r.uint32()+r.pos")\r
87056 ("while(r.pos<c2)")\r
87057 ("%s.push(r.%s())", ref, type)\r
87058 ("}else");\r
87059\r
87060 // Non-packed\r
87061 if (types.basic[type] === undefined) gen(field.resolvedType.group\r
87062 ? "%s.push(types[%i].decode(r))"\r
87063 : "%s.push(types[%i].decode(r,r.uint32()))", ref, i);\r
87064 else gen\r
87065 ("%s.push(r.%s())", ref, type);\r
87066\r
87067 // Non-repeated\r
87068 } else if (types.basic[type] === undefined) gen(field.resolvedType.group\r
87069 ? "%s=types[%i].decode(r)"\r
87070 : "%s=types[%i].decode(r,r.uint32())", ref, i);\r
87071 else gen\r
87072 ("%s=r.%s()", ref, type);\r
87073 gen\r
87074 ("break");\r
87075 // Unknown fields\r
87076 } gen\r
87077 ("default:")\r
87078 ("r.skipType(t&7)")\r
87079 ("break")\r
87080\r
87081 ("}")\r
87082 ("}");\r
87083\r
87084 // Field presence\r
87085 for (i = 0; i < mtype._fieldsArray.length; ++i) {\r
87086 var rfield = mtype._fieldsArray[i];\r
87087 if (rfield.required) gen\r
87088 ("if(!m.hasOwnProperty(%j))", rfield.name)\r
87089 ("throw util.ProtocolError(%j,{instance:m})", missing(rfield));\r
87090 }\r
87091\r
87092 return gen\r
87093 ("return m");\r
87094 /* eslint-enable no-unexpected-multiline */\r
87095}\r
87096
87097},{"./enum":684,"./types":705,"./util":706}],683:[function(require,module,exports){
87098"use strict";\r
87099module.exports = encoder;\r
87100\r
87101var Enum = require("./enum"),\r
87102 types = require("./types"),\r
87103 util = require("./util");\r
87104\r
87105/**\r
87106 * Generates a partial message type encoder.\r
87107 * @param {Codegen} gen Codegen instance\r
87108 * @param {Field} field Reflected field\r
87109 * @param {number} fieldIndex Field index\r
87110 * @param {string} ref Variable reference\r
87111 * @returns {Codegen} Codegen instance\r
87112 * @ignore\r
87113 */\r
87114function genTypePartial(gen, field, fieldIndex, ref) {\r
87115 return field.resolvedType.group\r
87116 ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)\r
87117 : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\r
87118}\r
87119\r
87120/**\r
87121 * Generates an encoder specific to the specified message type.\r
87122 * @param {Type} mtype Message type\r
87123 * @returns {Codegen} Codegen instance\r
87124 */\r
87125function encoder(mtype) {\r
87126 /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
87127 var gen = util.codegen(["m", "w"], mtype.name + "$encode")\r
87128 ("if(!w)")\r
87129 ("w=Writer.create()");\r
87130\r
87131 var i, ref;\r
87132\r
87133 // "when a message is serialized its known fields should be written sequentially by field number"\r
87134 var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\r
87135\r
87136 for (var i = 0; i < fields.length; ++i) {\r
87137 var field = fields[i].resolve(),\r
87138 index = mtype._fieldsArray.indexOf(field),\r
87139 type = field.resolvedType instanceof Enum ? "int32" : field.type,\r
87140 wireType = types.basic[type];\r
87141 ref = "m" + util.safeProp(field.name);\r
87142\r
87143 // Map fields\r
87144 if (field.map) {\r
87145 gen\r
87146 ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name) // !== undefined && !== null\r
87147 ("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", ref)\r
87148 ("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);\r
87149 if (wireType === undefined) gen\r
87150 ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups\r
87151 else gen\r
87152 (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref);\r
87153 gen\r
87154 ("}")\r
87155 ("}");\r
87156\r
87157 // Repeated fields\r
87158 } else if (field.repeated) { gen\r
87159 ("if(%s!=null&&%s.length){", ref, ref); // !== undefined && !== null\r
87160\r
87161 // Packed repeated\r
87162 if (field.packed && types.packed[type] !== undefined) { gen\r
87163\r
87164 ("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0)\r
87165 ("for(var i=0;i<%s.length;++i)", ref)\r
87166 ("w.%s(%s[i])", type, ref)\r
87167 ("w.ldelim()");\r
87168\r
87169 // Non-packed\r
87170 } else { gen\r
87171\r
87172 ("for(var i=0;i<%s.length;++i)", ref);\r
87173 if (wireType === undefined)\r
87174 genTypePartial(gen, field, index, ref + "[i]");\r
87175 else gen\r
87176 ("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref);\r
87177\r
87178 } gen\r
87179 ("}");\r
87180\r
87181 // Non-repeated\r
87182 } else {\r
87183 if (field.optional) gen\r
87184 ("if(%s!=null&&m.hasOwnProperty(%j))", ref, field.name); // !== undefined && !== null\r
87185\r
87186 if (wireType === undefined)\r
87187 genTypePartial(gen, field, index, ref);\r
87188 else gen\r
87189 ("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref);\r
87190\r
87191 }\r
87192 }\r
87193\r
87194 return gen\r
87195 ("return w");\r
87196 /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r
87197}
87198},{"./enum":684,"./types":705,"./util":706}],684:[function(require,module,exports){
87199"use strict";\r
87200module.exports = Enum;\r
87201\r
87202// extends ReflectionObject\r
87203var ReflectionObject = require("./object");\r
87204((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum";\r
87205\r
87206var Namespace = require("./namespace"),\r
87207 util = require("./util");\r
87208\r
87209/**\r
87210 * Constructs a new enum instance.\r
87211 * @classdesc Reflected enum.\r
87212 * @extends ReflectionObject\r
87213 * @constructor\r
87214 * @param {string} name Unique name within its namespace\r
87215 * @param {Object.<string,number>} [values] Enum values as an object, by name\r
87216 * @param {Object.<string,*>} [options] Declared options\r
87217 * @param {string} [comment] The comment for this enum\r
87218 * @param {Object.<string,string>} [comments] The value comments for this enum\r
87219 */\r
87220function Enum(name, values, options, comment, comments) {\r
87221 ReflectionObject.call(this, name, options);\r
87222\r
87223 if (values && typeof values !== "object")\r
87224 throw TypeError("values must be an object");\r
87225\r
87226 /**\r
87227 * Enum values by id.\r
87228 * @type {Object.<number,string>}\r
87229 */\r
87230 this.valuesById = {};\r
87231\r
87232 /**\r
87233 * Enum values by name.\r
87234 * @type {Object.<string,number>}\r
87235 */\r
87236 this.values = Object.create(this.valuesById); // toJSON, marker\r
87237\r
87238 /**\r
87239 * Enum comment text.\r
87240 * @type {string|null}\r
87241 */\r
87242 this.comment = comment;\r
87243\r
87244 /**\r
87245 * Value comment texts, if any.\r
87246 * @type {Object.<string,string>}\r
87247 */\r
87248 this.comments = comments || {};\r
87249\r
87250 /**\r
87251 * Reserved ranges, if any.\r
87252 * @type {Array.<number[]|string>}\r
87253 */\r
87254 this.reserved = undefined; // toJSON\r
87255\r
87256 // Note that values inherit valuesById on their prototype which makes them a TypeScript-\r
87257 // compatible enum. This is used by pbts to write actual enum definitions that work for\r
87258 // static and reflection code alike instead of emitting generic object definitions.\r
87259\r
87260 if (values)\r
87261 for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\r
87262 if (typeof values[keys[i]] === "number") // use forward entries only\r
87263 this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\r
87264}\r
87265\r
87266/**\r
87267 * Enum descriptor.\r
87268 * @interface IEnum\r
87269 * @property {Object.<string,number>} values Enum values\r
87270 * @property {Object.<string,*>} [options] Enum options\r
87271 */\r
87272\r
87273/**\r
87274 * Constructs an enum from an enum descriptor.\r
87275 * @param {string} name Enum name\r
87276 * @param {IEnum} json Enum descriptor\r
87277 * @returns {Enum} Created enum\r
87278 * @throws {TypeError} If arguments are invalid\r
87279 */\r
87280Enum.fromJSON = function fromJSON(name, json) {\r
87281 var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\r
87282 enm.reserved = json.reserved;\r
87283 return enm;\r
87284};\r
87285\r
87286/**\r
87287 * Converts this enum to an enum descriptor.\r
87288 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
87289 * @returns {IEnum} Enum descriptor\r
87290 */\r
87291Enum.prototype.toJSON = function toJSON(toJSONOptions) {\r
87292 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
87293 return util.toObject([\r
87294 "options" , this.options,\r
87295 "values" , this.values,\r
87296 "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined,\r
87297 "comment" , keepComments ? this.comment : undefined,\r
87298 "comments" , keepComments ? this.comments : undefined\r
87299 ]);\r
87300};\r
87301\r
87302/**\r
87303 * Adds a value to this enum.\r
87304 * @param {string} name Value name\r
87305 * @param {number} id Value id\r
87306 * @param {string} [comment] Comment, if any\r
87307 * @returns {Enum} `this`\r
87308 * @throws {TypeError} If arguments are invalid\r
87309 * @throws {Error} If there is already a value with this name or id\r
87310 */\r
87311Enum.prototype.add = function add(name, id, comment) {\r
87312 // utilized by the parser but not by .fromJSON\r
87313\r
87314 if (!util.isString(name))\r
87315 throw TypeError("name must be a string");\r
87316\r
87317 if (!util.isInteger(id))\r
87318 throw TypeError("id must be an integer");\r
87319\r
87320 if (this.values[name] !== undefined)\r
87321 throw Error("duplicate name '" + name + "' in " + this);\r
87322\r
87323 if (this.isReservedId(id))\r
87324 throw Error("id " + id + " is reserved in " + this);\r
87325\r
87326 if (this.isReservedName(name))\r
87327 throw Error("name '" + name + "' is reserved in " + this);\r
87328\r
87329 if (this.valuesById[id] !== undefined) {\r
87330 if (!(this.options && this.options.allow_alias))\r
87331 throw Error("duplicate id " + id + " in " + this);\r
87332 this.values[name] = id;\r
87333 } else\r
87334 this.valuesById[this.values[name] = id] = name;\r
87335\r
87336 this.comments[name] = comment || null;\r
87337 return this;\r
87338};\r
87339\r
87340/**\r
87341 * Removes a value from this enum\r
87342 * @param {string} name Value name\r
87343 * @returns {Enum} `this`\r
87344 * @throws {TypeError} If arguments are invalid\r
87345 * @throws {Error} If `name` is not a name of this enum\r
87346 */\r
87347Enum.prototype.remove = function remove(name) {\r
87348\r
87349 if (!util.isString(name))\r
87350 throw TypeError("name must be a string");\r
87351\r
87352 var val = this.values[name];\r
87353 if (val == null)\r
87354 throw Error("name '" + name + "' does not exist in " + this);\r
87355\r
87356 delete this.valuesById[val];\r
87357 delete this.values[name];\r
87358 delete this.comments[name];\r
87359\r
87360 return this;\r
87361};\r
87362\r
87363/**\r
87364 * Tests if the specified id is reserved.\r
87365 * @param {number} id Id to test\r
87366 * @returns {boolean} `true` if reserved, otherwise `false`\r
87367 */\r
87368Enum.prototype.isReservedId = function isReservedId(id) {\r
87369 return Namespace.isReservedId(this.reserved, id);\r
87370};\r
87371\r
87372/**\r
87373 * Tests if the specified name is reserved.\r
87374 * @param {string} name Name to test\r
87375 * @returns {boolean} `true` if reserved, otherwise `false`\r
87376 */\r
87377Enum.prototype.isReservedName = function isReservedName(name) {\r
87378 return Namespace.isReservedName(this.reserved, name);\r
87379};\r
87380
87381},{"./namespace":692,"./object":693,"./util":706}],685:[function(require,module,exports){
87382"use strict";\r
87383module.exports = Field;\r
87384\r
87385// extends ReflectionObject\r
87386var ReflectionObject = require("./object");\r
87387((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field";\r
87388\r
87389var Enum = require("./enum"),\r
87390 types = require("./types"),\r
87391 util = require("./util");\r
87392\r
87393var Type; // cyclic\r
87394\r
87395var ruleRe = /^required|optional|repeated$/;\r
87396\r
87397/**\r
87398 * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\r
87399 * @name Field\r
87400 * @classdesc Reflected message field.\r
87401 * @extends FieldBase\r
87402 * @constructor\r
87403 * @param {string} name Unique name within its namespace\r
87404 * @param {number} id Unique id within its namespace\r
87405 * @param {string} type Value type\r
87406 * @param {string|Object.<string,*>} [rule="optional"] Field rule\r
87407 * @param {string|Object.<string,*>} [extend] Extended type if different from parent\r
87408 * @param {Object.<string,*>} [options] Declared options\r
87409 */\r
87410\r
87411/**\r
87412 * Constructs a field from a field descriptor.\r
87413 * @param {string} name Field name\r
87414 * @param {IField} json Field descriptor\r
87415 * @returns {Field} Created field\r
87416 * @throws {TypeError} If arguments are invalid\r
87417 */\r
87418Field.fromJSON = function fromJSON(name, json) {\r
87419 return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\r
87420};\r
87421\r
87422/**\r
87423 * Not an actual constructor. Use {@link Field} instead.\r
87424 * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\r
87425 * @exports FieldBase\r
87426 * @extends ReflectionObject\r
87427 * @constructor\r
87428 * @param {string} name Unique name within its namespace\r
87429 * @param {number} id Unique id within its namespace\r
87430 * @param {string} type Value type\r
87431 * @param {string|Object.<string,*>} [rule="optional"] Field rule\r
87432 * @param {string|Object.<string,*>} [extend] Extended type if different from parent\r
87433 * @param {Object.<string,*>} [options] Declared options\r
87434 * @param {string} [comment] Comment associated with this field\r
87435 */\r
87436function Field(name, id, type, rule, extend, options, comment) {\r
87437\r
87438 if (util.isObject(rule)) {\r
87439 comment = extend;\r
87440 options = rule;\r
87441 rule = extend = undefined;\r
87442 } else if (util.isObject(extend)) {\r
87443 comment = options;\r
87444 options = extend;\r
87445 extend = undefined;\r
87446 }\r
87447\r
87448 ReflectionObject.call(this, name, options);\r
87449\r
87450 if (!util.isInteger(id) || id < 0)\r
87451 throw TypeError("id must be a non-negative integer");\r
87452\r
87453 if (!util.isString(type))\r
87454 throw TypeError("type must be a string");\r
87455\r
87456 if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\r
87457 throw TypeError("rule must be a string rule");\r
87458\r
87459 if (extend !== undefined && !util.isString(extend))\r
87460 throw TypeError("extend must be a string");\r
87461\r
87462 /**\r
87463 * Field rule, if any.\r
87464 * @type {string|undefined}\r
87465 */\r
87466 this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON\r
87467\r
87468 /**\r
87469 * Field type.\r
87470 * @type {string}\r
87471 */\r
87472 this.type = type; // toJSON\r
87473\r
87474 /**\r
87475 * Unique field id.\r
87476 * @type {number}\r
87477 */\r
87478 this.id = id; // toJSON, marker\r
87479\r
87480 /**\r
87481 * Extended type if different from parent.\r
87482 * @type {string|undefined}\r
87483 */\r
87484 this.extend = extend || undefined; // toJSON\r
87485\r
87486 /**\r
87487 * Whether this field is required.\r
87488 * @type {boolean}\r
87489 */\r
87490 this.required = rule === "required";\r
87491\r
87492 /**\r
87493 * Whether this field is optional.\r
87494 * @type {boolean}\r
87495 */\r
87496 this.optional = !this.required;\r
87497\r
87498 /**\r
87499 * Whether this field is repeated.\r
87500 * @type {boolean}\r
87501 */\r
87502 this.repeated = rule === "repeated";\r
87503\r
87504 /**\r
87505 * Whether this field is a map or not.\r
87506 * @type {boolean}\r
87507 */\r
87508 this.map = false;\r
87509\r
87510 /**\r
87511 * Message this field belongs to.\r
87512 * @type {Type|null}\r
87513 */\r
87514 this.message = null;\r
87515\r
87516 /**\r
87517 * OneOf this field belongs to, if any,\r
87518 * @type {OneOf|null}\r
87519 */\r
87520 this.partOf = null;\r
87521\r
87522 /**\r
87523 * The field type's default value.\r
87524 * @type {*}\r
87525 */\r
87526 this.typeDefault = null;\r
87527\r
87528 /**\r
87529 * The field's default value on prototypes.\r
87530 * @type {*}\r
87531 */\r
87532 this.defaultValue = null;\r
87533\r
87534 /**\r
87535 * Whether this field's value should be treated as a long.\r
87536 * @type {boolean}\r
87537 */\r
87538 this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\r
87539\r
87540 /**\r
87541 * Whether this field's value is a buffer.\r
87542 * @type {boolean}\r
87543 */\r
87544 this.bytes = type === "bytes";\r
87545\r
87546 /**\r
87547 * Resolved type if not a basic type.\r
87548 * @type {Type|Enum|null}\r
87549 */\r
87550 this.resolvedType = null;\r
87551\r
87552 /**\r
87553 * Sister-field within the extended type if a declaring extension field.\r
87554 * @type {Field|null}\r
87555 */\r
87556 this.extensionField = null;\r
87557\r
87558 /**\r
87559 * Sister-field within the declaring namespace if an extended field.\r
87560 * @type {Field|null}\r
87561 */\r
87562 this.declaringField = null;\r
87563\r
87564 /**\r
87565 * Internally remembers whether this field is packed.\r
87566 * @type {boolean|null}\r
87567 * @private\r
87568 */\r
87569 this._packed = null;\r
87570\r
87571 /**\r
87572 * Comment for this field.\r
87573 * @type {string|null}\r
87574 */\r
87575 this.comment = comment;\r
87576}\r
87577\r
87578/**\r
87579 * Determines whether this field is packed. Only relevant when repeated and working with proto2.\r
87580 * @name Field#packed\r
87581 * @type {boolean}\r
87582 * @readonly\r
87583 */\r
87584Object.defineProperty(Field.prototype, "packed", {\r
87585 get: function() {\r
87586 // defaults to packed=true if not explicity set to false\r
87587 if (this._packed === null)\r
87588 this._packed = this.getOption("packed") !== false;\r
87589 return this._packed;\r
87590 }\r
87591});\r
87592\r
87593/**\r
87594 * @override\r
87595 */\r
87596Field.prototype.setOption = function setOption(name, value, ifNotSet) {\r
87597 if (name === "packed") // clear cached before setting\r
87598 this._packed = null;\r
87599 return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\r
87600};\r
87601\r
87602/**\r
87603 * Field descriptor.\r
87604 * @interface IField\r
87605 * @property {string} [rule="optional"] Field rule\r
87606 * @property {string} type Field type\r
87607 * @property {number} id Field id\r
87608 * @property {Object.<string,*>} [options] Field options\r
87609 */\r
87610\r
87611/**\r
87612 * Extension field descriptor.\r
87613 * @interface IExtensionField\r
87614 * @extends IField\r
87615 * @property {string} extend Extended type\r
87616 */\r
87617\r
87618/**\r
87619 * Converts this field to a field descriptor.\r
87620 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
87621 * @returns {IField} Field descriptor\r
87622 */\r
87623Field.prototype.toJSON = function toJSON(toJSONOptions) {\r
87624 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
87625 return util.toObject([\r
87626 "rule" , this.rule !== "optional" && this.rule || undefined,\r
87627 "type" , this.type,\r
87628 "id" , this.id,\r
87629 "extend" , this.extend,\r
87630 "options" , this.options,\r
87631 "comment" , keepComments ? this.comment : undefined\r
87632 ]);\r
87633};\r
87634\r
87635/**\r
87636 * Resolves this field's type references.\r
87637 * @returns {Field} `this`\r
87638 * @throws {Error} If any reference cannot be resolved\r
87639 */\r
87640Field.prototype.resolve = function resolve() {\r
87641\r
87642 if (this.resolved)\r
87643 return this;\r
87644\r
87645 if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\r
87646 this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\r
87647 if (this.resolvedType instanceof Type)\r
87648 this.typeDefault = null;\r
87649 else // instanceof Enum\r
87650 this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\r
87651 }\r
87652\r
87653 // use explicitly set default value if present\r
87654 if (this.options && this.options["default"] != null) {\r
87655 this.typeDefault = this.options["default"];\r
87656 if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string")\r
87657 this.typeDefault = this.resolvedType.values[this.typeDefault];\r
87658 }\r
87659\r
87660 // remove unnecessary options\r
87661 if (this.options) {\r
87662 if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\r
87663 delete this.options.packed;\r
87664 if (!Object.keys(this.options).length)\r
87665 this.options = undefined;\r
87666 }\r
87667\r
87668 // convert to internal data type if necesssary\r
87669 if (this.long) {\r
87670 this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u");\r
87671\r
87672 /* istanbul ignore else */\r
87673 if (Object.freeze)\r
87674 Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\r
87675\r
87676 } else if (this.bytes && typeof this.typeDefault === "string") {\r
87677 var buf;\r
87678 if (util.base64.test(this.typeDefault))\r
87679 util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\r
87680 else\r
87681 util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\r
87682 this.typeDefault = buf;\r
87683 }\r
87684\r
87685 // take special care of maps and repeated fields\r
87686 if (this.map)\r
87687 this.defaultValue = util.emptyObject;\r
87688 else if (this.repeated)\r
87689 this.defaultValue = util.emptyArray;\r
87690 else\r
87691 this.defaultValue = this.typeDefault;\r
87692\r
87693 // ensure proper value on prototype\r
87694 if (this.parent instanceof Type)\r
87695 this.parent.ctor.prototype[this.name] = this.defaultValue;\r
87696\r
87697 return ReflectionObject.prototype.resolve.call(this);\r
87698};\r
87699\r
87700/**\r
87701 * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\r
87702 * @typedef FieldDecorator\r
87703 * @type {function}\r
87704 * @param {Object} prototype Target prototype\r
87705 * @param {string} fieldName Field name\r
87706 * @returns {undefined}\r
87707 */\r
87708\r
87709/**\r
87710 * Field decorator (TypeScript).\r
87711 * @name Field.d\r
87712 * @function\r
87713 * @param {number} fieldId Field id\r
87714 * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|Object} fieldType Field type\r
87715 * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule\r
87716 * @param {T} [defaultValue] Default value\r
87717 * @returns {FieldDecorator} Decorator function\r
87718 * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\r
87719 */\r
87720Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\r
87721\r
87722 // submessage: decorate the submessage and use its name as the type\r
87723 if (typeof fieldType === "function")\r
87724 fieldType = util.decorateType(fieldType).name;\r
87725\r
87726 // enum reference: create a reflected copy of the enum and keep reuseing it\r
87727 else if (fieldType && typeof fieldType === "object")\r
87728 fieldType = util.decorateEnum(fieldType).name;\r
87729\r
87730 return function fieldDecorator(prototype, fieldName) {\r
87731 util.decorateType(prototype.constructor)\r
87732 .add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue }));\r
87733 };\r
87734};\r
87735\r
87736/**\r
87737 * Field decorator (TypeScript).\r
87738 * @name Field.d\r
87739 * @function\r
87740 * @param {number} fieldId Field id\r
87741 * @param {Constructor<T>|string} fieldType Field type\r
87742 * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule\r
87743 * @returns {FieldDecorator} Decorator function\r
87744 * @template T extends Message<T>\r
87745 * @variation 2\r
87746 */\r
87747// like Field.d but without a default value\r
87748\r
87749// Sets up cyclic dependencies (called in index-light)\r
87750Field._configure = function configure(Type_) {\r
87751 Type = Type_;\r
87752};\r
87753
87754},{"./enum":684,"./object":693,"./types":705,"./util":706}],686:[function(require,module,exports){
87755"use strict";\r
87756var protobuf = module.exports = require("./index-minimal");\r
87757\r
87758protobuf.build = "light";\r
87759\r
87760/**\r
87761 * A node-style callback as used by {@link load} and {@link Root#load}.\r
87762 * @typedef LoadCallback\r
87763 * @type {function}\r
87764 * @param {Error|null} error Error, if any, otherwise `null`\r
87765 * @param {Root} [root] Root, if there hasn't been an error\r
87766 * @returns {undefined}\r
87767 */\r
87768\r
87769/**\r
87770 * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\r
87771 * @param {string|string[]} filename One or multiple files to load\r
87772 * @param {Root} root Root namespace, defaults to create a new one if omitted.\r
87773 * @param {LoadCallback} callback Callback function\r
87774 * @returns {undefined}\r
87775 * @see {@link Root#load}\r
87776 */\r
87777function load(filename, root, callback) {\r
87778 if (typeof root === "function") {\r
87779 callback = root;\r
87780 root = new protobuf.Root();\r
87781 } else if (!root)\r
87782 root = new protobuf.Root();\r
87783 return root.load(filename, callback);\r
87784}\r
87785\r
87786/**\r
87787 * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\r
87788 * @name load\r
87789 * @function\r
87790 * @param {string|string[]} filename One or multiple files to load\r
87791 * @param {LoadCallback} callback Callback function\r
87792 * @returns {undefined}\r
87793 * @see {@link Root#load}\r
87794 * @variation 2\r
87795 */\r
87796// function load(filename:string, callback:LoadCallback):undefined\r
87797\r
87798/**\r
87799 * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\r
87800 * @name load\r
87801 * @function\r
87802 * @param {string|string[]} filename One or multiple files to load\r
87803 * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\r
87804 * @returns {Promise<Root>} Promise\r
87805 * @see {@link Root#load}\r
87806 * @variation 3\r
87807 */\r
87808// function load(filename:string, [root:Root]):Promise<Root>\r
87809\r
87810protobuf.load = load;\r
87811\r
87812/**\r
87813 * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\r
87814 * @param {string|string[]} filename One or multiple files to load\r
87815 * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\r
87816 * @returns {Root} Root namespace\r
87817 * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\r
87818 * @see {@link Root#loadSync}\r
87819 */\r
87820function loadSync(filename, root) {\r
87821 if (!root)\r
87822 root = new protobuf.Root();\r
87823 return root.loadSync(filename);\r
87824}\r
87825\r
87826protobuf.loadSync = loadSync;\r
87827\r
87828// Serialization\r
87829protobuf.encoder = require("./encoder");\r
87830protobuf.decoder = require("./decoder");\r
87831protobuf.verifier = require("./verifier");\r
87832protobuf.converter = require("./converter");\r
87833\r
87834// Reflection\r
87835protobuf.ReflectionObject = require("./object");\r
87836protobuf.Namespace = require("./namespace");\r
87837protobuf.Root = require("./root");\r
87838protobuf.Enum = require("./enum");\r
87839protobuf.Type = require("./type");\r
87840protobuf.Field = require("./field");\r
87841protobuf.OneOf = require("./oneof");\r
87842protobuf.MapField = require("./mapfield");\r
87843protobuf.Service = require("./service");\r
87844protobuf.Method = require("./method");\r
87845\r
87846// Runtime\r
87847protobuf.Message = require("./message");\r
87848protobuf.wrappers = require("./wrappers");\r
87849\r
87850// Utility\r
87851protobuf.types = require("./types");\r
87852protobuf.util = require("./util");\r
87853\r
87854// Set up possibly cyclic reflection dependencies\r
87855protobuf.ReflectionObject._configure(protobuf.Root);\r
87856protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\r
87857protobuf.Root._configure(protobuf.Type);\r
87858protobuf.Field._configure(protobuf.Type);\r
87859
87860},{"./converter":681,"./decoder":682,"./encoder":683,"./enum":684,"./field":685,"./index-minimal":687,"./mapfield":689,"./message":690,"./method":691,"./namespace":692,"./object":693,"./oneof":694,"./root":698,"./service":702,"./type":704,"./types":705,"./util":706,"./verifier":709,"./wrappers":710}],687:[function(require,module,exports){
87861"use strict";\r
87862var protobuf = exports;\r
87863\r
87864/**\r
87865 * Build type, one of `"full"`, `"light"` or `"minimal"`.\r
87866 * @name build\r
87867 * @type {string}\r
87868 * @const\r
87869 */\r
87870protobuf.build = "minimal";\r
87871\r
87872// Serialization\r
87873protobuf.Writer = require("./writer");\r
87874protobuf.BufferWriter = require("./writer_buffer");\r
87875protobuf.Reader = require("./reader");\r
87876protobuf.BufferReader = require("./reader_buffer");\r
87877\r
87878// Utility\r
87879protobuf.util = require("./util/minimal");\r
87880protobuf.rpc = require("./rpc");\r
87881protobuf.roots = require("./roots");\r
87882protobuf.configure = configure;\r
87883\r
87884/* istanbul ignore next */\r
87885/**\r
87886 * Reconfigures the library according to the environment.\r
87887 * @returns {undefined}\r
87888 */\r
87889function configure() {\r
87890 protobuf.Reader._configure(protobuf.BufferReader);\r
87891 protobuf.util._configure();\r
87892}\r
87893\r
87894// Set up buffer utility according to the environment\r
87895protobuf.Writer._configure(protobuf.BufferWriter);\r
87896configure();\r
87897
87898},{"./reader":696,"./reader_buffer":697,"./roots":699,"./rpc":700,"./util/minimal":708,"./writer":711,"./writer_buffer":712}],688:[function(require,module,exports){
87899"use strict";\r
87900var protobuf = module.exports = require("./index-light");\r
87901\r
87902protobuf.build = "full";\r
87903\r
87904// Parser\r
87905protobuf.tokenize = require("./tokenize");\r
87906protobuf.parse = require("./parse");\r
87907protobuf.common = require("./common");\r
87908\r
87909// Configure parser\r
87910protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);\r
87911
87912},{"./common":680,"./index-light":686,"./parse":695,"./tokenize":703}],689:[function(require,module,exports){
87913"use strict";\r
87914module.exports = MapField;\r
87915\r
87916// extends Field\r
87917var Field = require("./field");\r
87918((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField";\r
87919\r
87920var types = require("./types"),\r
87921 util = require("./util");\r
87922\r
87923/**\r
87924 * Constructs a new map field instance.\r
87925 * @classdesc Reflected map field.\r
87926 * @extends FieldBase\r
87927 * @constructor\r
87928 * @param {string} name Unique name within its namespace\r
87929 * @param {number} id Unique id within its namespace\r
87930 * @param {string} keyType Key type\r
87931 * @param {string} type Value type\r
87932 * @param {Object.<string,*>} [options] Declared options\r
87933 * @param {string} [comment] Comment associated with this field\r
87934 */\r
87935function MapField(name, id, keyType, type, options, comment) {\r
87936 Field.call(this, name, id, type, undefined, undefined, options, comment);\r
87937\r
87938 /* istanbul ignore if */\r
87939 if (!util.isString(keyType))\r
87940 throw TypeError("keyType must be a string");\r
87941\r
87942 /**\r
87943 * Key type.\r
87944 * @type {string}\r
87945 */\r
87946 this.keyType = keyType; // toJSON, marker\r
87947\r
87948 /**\r
87949 * Resolved key type if not a basic type.\r
87950 * @type {ReflectionObject|null}\r
87951 */\r
87952 this.resolvedKeyType = null;\r
87953\r
87954 // Overrides Field#map\r
87955 this.map = true;\r
87956}\r
87957\r
87958/**\r
87959 * Map field descriptor.\r
87960 * @interface IMapField\r
87961 * @extends {IField}\r
87962 * @property {string} keyType Key type\r
87963 */\r
87964\r
87965/**\r
87966 * Extension map field descriptor.\r
87967 * @interface IExtensionMapField\r
87968 * @extends IMapField\r
87969 * @property {string} extend Extended type\r
87970 */\r
87971\r
87972/**\r
87973 * Constructs a map field from a map field descriptor.\r
87974 * @param {string} name Field name\r
87975 * @param {IMapField} json Map field descriptor\r
87976 * @returns {MapField} Created map field\r
87977 * @throws {TypeError} If arguments are invalid\r
87978 */\r
87979MapField.fromJSON = function fromJSON(name, json) {\r
87980 return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\r
87981};\r
87982\r
87983/**\r
87984 * Converts this map field to a map field descriptor.\r
87985 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
87986 * @returns {IMapField} Map field descriptor\r
87987 */\r
87988MapField.prototype.toJSON = function toJSON(toJSONOptions) {\r
87989 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
87990 return util.toObject([\r
87991 "keyType" , this.keyType,\r
87992 "type" , this.type,\r
87993 "id" , this.id,\r
87994 "extend" , this.extend,\r
87995 "options" , this.options,\r
87996 "comment" , keepComments ? this.comment : undefined\r
87997 ]);\r
87998};\r
87999\r
88000/**\r
88001 * @override\r
88002 */\r
88003MapField.prototype.resolve = function resolve() {\r
88004 if (this.resolved)\r
88005 return this;\r
88006\r
88007 // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes"\r
88008 if (types.mapKey[this.keyType] === undefined)\r
88009 throw Error("invalid key type: " + this.keyType);\r
88010\r
88011 return Field.prototype.resolve.call(this);\r
88012};\r
88013\r
88014/**\r
88015 * Map field decorator (TypeScript).\r
88016 * @name MapField.d\r
88017 * @function\r
88018 * @param {number} fieldId Field id\r
88019 * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type\r
88020 * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type\r
88021 * @returns {FieldDecorator} Decorator function\r
88022 * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\r
88023 */\r
88024MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\r
88025\r
88026 // submessage value: decorate the submessage and use its name as the type\r
88027 if (typeof fieldValueType === "function")\r
88028 fieldValueType = util.decorateType(fieldValueType).name;\r
88029\r
88030 // enum reference value: create a reflected copy of the enum and keep reuseing it\r
88031 else if (fieldValueType && typeof fieldValueType === "object")\r
88032 fieldValueType = util.decorateEnum(fieldValueType).name;\r
88033\r
88034 return function mapFieldDecorator(prototype, fieldName) {\r
88035 util.decorateType(prototype.constructor)\r
88036 .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\r
88037 };\r
88038};\r
88039
88040},{"./field":685,"./types":705,"./util":706}],690:[function(require,module,exports){
88041"use strict";\r
88042module.exports = Message;\r
88043\r
88044var util = require("./util/minimal");\r
88045\r
88046/**\r
88047 * Constructs a new message instance.\r
88048 * @classdesc Abstract runtime message.\r
88049 * @constructor\r
88050 * @param {Properties<T>} [properties] Properties to set\r
88051 * @template T extends object = object\r
88052 */\r
88053function Message(properties) {\r
88054 // not used internally\r
88055 if (properties)\r
88056 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\r
88057 this[keys[i]] = properties[keys[i]];\r
88058}\r
88059\r
88060/**\r
88061 * Reference to the reflected type.\r
88062 * @name Message.$type\r
88063 * @type {Type}\r
88064 * @readonly\r
88065 */\r
88066\r
88067/**\r
88068 * Reference to the reflected type.\r
88069 * @name Message#$type\r
88070 * @type {Type}\r
88071 * @readonly\r
88072 */\r
88073\r
88074/*eslint-disable valid-jsdoc*/\r
88075\r
88076/**\r
88077 * Creates a new message of this type using the specified properties.\r
88078 * @param {Object.<string,*>} [properties] Properties to set\r
88079 * @returns {Message<T>} Message instance\r
88080 * @template T extends Message<T>\r
88081 * @this Constructor<T>\r
88082 */\r
88083Message.create = function create(properties) {\r
88084 return this.$type.create(properties);\r
88085};\r
88086\r
88087/**\r
88088 * Encodes a message of this type.\r
88089 * @param {T|Object.<string,*>} message Message to encode\r
88090 * @param {Writer} [writer] Writer to use\r
88091 * @returns {Writer} Writer\r
88092 * @template T extends Message<T>\r
88093 * @this Constructor<T>\r
88094 */\r
88095Message.encode = function encode(message, writer) {\r
88096 return this.$type.encode(message, writer);\r
88097};\r
88098\r
88099/**\r
88100 * Encodes a message of this type preceeded by its length as a varint.\r
88101 * @param {T|Object.<string,*>} message Message to encode\r
88102 * @param {Writer} [writer] Writer to use\r
88103 * @returns {Writer} Writer\r
88104 * @template T extends Message<T>\r
88105 * @this Constructor<T>\r
88106 */\r
88107Message.encodeDelimited = function encodeDelimited(message, writer) {\r
88108 return this.$type.encodeDelimited(message, writer);\r
88109};\r
88110\r
88111/**\r
88112 * Decodes a message of this type.\r
88113 * @name Message.decode\r
88114 * @function\r
88115 * @param {Reader|Uint8Array} reader Reader or buffer to decode\r
88116 * @returns {T} Decoded message\r
88117 * @template T extends Message<T>\r
88118 * @this Constructor<T>\r
88119 */\r
88120Message.decode = function decode(reader) {\r
88121 return this.$type.decode(reader);\r
88122};\r
88123\r
88124/**\r
88125 * Decodes a message of this type preceeded by its length as a varint.\r
88126 * @name Message.decodeDelimited\r
88127 * @function\r
88128 * @param {Reader|Uint8Array} reader Reader or buffer to decode\r
88129 * @returns {T} Decoded message\r
88130 * @template T extends Message<T>\r
88131 * @this Constructor<T>\r
88132 */\r
88133Message.decodeDelimited = function decodeDelimited(reader) {\r
88134 return this.$type.decodeDelimited(reader);\r
88135};\r
88136\r
88137/**\r
88138 * Verifies a message of this type.\r
88139 * @name Message.verify\r
88140 * @function\r
88141 * @param {Object.<string,*>} message Plain object to verify\r
88142 * @returns {string|null} `null` if valid, otherwise the reason why it is not\r
88143 */\r
88144Message.verify = function verify(message) {\r
88145 return this.$type.verify(message);\r
88146};\r
88147\r
88148/**\r
88149 * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\r
88150 * @param {Object.<string,*>} object Plain object\r
88151 * @returns {T} Message instance\r
88152 * @template T extends Message<T>\r
88153 * @this Constructor<T>\r
88154 */\r
88155Message.fromObject = function fromObject(object) {\r
88156 return this.$type.fromObject(object);\r
88157};\r
88158\r
88159/**\r
88160 * Creates a plain object from a message of this type. Also converts values to other types if specified.\r
88161 * @param {T} message Message instance\r
88162 * @param {IConversionOptions} [options] Conversion options\r
88163 * @returns {Object.<string,*>} Plain object\r
88164 * @template T extends Message<T>\r
88165 * @this Constructor<T>\r
88166 */\r
88167Message.toObject = function toObject(message, options) {\r
88168 return this.$type.toObject(message, options);\r
88169};\r
88170\r
88171/**\r
88172 * Converts this message to JSON.\r
88173 * @returns {Object.<string,*>} JSON object\r
88174 */\r
88175Message.prototype.toJSON = function toJSON() {\r
88176 return this.$type.toObject(this, util.toJSONOptions);\r
88177};\r
88178\r
88179/*eslint-enable valid-jsdoc*/
88180},{"./util/minimal":708}],691:[function(require,module,exports){
88181"use strict";\r
88182module.exports = Method;\r
88183\r
88184// extends ReflectionObject\r
88185var ReflectionObject = require("./object");\r
88186((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method";\r
88187\r
88188var util = require("./util");\r
88189\r
88190/**\r
88191 * Constructs a new service method instance.\r
88192 * @classdesc Reflected service method.\r
88193 * @extends ReflectionObject\r
88194 * @constructor\r
88195 * @param {string} name Method name\r
88196 * @param {string|undefined} type Method type, usually `"rpc"`\r
88197 * @param {string} requestType Request message type\r
88198 * @param {string} responseType Response message type\r
88199 * @param {boolean|Object.<string,*>} [requestStream] Whether the request is streamed\r
88200 * @param {boolean|Object.<string,*>} [responseStream] Whether the response is streamed\r
88201 * @param {Object.<string,*>} [options] Declared options\r
88202 * @param {string} [comment] The comment for this method\r
88203 */\r
88204function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {\r
88205\r
88206 /* istanbul ignore next */\r
88207 if (util.isObject(requestStream)) {\r
88208 options = requestStream;\r
88209 requestStream = responseStream = undefined;\r
88210 } else if (util.isObject(responseStream)) {\r
88211 options = responseStream;\r
88212 responseStream = undefined;\r
88213 }\r
88214\r
88215 /* istanbul ignore if */\r
88216 if (!(type === undefined || util.isString(type)))\r
88217 throw TypeError("type must be a string");\r
88218\r
88219 /* istanbul ignore if */\r
88220 if (!util.isString(requestType))\r
88221 throw TypeError("requestType must be a string");\r
88222\r
88223 /* istanbul ignore if */\r
88224 if (!util.isString(responseType))\r
88225 throw TypeError("responseType must be a string");\r
88226\r
88227 ReflectionObject.call(this, name, options);\r
88228\r
88229 /**\r
88230 * Method type.\r
88231 * @type {string}\r
88232 */\r
88233 this.type = type || "rpc"; // toJSON\r
88234\r
88235 /**\r
88236 * Request type.\r
88237 * @type {string}\r
88238 */\r
88239 this.requestType = requestType; // toJSON, marker\r
88240\r
88241 /**\r
88242 * Whether requests are streamed or not.\r
88243 * @type {boolean|undefined}\r
88244 */\r
88245 this.requestStream = requestStream ? true : undefined; // toJSON\r
88246\r
88247 /**\r
88248 * Response type.\r
88249 * @type {string}\r
88250 */\r
88251 this.responseType = responseType; // toJSON\r
88252\r
88253 /**\r
88254 * Whether responses are streamed or not.\r
88255 * @type {boolean|undefined}\r
88256 */\r
88257 this.responseStream = responseStream ? true : undefined; // toJSON\r
88258\r
88259 /**\r
88260 * Resolved request type.\r
88261 * @type {Type|null}\r
88262 */\r
88263 this.resolvedRequestType = null;\r
88264\r
88265 /**\r
88266 * Resolved response type.\r
88267 * @type {Type|null}\r
88268 */\r
88269 this.resolvedResponseType = null;\r
88270\r
88271 /**\r
88272 * Comment for this method\r
88273 * @type {string|null}\r
88274 */\r
88275 this.comment = comment;\r
88276}\r
88277\r
88278/**\r
88279 * Method descriptor.\r
88280 * @interface IMethod\r
88281 * @property {string} [type="rpc"] Method type\r
88282 * @property {string} requestType Request type\r
88283 * @property {string} responseType Response type\r
88284 * @property {boolean} [requestStream=false] Whether requests are streamed\r
88285 * @property {boolean} [responseStream=false] Whether responses are streamed\r
88286 * @property {Object.<string,*>} [options] Method options\r
88287 */\r
88288\r
88289/**\r
88290 * Constructs a method from a method descriptor.\r
88291 * @param {string} name Method name\r
88292 * @param {IMethod} json Method descriptor\r
88293 * @returns {Method} Created method\r
88294 * @throws {TypeError} If arguments are invalid\r
88295 */\r
88296Method.fromJSON = function fromJSON(name, json) {\r
88297 return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);\r
88298};\r
88299\r
88300/**\r
88301 * Converts this method to a method descriptor.\r
88302 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
88303 * @returns {IMethod} Method descriptor\r
88304 */\r
88305Method.prototype.toJSON = function toJSON(toJSONOptions) {\r
88306 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
88307 return util.toObject([\r
88308 "type" , this.type !== "rpc" && /* istanbul ignore next */ this.type || undefined,\r
88309 "requestType" , this.requestType,\r
88310 "requestStream" , this.requestStream,\r
88311 "responseType" , this.responseType,\r
88312 "responseStream" , this.responseStream,\r
88313 "options" , this.options,\r
88314 "comment" , keepComments ? this.comment : undefined\r
88315 ]);\r
88316};\r
88317\r
88318/**\r
88319 * @override\r
88320 */\r
88321Method.prototype.resolve = function resolve() {\r
88322\r
88323 /* istanbul ignore if */\r
88324 if (this.resolved)\r
88325 return this;\r
88326\r
88327 this.resolvedRequestType = this.parent.lookupType(this.requestType);\r
88328 this.resolvedResponseType = this.parent.lookupType(this.responseType);\r
88329\r
88330 return ReflectionObject.prototype.resolve.call(this);\r
88331};\r
88332
88333},{"./object":693,"./util":706}],692:[function(require,module,exports){
88334"use strict";\r
88335module.exports = Namespace;\r
88336\r
88337// extends ReflectionObject\r
88338var ReflectionObject = require("./object");\r
88339((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";\r
88340\r
88341var Field = require("./field"),\r
88342 util = require("./util");\r
88343\r
88344var Type, // cyclic\r
88345 Service,\r
88346 Enum;\r
88347\r
88348/**\r
88349 * Constructs a new namespace instance.\r
88350 * @name Namespace\r
88351 * @classdesc Reflected namespace.\r
88352 * @extends NamespaceBase\r
88353 * @constructor\r
88354 * @param {string} name Namespace name\r
88355 * @param {Object.<string,*>} [options] Declared options\r
88356 */\r
88357\r
88358/**\r
88359 * Constructs a namespace from JSON.\r
88360 * @memberof Namespace\r
88361 * @function\r
88362 * @param {string} name Namespace name\r
88363 * @param {Object.<string,*>} json JSON object\r
88364 * @returns {Namespace} Created namespace\r
88365 * @throws {TypeError} If arguments are invalid\r
88366 */\r
88367Namespace.fromJSON = function fromJSON(name, json) {\r
88368 return new Namespace(name, json.options).addJSON(json.nested);\r
88369};\r
88370\r
88371/**\r
88372 * Converts an array of reflection objects to JSON.\r
88373 * @memberof Namespace\r
88374 * @param {ReflectionObject[]} array Object array\r
88375 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
88376 * @returns {Object.<string,*>|undefined} JSON object or `undefined` when array is empty\r
88377 */\r
88378function arrayToJSON(array, toJSONOptions) {\r
88379 if (!(array && array.length))\r
88380 return undefined;\r
88381 var obj = {};\r
88382 for (var i = 0; i < array.length; ++i)\r
88383 obj[array[i].name] = array[i].toJSON(toJSONOptions);\r
88384 return obj;\r
88385}\r
88386\r
88387Namespace.arrayToJSON = arrayToJSON;\r
88388\r
88389/**\r
88390 * Tests if the specified id is reserved.\r
88391 * @param {Array.<number[]|string>|undefined} reserved Array of reserved ranges and names\r
88392 * @param {number} id Id to test\r
88393 * @returns {boolean} `true` if reserved, otherwise `false`\r
88394 */\r
88395Namespace.isReservedId = function isReservedId(reserved, id) {\r
88396 if (reserved)\r
88397 for (var i = 0; i < reserved.length; ++i)\r
88398 if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] >= id)\r
88399 return true;\r
88400 return false;\r
88401};\r
88402\r
88403/**\r
88404 * Tests if the specified name is reserved.\r
88405 * @param {Array.<number[]|string>|undefined} reserved Array of reserved ranges and names\r
88406 * @param {string} name Name to test\r
88407 * @returns {boolean} `true` if reserved, otherwise `false`\r
88408 */\r
88409Namespace.isReservedName = function isReservedName(reserved, name) {\r
88410 if (reserved)\r
88411 for (var i = 0; i < reserved.length; ++i)\r
88412 if (reserved[i] === name)\r
88413 return true;\r
88414 return false;\r
88415};\r
88416\r
88417/**\r
88418 * Not an actual constructor. Use {@link Namespace} instead.\r
88419 * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\r
88420 * @exports NamespaceBase\r
88421 * @extends ReflectionObject\r
88422 * @abstract\r
88423 * @constructor\r
88424 * @param {string} name Namespace name\r
88425 * @param {Object.<string,*>} [options] Declared options\r
88426 * @see {@link Namespace}\r
88427 */\r
88428function Namespace(name, options) {\r
88429 ReflectionObject.call(this, name, options);\r
88430\r
88431 /**\r
88432 * Nested objects by name.\r
88433 * @type {Object.<string,ReflectionObject>|undefined}\r
88434 */\r
88435 this.nested = undefined; // toJSON\r
88436\r
88437 /**\r
88438 * Cached nested objects as an array.\r
88439 * @type {ReflectionObject[]|null}\r
88440 * @private\r
88441 */\r
88442 this._nestedArray = null;\r
88443}\r
88444\r
88445function clearCache(namespace) {\r
88446 namespace._nestedArray = null;\r
88447 return namespace;\r
88448}\r
88449\r
88450/**\r
88451 * Nested objects of this namespace as an array for iteration.\r
88452 * @name NamespaceBase#nestedArray\r
88453 * @type {ReflectionObject[]}\r
88454 * @readonly\r
88455 */\r
88456Object.defineProperty(Namespace.prototype, "nestedArray", {\r
88457 get: function() {\r
88458 return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\r
88459 }\r
88460});\r
88461\r
88462/**\r
88463 * Namespace descriptor.\r
88464 * @interface INamespace\r
88465 * @property {Object.<string,*>} [options] Namespace options\r
88466 * @property {Object.<string,AnyNestedObject>} [nested] Nested object descriptors\r
88467 */\r
88468\r
88469/**\r
88470 * Any extension field descriptor.\r
88471 * @typedef AnyExtensionField\r
88472 * @type {IExtensionField|IExtensionMapField}\r
88473 */\r
88474\r
88475/**\r
88476 * Any nested object descriptor.\r
88477 * @typedef AnyNestedObject\r
88478 * @type {IEnum|IType|IService|AnyExtensionField|INamespace}\r
88479 */\r
88480// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)\r
88481\r
88482/**\r
88483 * Converts this namespace to a namespace descriptor.\r
88484 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
88485 * @returns {INamespace} Namespace descriptor\r
88486 */\r
88487Namespace.prototype.toJSON = function toJSON(toJSONOptions) {\r
88488 return util.toObject([\r
88489 "options" , this.options,\r
88490 "nested" , arrayToJSON(this.nestedArray, toJSONOptions)\r
88491 ]);\r
88492};\r
88493\r
88494/**\r
88495 * Adds nested objects to this namespace from nested object descriptors.\r
88496 * @param {Object.<string,AnyNestedObject>} nestedJson Any nested object descriptors\r
88497 * @returns {Namespace} `this`\r
88498 */\r
88499Namespace.prototype.addJSON = function addJSON(nestedJson) {\r
88500 var ns = this;\r
88501 /* istanbul ignore else */\r
88502 if (nestedJson) {\r
88503 for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\r
88504 nested = nestedJson[names[i]];\r
88505 ns.add( // most to least likely\r
88506 ( nested.fields !== undefined\r
88507 ? Type.fromJSON\r
88508 : nested.values !== undefined\r
88509 ? Enum.fromJSON\r
88510 : nested.methods !== undefined\r
88511 ? Service.fromJSON\r
88512 : nested.id !== undefined\r
88513 ? Field.fromJSON\r
88514 : Namespace.fromJSON )(names[i], nested)\r
88515 );\r
88516 }\r
88517 }\r
88518 return this;\r
88519};\r
88520\r
88521/**\r
88522 * Gets the nested object of the specified name.\r
88523 * @param {string} name Nested object name\r
88524 * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\r
88525 */\r
88526Namespace.prototype.get = function get(name) {\r
88527 return this.nested && this.nested[name]\r
88528 || null;\r
88529};\r
88530\r
88531/**\r
88532 * Gets the values of the nested {@link Enum|enum} of the specified name.\r
88533 * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\r
88534 * @param {string} name Nested enum name\r
88535 * @returns {Object.<string,number>} Enum values\r
88536 * @throws {Error} If there is no such enum\r
88537 */\r
88538Namespace.prototype.getEnum = function getEnum(name) {\r
88539 if (this.nested && this.nested[name] instanceof Enum)\r
88540 return this.nested[name].values;\r
88541 throw Error("no such enum: " + name);\r
88542};\r
88543\r
88544/**\r
88545 * Adds a nested object to this namespace.\r
88546 * @param {ReflectionObject} object Nested object to add\r
88547 * @returns {Namespace} `this`\r
88548 * @throws {TypeError} If arguments are invalid\r
88549 * @throws {Error} If there is already a nested object with this name\r
88550 */\r
88551Namespace.prototype.add = function add(object) {\r
88552\r
88553 if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))\r
88554 throw TypeError("object must be a valid nested object");\r
88555\r
88556 if (!this.nested)\r
88557 this.nested = {};\r
88558 else {\r
88559 var prev = this.get(object.name);\r
88560 if (prev) {\r
88561 if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\r
88562 // replace plain namespace but keep existing nested elements and options\r
88563 var nested = prev.nestedArray;\r
88564 for (var i = 0; i < nested.length; ++i)\r
88565 object.add(nested[i]);\r
88566 this.remove(prev);\r
88567 if (!this.nested)\r
88568 this.nested = {};\r
88569 object.setOptions(prev.options, true);\r
88570\r
88571 } else\r
88572 throw Error("duplicate name '" + object.name + "' in " + this);\r
88573 }\r
88574 }\r
88575 this.nested[object.name] = object;\r
88576 object.onAdd(this);\r
88577 return clearCache(this);\r
88578};\r
88579\r
88580/**\r
88581 * Removes a nested object from this namespace.\r
88582 * @param {ReflectionObject} object Nested object to remove\r
88583 * @returns {Namespace} `this`\r
88584 * @throws {TypeError} If arguments are invalid\r
88585 * @throws {Error} If `object` is not a member of this namespace\r
88586 */\r
88587Namespace.prototype.remove = function remove(object) {\r
88588\r
88589 if (!(object instanceof ReflectionObject))\r
88590 throw TypeError("object must be a ReflectionObject");\r
88591 if (object.parent !== this)\r
88592 throw Error(object + " is not a member of " + this);\r
88593\r
88594 delete this.nested[object.name];\r
88595 if (!Object.keys(this.nested).length)\r
88596 this.nested = undefined;\r
88597\r
88598 object.onRemove(this);\r
88599 return clearCache(this);\r
88600};\r
88601\r
88602/**\r
88603 * Defines additial namespaces within this one if not yet existing.\r
88604 * @param {string|string[]} path Path to create\r
88605 * @param {*} [json] Nested types to create from JSON\r
88606 * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\r
88607 */\r
88608Namespace.prototype.define = function define(path, json) {\r
88609\r
88610 if (util.isString(path))\r
88611 path = path.split(".");\r
88612 else if (!Array.isArray(path))\r
88613 throw TypeError("illegal path");\r
88614 if (path && path.length && path[0] === "")\r
88615 throw Error("path must be relative");\r
88616\r
88617 var ptr = this;\r
88618 while (path.length > 0) {\r
88619 var part = path.shift();\r
88620 if (ptr.nested && ptr.nested[part]) {\r
88621 ptr = ptr.nested[part];\r
88622 if (!(ptr instanceof Namespace))\r
88623 throw Error("path conflicts with non-namespace objects");\r
88624 } else\r
88625 ptr.add(ptr = new Namespace(part));\r
88626 }\r
88627 if (json)\r
88628 ptr.addJSON(json);\r
88629 return ptr;\r
88630};\r
88631\r
88632/**\r
88633 * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\r
88634 * @returns {Namespace} `this`\r
88635 */\r
88636Namespace.prototype.resolveAll = function resolveAll() {\r
88637 var nested = this.nestedArray, i = 0;\r
88638 while (i < nested.length)\r
88639 if (nested[i] instanceof Namespace)\r
88640 nested[i++].resolveAll();\r
88641 else\r
88642 nested[i++].resolve();\r
88643 return this.resolve();\r
88644};\r
88645\r
88646/**\r
88647 * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\r
88648 * @param {string|string[]} path Path to look up\r
88649 * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\r
88650 * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\r
88651 * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\r
88652 */\r
88653Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\r
88654\r
88655 /* istanbul ignore next */\r
88656 if (typeof filterTypes === "boolean") {\r
88657 parentAlreadyChecked = filterTypes;\r
88658 filterTypes = undefined;\r
88659 } else if (filterTypes && !Array.isArray(filterTypes))\r
88660 filterTypes = [ filterTypes ];\r
88661\r
88662 if (util.isString(path) && path.length) {\r
88663 if (path === ".")\r
88664 return this.root;\r
88665 path = path.split(".");\r
88666 } else if (!path.length)\r
88667 return this;\r
88668\r
88669 // Start at root if path is absolute\r
88670 if (path[0] === "")\r
88671 return this.root.lookup(path.slice(1), filterTypes);\r
88672\r
88673 // Test if the first part matches any nested object, and if so, traverse if path contains more\r
88674 var found = this.get(path[0]);\r
88675 if (found) {\r
88676 if (path.length === 1) {\r
88677 if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\r
88678 return found;\r
88679 } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\r
88680 return found;\r
88681\r
88682 // Otherwise try each nested namespace\r
88683 } else\r
88684 for (var i = 0; i < this.nestedArray.length; ++i)\r
88685 if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\r
88686 return found;\r
88687\r
88688 // If there hasn't been a match, try again at the parent\r
88689 if (this.parent === null || parentAlreadyChecked)\r
88690 return null;\r
88691 return this.parent.lookup(path, filterTypes);\r
88692};\r
88693\r
88694/**\r
88695 * Looks up the reflection object at the specified path, relative to this namespace.\r
88696 * @name NamespaceBase#lookup\r
88697 * @function\r
88698 * @param {string|string[]} path Path to look up\r
88699 * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\r
88700 * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\r
88701 * @variation 2\r
88702 */\r
88703// lookup(path: string, [parentAlreadyChecked: boolean])\r
88704\r
88705/**\r
88706 * Looks up the {@link Type|type} at the specified path, relative to this namespace.\r
88707 * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r
88708 * @param {string|string[]} path Path to look up\r
88709 * @returns {Type} Looked up type\r
88710 * @throws {Error} If `path` does not point to a type\r
88711 */\r
88712Namespace.prototype.lookupType = function lookupType(path) {\r
88713 var found = this.lookup(path, [ Type ]);\r
88714 if (!found)\r
88715 throw Error("no such type: " + path);\r
88716 return found;\r
88717};\r
88718\r
88719/**\r
88720 * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\r
88721 * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r
88722 * @param {string|string[]} path Path to look up\r
88723 * @returns {Enum} Looked up enum\r
88724 * @throws {Error} If `path` does not point to an enum\r
88725 */\r
88726Namespace.prototype.lookupEnum = function lookupEnum(path) {\r
88727 var found = this.lookup(path, [ Enum ]);\r
88728 if (!found)\r
88729 throw Error("no such Enum '" + path + "' in " + this);\r
88730 return found;\r
88731};\r
88732\r
88733/**\r
88734 * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\r
88735 * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r
88736 * @param {string|string[]} path Path to look up\r
88737 * @returns {Type} Looked up type or enum\r
88738 * @throws {Error} If `path` does not point to a type or enum\r
88739 */\r
88740Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\r
88741 var found = this.lookup(path, [ Type, Enum ]);\r
88742 if (!found)\r
88743 throw Error("no such Type or Enum '" + path + "' in " + this);\r
88744 return found;\r
88745};\r
88746\r
88747/**\r
88748 * Looks up the {@link Service|service} at the specified path, relative to this namespace.\r
88749 * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r
88750 * @param {string|string[]} path Path to look up\r
88751 * @returns {Service} Looked up service\r
88752 * @throws {Error} If `path` does not point to a service\r
88753 */\r
88754Namespace.prototype.lookupService = function lookupService(path) {\r
88755 var found = this.lookup(path, [ Service ]);\r
88756 if (!found)\r
88757 throw Error("no such Service '" + path + "' in " + this);\r
88758 return found;\r
88759};\r
88760\r
88761// Sets up cyclic dependencies (called in index-light)\r
88762Namespace._configure = function(Type_, Service_, Enum_) {\r
88763 Type = Type_;\r
88764 Service = Service_;\r
88765 Enum = Enum_;\r
88766};\r
88767
88768},{"./field":685,"./object":693,"./util":706}],693:[function(require,module,exports){
88769"use strict";\r
88770module.exports = ReflectionObject;\r
88771\r
88772ReflectionObject.className = "ReflectionObject";\r
88773\r
88774var util = require("./util");\r
88775\r
88776var Root; // cyclic\r
88777\r
88778/**\r
88779 * Constructs a new reflection object instance.\r
88780 * @classdesc Base class of all reflection objects.\r
88781 * @constructor\r
88782 * @param {string} name Object name\r
88783 * @param {Object.<string,*>} [options] Declared options\r
88784 * @abstract\r
88785 */\r
88786function ReflectionObject(name, options) {\r
88787\r
88788 if (!util.isString(name))\r
88789 throw TypeError("name must be a string");\r
88790\r
88791 if (options && !util.isObject(options))\r
88792 throw TypeError("options must be an object");\r
88793\r
88794 /**\r
88795 * Options.\r
88796 * @type {Object.<string,*>|undefined}\r
88797 */\r
88798 this.options = options; // toJSON\r
88799\r
88800 /**\r
88801 * Unique name within its namespace.\r
88802 * @type {string}\r
88803 */\r
88804 this.name = name;\r
88805\r
88806 /**\r
88807 * Parent namespace.\r
88808 * @type {Namespace|null}\r
88809 */\r
88810 this.parent = null;\r
88811\r
88812 /**\r
88813 * Whether already resolved or not.\r
88814 * @type {boolean}\r
88815 */\r
88816 this.resolved = false;\r
88817\r
88818 /**\r
88819 * Comment text, if any.\r
88820 * @type {string|null}\r
88821 */\r
88822 this.comment = null;\r
88823\r
88824 /**\r
88825 * Defining file name.\r
88826 * @type {string|null}\r
88827 */\r
88828 this.filename = null;\r
88829}\r
88830\r
88831Object.defineProperties(ReflectionObject.prototype, {\r
88832\r
88833 /**\r
88834 * Reference to the root namespace.\r
88835 * @name ReflectionObject#root\r
88836 * @type {Root}\r
88837 * @readonly\r
88838 */\r
88839 root: {\r
88840 get: function() {\r
88841 var ptr = this;\r
88842 while (ptr.parent !== null)\r
88843 ptr = ptr.parent;\r
88844 return ptr;\r
88845 }\r
88846 },\r
88847\r
88848 /**\r
88849 * Full name including leading dot.\r
88850 * @name ReflectionObject#fullName\r
88851 * @type {string}\r
88852 * @readonly\r
88853 */\r
88854 fullName: {\r
88855 get: function() {\r
88856 var path = [ this.name ],\r
88857 ptr = this.parent;\r
88858 while (ptr) {\r
88859 path.unshift(ptr.name);\r
88860 ptr = ptr.parent;\r
88861 }\r
88862 return path.join(".");\r
88863 }\r
88864 }\r
88865});\r
88866\r
88867/**\r
88868 * Converts this reflection object to its descriptor representation.\r
88869 * @returns {Object.<string,*>} Descriptor\r
88870 * @abstract\r
88871 */\r
88872ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\r
88873 throw Error(); // not implemented, shouldn't happen\r
88874};\r
88875\r
88876/**\r
88877 * Called when this object is added to a parent.\r
88878 * @param {ReflectionObject} parent Parent added to\r
88879 * @returns {undefined}\r
88880 */\r
88881ReflectionObject.prototype.onAdd = function onAdd(parent) {\r
88882 if (this.parent && this.parent !== parent)\r
88883 this.parent.remove(this);\r
88884 this.parent = parent;\r
88885 this.resolved = false;\r
88886 var root = parent.root;\r
88887 if (root instanceof Root)\r
88888 root._handleAdd(this);\r
88889};\r
88890\r
88891/**\r
88892 * Called when this object is removed from a parent.\r
88893 * @param {ReflectionObject} parent Parent removed from\r
88894 * @returns {undefined}\r
88895 */\r
88896ReflectionObject.prototype.onRemove = function onRemove(parent) {\r
88897 var root = parent.root;\r
88898 if (root instanceof Root)\r
88899 root._handleRemove(this);\r
88900 this.parent = null;\r
88901 this.resolved = false;\r
88902};\r
88903\r
88904/**\r
88905 * Resolves this objects type references.\r
88906 * @returns {ReflectionObject} `this`\r
88907 */\r
88908ReflectionObject.prototype.resolve = function resolve() {\r
88909 if (this.resolved)\r
88910 return this;\r
88911 if (this.root instanceof Root)\r
88912 this.resolved = true; // only if part of a root\r
88913 return this;\r
88914};\r
88915\r
88916/**\r
88917 * Gets an option value.\r
88918 * @param {string} name Option name\r
88919 * @returns {*} Option value or `undefined` if not set\r
88920 */\r
88921ReflectionObject.prototype.getOption = function getOption(name) {\r
88922 if (this.options)\r
88923 return this.options[name];\r
88924 return undefined;\r
88925};\r
88926\r
88927/**\r
88928 * Sets an option.\r
88929 * @param {string} name Option name\r
88930 * @param {*} value Option value\r
88931 * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\r
88932 * @returns {ReflectionObject} `this`\r
88933 */\r
88934ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\r
88935 if (!ifNotSet || !this.options || this.options[name] === undefined)\r
88936 (this.options || (this.options = {}))[name] = value;\r
88937 return this;\r
88938};\r
88939\r
88940/**\r
88941 * Sets multiple options.\r
88942 * @param {Object.<string,*>} options Options to set\r
88943 * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\r
88944 * @returns {ReflectionObject} `this`\r
88945 */\r
88946ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\r
88947 if (options)\r
88948 for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\r
88949 this.setOption(keys[i], options[keys[i]], ifNotSet);\r
88950 return this;\r
88951};\r
88952\r
88953/**\r
88954 * Converts this instance to its string representation.\r
88955 * @returns {string} Class name[, space, full name]\r
88956 */\r
88957ReflectionObject.prototype.toString = function toString() {\r
88958 var className = this.constructor.className,\r
88959 fullName = this.fullName;\r
88960 if (fullName.length)\r
88961 return className + " " + fullName;\r
88962 return className;\r
88963};\r
88964\r
88965// Sets up cyclic dependencies (called in index-light)\r
88966ReflectionObject._configure = function(Root_) {\r
88967 Root = Root_;\r
88968};\r
88969
88970},{"./util":706}],694:[function(require,module,exports){
88971"use strict";\r
88972module.exports = OneOf;\r
88973\r
88974// extends ReflectionObject\r
88975var ReflectionObject = require("./object");\r
88976((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf";\r
88977\r
88978var Field = require("./field"),\r
88979 util = require("./util");\r
88980\r
88981/**\r
88982 * Constructs a new oneof instance.\r
88983 * @classdesc Reflected oneof.\r
88984 * @extends ReflectionObject\r
88985 * @constructor\r
88986 * @param {string} name Oneof name\r
88987 * @param {string[]|Object.<string,*>} [fieldNames] Field names\r
88988 * @param {Object.<string,*>} [options] Declared options\r
88989 * @param {string} [comment] Comment associated with this field\r
88990 */\r
88991function OneOf(name, fieldNames, options, comment) {\r
88992 if (!Array.isArray(fieldNames)) {\r
88993 options = fieldNames;\r
88994 fieldNames = undefined;\r
88995 }\r
88996 ReflectionObject.call(this, name, options);\r
88997\r
88998 /* istanbul ignore if */\r
88999 if (!(fieldNames === undefined || Array.isArray(fieldNames)))\r
89000 throw TypeError("fieldNames must be an Array");\r
89001\r
89002 /**\r
89003 * Field names that belong to this oneof.\r
89004 * @type {string[]}\r
89005 */\r
89006 this.oneof = fieldNames || []; // toJSON, marker\r
89007\r
89008 /**\r
89009 * Fields that belong to this oneof as an array for iteration.\r
89010 * @type {Field[]}\r
89011 * @readonly\r
89012 */\r
89013 this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\r
89014\r
89015 /**\r
89016 * Comment for this field.\r
89017 * @type {string|null}\r
89018 */\r
89019 this.comment = comment;\r
89020}\r
89021\r
89022/**\r
89023 * Oneof descriptor.\r
89024 * @interface IOneOf\r
89025 * @property {Array.<string>} oneof Oneof field names\r
89026 * @property {Object.<string,*>} [options] Oneof options\r
89027 */\r
89028\r
89029/**\r
89030 * Constructs a oneof from a oneof descriptor.\r
89031 * @param {string} name Oneof name\r
89032 * @param {IOneOf} json Oneof descriptor\r
89033 * @returns {OneOf} Created oneof\r
89034 * @throws {TypeError} If arguments are invalid\r
89035 */\r
89036OneOf.fromJSON = function fromJSON(name, json) {\r
89037 return new OneOf(name, json.oneof, json.options, json.comment);\r
89038};\r
89039\r
89040/**\r
89041 * Converts this oneof to a oneof descriptor.\r
89042 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
89043 * @returns {IOneOf} Oneof descriptor\r
89044 */\r
89045OneOf.prototype.toJSON = function toJSON(toJSONOptions) {\r
89046 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
89047 return util.toObject([\r
89048 "options" , this.options,\r
89049 "oneof" , this.oneof,\r
89050 "comment" , keepComments ? this.comment : undefined\r
89051 ]);\r
89052};\r
89053\r
89054/**\r
89055 * Adds the fields of the specified oneof to the parent if not already done so.\r
89056 * @param {OneOf} oneof The oneof\r
89057 * @returns {undefined}\r
89058 * @inner\r
89059 * @ignore\r
89060 */\r
89061function addFieldsToParent(oneof) {\r
89062 if (oneof.parent)\r
89063 for (var i = 0; i < oneof.fieldsArray.length; ++i)\r
89064 if (!oneof.fieldsArray[i].parent)\r
89065 oneof.parent.add(oneof.fieldsArray[i]);\r
89066}\r
89067\r
89068/**\r
89069 * Adds a field to this oneof and removes it from its current parent, if any.\r
89070 * @param {Field} field Field to add\r
89071 * @returns {OneOf} `this`\r
89072 */\r
89073OneOf.prototype.add = function add(field) {\r
89074\r
89075 /* istanbul ignore if */\r
89076 if (!(field instanceof Field))\r
89077 throw TypeError("field must be a Field");\r
89078\r
89079 if (field.parent && field.parent !== this.parent)\r
89080 field.parent.remove(field);\r
89081 this.oneof.push(field.name);\r
89082 this.fieldsArray.push(field);\r
89083 field.partOf = this; // field.parent remains null\r
89084 addFieldsToParent(this);\r
89085 return this;\r
89086};\r
89087\r
89088/**\r
89089 * Removes a field from this oneof and puts it back to the oneof's parent.\r
89090 * @param {Field} field Field to remove\r
89091 * @returns {OneOf} `this`\r
89092 */\r
89093OneOf.prototype.remove = function remove(field) {\r
89094\r
89095 /* istanbul ignore if */\r
89096 if (!(field instanceof Field))\r
89097 throw TypeError("field must be a Field");\r
89098\r
89099 var index = this.fieldsArray.indexOf(field);\r
89100\r
89101 /* istanbul ignore if */\r
89102 if (index < 0)\r
89103 throw Error(field + " is not a member of " + this);\r
89104\r
89105 this.fieldsArray.splice(index, 1);\r
89106 index = this.oneof.indexOf(field.name);\r
89107\r
89108 /* istanbul ignore else */\r
89109 if (index > -1) // theoretical\r
89110 this.oneof.splice(index, 1);\r
89111\r
89112 field.partOf = null;\r
89113 return this;\r
89114};\r
89115\r
89116/**\r
89117 * @override\r
89118 */\r
89119OneOf.prototype.onAdd = function onAdd(parent) {\r
89120 ReflectionObject.prototype.onAdd.call(this, parent);\r
89121 var self = this;\r
89122 // Collect present fields\r
89123 for (var i = 0; i < this.oneof.length; ++i) {\r
89124 var field = parent.get(this.oneof[i]);\r
89125 if (field && !field.partOf) {\r
89126 field.partOf = self;\r
89127 self.fieldsArray.push(field);\r
89128 }\r
89129 }\r
89130 // Add not yet present fields\r
89131 addFieldsToParent(this);\r
89132};\r
89133\r
89134/**\r
89135 * @override\r
89136 */\r
89137OneOf.prototype.onRemove = function onRemove(parent) {\r
89138 for (var i = 0, field; i < this.fieldsArray.length; ++i)\r
89139 if ((field = this.fieldsArray[i]).parent)\r
89140 field.parent.remove(field);\r
89141 ReflectionObject.prototype.onRemove.call(this, parent);\r
89142};\r
89143\r
89144/**\r
89145 * Decorator function as returned by {@link OneOf.d} (TypeScript).\r
89146 * @typedef OneOfDecorator\r
89147 * @type {function}\r
89148 * @param {Object} prototype Target prototype\r
89149 * @param {string} oneofName OneOf name\r
89150 * @returns {undefined}\r
89151 */\r
89152\r
89153/**\r
89154 * OneOf decorator (TypeScript).\r
89155 * @function\r
89156 * @param {...string} fieldNames Field names\r
89157 * @returns {OneOfDecorator} Decorator function\r
89158 * @template T extends string\r
89159 */\r
89160OneOf.d = function decorateOneOf() {\r
89161 var fieldNames = new Array(arguments.length),\r
89162 index = 0;\r
89163 while (index < arguments.length)\r
89164 fieldNames[index] = arguments[index++];\r
89165 return function oneOfDecorator(prototype, oneofName) {\r
89166 util.decorateType(prototype.constructor)\r
89167 .add(new OneOf(oneofName, fieldNames));\r
89168 Object.defineProperty(prototype, oneofName, {\r
89169 get: util.oneOfGetter(fieldNames),\r
89170 set: util.oneOfSetter(fieldNames)\r
89171 });\r
89172 };\r
89173};\r
89174
89175},{"./field":685,"./object":693,"./util":706}],695:[function(require,module,exports){
89176"use strict";\r
89177module.exports = parse;\r
89178\r
89179parse.filename = null;\r
89180parse.defaults = { keepCase: false };\r
89181\r
89182var tokenize = require("./tokenize"),\r
89183 Root = require("./root"),\r
89184 Type = require("./type"),\r
89185 Field = require("./field"),\r
89186 MapField = require("./mapfield"),\r
89187 OneOf = require("./oneof"),\r
89188 Enum = require("./enum"),\r
89189 Service = require("./service"),\r
89190 Method = require("./method"),\r
89191 types = require("./types"),\r
89192 util = require("./util");\r
89193\r
89194var base10Re = /^[1-9][0-9]*$/,\r
89195 base10NegRe = /^-?[1-9][0-9]*$/,\r
89196 base16Re = /^0[x][0-9a-fA-F]+$/,\r
89197 base16NegRe = /^-?0[x][0-9a-fA-F]+$/,\r
89198 base8Re = /^0[0-7]+$/,\r
89199 base8NegRe = /^-?0[0-7]+$/,\r
89200 numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,\r
89201 nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/,\r
89202 typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\r
89203 fqTypeRefRe = /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;\r
89204\r
89205/**\r
89206 * Result object returned from {@link parse}.\r
89207 * @interface IParserResult\r
89208 * @property {string|undefined} package Package name, if declared\r
89209 * @property {string[]|undefined} imports Imports, if any\r
89210 * @property {string[]|undefined} weakImports Weak imports, if any\r
89211 * @property {string|undefined} syntax Syntax, if specified (either `"proto2"` or `"proto3"`)\r
89212 * @property {Root} root Populated root instance\r
89213 */\r
89214\r
89215/**\r
89216 * Options modifying the behavior of {@link parse}.\r
89217 * @interface IParseOptions\r
89218 * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case\r
89219 * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments.\r
89220 */\r
89221\r
89222/**\r
89223 * Options modifying the behavior of JSON serialization.\r
89224 * @interface IToJSONOptions\r
89225 * @property {boolean} [keepComments=false] Serializes comments.\r
89226 */\r
89227\r
89228/**\r
89229 * Parses the given .proto source and returns an object with the parsed contents.\r
89230 * @param {string} source Source contents\r
89231 * @param {Root} root Root to populate\r
89232 * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r
89233 * @returns {IParserResult} Parser result\r
89234 * @property {string} filename=null Currently processing file name for error reporting, if known\r
89235 * @property {IParseOptions} defaults Default {@link IParseOptions}\r
89236 */\r
89237function parse(source, root, options) {\r
89238 /* eslint-disable callback-return */\r
89239 if (!(root instanceof Root)) {\r
89240 options = root;\r
89241 root = new Root();\r
89242 }\r
89243 if (!options)\r
89244 options = parse.defaults;\r
89245\r
89246 var tn = tokenize(source, options.alternateCommentMode || false),\r
89247 next = tn.next,\r
89248 push = tn.push,\r
89249 peek = tn.peek,\r
89250 skip = tn.skip,\r
89251 cmnt = tn.cmnt;\r
89252\r
89253 var head = true,\r
89254 pkg,\r
89255 imports,\r
89256 weakImports,\r
89257 syntax,\r
89258 isProto3 = false;\r
89259\r
89260 var ptr = root;\r
89261\r
89262 var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase;\r
89263\r
89264 /* istanbul ignore next */\r
89265 function illegal(token, name, insideTryCatch) {\r
89266 var filename = parse.filename;\r
89267 if (!insideTryCatch)\r
89268 parse.filename = null;\r
89269 return Error("illegal " + (name || "token") + " '" + token + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")");\r
89270 }\r
89271\r
89272 function readString() {\r
89273 var values = [],\r
89274 token;\r
89275 do {\r
89276 /* istanbul ignore if */\r
89277 if ((token = next()) !== "\"" && token !== "'")\r
89278 throw illegal(token);\r
89279\r
89280 values.push(next());\r
89281 skip(token);\r
89282 token = peek();\r
89283 } while (token === "\"" || token === "'");\r
89284 return values.join("");\r
89285 }\r
89286\r
89287 function readValue(acceptTypeRef) {\r
89288 var token = next();\r
89289 switch (token) {\r
89290 case "'":\r
89291 case "\"":\r
89292 push(token);\r
89293 return readString();\r
89294 case "true": case "TRUE":\r
89295 return true;\r
89296 case "false": case "FALSE":\r
89297 return false;\r
89298 }\r
89299 try {\r
89300 return parseNumber(token, /* insideTryCatch */ true);\r
89301 } catch (e) {\r
89302\r
89303 /* istanbul ignore else */\r
89304 if (acceptTypeRef && typeRefRe.test(token))\r
89305 return token;\r
89306\r
89307 /* istanbul ignore next */\r
89308 throw illegal(token, "value");\r
89309 }\r
89310 }\r
89311\r
89312 function readRanges(target, acceptStrings) {\r
89313 var token, start;\r
89314 do {\r
89315 if (acceptStrings && ((token = peek()) === "\"" || token === "'"))\r
89316 target.push(readString());\r
89317 else\r
89318 target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]);\r
89319 } while (skip(",", true));\r
89320 skip(";");\r
89321 }\r
89322\r
89323 function parseNumber(token, insideTryCatch) {\r
89324 var sign = 1;\r
89325 if (token.charAt(0) === "-") {\r
89326 sign = -1;\r
89327 token = token.substring(1);\r
89328 }\r
89329 switch (token) {\r
89330 case "inf": case "INF": case "Inf":\r
89331 return sign * Infinity;\r
89332 case "nan": case "NAN": case "Nan": case "NaN":\r
89333 return NaN;\r
89334 case "0":\r
89335 return 0;\r
89336 }\r
89337 if (base10Re.test(token))\r
89338 return sign * parseInt(token, 10);\r
89339 if (base16Re.test(token))\r
89340 return sign * parseInt(token, 16);\r
89341 if (base8Re.test(token))\r
89342 return sign * parseInt(token, 8);\r
89343\r
89344 /* istanbul ignore else */\r
89345 if (numberRe.test(token))\r
89346 return sign * parseFloat(token);\r
89347\r
89348 /* istanbul ignore next */\r
89349 throw illegal(token, "number", insideTryCatch);\r
89350 }\r
89351\r
89352 function parseId(token, acceptNegative) {\r
89353 switch (token) {\r
89354 case "max": case "MAX": case "Max":\r
89355 return 536870911;\r
89356 case "0":\r
89357 return 0;\r
89358 }\r
89359\r
89360 /* istanbul ignore if */\r
89361 if (!acceptNegative && token.charAt(0) === "-")\r
89362 throw illegal(token, "id");\r
89363\r
89364 if (base10NegRe.test(token))\r
89365 return parseInt(token, 10);\r
89366 if (base16NegRe.test(token))\r
89367 return parseInt(token, 16);\r
89368\r
89369 /* istanbul ignore else */\r
89370 if (base8NegRe.test(token))\r
89371 return parseInt(token, 8);\r
89372\r
89373 /* istanbul ignore next */\r
89374 throw illegal(token, "id");\r
89375 }\r
89376\r
89377 function parsePackage() {\r
89378\r
89379 /* istanbul ignore if */\r
89380 if (pkg !== undefined)\r
89381 throw illegal("package");\r
89382\r
89383 pkg = next();\r
89384\r
89385 /* istanbul ignore if */\r
89386 if (!typeRefRe.test(pkg))\r
89387 throw illegal(pkg, "name");\r
89388\r
89389 ptr = ptr.define(pkg);\r
89390 skip(";");\r
89391 }\r
89392\r
89393 function parseImport() {\r
89394 var token = peek();\r
89395 var whichImports;\r
89396 switch (token) {\r
89397 case "weak":\r
89398 whichImports = weakImports || (weakImports = []);\r
89399 next();\r
89400 break;\r
89401 case "public":\r
89402 next();\r
89403 // eslint-disable-line no-fallthrough\r
89404 default:\r
89405 whichImports = imports || (imports = []);\r
89406 break;\r
89407 }\r
89408 token = readString();\r
89409 skip(";");\r
89410 whichImports.push(token);\r
89411 }\r
89412\r
89413 function parseSyntax() {\r
89414 skip("=");\r
89415 syntax = readString();\r
89416 isProto3 = syntax === "proto3";\r
89417\r
89418 /* istanbul ignore if */\r
89419 if (!isProto3 && syntax !== "proto2")\r
89420 throw illegal(syntax, "syntax");\r
89421\r
89422 skip(";");\r
89423 }\r
89424\r
89425 function parseCommon(parent, token) {\r
89426 switch (token) {\r
89427\r
89428 case "option":\r
89429 parseOption(parent, token);\r
89430 skip(";");\r
89431 return true;\r
89432\r
89433 case "message":\r
89434 parseType(parent, token);\r
89435 return true;\r
89436\r
89437 case "enum":\r
89438 parseEnum(parent, token);\r
89439 return true;\r
89440\r
89441 case "service":\r
89442 parseService(parent, token);\r
89443 return true;\r
89444\r
89445 case "extend":\r
89446 parseExtension(parent, token);\r
89447 return true;\r
89448 }\r
89449 return false;\r
89450 }\r
89451\r
89452 function ifBlock(obj, fnIf, fnElse) {\r
89453 var trailingLine = tn.line;\r
89454 if (obj) {\r
89455 obj.comment = cmnt(); // try block-type comment\r
89456 obj.filename = parse.filename;\r
89457 }\r
89458 if (skip("{", true)) {\r
89459 var token;\r
89460 while ((token = next()) !== "}")\r
89461 fnIf(token);\r
89462 skip(";", true);\r
89463 } else {\r
89464 if (fnElse)\r
89465 fnElse();\r
89466 skip(";");\r
89467 if (obj && typeof obj.comment !== "string")\r
89468 obj.comment = cmnt(trailingLine); // try line-type comment if no block\r
89469 }\r
89470 }\r
89471\r
89472 function parseType(parent, token) {\r
89473\r
89474 /* istanbul ignore if */\r
89475 if (!nameRe.test(token = next()))\r
89476 throw illegal(token, "type name");\r
89477\r
89478 var type = new Type(token);\r
89479 ifBlock(type, function parseType_block(token) {\r
89480 if (parseCommon(type, token))\r
89481 return;\r
89482\r
89483 switch (token) {\r
89484\r
89485 case "map":\r
89486 parseMapField(type, token);\r
89487 break;\r
89488\r
89489 case "required":\r
89490 case "optional":\r
89491 case "repeated":\r
89492 parseField(type, token);\r
89493 break;\r
89494\r
89495 case "oneof":\r
89496 parseOneOf(type, token);\r
89497 break;\r
89498\r
89499 case "extensions":\r
89500 readRanges(type.extensions || (type.extensions = []));\r
89501 break;\r
89502\r
89503 case "reserved":\r
89504 readRanges(type.reserved || (type.reserved = []), true);\r
89505 break;\r
89506\r
89507 default:\r
89508 /* istanbul ignore if */\r
89509 if (!isProto3 || !typeRefRe.test(token))\r
89510 throw illegal(token);\r
89511\r
89512 push(token);\r
89513 parseField(type, "optional");\r
89514 break;\r
89515 }\r
89516 });\r
89517 parent.add(type);\r
89518 }\r
89519\r
89520 function parseField(parent, rule, extend) {\r
89521 var type = next();\r
89522 if (type === "group") {\r
89523 parseGroup(parent, rule);\r
89524 return;\r
89525 }\r
89526\r
89527 /* istanbul ignore if */\r
89528 if (!typeRefRe.test(type))\r
89529 throw illegal(type, "type");\r
89530\r
89531 var name = next();\r
89532\r
89533 /* istanbul ignore if */\r
89534 if (!nameRe.test(name))\r
89535 throw illegal(name, "name");\r
89536\r
89537 name = applyCase(name);\r
89538 skip("=");\r
89539\r
89540 var field = new Field(name, parseId(next()), type, rule, extend);\r
89541 ifBlock(field, function parseField_block(token) {\r
89542\r
89543 /* istanbul ignore else */\r
89544 if (token === "option") {\r
89545 parseOption(field, token);\r
89546 skip(";");\r
89547 } else\r
89548 throw illegal(token);\r
89549\r
89550 }, function parseField_line() {\r
89551 parseInlineOptions(field);\r
89552 });\r
89553 parent.add(field);\r
89554\r
89555 // JSON defaults to packed=true if not set so we have to set packed=false explicity when\r
89556 // parsing proto2 descriptors without the option, where applicable. This must be done for\r
89557 // all known packable types and anything that could be an enum (= is not a basic type).\r
89558 if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined))\r
89559 field.setOption("packed", false, /* ifNotSet */ true);\r
89560 }\r
89561\r
89562 function parseGroup(parent, rule) {\r
89563 var name = next();\r
89564\r
89565 /* istanbul ignore if */\r
89566 if (!nameRe.test(name))\r
89567 throw illegal(name, "name");\r
89568\r
89569 var fieldName = util.lcFirst(name);\r
89570 if (name === fieldName)\r
89571 name = util.ucFirst(name);\r
89572 skip("=");\r
89573 var id = parseId(next());\r
89574 var type = new Type(name);\r
89575 type.group = true;\r
89576 var field = new Field(fieldName, id, name, rule);\r
89577 field.filename = parse.filename;\r
89578 ifBlock(type, function parseGroup_block(token) {\r
89579 switch (token) {\r
89580\r
89581 case "option":\r
89582 parseOption(type, token);\r
89583 skip(";");\r
89584 break;\r
89585\r
89586 case "required":\r
89587 case "optional":\r
89588 case "repeated":\r
89589 parseField(type, token);\r
89590 break;\r
89591\r
89592 /* istanbul ignore next */\r
89593 default:\r
89594 throw illegal(token); // there are no groups with proto3 semantics\r
89595 }\r
89596 });\r
89597 parent.add(type)\r
89598 .add(field);\r
89599 }\r
89600\r
89601 function parseMapField(parent) {\r
89602 skip("<");\r
89603 var keyType = next();\r
89604\r
89605 /* istanbul ignore if */\r
89606 if (types.mapKey[keyType] === undefined)\r
89607 throw illegal(keyType, "type");\r
89608\r
89609 skip(",");\r
89610 var valueType = next();\r
89611\r
89612 /* istanbul ignore if */\r
89613 if (!typeRefRe.test(valueType))\r
89614 throw illegal(valueType, "type");\r
89615\r
89616 skip(">");\r
89617 var name = next();\r
89618\r
89619 /* istanbul ignore if */\r
89620 if (!nameRe.test(name))\r
89621 throw illegal(name, "name");\r
89622\r
89623 skip("=");\r
89624 var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);\r
89625 ifBlock(field, function parseMapField_block(token) {\r
89626\r
89627 /* istanbul ignore else */\r
89628 if (token === "option") {\r
89629 parseOption(field, token);\r
89630 skip(";");\r
89631 } else\r
89632 throw illegal(token);\r
89633\r
89634 }, function parseMapField_line() {\r
89635 parseInlineOptions(field);\r
89636 });\r
89637 parent.add(field);\r
89638 }\r
89639\r
89640 function parseOneOf(parent, token) {\r
89641\r
89642 /* istanbul ignore if */\r
89643 if (!nameRe.test(token = next()))\r
89644 throw illegal(token, "name");\r
89645\r
89646 var oneof = new OneOf(applyCase(token));\r
89647 ifBlock(oneof, function parseOneOf_block(token) {\r
89648 if (token === "option") {\r
89649 parseOption(oneof, token);\r
89650 skip(";");\r
89651 } else {\r
89652 push(token);\r
89653 parseField(oneof, "optional");\r
89654 }\r
89655 });\r
89656 parent.add(oneof);\r
89657 }\r
89658\r
89659 function parseEnum(parent, token) {\r
89660\r
89661 /* istanbul ignore if */\r
89662 if (!nameRe.test(token = next()))\r
89663 throw illegal(token, "name");\r
89664\r
89665 var enm = new Enum(token);\r
89666 ifBlock(enm, function parseEnum_block(token) {\r
89667 switch(token) {\r
89668 case "option":\r
89669 parseOption(enm, token);\r
89670 skip(";");\r
89671 break;\r
89672\r
89673 case "reserved":\r
89674 readRanges(enm.reserved || (enm.reserved = []), true);\r
89675 break;\r
89676\r
89677 default:\r
89678 parseEnumValue(enm, token);\r
89679 }\r
89680 });\r
89681 parent.add(enm);\r
89682 }\r
89683\r
89684 function parseEnumValue(parent, token) {\r
89685\r
89686 /* istanbul ignore if */\r
89687 if (!nameRe.test(token))\r
89688 throw illegal(token, "name");\r
89689\r
89690 skip("=");\r
89691 var value = parseId(next(), true),\r
89692 dummy = {};\r
89693 ifBlock(dummy, function parseEnumValue_block(token) {\r
89694\r
89695 /* istanbul ignore else */\r
89696 if (token === "option") {\r
89697 parseOption(dummy, token); // skip\r
89698 skip(";");\r
89699 } else\r
89700 throw illegal(token);\r
89701\r
89702 }, function parseEnumValue_line() {\r
89703 parseInlineOptions(dummy); // skip\r
89704 });\r
89705 parent.add(token, value, dummy.comment);\r
89706 }\r
89707\r
89708 function parseOption(parent, token) {\r
89709 var isCustom = skip("(", true);\r
89710\r
89711 /* istanbul ignore if */\r
89712 if (!typeRefRe.test(token = next()))\r
89713 throw illegal(token, "name");\r
89714\r
89715 var name = token;\r
89716 if (isCustom) {\r
89717 skip(")");\r
89718 name = "(" + name + ")";\r
89719 token = peek();\r
89720 if (fqTypeRefRe.test(token)) {\r
89721 name += token;\r
89722 next();\r
89723 }\r
89724 }\r
89725 skip("=");\r
89726 parseOptionValue(parent, name);\r
89727 }\r
89728\r
89729 function parseOptionValue(parent, name) {\r
89730 if (skip("{", true)) { // { a: "foo" b { c: "bar" } }\r
89731 do {\r
89732 /* istanbul ignore if */\r
89733 if (!nameRe.test(token = next()))\r
89734 throw illegal(token, "name");\r
89735\r
89736 if (peek() === "{")\r
89737 parseOptionValue(parent, name + "." + token);\r
89738 else {\r
89739 skip(":");\r
89740 if (peek() === "{")\r
89741 parseOptionValue(parent, name + "." + token);\r
89742 else\r
89743 setOption(parent, name + "." + token, readValue(true));\r
89744 }\r
89745 skip(",", true);\r
89746 } while (!skip("}", true));\r
89747 } else\r
89748 setOption(parent, name, readValue(true));\r
89749 // Does not enforce a delimiter to be universal\r
89750 }\r
89751\r
89752 function setOption(parent, name, value) {\r
89753 if (parent.setOption)\r
89754 parent.setOption(name, value);\r
89755 }\r
89756\r
89757 function parseInlineOptions(parent) {\r
89758 if (skip("[", true)) {\r
89759 do {\r
89760 parseOption(parent, "option");\r
89761 } while (skip(",", true));\r
89762 skip("]");\r
89763 }\r
89764 return parent;\r
89765 }\r
89766\r
89767 function parseService(parent, token) {\r
89768\r
89769 /* istanbul ignore if */\r
89770 if (!nameRe.test(token = next()))\r
89771 throw illegal(token, "service name");\r
89772\r
89773 var service = new Service(token);\r
89774 ifBlock(service, function parseService_block(token) {\r
89775 if (parseCommon(service, token))\r
89776 return;\r
89777\r
89778 /* istanbul ignore else */\r
89779 if (token === "rpc")\r
89780 parseMethod(service, token);\r
89781 else\r
89782 throw illegal(token);\r
89783 });\r
89784 parent.add(service);\r
89785 }\r
89786\r
89787 function parseMethod(parent, token) {\r
89788 var type = token;\r
89789\r
89790 /* istanbul ignore if */\r
89791 if (!nameRe.test(token = next()))\r
89792 throw illegal(token, "name");\r
89793\r
89794 var name = token,\r
89795 requestType, requestStream,\r
89796 responseType, responseStream;\r
89797\r
89798 skip("(");\r
89799 if (skip("stream", true))\r
89800 requestStream = true;\r
89801\r
89802 /* istanbul ignore if */\r
89803 if (!typeRefRe.test(token = next()))\r
89804 throw illegal(token);\r
89805\r
89806 requestType = token;\r
89807 skip(")"); skip("returns"); skip("(");\r
89808 if (skip("stream", true))\r
89809 responseStream = true;\r
89810\r
89811 /* istanbul ignore if */\r
89812 if (!typeRefRe.test(token = next()))\r
89813 throw illegal(token);\r
89814\r
89815 responseType = token;\r
89816 skip(")");\r
89817\r
89818 var method = new Method(name, type, requestType, responseType, requestStream, responseStream);\r
89819 ifBlock(method, function parseMethod_block(token) {\r
89820\r
89821 /* istanbul ignore else */\r
89822 if (token === "option") {\r
89823 parseOption(method, token);\r
89824 skip(";");\r
89825 } else\r
89826 throw illegal(token);\r
89827\r
89828 });\r
89829 parent.add(method);\r
89830 }\r
89831\r
89832 function parseExtension(parent, token) {\r
89833\r
89834 /* istanbul ignore if */\r
89835 if (!typeRefRe.test(token = next()))\r
89836 throw illegal(token, "reference");\r
89837\r
89838 var reference = token;\r
89839 ifBlock(null, function parseExtension_block(token) {\r
89840 switch (token) {\r
89841\r
89842 case "required":\r
89843 case "repeated":\r
89844 case "optional":\r
89845 parseField(parent, token, reference);\r
89846 break;\r
89847\r
89848 default:\r
89849 /* istanbul ignore if */\r
89850 if (!isProto3 || !typeRefRe.test(token))\r
89851 throw illegal(token);\r
89852 push(token);\r
89853 parseField(parent, "optional", reference);\r
89854 break;\r
89855 }\r
89856 });\r
89857 }\r
89858\r
89859 var token;\r
89860 while ((token = next()) !== null) {\r
89861 switch (token) {\r
89862\r
89863 case "package":\r
89864\r
89865 /* istanbul ignore if */\r
89866 if (!head)\r
89867 throw illegal(token);\r
89868\r
89869 parsePackage();\r
89870 break;\r
89871\r
89872 case "import":\r
89873\r
89874 /* istanbul ignore if */\r
89875 if (!head)\r
89876 throw illegal(token);\r
89877\r
89878 parseImport();\r
89879 break;\r
89880\r
89881 case "syntax":\r
89882\r
89883 /* istanbul ignore if */\r
89884 if (!head)\r
89885 throw illegal(token);\r
89886\r
89887 parseSyntax();\r
89888 break;\r
89889\r
89890 case "option":\r
89891\r
89892 /* istanbul ignore if */\r
89893 if (!head)\r
89894 throw illegal(token);\r
89895\r
89896 parseOption(ptr, token);\r
89897 skip(";");\r
89898 break;\r
89899\r
89900 default:\r
89901\r
89902 /* istanbul ignore else */\r
89903 if (parseCommon(ptr, token)) {\r
89904 head = false;\r
89905 continue;\r
89906 }\r
89907\r
89908 /* istanbul ignore next */\r
89909 throw illegal(token);\r
89910 }\r
89911 }\r
89912\r
89913 parse.filename = null;\r
89914 return {\r
89915 "package" : pkg,\r
89916 "imports" : imports,\r
89917 weakImports : weakImports,\r
89918 syntax : syntax,\r
89919 root : root\r
89920 };\r
89921}\r
89922\r
89923/**\r
89924 * Parses the given .proto source and returns an object with the parsed contents.\r
89925 * @name parse\r
89926 * @function\r
89927 * @param {string} source Source contents\r
89928 * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r
89929 * @returns {IParserResult} Parser result\r
89930 * @property {string} filename=null Currently processing file name for error reporting, if known\r
89931 * @property {IParseOptions} defaults Default {@link IParseOptions}\r
89932 * @variation 2\r
89933 */\r
89934
89935},{"./enum":684,"./field":685,"./mapfield":689,"./method":691,"./oneof":694,"./root":698,"./service":702,"./tokenize":703,"./type":704,"./types":705,"./util":706}],696:[function(require,module,exports){
89936"use strict";\r
89937module.exports = Reader;\r
89938\r
89939var util = require("./util/minimal");\r
89940\r
89941var BufferReader; // cyclic\r
89942\r
89943var LongBits = util.LongBits,\r
89944 utf8 = util.utf8;\r
89945\r
89946/* istanbul ignore next */\r
89947function indexOutOfRange(reader, writeLength) {\r
89948 return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);\r
89949}\r
89950\r
89951/**\r
89952 * Constructs a new reader instance using the specified buffer.\r
89953 * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\r
89954 * @constructor\r
89955 * @param {Uint8Array} buffer Buffer to read from\r
89956 */\r
89957function Reader(buffer) {\r
89958\r
89959 /**\r
89960 * Read buffer.\r
89961 * @type {Uint8Array}\r
89962 */\r
89963 this.buf = buffer;\r
89964\r
89965 /**\r
89966 * Read buffer position.\r
89967 * @type {number}\r
89968 */\r
89969 this.pos = 0;\r
89970\r
89971 /**\r
89972 * Read buffer length.\r
89973 * @type {number}\r
89974 */\r
89975 this.len = buffer.length;\r
89976}\r
89977\r
89978var create_array = typeof Uint8Array !== "undefined"\r
89979 ? function create_typed_array(buffer) {\r
89980 if (buffer instanceof Uint8Array || Array.isArray(buffer))\r
89981 return new Reader(buffer);\r
89982 throw Error("illegal buffer");\r
89983 }\r
89984 /* istanbul ignore next */\r
89985 : function create_array(buffer) {\r
89986 if (Array.isArray(buffer))\r
89987 return new Reader(buffer);\r
89988 throw Error("illegal buffer");\r
89989 };\r
89990\r
89991/**\r
89992 * Creates a new reader using the specified buffer.\r
89993 * @function\r
89994 * @param {Uint8Array|Buffer} buffer Buffer to read from\r
89995 * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\r
89996 * @throws {Error} If `buffer` is not a valid buffer\r
89997 */\r
89998Reader.create = util.Buffer\r
89999 ? function create_buffer_setup(buffer) {\r
90000 return (Reader.create = function create_buffer(buffer) {\r
90001 return util.Buffer.isBuffer(buffer)\r
90002 ? new BufferReader(buffer)\r
90003 /* istanbul ignore next */\r
90004 : create_array(buffer);\r
90005 })(buffer);\r
90006 }\r
90007 /* istanbul ignore next */\r
90008 : create_array;\r
90009\r
90010Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\r
90011\r
90012/**\r
90013 * Reads a varint as an unsigned 32 bit value.\r
90014 * @function\r
90015 * @returns {number} Value read\r
90016 */\r
90017Reader.prototype.uint32 = (function read_uint32_setup() {\r
90018 var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\r
90019 return function read_uint32() {\r
90020 value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\r
90021 value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\r
90022 value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\r
90023 value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\r
90024 value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\r
90025\r
90026 /* istanbul ignore if */\r
90027 if ((this.pos += 5) > this.len) {\r
90028 this.pos = this.len;\r
90029 throw indexOutOfRange(this, 10);\r
90030 }\r
90031 return value;\r
90032 };\r
90033})();\r
90034\r
90035/**\r
90036 * Reads a varint as a signed 32 bit value.\r
90037 * @returns {number} Value read\r
90038 */\r
90039Reader.prototype.int32 = function read_int32() {\r
90040 return this.uint32() | 0;\r
90041};\r
90042\r
90043/**\r
90044 * Reads a zig-zag encoded varint as a signed 32 bit value.\r
90045 * @returns {number} Value read\r
90046 */\r
90047Reader.prototype.sint32 = function read_sint32() {\r
90048 var value = this.uint32();\r
90049 return value >>> 1 ^ -(value & 1) | 0;\r
90050};\r
90051\r
90052/* eslint-disable no-invalid-this */\r
90053\r
90054function readLongVarint() {\r
90055 // tends to deopt with local vars for octet etc.\r
90056 var bits = new LongBits(0, 0);\r
90057 var i = 0;\r
90058 if (this.len - this.pos > 4) { // fast route (lo)\r
90059 for (; i < 4; ++i) {\r
90060 // 1st..4th\r
90061 bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\r
90062 if (this.buf[this.pos++] < 128)\r
90063 return bits;\r
90064 }\r
90065 // 5th\r
90066 bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\r
90067 bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\r
90068 if (this.buf[this.pos++] < 128)\r
90069 return bits;\r
90070 i = 0;\r
90071 } else {\r
90072 for (; i < 3; ++i) {\r
90073 /* istanbul ignore if */\r
90074 if (this.pos >= this.len)\r
90075 throw indexOutOfRange(this);\r
90076 // 1st..3th\r
90077 bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\r
90078 if (this.buf[this.pos++] < 128)\r
90079 return bits;\r
90080 }\r
90081 // 4th\r
90082 bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\r
90083 return bits;\r
90084 }\r
90085 if (this.len - this.pos > 4) { // fast route (hi)\r
90086 for (; i < 5; ++i) {\r
90087 // 6th..10th\r
90088 bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\r
90089 if (this.buf[this.pos++] < 128)\r
90090 return bits;\r
90091 }\r
90092 } else {\r
90093 for (; i < 5; ++i) {\r
90094 /* istanbul ignore if */\r
90095 if (this.pos >= this.len)\r
90096 throw indexOutOfRange(this);\r
90097 // 6th..10th\r
90098 bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\r
90099 if (this.buf[this.pos++] < 128)\r
90100 return bits;\r
90101 }\r
90102 }\r
90103 /* istanbul ignore next */\r
90104 throw Error("invalid varint encoding");\r
90105}\r
90106\r
90107/* eslint-enable no-invalid-this */\r
90108\r
90109/**\r
90110 * Reads a varint as a signed 64 bit value.\r
90111 * @name Reader#int64\r
90112 * @function\r
90113 * @returns {Long} Value read\r
90114 */\r
90115\r
90116/**\r
90117 * Reads a varint as an unsigned 64 bit value.\r
90118 * @name Reader#uint64\r
90119 * @function\r
90120 * @returns {Long} Value read\r
90121 */\r
90122\r
90123/**\r
90124 * Reads a zig-zag encoded varint as a signed 64 bit value.\r
90125 * @name Reader#sint64\r
90126 * @function\r
90127 * @returns {Long} Value read\r
90128 */\r
90129\r
90130/**\r
90131 * Reads a varint as a boolean.\r
90132 * @returns {boolean} Value read\r
90133 */\r
90134Reader.prototype.bool = function read_bool() {\r
90135 return this.uint32() !== 0;\r
90136};\r
90137\r
90138function readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\r
90139 return (buf[end - 4]\r
90140 | buf[end - 3] << 8\r
90141 | buf[end - 2] << 16\r
90142 | buf[end - 1] << 24) >>> 0;\r
90143}\r
90144\r
90145/**\r
90146 * Reads fixed 32 bits as an unsigned 32 bit integer.\r
90147 * @returns {number} Value read\r
90148 */\r
90149Reader.prototype.fixed32 = function read_fixed32() {\r
90150\r
90151 /* istanbul ignore if */\r
90152 if (this.pos + 4 > this.len)\r
90153 throw indexOutOfRange(this, 4);\r
90154\r
90155 return readFixed32_end(this.buf, this.pos += 4);\r
90156};\r
90157\r
90158/**\r
90159 * Reads fixed 32 bits as a signed 32 bit integer.\r
90160 * @returns {number} Value read\r
90161 */\r
90162Reader.prototype.sfixed32 = function read_sfixed32() {\r
90163\r
90164 /* istanbul ignore if */\r
90165 if (this.pos + 4 > this.len)\r
90166 throw indexOutOfRange(this, 4);\r
90167\r
90168 return readFixed32_end(this.buf, this.pos += 4) | 0;\r
90169};\r
90170\r
90171/* eslint-disable no-invalid-this */\r
90172\r
90173function readFixed64(/* this: Reader */) {\r
90174\r
90175 /* istanbul ignore if */\r
90176 if (this.pos + 8 > this.len)\r
90177 throw indexOutOfRange(this, 8);\r
90178\r
90179 return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\r
90180}\r
90181\r
90182/* eslint-enable no-invalid-this */\r
90183\r
90184/**\r
90185 * Reads fixed 64 bits.\r
90186 * @name Reader#fixed64\r
90187 * @function\r
90188 * @returns {Long} Value read\r
90189 */\r
90190\r
90191/**\r
90192 * Reads zig-zag encoded fixed 64 bits.\r
90193 * @name Reader#sfixed64\r
90194 * @function\r
90195 * @returns {Long} Value read\r
90196 */\r
90197\r
90198/**\r
90199 * Reads a float (32 bit) as a number.\r
90200 * @function\r
90201 * @returns {number} Value read\r
90202 */\r
90203Reader.prototype.float = function read_float() {\r
90204\r
90205 /* istanbul ignore if */\r
90206 if (this.pos + 4 > this.len)\r
90207 throw indexOutOfRange(this, 4);\r
90208\r
90209 var value = util.float.readFloatLE(this.buf, this.pos);\r
90210 this.pos += 4;\r
90211 return value;\r
90212};\r
90213\r
90214/**\r
90215 * Reads a double (64 bit float) as a number.\r
90216 * @function\r
90217 * @returns {number} Value read\r
90218 */\r
90219Reader.prototype.double = function read_double() {\r
90220\r
90221 /* istanbul ignore if */\r
90222 if (this.pos + 8 > this.len)\r
90223 throw indexOutOfRange(this, 4);\r
90224\r
90225 var value = util.float.readDoubleLE(this.buf, this.pos);\r
90226 this.pos += 8;\r
90227 return value;\r
90228};\r
90229\r
90230/**\r
90231 * Reads a sequence of bytes preceeded by its length as a varint.\r
90232 * @returns {Uint8Array} Value read\r
90233 */\r
90234Reader.prototype.bytes = function read_bytes() {\r
90235 var length = this.uint32(),\r
90236 start = this.pos,\r
90237 end = this.pos + length;\r
90238\r
90239 /* istanbul ignore if */\r
90240 if (end > this.len)\r
90241 throw indexOutOfRange(this, length);\r
90242\r
90243 this.pos += length;\r
90244 if (Array.isArray(this.buf)) // plain array\r
90245 return this.buf.slice(start, end);\r
90246 return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\r
90247 ? new this.buf.constructor(0)\r
90248 : this._slice.call(this.buf, start, end);\r
90249};\r
90250\r
90251/**\r
90252 * Reads a string preceeded by its byte length as a varint.\r
90253 * @returns {string} Value read\r
90254 */\r
90255Reader.prototype.string = function read_string() {\r
90256 var bytes = this.bytes();\r
90257 return utf8.read(bytes, 0, bytes.length);\r
90258};\r
90259\r
90260/**\r
90261 * Skips the specified number of bytes if specified, otherwise skips a varint.\r
90262 * @param {number} [length] Length if known, otherwise a varint is assumed\r
90263 * @returns {Reader} `this`\r
90264 */\r
90265Reader.prototype.skip = function skip(length) {\r
90266 if (typeof length === "number") {\r
90267 /* istanbul ignore if */\r
90268 if (this.pos + length > this.len)\r
90269 throw indexOutOfRange(this, length);\r
90270 this.pos += length;\r
90271 } else {\r
90272 do {\r
90273 /* istanbul ignore if */\r
90274 if (this.pos >= this.len)\r
90275 throw indexOutOfRange(this);\r
90276 } while (this.buf[this.pos++] & 128);\r
90277 }\r
90278 return this;\r
90279};\r
90280\r
90281/**\r
90282 * Skips the next element of the specified wire type.\r
90283 * @param {number} wireType Wire type received\r
90284 * @returns {Reader} `this`\r
90285 */\r
90286Reader.prototype.skipType = function(wireType) {\r
90287 switch (wireType) {\r
90288 case 0:\r
90289 this.skip();\r
90290 break;\r
90291 case 1:\r
90292 this.skip(8);\r
90293 break;\r
90294 case 2:\r
90295 this.skip(this.uint32());\r
90296 break;\r
90297 case 3:\r
90298 while ((wireType = this.uint32() & 7) !== 4) {\r
90299 this.skipType(wireType);\r
90300 }\r
90301 break;\r
90302 case 5:\r
90303 this.skip(4);\r
90304 break;\r
90305\r
90306 /* istanbul ignore next */\r
90307 default:\r
90308 throw Error("invalid wire type " + wireType + " at offset " + this.pos);\r
90309 }\r
90310 return this;\r
90311};\r
90312\r
90313Reader._configure = function(BufferReader_) {\r
90314 BufferReader = BufferReader_;\r
90315\r
90316 var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber";\r
90317 util.merge(Reader.prototype, {\r
90318\r
90319 int64: function read_int64() {\r
90320 return readLongVarint.call(this)[fn](false);\r
90321 },\r
90322\r
90323 uint64: function read_uint64() {\r
90324 return readLongVarint.call(this)[fn](true);\r
90325 },\r
90326\r
90327 sint64: function read_sint64() {\r
90328 return readLongVarint.call(this).zzDecode()[fn](false);\r
90329 },\r
90330\r
90331 fixed64: function read_fixed64() {\r
90332 return readFixed64.call(this)[fn](true);\r
90333 },\r
90334\r
90335 sfixed64: function read_sfixed64() {\r
90336 return readFixed64.call(this)[fn](false);\r
90337 }\r
90338\r
90339 });\r
90340};\r
90341
90342},{"./util/minimal":708}],697:[function(require,module,exports){
90343"use strict";\r
90344module.exports = BufferReader;\r
90345\r
90346// extends Reader\r
90347var Reader = require("./reader");\r
90348(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\r
90349\r
90350var util = require("./util/minimal");\r
90351\r
90352/**\r
90353 * Constructs a new buffer reader instance.\r
90354 * @classdesc Wire format reader using node buffers.\r
90355 * @extends Reader\r
90356 * @constructor\r
90357 * @param {Buffer} buffer Buffer to read from\r
90358 */\r
90359function BufferReader(buffer) {\r
90360 Reader.call(this, buffer);\r
90361\r
90362 /**\r
90363 * Read buffer.\r
90364 * @name BufferReader#buf\r
90365 * @type {Buffer}\r
90366 */\r
90367}\r
90368\r
90369/* istanbul ignore else */\r
90370if (util.Buffer)\r
90371 BufferReader.prototype._slice = util.Buffer.prototype.slice;\r
90372\r
90373/**\r
90374 * @override\r
90375 */\r
90376BufferReader.prototype.string = function read_string_buffer() {\r
90377 var len = this.uint32(); // modifies pos\r
90378 return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len));\r
90379};\r
90380\r
90381/**\r
90382 * Reads a sequence of bytes preceeded by its length as a varint.\r
90383 * @name BufferReader#bytes\r
90384 * @function\r
90385 * @returns {Buffer} Value read\r
90386 */\r
90387
90388},{"./reader":696,"./util/minimal":708}],698:[function(require,module,exports){
90389"use strict";\r
90390module.exports = Root;\r
90391\r
90392// extends Namespace\r
90393var Namespace = require("./namespace");\r
90394((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root";\r
90395\r
90396var Field = require("./field"),\r
90397 Enum = require("./enum"),\r
90398 OneOf = require("./oneof"),\r
90399 util = require("./util");\r
90400\r
90401var Type, // cyclic\r
90402 parse, // might be excluded\r
90403 common; // "\r
90404\r
90405/**\r
90406 * Constructs a new root namespace instance.\r
90407 * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\r
90408 * @extends NamespaceBase\r
90409 * @constructor\r
90410 * @param {Object.<string,*>} [options] Top level options\r
90411 */\r
90412function Root(options) {\r
90413 Namespace.call(this, "", options);\r
90414\r
90415 /**\r
90416 * Deferred extension fields.\r
90417 * @type {Field[]}\r
90418 */\r
90419 this.deferred = [];\r
90420\r
90421 /**\r
90422 * Resolved file names of loaded files.\r
90423 * @type {string[]}\r
90424 */\r
90425 this.files = [];\r
90426}\r
90427\r
90428/**\r
90429 * Loads a namespace descriptor into a root namespace.\r
90430 * @param {INamespace} json Nameespace descriptor\r
90431 * @param {Root} [root] Root namespace, defaults to create a new one if omitted\r
90432 * @returns {Root} Root namespace\r
90433 */\r
90434Root.fromJSON = function fromJSON(json, root) {\r
90435 if (!root)\r
90436 root = new Root();\r
90437 if (json.options)\r
90438 root.setOptions(json.options);\r
90439 return root.addJSON(json.nested);\r
90440};\r
90441\r
90442/**\r
90443 * Resolves the path of an imported file, relative to the importing origin.\r
90444 * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\r
90445 * @function\r
90446 * @param {string} origin The file name of the importing file\r
90447 * @param {string} target The file name being imported\r
90448 * @returns {string|null} Resolved path to `target` or `null` to skip the file\r
90449 */\r
90450Root.prototype.resolvePath = util.path.resolve;\r
90451\r
90452// A symbol-like function to safely signal synchronous loading\r
90453/* istanbul ignore next */\r
90454function SYNC() {} // eslint-disable-line no-empty-function\r
90455\r
90456/**\r
90457 * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\r
90458 * @param {string|string[]} filename Names of one or multiple files to load\r
90459 * @param {IParseOptions} options Parse options\r
90460 * @param {LoadCallback} callback Callback function\r
90461 * @returns {undefined}\r
90462 */\r
90463Root.prototype.load = function load(filename, options, callback) {\r
90464 if (typeof options === "function") {\r
90465 callback = options;\r
90466 options = undefined;\r
90467 }\r
90468 var self = this;\r
90469 if (!callback)\r
90470 return util.asPromise(load, self, filename, options);\r
90471\r
90472 var sync = callback === SYNC; // undocumented\r
90473\r
90474 // Finishes loading by calling the callback (exactly once)\r
90475 function finish(err, root) {\r
90476 /* istanbul ignore if */\r
90477 if (!callback)\r
90478 return;\r
90479 var cb = callback;\r
90480 callback = null;\r
90481 if (sync)\r
90482 throw err;\r
90483 cb(err, root);\r
90484 }\r
90485\r
90486 // Processes a single file\r
90487 function process(filename, source) {\r
90488 try {\r
90489 if (util.isString(source) && source.charAt(0) === "{")\r
90490 source = JSON.parse(source);\r
90491 if (!util.isString(source))\r
90492 self.setOptions(source.options).addJSON(source.nested);\r
90493 else {\r
90494 parse.filename = filename;\r
90495 var parsed = parse(source, self, options),\r
90496 resolved,\r
90497 i = 0;\r
90498 if (parsed.imports)\r
90499 for (; i < parsed.imports.length; ++i)\r
90500 if (resolved = self.resolvePath(filename, parsed.imports[i]))\r
90501 fetch(resolved);\r
90502 if (parsed.weakImports)\r
90503 for (i = 0; i < parsed.weakImports.length; ++i)\r
90504 if (resolved = self.resolvePath(filename, parsed.weakImports[i]))\r
90505 fetch(resolved, true);\r
90506 }\r
90507 } catch (err) {\r
90508 finish(err);\r
90509 }\r
90510 if (!sync && !queued)\r
90511 finish(null, self); // only once anyway\r
90512 }\r
90513\r
90514 // Fetches a single file\r
90515 function fetch(filename, weak) {\r
90516\r
90517 // Strip path if this file references a bundled definition\r
90518 var idx = filename.lastIndexOf("google/protobuf/");\r
90519 if (idx > -1) {\r
90520 var altname = filename.substring(idx);\r
90521 if (altname in common)\r
90522 filename = altname;\r
90523 }\r
90524\r
90525 // Skip if already loaded / attempted\r
90526 if (self.files.indexOf(filename) > -1)\r
90527 return;\r
90528 self.files.push(filename);\r
90529\r
90530 // Shortcut bundled definitions\r
90531 if (filename in common) {\r
90532 if (sync)\r
90533 process(filename, common[filename]);\r
90534 else {\r
90535 ++queued;\r
90536 setTimeout(function() {\r
90537 --queued;\r
90538 process(filename, common[filename]);\r
90539 });\r
90540 }\r
90541 return;\r
90542 }\r
90543\r
90544 // Otherwise fetch from disk or network\r
90545 if (sync) {\r
90546 var source;\r
90547 try {\r
90548 source = util.fs.readFileSync(filename).toString("utf8");\r
90549 } catch (err) {\r
90550 if (!weak)\r
90551 finish(err);\r
90552 return;\r
90553 }\r
90554 process(filename, source);\r
90555 } else {\r
90556 ++queued;\r
90557 util.fetch(filename, function(err, source) {\r
90558 --queued;\r
90559 /* istanbul ignore if */\r
90560 if (!callback)\r
90561 return; // terminated meanwhile\r
90562 if (err) {\r
90563 /* istanbul ignore else */\r
90564 if (!weak)\r
90565 finish(err);\r
90566 else if (!queued) // can't be covered reliably\r
90567 finish(null, self);\r
90568 return;\r
90569 }\r
90570 process(filename, source);\r
90571 });\r
90572 }\r
90573 }\r
90574 var queued = 0;\r
90575\r
90576 // Assembling the root namespace doesn't require working type\r
90577 // references anymore, so we can load everything in parallel\r
90578 if (util.isString(filename))\r
90579 filename = [ filename ];\r
90580 for (var i = 0, resolved; i < filename.length; ++i)\r
90581 if (resolved = self.resolvePath("", filename[i]))\r
90582 fetch(resolved);\r
90583\r
90584 if (sync)\r
90585 return self;\r
90586 if (!queued)\r
90587 finish(null, self);\r
90588 return undefined;\r
90589};\r
90590// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\r
90591\r
90592/**\r
90593 * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\r
90594 * @function Root#load\r
90595 * @param {string|string[]} filename Names of one or multiple files to load\r
90596 * @param {LoadCallback} callback Callback function\r
90597 * @returns {undefined}\r
90598 * @variation 2\r
90599 */\r
90600// function load(filename:string, callback:LoadCallback):undefined\r
90601\r
90602/**\r
90603 * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\r
90604 * @function Root#load\r
90605 * @param {string|string[]} filename Names of one or multiple files to load\r
90606 * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r
90607 * @returns {Promise<Root>} Promise\r
90608 * @variation 3\r
90609 */\r
90610// function load(filename:string, [options:IParseOptions]):Promise<Root>\r
90611\r
90612/**\r
90613 * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\r
90614 * @function Root#loadSync\r
90615 * @param {string|string[]} filename Names of one or multiple files to load\r
90616 * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r
90617 * @returns {Root} Root namespace\r
90618 * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\r
90619 */\r
90620Root.prototype.loadSync = function loadSync(filename, options) {\r
90621 if (!util.isNode)\r
90622 throw Error("not supported");\r
90623 return this.load(filename, options, SYNC);\r
90624};\r
90625\r
90626/**\r
90627 * @override\r
90628 */\r
90629Root.prototype.resolveAll = function resolveAll() {\r
90630 if (this.deferred.length)\r
90631 throw Error("unresolvable extensions: " + this.deferred.map(function(field) {\r
90632 return "'extend " + field.extend + "' in " + field.parent.fullName;\r
90633 }).join(", "));\r
90634 return Namespace.prototype.resolveAll.call(this);\r
90635};\r
90636\r
90637// only uppercased (and thus conflict-free) children are exposed, see below\r
90638var exposeRe = /^[A-Z]/;\r
90639\r
90640/**\r
90641 * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\r
90642 * @param {Root} root Root instance\r
90643 * @param {Field} field Declaring extension field witin the declaring type\r
90644 * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\r
90645 * @inner\r
90646 * @ignore\r
90647 */\r
90648function tryHandleExtension(root, field) {\r
90649 var extendedType = field.parent.lookup(field.extend);\r
90650 if (extendedType) {\r
90651 var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\r
90652 sisterField.declaringField = field;\r
90653 field.extensionField = sisterField;\r
90654 extendedType.add(sisterField);\r
90655 return true;\r
90656 }\r
90657 return false;\r
90658}\r
90659\r
90660/**\r
90661 * Called when any object is added to this root or its sub-namespaces.\r
90662 * @param {ReflectionObject} object Object added\r
90663 * @returns {undefined}\r
90664 * @private\r
90665 */\r
90666Root.prototype._handleAdd = function _handleAdd(object) {\r
90667 if (object instanceof Field) {\r
90668\r
90669 if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\r
90670 if (!tryHandleExtension(this, object))\r
90671 this.deferred.push(object);\r
90672\r
90673 } else if (object instanceof Enum) {\r
90674\r
90675 if (exposeRe.test(object.name))\r
90676 object.parent[object.name] = object.values; // expose enum values as property of its parent\r
90677\r
90678 } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\r
90679\r
90680 if (object instanceof Type) // Try to handle any deferred extensions\r
90681 for (var i = 0; i < this.deferred.length;)\r
90682 if (tryHandleExtension(this, this.deferred[i]))\r
90683 this.deferred.splice(i, 1);\r
90684 else\r
90685 ++i;\r
90686 for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\r
90687 this._handleAdd(object._nestedArray[j]);\r
90688 if (exposeRe.test(object.name))\r
90689 object.parent[object.name] = object; // expose namespace as property of its parent\r
90690 }\r
90691\r
90692 // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\r
90693 // properties of namespaces just like static code does. This allows using a .d.ts generated for\r
90694 // a static module with reflection-based solutions where the condition is met.\r
90695};\r
90696\r
90697/**\r
90698 * Called when any object is removed from this root or its sub-namespaces.\r
90699 * @param {ReflectionObject} object Object removed\r
90700 * @returns {undefined}\r
90701 * @private\r
90702 */\r
90703Root.prototype._handleRemove = function _handleRemove(object) {\r
90704 if (object instanceof Field) {\r
90705\r
90706 if (/* an extension field */ object.extend !== undefined) {\r
90707 if (/* already handled */ object.extensionField) { // remove its sister field\r
90708 object.extensionField.parent.remove(object.extensionField);\r
90709 object.extensionField = null;\r
90710 } else { // cancel the extension\r
90711 var index = this.deferred.indexOf(object);\r
90712 /* istanbul ignore else */\r
90713 if (index > -1)\r
90714 this.deferred.splice(index, 1);\r
90715 }\r
90716 }\r
90717\r
90718 } else if (object instanceof Enum) {\r
90719\r
90720 if (exposeRe.test(object.name))\r
90721 delete object.parent[object.name]; // unexpose enum values\r
90722\r
90723 } else if (object instanceof Namespace) {\r
90724\r
90725 for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\r
90726 this._handleRemove(object._nestedArray[i]);\r
90727\r
90728 if (exposeRe.test(object.name))\r
90729 delete object.parent[object.name]; // unexpose namespaces\r
90730\r
90731 }\r
90732};\r
90733\r
90734// Sets up cyclic dependencies (called in index-light)\r
90735Root._configure = function(Type_, parse_, common_) {\r
90736 Type = Type_;\r
90737 parse = parse_;\r
90738 common = common_;\r
90739};\r
90740
90741},{"./enum":684,"./field":685,"./namespace":692,"./oneof":694,"./util":706}],699:[function(require,module,exports){
90742"use strict";\r
90743module.exports = {};\r
90744\r
90745/**\r
90746 * Named roots.\r
90747 * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\r
90748 * Can also be used manually to make roots available accross modules.\r
90749 * @name roots\r
90750 * @type {Object.<string,Root>}\r
90751 * @example\r
90752 * // pbjs -r myroot -o compiled.js ...\r
90753 *\r
90754 * // in another module:\r
90755 * require("./compiled.js");\r
90756 *\r
90757 * // in any subsequent module:\r
90758 * var root = protobuf.roots["myroot"];\r
90759 */\r
90760
90761},{}],700:[function(require,module,exports){
90762"use strict";\r
90763\r
90764/**\r
90765 * Streaming RPC helpers.\r
90766 * @namespace\r
90767 */\r
90768var rpc = exports;\r
90769\r
90770/**\r
90771 * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\r
90772 * @typedef RPCImpl\r
90773 * @type {function}\r
90774 * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called\r
90775 * @param {Uint8Array} requestData Request data\r
90776 * @param {RPCImplCallback} callback Callback function\r
90777 * @returns {undefined}\r
90778 * @example\r
90779 * function rpcImpl(method, requestData, callback) {\r
90780 * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code\r
90781 * throw Error("no such method");\r
90782 * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\r
90783 * callback(err, responseData);\r
90784 * });\r
90785 * }\r
90786 */\r
90787\r
90788/**\r
90789 * Node-style callback as used by {@link RPCImpl}.\r
90790 * @typedef RPCImplCallback\r
90791 * @type {function}\r
90792 * @param {Error|null} error Error, if any, otherwise `null`\r
90793 * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\r
90794 * @returns {undefined}\r
90795 */\r
90796\r
90797rpc.Service = require("./rpc/service");\r
90798
90799},{"./rpc/service":701}],701:[function(require,module,exports){
90800"use strict";\r
90801module.exports = Service;\r
90802\r
90803var util = require("../util/minimal");\r
90804\r
90805// Extends EventEmitter\r
90806(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\r
90807\r
90808/**\r
90809 * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\r
90810 *\r
90811 * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\r
90812 * @typedef rpc.ServiceMethodCallback\r
90813 * @template TRes extends Message<TRes>\r
90814 * @type {function}\r
90815 * @param {Error|null} error Error, if any\r
90816 * @param {TRes} [response] Response message\r
90817 * @returns {undefined}\r
90818 */\r
90819\r
90820/**\r
90821 * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\r
90822 * @typedef rpc.ServiceMethod\r
90823 * @template TReq extends Message<TReq>\r
90824 * @template TRes extends Message<TRes>\r
90825 * @type {function}\r
90826 * @param {TReq|Properties<TReq>} request Request message or plain object\r
90827 * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message\r
90828 * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`\r
90829 */\r
90830\r
90831/**\r
90832 * Constructs a new RPC service instance.\r
90833 * @classdesc An RPC service as returned by {@link Service#create}.\r
90834 * @exports rpc.Service\r
90835 * @extends util.EventEmitter\r
90836 * @constructor\r
90837 * @param {RPCImpl} rpcImpl RPC implementation\r
90838 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\r
90839 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\r
90840 */\r
90841function Service(rpcImpl, requestDelimited, responseDelimited) {\r
90842\r
90843 if (typeof rpcImpl !== "function")\r
90844 throw TypeError("rpcImpl must be a function");\r
90845\r
90846 util.EventEmitter.call(this);\r
90847\r
90848 /**\r
90849 * RPC implementation. Becomes `null` once the service is ended.\r
90850 * @type {RPCImpl|null}\r
90851 */\r
90852 this.rpcImpl = rpcImpl;\r
90853\r
90854 /**\r
90855 * Whether requests are length-delimited.\r
90856 * @type {boolean}\r
90857 */\r
90858 this.requestDelimited = Boolean(requestDelimited);\r
90859\r
90860 /**\r
90861 * Whether responses are length-delimited.\r
90862 * @type {boolean}\r
90863 */\r
90864 this.responseDelimited = Boolean(responseDelimited);\r
90865}\r
90866\r
90867/**\r
90868 * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\r
90869 * @param {Method|rpc.ServiceMethod<TReq,TRes>} method Reflected or static method\r
90870 * @param {Constructor<TReq>} requestCtor Request constructor\r
90871 * @param {Constructor<TRes>} responseCtor Response constructor\r
90872 * @param {TReq|Properties<TReq>} request Request message or plain object\r
90873 * @param {rpc.ServiceMethodCallback<TRes>} callback Service callback\r
90874 * @returns {undefined}\r
90875 * @template TReq extends Message<TReq>\r
90876 * @template TRes extends Message<TRes>\r
90877 */\r
90878Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\r
90879\r
90880 if (!request)\r
90881 throw TypeError("request must be specified");\r
90882\r
90883 var self = this;\r
90884 if (!callback)\r
90885 return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\r
90886\r
90887 if (!self.rpcImpl) {\r
90888 setTimeout(function() { callback(Error("already ended")); }, 0);\r
90889 return undefined;\r
90890 }\r
90891\r
90892 try {\r
90893 return self.rpcImpl(\r
90894 method,\r
90895 requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),\r
90896 function rpcCallback(err, response) {\r
90897\r
90898 if (err) {\r
90899 self.emit("error", err, method);\r
90900 return callback(err);\r
90901 }\r
90902\r
90903 if (response === null) {\r
90904 self.end(/* endedByRPC */ true);\r
90905 return undefined;\r
90906 }\r
90907\r
90908 if (!(response instanceof responseCtor)) {\r
90909 try {\r
90910 response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response);\r
90911 } catch (err) {\r
90912 self.emit("error", err, method);\r
90913 return callback(err);\r
90914 }\r
90915 }\r
90916\r
90917 self.emit("data", response, method);\r
90918 return callback(null, response);\r
90919 }\r
90920 );\r
90921 } catch (err) {\r
90922 self.emit("error", err, method);\r
90923 setTimeout(function() { callback(err); }, 0);\r
90924 return undefined;\r
90925 }\r
90926};\r
90927\r
90928/**\r
90929 * Ends this service and emits the `end` event.\r
90930 * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\r
90931 * @returns {rpc.Service} `this`\r
90932 */\r
90933Service.prototype.end = function end(endedByRPC) {\r
90934 if (this.rpcImpl) {\r
90935 if (!endedByRPC) // signal end to rpcImpl\r
90936 this.rpcImpl(null, null, null);\r
90937 this.rpcImpl = null;\r
90938 this.emit("end").off();\r
90939 }\r
90940 return this;\r
90941};\r
90942
90943},{"../util/minimal":708}],702:[function(require,module,exports){
90944"use strict";\r
90945module.exports = Service;\r
90946\r
90947// extends Namespace\r
90948var Namespace = require("./namespace");\r
90949((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service";\r
90950\r
90951var Method = require("./method"),\r
90952 util = require("./util"),\r
90953 rpc = require("./rpc");\r
90954\r
90955/**\r
90956 * Constructs a new service instance.\r
90957 * @classdesc Reflected service.\r
90958 * @extends NamespaceBase\r
90959 * @constructor\r
90960 * @param {string} name Service name\r
90961 * @param {Object.<string,*>} [options] Service options\r
90962 * @throws {TypeError} If arguments are invalid\r
90963 */\r
90964function Service(name, options) {\r
90965 Namespace.call(this, name, options);\r
90966\r
90967 /**\r
90968 * Service methods.\r
90969 * @type {Object.<string,Method>}\r
90970 */\r
90971 this.methods = {}; // toJSON, marker\r
90972\r
90973 /**\r
90974 * Cached methods as an array.\r
90975 * @type {Method[]|null}\r
90976 * @private\r
90977 */\r
90978 this._methodsArray = null;\r
90979}\r
90980\r
90981/**\r
90982 * Service descriptor.\r
90983 * @interface IService\r
90984 * @extends INamespace\r
90985 * @property {Object.<string,IMethod>} methods Method descriptors\r
90986 */\r
90987\r
90988/**\r
90989 * Constructs a service from a service descriptor.\r
90990 * @param {string} name Service name\r
90991 * @param {IService} json Service descriptor\r
90992 * @returns {Service} Created service\r
90993 * @throws {TypeError} If arguments are invalid\r
90994 */\r
90995Service.fromJSON = function fromJSON(name, json) {\r
90996 var service = new Service(name, json.options);\r
90997 /* istanbul ignore else */\r
90998 if (json.methods)\r
90999 for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\r
91000 service.add(Method.fromJSON(names[i], json.methods[names[i]]));\r
91001 if (json.nested)\r
91002 service.addJSON(json.nested);\r
91003 service.comment = json.comment;\r
91004 return service;\r
91005};\r
91006\r
91007/**\r
91008 * Converts this service to a service descriptor.\r
91009 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
91010 * @returns {IService} Service descriptor\r
91011 */\r
91012Service.prototype.toJSON = function toJSON(toJSONOptions) {\r
91013 var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\r
91014 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
91015 return util.toObject([\r
91016 "options" , inherited && inherited.options || undefined,\r
91017 "methods" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\r
91018 "nested" , inherited && inherited.nested || undefined,\r
91019 "comment" , keepComments ? this.comment : undefined\r
91020 ]);\r
91021};\r
91022\r
91023/**\r
91024 * Methods of this service as an array for iteration.\r
91025 * @name Service#methodsArray\r
91026 * @type {Method[]}\r
91027 * @readonly\r
91028 */\r
91029Object.defineProperty(Service.prototype, "methodsArray", {\r
91030 get: function() {\r
91031 return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\r
91032 }\r
91033});\r
91034\r
91035function clearCache(service) {\r
91036 service._methodsArray = null;\r
91037 return service;\r
91038}\r
91039\r
91040/**\r
91041 * @override\r
91042 */\r
91043Service.prototype.get = function get(name) {\r
91044 return this.methods[name]\r
91045 || Namespace.prototype.get.call(this, name);\r
91046};\r
91047\r
91048/**\r
91049 * @override\r
91050 */\r
91051Service.prototype.resolveAll = function resolveAll() {\r
91052 var methods = this.methodsArray;\r
91053 for (var i = 0; i < methods.length; ++i)\r
91054 methods[i].resolve();\r
91055 return Namespace.prototype.resolve.call(this);\r
91056};\r
91057\r
91058/**\r
91059 * @override\r
91060 */\r
91061Service.prototype.add = function add(object) {\r
91062\r
91063 /* istanbul ignore if */\r
91064 if (this.get(object.name))\r
91065 throw Error("duplicate name '" + object.name + "' in " + this);\r
91066\r
91067 if (object instanceof Method) {\r
91068 this.methods[object.name] = object;\r
91069 object.parent = this;\r
91070 return clearCache(this);\r
91071 }\r
91072 return Namespace.prototype.add.call(this, object);\r
91073};\r
91074\r
91075/**\r
91076 * @override\r
91077 */\r
91078Service.prototype.remove = function remove(object) {\r
91079 if (object instanceof Method) {\r
91080\r
91081 /* istanbul ignore if */\r
91082 if (this.methods[object.name] !== object)\r
91083 throw Error(object + " is not a member of " + this);\r
91084\r
91085 delete this.methods[object.name];\r
91086 object.parent = null;\r
91087 return clearCache(this);\r
91088 }\r
91089 return Namespace.prototype.remove.call(this, object);\r
91090};\r
91091\r
91092/**\r
91093 * Creates a runtime service using the specified rpc implementation.\r
91094 * @param {RPCImpl} rpcImpl RPC implementation\r
91095 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\r
91096 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\r
91097 * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\r
91098 */\r
91099Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\r
91100 var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\r
91101 for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\r
91102 var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");\r
91103 rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({\r
91104 m: method,\r
91105 q: method.resolvedRequestType.ctor,\r
91106 s: method.resolvedResponseType.ctor\r
91107 });\r
91108 }\r
91109 return rpcService;\r
91110};\r
91111
91112},{"./method":691,"./namespace":692,"./rpc":700,"./util":706}],703:[function(require,module,exports){
91113"use strict";\r
91114module.exports = tokenize;\r
91115\r
91116var delimRe = /[\s{}=;:[\],'"()<>]/g,\r
91117 stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,\r
91118 stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g;\r
91119\r
91120var setCommentRe = /^ *[*/]+ */,\r
91121 setCommentAltRe = /^\s*\*?\/*/,\r
91122 setCommentSplitRe = /\n/g,\r
91123 whitespaceRe = /\s/,\r
91124 unescapeRe = /\\(.?)/g;\r
91125\r
91126var unescapeMap = {\r
91127 "0": "\0",\r
91128 "r": "\r",\r
91129 "n": "\n",\r
91130 "t": "\t"\r
91131};\r
91132\r
91133/**\r
91134 * Unescapes a string.\r
91135 * @param {string} str String to unescape\r
91136 * @returns {string} Unescaped string\r
91137 * @property {Object.<string,string>} map Special characters map\r
91138 * @memberof tokenize\r
91139 */\r
91140function unescape(str) {\r
91141 return str.replace(unescapeRe, function($0, $1) {\r
91142 switch ($1) {\r
91143 case "\\":\r
91144 case "":\r
91145 return $1;\r
91146 default:\r
91147 return unescapeMap[$1] || "";\r
91148 }\r
91149 });\r
91150}\r
91151\r
91152tokenize.unescape = unescape;\r
91153\r
91154/**\r
91155 * Gets the next token and advances.\r
91156 * @typedef TokenizerHandleNext\r
91157 * @type {function}\r
91158 * @returns {string|null} Next token or `null` on eof\r
91159 */\r
91160\r
91161/**\r
91162 * Peeks for the next token.\r
91163 * @typedef TokenizerHandlePeek\r
91164 * @type {function}\r
91165 * @returns {string|null} Next token or `null` on eof\r
91166 */\r
91167\r
91168/**\r
91169 * Pushes a token back to the stack.\r
91170 * @typedef TokenizerHandlePush\r
91171 * @type {function}\r
91172 * @param {string} token Token\r
91173 * @returns {undefined}\r
91174 */\r
91175\r
91176/**\r
91177 * Skips the next token.\r
91178 * @typedef TokenizerHandleSkip\r
91179 * @type {function}\r
91180 * @param {string} expected Expected token\r
91181 * @param {boolean} [optional=false] If optional\r
91182 * @returns {boolean} Whether the token matched\r
91183 * @throws {Error} If the token didn't match and is not optional\r
91184 */\r
91185\r
91186/**\r
91187 * Gets the comment on the previous line or, alternatively, the line comment on the specified line.\r
91188 * @typedef TokenizerHandleCmnt\r
91189 * @type {function}\r
91190 * @param {number} [line] Line number\r
91191 * @returns {string|null} Comment text or `null` if none\r
91192 */\r
91193\r
91194/**\r
91195 * Handle object returned from {@link tokenize}.\r
91196 * @interface ITokenizerHandle\r
91197 * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof)\r
91198 * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof)\r
91199 * @property {TokenizerHandlePush} push Pushes a token back to the stack\r
91200 * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws\r
91201 * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any\r
91202 * @property {number} line Current line number\r
91203 */\r
91204\r
91205/**\r
91206 * Tokenizes the given .proto source and returns an object with useful utility functions.\r
91207 * @param {string} source Source contents\r
91208 * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode.\r
91209 * @returns {ITokenizerHandle} Tokenizer handle\r
91210 */\r
91211function tokenize(source, alternateCommentMode) {\r
91212 /* eslint-disable callback-return */\r
91213 source = source.toString();\r
91214\r
91215 var offset = 0,\r
91216 length = source.length,\r
91217 line = 1,\r
91218 commentType = null,\r
91219 commentText = null,\r
91220 commentLine = 0,\r
91221 commentLineEmpty = false;\r
91222\r
91223 var stack = [];\r
91224\r
91225 var stringDelim = null;\r
91226\r
91227 /* istanbul ignore next */\r
91228 /**\r
91229 * Creates an error for illegal syntax.\r
91230 * @param {string} subject Subject\r
91231 * @returns {Error} Error created\r
91232 * @inner\r
91233 */\r
91234 function illegal(subject) {\r
91235 return Error("illegal " + subject + " (line " + line + ")");\r
91236 }\r
91237\r
91238 /**\r
91239 * Reads a string till its end.\r
91240 * @returns {string} String read\r
91241 * @inner\r
91242 */\r
91243 function readString() {\r
91244 var re = stringDelim === "'" ? stringSingleRe : stringDoubleRe;\r
91245 re.lastIndex = offset - 1;\r
91246 var match = re.exec(source);\r
91247 if (!match)\r
91248 throw illegal("string");\r
91249 offset = re.lastIndex;\r
91250 push(stringDelim);\r
91251 stringDelim = null;\r
91252 return unescape(match[1]);\r
91253 }\r
91254\r
91255 /**\r
91256 * Gets the character at `pos` within the source.\r
91257 * @param {number} pos Position\r
91258 * @returns {string} Character\r
91259 * @inner\r
91260 */\r
91261 function charAt(pos) {\r
91262 return source.charAt(pos);\r
91263 }\r
91264\r
91265 /**\r
91266 * Sets the current comment text.\r
91267 * @param {number} start Start offset\r
91268 * @param {number} end End offset\r
91269 * @returns {undefined}\r
91270 * @inner\r
91271 */\r
91272 function setComment(start, end) {\r
91273 commentType = source.charAt(start++);\r
91274 commentLine = line;\r
91275 commentLineEmpty = false;\r
91276 var lookback;\r
91277 if (alternateCommentMode) {\r
91278 lookback = 2; // alternate comment parsing: "//" or "/*"\r
91279 } else {\r
91280 lookback = 3; // "///" or "/**"\r
91281 }\r
91282 var commentOffset = start - lookback,\r
91283 c;\r
91284 do {\r
91285 if (--commentOffset < 0 ||\r
91286 (c = source.charAt(commentOffset)) === "\n") {\r
91287 commentLineEmpty = true;\r
91288 break;\r
91289 }\r
91290 } while (c === " " || c === "\t");\r
91291 var lines = source\r
91292 .substring(start, end)\r
91293 .split(setCommentSplitRe);\r
91294 for (var i = 0; i < lines.length; ++i)\r
91295 lines[i] = lines[i]\r
91296 .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "")\r
91297 .trim();\r
91298 commentText = lines\r
91299 .join("\n")\r
91300 .trim();\r
91301 }\r
91302\r
91303 function isDoubleSlashCommentLine(startOffset) {\r
91304 var endOffset = findEndOfLine(startOffset);\r
91305\r
91306 // see if remaining line matches comment pattern\r
91307 var lineText = source.substring(startOffset, endOffset);\r
91308 // look for 1 or 2 slashes since startOffset would already point past\r
91309 // the first slash that started the comment.\r
91310 var isComment = /^\s*\/{1,2}/.test(lineText);\r
91311 return isComment;\r
91312 }\r
91313\r
91314 function findEndOfLine(cursor) {\r
91315 // find end of cursor's line\r
91316 var endOffset = cursor;\r
91317 while (endOffset < length && charAt(endOffset) !== "\n") {\r
91318 endOffset++;\r
91319 }\r
91320 return endOffset;\r
91321 }\r
91322\r
91323 /**\r
91324 * Obtains the next token.\r
91325 * @returns {string|null} Next token or `null` on eof\r
91326 * @inner\r
91327 */\r
91328 function next() {\r
91329 if (stack.length > 0)\r
91330 return stack.shift();\r
91331 if (stringDelim)\r
91332 return readString();\r
91333 var repeat,\r
91334 prev,\r
91335 curr,\r
91336 start,\r
91337 isDoc;\r
91338 do {\r
91339 if (offset === length)\r
91340 return null;\r
91341 repeat = false;\r
91342 while (whitespaceRe.test(curr = charAt(offset))) {\r
91343 if (curr === "\n")\r
91344 ++line;\r
91345 if (++offset === length)\r
91346 return null;\r
91347 }\r
91348\r
91349 if (charAt(offset) === "/") {\r
91350 if (++offset === length) {\r
91351 throw illegal("comment");\r
91352 }\r
91353 if (charAt(offset) === "/") { // Line\r
91354 if (!alternateCommentMode) {\r
91355 // check for triple-slash comment\r
91356 isDoc = charAt(start = offset + 1) === "/";\r
91357\r
91358 while (charAt(++offset) !== "\n") {\r
91359 if (offset === length) {\r
91360 return null;\r
91361 }\r
91362 }\r
91363 ++offset;\r
91364 if (isDoc) {\r
91365 setComment(start, offset - 1);\r
91366 }\r
91367 ++line;\r
91368 repeat = true;\r
91369 } else {\r
91370 // check for double-slash comments, consolidating consecutive lines\r
91371 start = offset;\r
91372 isDoc = false;\r
91373 if (isDoubleSlashCommentLine(offset)) {\r
91374 isDoc = true;\r
91375 do {\r
91376 offset = findEndOfLine(offset);\r
91377 if (offset === length) {\r
91378 break;\r
91379 }\r
91380 offset++;\r
91381 } while (isDoubleSlashCommentLine(offset));\r
91382 } else {\r
91383 offset = Math.min(length, findEndOfLine(offset) + 1);\r
91384 }\r
91385 if (isDoc) {\r
91386 setComment(start, offset);\r
91387 }\r
91388 line++;\r
91389 repeat = true;\r
91390 }\r
91391 } else if ((curr = charAt(offset)) === "*") { /* Block */\r
91392 // check for /** (regular comment mode) or /* (alternate comment mode)\r
91393 start = offset + 1;\r
91394 isDoc = alternateCommentMode || charAt(start) === "*";\r
91395 do {\r
91396 if (curr === "\n") {\r
91397 ++line;\r
91398 }\r
91399 if (++offset === length) {\r
91400 throw illegal("comment");\r
91401 }\r
91402 prev = curr;\r
91403 curr = charAt(offset);\r
91404 } while (prev !== "*" || curr !== "/");\r
91405 ++offset;\r
91406 if (isDoc) {\r
91407 setComment(start, offset - 2);\r
91408 }\r
91409 repeat = true;\r
91410 } else {\r
91411 return "/";\r
91412 }\r
91413 }\r
91414 } while (repeat);\r
91415\r
91416 // offset !== length if we got here\r
91417\r
91418 var end = offset;\r
91419 delimRe.lastIndex = 0;\r
91420 var delim = delimRe.test(charAt(end++));\r
91421 if (!delim)\r
91422 while (end < length && !delimRe.test(charAt(end)))\r
91423 ++end;\r
91424 var token = source.substring(offset, offset = end);\r
91425 if (token === "\"" || token === "'")\r
91426 stringDelim = token;\r
91427 return token;\r
91428 }\r
91429\r
91430 /**\r
91431 * Pushes a token back to the stack.\r
91432 * @param {string} token Token\r
91433 * @returns {undefined}\r
91434 * @inner\r
91435 */\r
91436 function push(token) {\r
91437 stack.push(token);\r
91438 }\r
91439\r
91440 /**\r
91441 * Peeks for the next token.\r
91442 * @returns {string|null} Token or `null` on eof\r
91443 * @inner\r
91444 */\r
91445 function peek() {\r
91446 if (!stack.length) {\r
91447 var token = next();\r
91448 if (token === null)\r
91449 return null;\r
91450 push(token);\r
91451 }\r
91452 return stack[0];\r
91453 }\r
91454\r
91455 /**\r
91456 * Skips a token.\r
91457 * @param {string} expected Expected token\r
91458 * @param {boolean} [optional=false] Whether the token is optional\r
91459 * @returns {boolean} `true` when skipped, `false` if not\r
91460 * @throws {Error} When a required token is not present\r
91461 * @inner\r
91462 */\r
91463 function skip(expected, optional) {\r
91464 var actual = peek(),\r
91465 equals = actual === expected;\r
91466 if (equals) {\r
91467 next();\r
91468 return true;\r
91469 }\r
91470 if (!optional)\r
91471 throw illegal("token '" + actual + "', '" + expected + "' expected");\r
91472 return false;\r
91473 }\r
91474\r
91475 /**\r
91476 * Gets a comment.\r
91477 * @param {number} [trailingLine] Line number if looking for a trailing comment\r
91478 * @returns {string|null} Comment text\r
91479 * @inner\r
91480 */\r
91481 function cmnt(trailingLine) {\r
91482 var ret = null;\r
91483 if (trailingLine === undefined) {\r
91484 if (commentLine === line - 1 && (alternateCommentMode || commentType === "*" || commentLineEmpty)) {\r
91485 ret = commentText;\r
91486 }\r
91487 } else {\r
91488 /* istanbul ignore else */\r
91489 if (commentLine < trailingLine) {\r
91490 peek();\r
91491 }\r
91492 if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === "/")) {\r
91493 ret = commentText;\r
91494 }\r
91495 }\r
91496 return ret;\r
91497 }\r
91498\r
91499 return Object.defineProperty({\r
91500 next: next,\r
91501 peek: peek,\r
91502 push: push,\r
91503 skip: skip,\r
91504 cmnt: cmnt\r
91505 }, "line", {\r
91506 get: function() { return line; }\r
91507 });\r
91508 /* eslint-enable callback-return */\r
91509}\r
91510
91511},{}],704:[function(require,module,exports){
91512"use strict";\r
91513module.exports = Type;\r
91514\r
91515// extends Namespace\r
91516var Namespace = require("./namespace");\r
91517((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type";\r
91518\r
91519var Enum = require("./enum"),\r
91520 OneOf = require("./oneof"),\r
91521 Field = require("./field"),\r
91522 MapField = require("./mapfield"),\r
91523 Service = require("./service"),\r
91524 Message = require("./message"),\r
91525 Reader = require("./reader"),\r
91526 Writer = require("./writer"),\r
91527 util = require("./util"),\r
91528 encoder = require("./encoder"),\r
91529 decoder = require("./decoder"),\r
91530 verifier = require("./verifier"),\r
91531 converter = require("./converter"),\r
91532 wrappers = require("./wrappers");\r
91533\r
91534/**\r
91535 * Constructs a new reflected message type instance.\r
91536 * @classdesc Reflected message type.\r
91537 * @extends NamespaceBase\r
91538 * @constructor\r
91539 * @param {string} name Message name\r
91540 * @param {Object.<string,*>} [options] Declared options\r
91541 */\r
91542function Type(name, options) {\r
91543 Namespace.call(this, name, options);\r
91544\r
91545 /**\r
91546 * Message fields.\r
91547 * @type {Object.<string,Field>}\r
91548 */\r
91549 this.fields = {}; // toJSON, marker\r
91550\r
91551 /**\r
91552 * Oneofs declared within this namespace, if any.\r
91553 * @type {Object.<string,OneOf>}\r
91554 */\r
91555 this.oneofs = undefined; // toJSON\r
91556\r
91557 /**\r
91558 * Extension ranges, if any.\r
91559 * @type {number[][]}\r
91560 */\r
91561 this.extensions = undefined; // toJSON\r
91562\r
91563 /**\r
91564 * Reserved ranges, if any.\r
91565 * @type {Array.<number[]|string>}\r
91566 */\r
91567 this.reserved = undefined; // toJSON\r
91568\r
91569 /*?\r
91570 * Whether this type is a legacy group.\r
91571 * @type {boolean|undefined}\r
91572 */\r
91573 this.group = undefined; // toJSON\r
91574\r
91575 /**\r
91576 * Cached fields by id.\r
91577 * @type {Object.<number,Field>|null}\r
91578 * @private\r
91579 */\r
91580 this._fieldsById = null;\r
91581\r
91582 /**\r
91583 * Cached fields as an array.\r
91584 * @type {Field[]|null}\r
91585 * @private\r
91586 */\r
91587 this._fieldsArray = null;\r
91588\r
91589 /**\r
91590 * Cached oneofs as an array.\r
91591 * @type {OneOf[]|null}\r
91592 * @private\r
91593 */\r
91594 this._oneofsArray = null;\r
91595\r
91596 /**\r
91597 * Cached constructor.\r
91598 * @type {Constructor<{}>}\r
91599 * @private\r
91600 */\r
91601 this._ctor = null;\r
91602}\r
91603\r
91604Object.defineProperties(Type.prototype, {\r
91605\r
91606 /**\r
91607 * Message fields by id.\r
91608 * @name Type#fieldsById\r
91609 * @type {Object.<number,Field>}\r
91610 * @readonly\r
91611 */\r
91612 fieldsById: {\r
91613 get: function() {\r
91614\r
91615 /* istanbul ignore if */\r
91616 if (this._fieldsById)\r
91617 return this._fieldsById;\r
91618\r
91619 this._fieldsById = {};\r
91620 for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\r
91621 var field = this.fields[names[i]],\r
91622 id = field.id;\r
91623\r
91624 /* istanbul ignore if */\r
91625 if (this._fieldsById[id])\r
91626 throw Error("duplicate id " + id + " in " + this);\r
91627\r
91628 this._fieldsById[id] = field;\r
91629 }\r
91630 return this._fieldsById;\r
91631 }\r
91632 },\r
91633\r
91634 /**\r
91635 * Fields of this message as an array for iteration.\r
91636 * @name Type#fieldsArray\r
91637 * @type {Field[]}\r
91638 * @readonly\r
91639 */\r
91640 fieldsArray: {\r
91641 get: function() {\r
91642 return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\r
91643 }\r
91644 },\r
91645\r
91646 /**\r
91647 * Oneofs of this message as an array for iteration.\r
91648 * @name Type#oneofsArray\r
91649 * @type {OneOf[]}\r
91650 * @readonly\r
91651 */\r
91652 oneofsArray: {\r
91653 get: function() {\r
91654 return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\r
91655 }\r
91656 },\r
91657\r
91658 /**\r
91659 * The registered constructor, if any registered, otherwise a generic constructor.\r
91660 * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\r
91661 * @name Type#ctor\r
91662 * @type {Constructor<{}>}\r
91663 */\r
91664 ctor: {\r
91665 get: function() {\r
91666 return this._ctor || (this.ctor = Type.generateConstructor(this)());\r
91667 },\r
91668 set: function(ctor) {\r
91669\r
91670 // Ensure proper prototype\r
91671 var prototype = ctor.prototype;\r
91672 if (!(prototype instanceof Message)) {\r
91673 (ctor.prototype = new Message()).constructor = ctor;\r
91674 util.merge(ctor.prototype, prototype);\r
91675 }\r
91676\r
91677 // Classes and messages reference their reflected type\r
91678 ctor.$type = ctor.prototype.$type = this;\r
91679\r
91680 // Mix in static methods\r
91681 util.merge(ctor, Message, true);\r
91682\r
91683 this._ctor = ctor;\r
91684\r
91685 // Messages have non-enumerable default values on their prototype\r
91686 var i = 0;\r
91687 for (; i < /* initializes */ this.fieldsArray.length; ++i)\r
91688 this._fieldsArray[i].resolve(); // ensures a proper value\r
91689\r
91690 // Messages have non-enumerable getters and setters for each virtual oneof field\r
91691 var ctorProperties = {};\r
91692 for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\r
91693 ctorProperties[this._oneofsArray[i].resolve().name] = {\r
91694 get: util.oneOfGetter(this._oneofsArray[i].oneof),\r
91695 set: util.oneOfSetter(this._oneofsArray[i].oneof)\r
91696 };\r
91697 if (i)\r
91698 Object.defineProperties(ctor.prototype, ctorProperties);\r
91699 }\r
91700 }\r
91701});\r
91702\r
91703/**\r
91704 * Generates a constructor function for the specified type.\r
91705 * @param {Type} mtype Message type\r
91706 * @returns {Codegen} Codegen instance\r
91707 */\r
91708Type.generateConstructor = function generateConstructor(mtype) {\r
91709 /* eslint-disable no-unexpected-multiline */\r
91710 var gen = util.codegen(["p"], mtype.name);\r
91711 // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\r
91712 for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\r
91713 if ((field = mtype._fieldsArray[i]).map) gen\r
91714 ("this%s={}", util.safeProp(field.name));\r
91715 else if (field.repeated) gen\r
91716 ("this%s=[]", util.safeProp(field.name));\r
91717 return gen\r
91718 ("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)") // omit undefined or null\r
91719 ("this[ks[i]]=p[ks[i]]");\r
91720 /* eslint-enable no-unexpected-multiline */\r
91721};\r
91722\r
91723function clearCache(type) {\r
91724 type._fieldsById = type._fieldsArray = type._oneofsArray = null;\r
91725 delete type.encode;\r
91726 delete type.decode;\r
91727 delete type.verify;\r
91728 return type;\r
91729}\r
91730\r
91731/**\r
91732 * Message type descriptor.\r
91733 * @interface IType\r
91734 * @extends INamespace\r
91735 * @property {Object.<string,IOneOf>} [oneofs] Oneof descriptors\r
91736 * @property {Object.<string,IField>} fields Field descriptors\r
91737 * @property {number[][]} [extensions] Extension ranges\r
91738 * @property {number[][]} [reserved] Reserved ranges\r
91739 * @property {boolean} [group=false] Whether a legacy group or not\r
91740 */\r
91741\r
91742/**\r
91743 * Creates a message type from a message type descriptor.\r
91744 * @param {string} name Message name\r
91745 * @param {IType} json Message type descriptor\r
91746 * @returns {Type} Created message type\r
91747 */\r
91748Type.fromJSON = function fromJSON(name, json) {\r
91749 var type = new Type(name, json.options);\r
91750 type.extensions = json.extensions;\r
91751 type.reserved = json.reserved;\r
91752 var names = Object.keys(json.fields),\r
91753 i = 0;\r
91754 for (; i < names.length; ++i)\r
91755 type.add(\r
91756 ( typeof json.fields[names[i]].keyType !== "undefined"\r
91757 ? MapField.fromJSON\r
91758 : Field.fromJSON )(names[i], json.fields[names[i]])\r
91759 );\r
91760 if (json.oneofs)\r
91761 for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\r
91762 type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\r
91763 if (json.nested)\r
91764 for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\r
91765 var nested = json.nested[names[i]];\r
91766 type.add( // most to least likely\r
91767 ( nested.id !== undefined\r
91768 ? Field.fromJSON\r
91769 : nested.fields !== undefined\r
91770 ? Type.fromJSON\r
91771 : nested.values !== undefined\r
91772 ? Enum.fromJSON\r
91773 : nested.methods !== undefined\r
91774 ? Service.fromJSON\r
91775 : Namespace.fromJSON )(names[i], nested)\r
91776 );\r
91777 }\r
91778 if (json.extensions && json.extensions.length)\r
91779 type.extensions = json.extensions;\r
91780 if (json.reserved && json.reserved.length)\r
91781 type.reserved = json.reserved;\r
91782 if (json.group)\r
91783 type.group = true;\r
91784 if (json.comment)\r
91785 type.comment = json.comment;\r
91786 return type;\r
91787};\r
91788\r
91789/**\r
91790 * Converts this message type to a message type descriptor.\r
91791 * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r
91792 * @returns {IType} Message type descriptor\r
91793 */\r
91794Type.prototype.toJSON = function toJSON(toJSONOptions) {\r
91795 var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\r
91796 var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r
91797 return util.toObject([\r
91798 "options" , inherited && inherited.options || undefined,\r
91799 "oneofs" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\r
91800 "fields" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\r
91801 "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined,\r
91802 "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined,\r
91803 "group" , this.group || undefined,\r
91804 "nested" , inherited && inherited.nested || undefined,\r
91805 "comment" , keepComments ? this.comment : undefined\r
91806 ]);\r
91807};\r
91808\r
91809/**\r
91810 * @override\r
91811 */\r
91812Type.prototype.resolveAll = function resolveAll() {\r
91813 var fields = this.fieldsArray, i = 0;\r
91814 while (i < fields.length)\r
91815 fields[i++].resolve();\r
91816 var oneofs = this.oneofsArray; i = 0;\r
91817 while (i < oneofs.length)\r
91818 oneofs[i++].resolve();\r
91819 return Namespace.prototype.resolveAll.call(this);\r
91820};\r
91821\r
91822/**\r
91823 * @override\r
91824 */\r
91825Type.prototype.get = function get(name) {\r
91826 return this.fields[name]\r
91827 || this.oneofs && this.oneofs[name]\r
91828 || this.nested && this.nested[name]\r
91829 || null;\r
91830};\r
91831\r
91832/**\r
91833 * Adds a nested object to this type.\r
91834 * @param {ReflectionObject} object Nested object to add\r
91835 * @returns {Type} `this`\r
91836 * @throws {TypeError} If arguments are invalid\r
91837 * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\r
91838 */\r
91839Type.prototype.add = function add(object) {\r
91840\r
91841 if (this.get(object.name))\r
91842 throw Error("duplicate name '" + object.name + "' in " + this);\r
91843\r
91844 if (object instanceof Field && object.extend === undefined) {\r
91845 // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\r
91846 // The root object takes care of adding distinct sister-fields to the respective extended\r
91847 // type instead.\r
91848\r
91849 // avoids calling the getter if not absolutely necessary because it's called quite frequently\r
91850 if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\r
91851 throw Error("duplicate id " + object.id + " in " + this);\r
91852 if (this.isReservedId(object.id))\r
91853 throw Error("id " + object.id + " is reserved in " + this);\r
91854 if (this.isReservedName(object.name))\r
91855 throw Error("name '" + object.name + "' is reserved in " + this);\r
91856\r
91857 if (object.parent)\r
91858 object.parent.remove(object);\r
91859 this.fields[object.name] = object;\r
91860 object.message = this;\r
91861 object.onAdd(this);\r
91862 return clearCache(this);\r
91863 }\r
91864 if (object instanceof OneOf) {\r
91865 if (!this.oneofs)\r
91866 this.oneofs = {};\r
91867 this.oneofs[object.name] = object;\r
91868 object.onAdd(this);\r
91869 return clearCache(this);\r
91870 }\r
91871 return Namespace.prototype.add.call(this, object);\r
91872};\r
91873\r
91874/**\r
91875 * Removes a nested object from this type.\r
91876 * @param {ReflectionObject} object Nested object to remove\r
91877 * @returns {Type} `this`\r
91878 * @throws {TypeError} If arguments are invalid\r
91879 * @throws {Error} If `object` is not a member of this type\r
91880 */\r
91881Type.prototype.remove = function remove(object) {\r
91882 if (object instanceof Field && object.extend === undefined) {\r
91883 // See Type#add for the reason why extension fields are excluded here.\r
91884\r
91885 /* istanbul ignore if */\r
91886 if (!this.fields || this.fields[object.name] !== object)\r
91887 throw Error(object + " is not a member of " + this);\r
91888\r
91889 delete this.fields[object.name];\r
91890 object.parent = null;\r
91891 object.onRemove(this);\r
91892 return clearCache(this);\r
91893 }\r
91894 if (object instanceof OneOf) {\r
91895\r
91896 /* istanbul ignore if */\r
91897 if (!this.oneofs || this.oneofs[object.name] !== object)\r
91898 throw Error(object + " is not a member of " + this);\r
91899\r
91900 delete this.oneofs[object.name];\r
91901 object.parent = null;\r
91902 object.onRemove(this);\r
91903 return clearCache(this);\r
91904 }\r
91905 return Namespace.prototype.remove.call(this, object);\r
91906};\r
91907\r
91908/**\r
91909 * Tests if the specified id is reserved.\r
91910 * @param {number} id Id to test\r
91911 * @returns {boolean} `true` if reserved, otherwise `false`\r
91912 */\r
91913Type.prototype.isReservedId = function isReservedId(id) {\r
91914 return Namespace.isReservedId(this.reserved, id);\r
91915};\r
91916\r
91917/**\r
91918 * Tests if the specified name is reserved.\r
91919 * @param {string} name Name to test\r
91920 * @returns {boolean} `true` if reserved, otherwise `false`\r
91921 */\r
91922Type.prototype.isReservedName = function isReservedName(name) {\r
91923 return Namespace.isReservedName(this.reserved, name);\r
91924};\r
91925\r
91926/**\r
91927 * Creates a new message of this type using the specified properties.\r
91928 * @param {Object.<string,*>} [properties] Properties to set\r
91929 * @returns {Message<{}>} Message instance\r
91930 */\r
91931Type.prototype.create = function create(properties) {\r
91932 return new this.ctor(properties);\r
91933};\r
91934\r
91935/**\r
91936 * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\r
91937 * @returns {Type} `this`\r
91938 */\r
91939Type.prototype.setup = function setup() {\r
91940 // Sets up everything at once so that the prototype chain does not have to be re-evaluated\r
91941 // multiple times (V8, soft-deopt prototype-check).\r
91942\r
91943 var fullName = this.fullName,\r
91944 types = [];\r
91945 for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\r
91946 types.push(this._fieldsArray[i].resolve().resolvedType);\r
91947\r
91948 // Replace setup methods with type-specific generated functions\r
91949 this.encode = encoder(this)({\r
91950 Writer : Writer,\r
91951 types : types,\r
91952 util : util\r
91953 });\r
91954 this.decode = decoder(this)({\r
91955 Reader : Reader,\r
91956 types : types,\r
91957 util : util\r
91958 });\r
91959 this.verify = verifier(this)({\r
91960 types : types,\r
91961 util : util\r
91962 });\r
91963 this.fromObject = converter.fromObject(this)({\r
91964 types : types,\r
91965 util : util\r
91966 });\r
91967 this.toObject = converter.toObject(this)({\r
91968 types : types,\r
91969 util : util\r
91970 });\r
91971\r
91972 // Inject custom wrappers for common types\r
91973 var wrapper = wrappers[fullName];\r
91974 if (wrapper) {\r
91975 var originalThis = Object.create(this);\r
91976 // if (wrapper.fromObject) {\r
91977 originalThis.fromObject = this.fromObject;\r
91978 this.fromObject = wrapper.fromObject.bind(originalThis);\r
91979 // }\r
91980 // if (wrapper.toObject) {\r
91981 originalThis.toObject = this.toObject;\r
91982 this.toObject = wrapper.toObject.bind(originalThis);\r
91983 // }\r
91984 }\r
91985\r
91986 return this;\r
91987};\r
91988\r
91989/**\r
91990 * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\r
91991 * @param {Message<{}>|Object.<string,*>} message Message instance or plain object\r
91992 * @param {Writer} [writer] Writer to encode to\r
91993 * @returns {Writer} writer\r
91994 */\r
91995Type.prototype.encode = function encode_setup(message, writer) {\r
91996 return this.setup().encode(message, writer); // overrides this method\r
91997};\r
91998\r
91999/**\r
92000 * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\r
92001 * @param {Message<{}>|Object.<string,*>} message Message instance or plain object\r
92002 * @param {Writer} [writer] Writer to encode to\r
92003 * @returns {Writer} writer\r
92004 */\r
92005Type.prototype.encodeDelimited = function encodeDelimited(message, writer) {\r
92006 return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\r
92007};\r
92008\r
92009/**\r
92010 * Decodes a message of this type.\r
92011 * @param {Reader|Uint8Array} reader Reader or buffer to decode from\r
92012 * @param {number} [length] Length of the message, if known beforehand\r
92013 * @returns {Message<{}>} Decoded message\r
92014 * @throws {Error} If the payload is not a reader or valid buffer\r
92015 * @throws {util.ProtocolError<{}>} If required fields are missing\r
92016 */\r
92017Type.prototype.decode = function decode_setup(reader, length) {\r
92018 return this.setup().decode(reader, length); // overrides this method\r
92019};\r
92020\r
92021/**\r
92022 * Decodes a message of this type preceeded by its byte length as a varint.\r
92023 * @param {Reader|Uint8Array} reader Reader or buffer to decode from\r
92024 * @returns {Message<{}>} Decoded message\r
92025 * @throws {Error} If the payload is not a reader or valid buffer\r
92026 * @throws {util.ProtocolError} If required fields are missing\r
92027 */\r
92028Type.prototype.decodeDelimited = function decodeDelimited(reader) {\r
92029 if (!(reader instanceof Reader))\r
92030 reader = Reader.create(reader);\r
92031 return this.decode(reader, reader.uint32());\r
92032};\r
92033\r
92034/**\r
92035 * Verifies that field values are valid and that required fields are present.\r
92036 * @param {Object.<string,*>} message Plain object to verify\r
92037 * @returns {null|string} `null` if valid, otherwise the reason why it is not\r
92038 */\r
92039Type.prototype.verify = function verify_setup(message) {\r
92040 return this.setup().verify(message); // overrides this method\r
92041};\r
92042\r
92043/**\r
92044 * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\r
92045 * @param {Object.<string,*>} object Plain object to convert\r
92046 * @returns {Message<{}>} Message instance\r
92047 */\r
92048Type.prototype.fromObject = function fromObject(object) {\r
92049 return this.setup().fromObject(object);\r
92050};\r
92051\r
92052/**\r
92053 * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\r
92054 * @interface IConversionOptions\r
92055 * @property {Function} [longs] Long conversion type.\r
92056 * Valid values are `String` and `Number` (the global types).\r
92057 * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\r
92058 * @property {Function} [enums] Enum value conversion type.\r
92059 * Only valid value is `String` (the global type).\r
92060 * Defaults to copy the present value, which is the numeric id.\r
92061 * @property {Function} [bytes] Bytes value conversion type.\r
92062 * Valid values are `Array` and (a base64 encoded) `String` (the global types).\r
92063 * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\r
92064 * @property {boolean} [defaults=false] Also sets default values on the resulting object\r
92065 * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\r
92066 * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\r
92067 * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\r
92068 * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\r
92069 */\r
92070\r
92071/**\r
92072 * Creates a plain object from a message of this type. Also converts values to other types if specified.\r
92073 * @param {Message<{}>} message Message instance\r
92074 * @param {IConversionOptions} [options] Conversion options\r
92075 * @returns {Object.<string,*>} Plain object\r
92076 */\r
92077Type.prototype.toObject = function toObject(message, options) {\r
92078 return this.setup().toObject(message, options);\r
92079};\r
92080\r
92081/**\r
92082 * Decorator function as returned by {@link Type.d} (TypeScript).\r
92083 * @typedef TypeDecorator\r
92084 * @type {function}\r
92085 * @param {Constructor<T>} target Target constructor\r
92086 * @returns {undefined}\r
92087 * @template T extends Message<T>\r
92088 */\r
92089\r
92090/**\r
92091 * Type decorator (TypeScript).\r
92092 * @param {string} [typeName] Type name, defaults to the constructor's name\r
92093 * @returns {TypeDecorator<T>} Decorator function\r
92094 * @template T extends Message<T>\r
92095 */\r
92096Type.d = function decorateType(typeName) {\r
92097 return function typeDecorator(target) {\r
92098 util.decorateType(target, typeName);\r
92099 };\r
92100};\r
92101
92102},{"./converter":681,"./decoder":682,"./encoder":683,"./enum":684,"./field":685,"./mapfield":689,"./message":690,"./namespace":692,"./oneof":694,"./reader":696,"./service":702,"./util":706,"./verifier":709,"./wrappers":710,"./writer":711}],705:[function(require,module,exports){
92103"use strict";\r
92104\r
92105/**\r
92106 * Common type constants.\r
92107 * @namespace\r
92108 */\r
92109var types = exports;\r
92110\r
92111var util = require("./util");\r
92112\r
92113var s = [\r
92114 "double", // 0\r
92115 "float", // 1\r
92116 "int32", // 2\r
92117 "uint32", // 3\r
92118 "sint32", // 4\r
92119 "fixed32", // 5\r
92120 "sfixed32", // 6\r
92121 "int64", // 7\r
92122 "uint64", // 8\r
92123 "sint64", // 9\r
92124 "fixed64", // 10\r
92125 "sfixed64", // 11\r
92126 "bool", // 12\r
92127 "string", // 13\r
92128 "bytes" // 14\r
92129];\r
92130\r
92131function bake(values, offset) {\r
92132 var i = 0, o = {};\r
92133 offset |= 0;\r
92134 while (i < values.length) o[s[i + offset]] = values[i++];\r
92135 return o;\r
92136}\r
92137\r
92138/**\r
92139 * Basic type wire types.\r
92140 * @type {Object.<string,number>}\r
92141 * @const\r
92142 * @property {number} double=1 Fixed64 wire type\r
92143 * @property {number} float=5 Fixed32 wire type\r
92144 * @property {number} int32=0 Varint wire type\r
92145 * @property {number} uint32=0 Varint wire type\r
92146 * @property {number} sint32=0 Varint wire type\r
92147 * @property {number} fixed32=5 Fixed32 wire type\r
92148 * @property {number} sfixed32=5 Fixed32 wire type\r
92149 * @property {number} int64=0 Varint wire type\r
92150 * @property {number} uint64=0 Varint wire type\r
92151 * @property {number} sint64=0 Varint wire type\r
92152 * @property {number} fixed64=1 Fixed64 wire type\r
92153 * @property {number} sfixed64=1 Fixed64 wire type\r
92154 * @property {number} bool=0 Varint wire type\r
92155 * @property {number} string=2 Ldelim wire type\r
92156 * @property {number} bytes=2 Ldelim wire type\r
92157 */\r
92158types.basic = bake([\r
92159 /* double */ 1,\r
92160 /* float */ 5,\r
92161 /* int32 */ 0,\r
92162 /* uint32 */ 0,\r
92163 /* sint32 */ 0,\r
92164 /* fixed32 */ 5,\r
92165 /* sfixed32 */ 5,\r
92166 /* int64 */ 0,\r
92167 /* uint64 */ 0,\r
92168 /* sint64 */ 0,\r
92169 /* fixed64 */ 1,\r
92170 /* sfixed64 */ 1,\r
92171 /* bool */ 0,\r
92172 /* string */ 2,\r
92173 /* bytes */ 2\r
92174]);\r
92175\r
92176/**\r
92177 * Basic type defaults.\r
92178 * @type {Object.<string,*>}\r
92179 * @const\r
92180 * @property {number} double=0 Double default\r
92181 * @property {number} float=0 Float default\r
92182 * @property {number} int32=0 Int32 default\r
92183 * @property {number} uint32=0 Uint32 default\r
92184 * @property {number} sint32=0 Sint32 default\r
92185 * @property {number} fixed32=0 Fixed32 default\r
92186 * @property {number} sfixed32=0 Sfixed32 default\r
92187 * @property {number} int64=0 Int64 default\r
92188 * @property {number} uint64=0 Uint64 default\r
92189 * @property {number} sint64=0 Sint32 default\r
92190 * @property {number} fixed64=0 Fixed64 default\r
92191 * @property {number} sfixed64=0 Sfixed64 default\r
92192 * @property {boolean} bool=false Bool default\r
92193 * @property {string} string="" String default\r
92194 * @property {Array.<number>} bytes=Array(0) Bytes default\r
92195 * @property {null} message=null Message default\r
92196 */\r
92197types.defaults = bake([\r
92198 /* double */ 0,\r
92199 /* float */ 0,\r
92200 /* int32 */ 0,\r
92201 /* uint32 */ 0,\r
92202 /* sint32 */ 0,\r
92203 /* fixed32 */ 0,\r
92204 /* sfixed32 */ 0,\r
92205 /* int64 */ 0,\r
92206 /* uint64 */ 0,\r
92207 /* sint64 */ 0,\r
92208 /* fixed64 */ 0,\r
92209 /* sfixed64 */ 0,\r
92210 /* bool */ false,\r
92211 /* string */ "",\r
92212 /* bytes */ util.emptyArray,\r
92213 /* message */ null\r
92214]);\r
92215\r
92216/**\r
92217 * Basic long type wire types.\r
92218 * @type {Object.<string,number>}\r
92219 * @const\r
92220 * @property {number} int64=0 Varint wire type\r
92221 * @property {number} uint64=0 Varint wire type\r
92222 * @property {number} sint64=0 Varint wire type\r
92223 * @property {number} fixed64=1 Fixed64 wire type\r
92224 * @property {number} sfixed64=1 Fixed64 wire type\r
92225 */\r
92226types.long = bake([\r
92227 /* int64 */ 0,\r
92228 /* uint64 */ 0,\r
92229 /* sint64 */ 0,\r
92230 /* fixed64 */ 1,\r
92231 /* sfixed64 */ 1\r
92232], 7);\r
92233\r
92234/**\r
92235 * Allowed types for map keys with their associated wire type.\r
92236 * @type {Object.<string,number>}\r
92237 * @const\r
92238 * @property {number} int32=0 Varint wire type\r
92239 * @property {number} uint32=0 Varint wire type\r
92240 * @property {number} sint32=0 Varint wire type\r
92241 * @property {number} fixed32=5 Fixed32 wire type\r
92242 * @property {number} sfixed32=5 Fixed32 wire type\r
92243 * @property {number} int64=0 Varint wire type\r
92244 * @property {number} uint64=0 Varint wire type\r
92245 * @property {number} sint64=0 Varint wire type\r
92246 * @property {number} fixed64=1 Fixed64 wire type\r
92247 * @property {number} sfixed64=1 Fixed64 wire type\r
92248 * @property {number} bool=0 Varint wire type\r
92249 * @property {number} string=2 Ldelim wire type\r
92250 */\r
92251types.mapKey = bake([\r
92252 /* int32 */ 0,\r
92253 /* uint32 */ 0,\r
92254 /* sint32 */ 0,\r
92255 /* fixed32 */ 5,\r
92256 /* sfixed32 */ 5,\r
92257 /* int64 */ 0,\r
92258 /* uint64 */ 0,\r
92259 /* sint64 */ 0,\r
92260 /* fixed64 */ 1,\r
92261 /* sfixed64 */ 1,\r
92262 /* bool */ 0,\r
92263 /* string */ 2\r
92264], 2);\r
92265\r
92266/**\r
92267 * Allowed types for packed repeated fields with their associated wire type.\r
92268 * @type {Object.<string,number>}\r
92269 * @const\r
92270 * @property {number} double=1 Fixed64 wire type\r
92271 * @property {number} float=5 Fixed32 wire type\r
92272 * @property {number} int32=0 Varint wire type\r
92273 * @property {number} uint32=0 Varint wire type\r
92274 * @property {number} sint32=0 Varint wire type\r
92275 * @property {number} fixed32=5 Fixed32 wire type\r
92276 * @property {number} sfixed32=5 Fixed32 wire type\r
92277 * @property {number} int64=0 Varint wire type\r
92278 * @property {number} uint64=0 Varint wire type\r
92279 * @property {number} sint64=0 Varint wire type\r
92280 * @property {number} fixed64=1 Fixed64 wire type\r
92281 * @property {number} sfixed64=1 Fixed64 wire type\r
92282 * @property {number} bool=0 Varint wire type\r
92283 */\r
92284types.packed = bake([\r
92285 /* double */ 1,\r
92286 /* float */ 5,\r
92287 /* int32 */ 0,\r
92288 /* uint32 */ 0,\r
92289 /* sint32 */ 0,\r
92290 /* fixed32 */ 5,\r
92291 /* sfixed32 */ 5,\r
92292 /* int64 */ 0,\r
92293 /* uint64 */ 0,\r
92294 /* sint64 */ 0,\r
92295 /* fixed64 */ 1,\r
92296 /* sfixed64 */ 1,\r
92297 /* bool */ 0\r
92298]);\r
92299
92300},{"./util":706}],706:[function(require,module,exports){
92301"use strict";\r
92302\r
92303/**\r
92304 * Various utility functions.\r
92305 * @namespace\r
92306 */\r
92307var util = module.exports = require("./util/minimal");\r
92308\r
92309var roots = require("./roots");\r
92310\r
92311var Type, // cyclic\r
92312 Enum;\r
92313\r
92314util.codegen = require("@protobufjs/codegen");\r
92315util.fetch = require("@protobufjs/fetch");\r
92316util.path = require("@protobufjs/path");\r
92317\r
92318/**\r
92319 * Node's fs module if available.\r
92320 * @type {Object.<string,*>}\r
92321 */\r
92322util.fs = util.inquire("fs");\r
92323\r
92324/**\r
92325 * Converts an object's values to an array.\r
92326 * @param {Object.<string,*>} object Object to convert\r
92327 * @returns {Array.<*>} Converted array\r
92328 */\r
92329util.toArray = function toArray(object) {\r
92330 if (object) {\r
92331 var keys = Object.keys(object),\r
92332 array = new Array(keys.length),\r
92333 index = 0;\r
92334 while (index < keys.length)\r
92335 array[index] = object[keys[index++]];\r
92336 return array;\r
92337 }\r
92338 return [];\r
92339};\r
92340\r
92341/**\r
92342 * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\r
92343 * @param {Array.<*>} array Array to convert\r
92344 * @returns {Object.<string,*>} Converted object\r
92345 */\r
92346util.toObject = function toObject(array) {\r
92347 var object = {},\r
92348 index = 0;\r
92349 while (index < array.length) {\r
92350 var key = array[index++],\r
92351 val = array[index++];\r
92352 if (val !== undefined)\r
92353 object[key] = val;\r
92354 }\r
92355 return object;\r
92356};\r
92357\r
92358var safePropBackslashRe = /\\/g,\r
92359 safePropQuoteRe = /"/g;\r
92360\r
92361/**\r
92362 * Tests whether the specified name is a reserved word in JS.\r
92363 * @param {string} name Name to test\r
92364 * @returns {boolean} `true` if reserved, otherwise `false`\r
92365 */\r
92366util.isReserved = function isReserved(name) {\r
92367 return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\r
92368};\r
92369\r
92370/**\r
92371 * Returns a safe property accessor for the specified property name.\r
92372 * @param {string} prop Property name\r
92373 * @returns {string} Safe accessor\r
92374 */\r
92375util.safeProp = function safeProp(prop) {\r
92376 if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop))\r
92377 return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]";\r
92378 return "." + prop;\r
92379};\r
92380\r
92381/**\r
92382 * Converts the first character of a string to upper case.\r
92383 * @param {string} str String to convert\r
92384 * @returns {string} Converted string\r
92385 */\r
92386util.ucFirst = function ucFirst(str) {\r
92387 return str.charAt(0).toUpperCase() + str.substring(1);\r
92388};\r
92389\r
92390var camelCaseRe = /_([a-z])/g;\r
92391\r
92392/**\r
92393 * Converts a string to camel case.\r
92394 * @param {string} str String to convert\r
92395 * @returns {string} Converted string\r
92396 */\r
92397util.camelCase = function camelCase(str) {\r
92398 return str.substring(0, 1)\r
92399 + str.substring(1)\r
92400 .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\r
92401};\r
92402\r
92403/**\r
92404 * Compares reflected fields by id.\r
92405 * @param {Field} a First field\r
92406 * @param {Field} b Second field\r
92407 * @returns {number} Comparison value\r
92408 */\r
92409util.compareFieldsById = function compareFieldsById(a, b) {\r
92410 return a.id - b.id;\r
92411};\r
92412\r
92413/**\r
92414 * Decorator helper for types (TypeScript).\r
92415 * @param {Constructor<T>} ctor Constructor function\r
92416 * @param {string} [typeName] Type name, defaults to the constructor's name\r
92417 * @returns {Type} Reflected type\r
92418 * @template T extends Message<T>\r
92419 * @property {Root} root Decorators root\r
92420 */\r
92421util.decorateType = function decorateType(ctor, typeName) {\r
92422\r
92423 /* istanbul ignore if */\r
92424 if (ctor.$type) {\r
92425 if (typeName && ctor.$type.name !== typeName) {\r
92426 util.decorateRoot.remove(ctor.$type);\r
92427 ctor.$type.name = typeName;\r
92428 util.decorateRoot.add(ctor.$type);\r
92429 }\r
92430 return ctor.$type;\r
92431 }\r
92432\r
92433 /* istanbul ignore next */\r
92434 if (!Type)\r
92435 Type = require("./type");\r
92436\r
92437 var type = new Type(typeName || ctor.name);\r
92438 util.decorateRoot.add(type);\r
92439 type.ctor = ctor; // sets up .encode, .decode etc.\r
92440 Object.defineProperty(ctor, "$type", { value: type, enumerable: false });\r
92441 Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false });\r
92442 return type;\r
92443};\r
92444\r
92445var decorateEnumIndex = 0;\r
92446\r
92447/**\r
92448 * Decorator helper for enums (TypeScript).\r
92449 * @param {Object} object Enum object\r
92450 * @returns {Enum} Reflected enum\r
92451 */\r
92452util.decorateEnum = function decorateEnum(object) {\r
92453\r
92454 /* istanbul ignore if */\r
92455 if (object.$type)\r
92456 return object.$type;\r
92457\r
92458 /* istanbul ignore next */\r
92459 if (!Enum)\r
92460 Enum = require("./enum");\r
92461\r
92462 var enm = new Enum("Enum" + decorateEnumIndex++, object);\r
92463 util.decorateRoot.add(enm);\r
92464 Object.defineProperty(object, "$type", { value: enm, enumerable: false });\r
92465 return enm;\r
92466};\r
92467\r
92468/**\r
92469 * Decorator root (TypeScript).\r
92470 * @name util.decorateRoot\r
92471 * @type {Root}\r
92472 * @readonly\r
92473 */\r
92474Object.defineProperty(util, "decorateRoot", {\r
92475 get: function() {\r
92476 return roots["decorated"] || (roots["decorated"] = new (require("./root"))());\r
92477 }\r
92478});\r
92479
92480},{"./enum":684,"./root":698,"./roots":699,"./type":704,"./util/minimal":708,"@protobufjs/codegen":4,"@protobufjs/fetch":6,"@protobufjs/path":9}],707:[function(require,module,exports){
92481"use strict";\r
92482module.exports = LongBits;\r
92483\r
92484var util = require("../util/minimal");\r
92485\r
92486/**\r
92487 * Constructs new long bits.\r
92488 * @classdesc Helper class for working with the low and high bits of a 64 bit value.\r
92489 * @memberof util\r
92490 * @constructor\r
92491 * @param {number} lo Low 32 bits, unsigned\r
92492 * @param {number} hi High 32 bits, unsigned\r
92493 */\r
92494function LongBits(lo, hi) {\r
92495\r
92496 // note that the casts below are theoretically unnecessary as of today, but older statically\r
92497 // generated converter code might still call the ctor with signed 32bits. kept for compat.\r
92498\r
92499 /**\r
92500 * Low bits.\r
92501 * @type {number}\r
92502 */\r
92503 this.lo = lo >>> 0;\r
92504\r
92505 /**\r
92506 * High bits.\r
92507 * @type {number}\r
92508 */\r
92509 this.hi = hi >>> 0;\r
92510}\r
92511\r
92512/**\r
92513 * Zero bits.\r
92514 * @memberof util.LongBits\r
92515 * @type {util.LongBits}\r
92516 */\r
92517var zero = LongBits.zero = new LongBits(0, 0);\r
92518\r
92519zero.toNumber = function() { return 0; };\r
92520zero.zzEncode = zero.zzDecode = function() { return this; };\r
92521zero.length = function() { return 1; };\r
92522\r
92523/**\r
92524 * Zero hash.\r
92525 * @memberof util.LongBits\r
92526 * @type {string}\r
92527 */\r
92528var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";\r
92529\r
92530/**\r
92531 * Constructs new long bits from the specified number.\r
92532 * @param {number} value Value\r
92533 * @returns {util.LongBits} Instance\r
92534 */\r
92535LongBits.fromNumber = function fromNumber(value) {\r
92536 if (value === 0)\r
92537 return zero;\r
92538 var sign = value < 0;\r
92539 if (sign)\r
92540 value = -value;\r
92541 var lo = value >>> 0,\r
92542 hi = (value - lo) / 4294967296 >>> 0;\r
92543 if (sign) {\r
92544 hi = ~hi >>> 0;\r
92545 lo = ~lo >>> 0;\r
92546 if (++lo > 4294967295) {\r
92547 lo = 0;\r
92548 if (++hi > 4294967295)\r
92549 hi = 0;\r
92550 }\r
92551 }\r
92552 return new LongBits(lo, hi);\r
92553};\r
92554\r
92555/**\r
92556 * Constructs new long bits from a number, long or string.\r
92557 * @param {Long|number|string} value Value\r
92558 * @returns {util.LongBits} Instance\r
92559 */\r
92560LongBits.from = function from(value) {\r
92561 if (typeof value === "number")\r
92562 return LongBits.fromNumber(value);\r
92563 if (util.isString(value)) {\r
92564 /* istanbul ignore else */\r
92565 if (util.Long)\r
92566 value = util.Long.fromString(value);\r
92567 else\r
92568 return LongBits.fromNumber(parseInt(value, 10));\r
92569 }\r
92570 return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\r
92571};\r
92572\r
92573/**\r
92574 * Converts this long bits to a possibly unsafe JavaScript number.\r
92575 * @param {boolean} [unsigned=false] Whether unsigned or not\r
92576 * @returns {number} Possibly unsafe number\r
92577 */\r
92578LongBits.prototype.toNumber = function toNumber(unsigned) {\r
92579 if (!unsigned && this.hi >>> 31) {\r
92580 var lo = ~this.lo + 1 >>> 0,\r
92581 hi = ~this.hi >>> 0;\r
92582 if (!lo)\r
92583 hi = hi + 1 >>> 0;\r
92584 return -(lo + hi * 4294967296);\r
92585 }\r
92586 return this.lo + this.hi * 4294967296;\r
92587};\r
92588\r
92589/**\r
92590 * Converts this long bits to a long.\r
92591 * @param {boolean} [unsigned=false] Whether unsigned or not\r
92592 * @returns {Long} Long\r
92593 */\r
92594LongBits.prototype.toLong = function toLong(unsigned) {\r
92595 return util.Long\r
92596 ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\r
92597 /* istanbul ignore next */\r
92598 : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\r
92599};\r
92600\r
92601var charCodeAt = String.prototype.charCodeAt;\r
92602\r
92603/**\r
92604 * Constructs new long bits from the specified 8 characters long hash.\r
92605 * @param {string} hash Hash\r
92606 * @returns {util.LongBits} Bits\r
92607 */\r
92608LongBits.fromHash = function fromHash(hash) {\r
92609 if (hash === zeroHash)\r
92610 return zero;\r
92611 return new LongBits(\r
92612 ( charCodeAt.call(hash, 0)\r
92613 | charCodeAt.call(hash, 1) << 8\r
92614 | charCodeAt.call(hash, 2) << 16\r
92615 | charCodeAt.call(hash, 3) << 24) >>> 0\r
92616 ,\r
92617 ( charCodeAt.call(hash, 4)\r
92618 | charCodeAt.call(hash, 5) << 8\r
92619 | charCodeAt.call(hash, 6) << 16\r
92620 | charCodeAt.call(hash, 7) << 24) >>> 0\r
92621 );\r
92622};\r
92623\r
92624/**\r
92625 * Converts this long bits to a 8 characters long hash.\r
92626 * @returns {string} Hash\r
92627 */\r
92628LongBits.prototype.toHash = function toHash() {\r
92629 return String.fromCharCode(\r
92630 this.lo & 255,\r
92631 this.lo >>> 8 & 255,\r
92632 this.lo >>> 16 & 255,\r
92633 this.lo >>> 24 ,\r
92634 this.hi & 255,\r
92635 this.hi >>> 8 & 255,\r
92636 this.hi >>> 16 & 255,\r
92637 this.hi >>> 24\r
92638 );\r
92639};\r
92640\r
92641/**\r
92642 * Zig-zag encodes this long bits.\r
92643 * @returns {util.LongBits} `this`\r
92644 */\r
92645LongBits.prototype.zzEncode = function zzEncode() {\r
92646 var mask = this.hi >> 31;\r
92647 this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\r
92648 this.lo = ( this.lo << 1 ^ mask) >>> 0;\r
92649 return this;\r
92650};\r
92651\r
92652/**\r
92653 * Zig-zag decodes this long bits.\r
92654 * @returns {util.LongBits} `this`\r
92655 */\r
92656LongBits.prototype.zzDecode = function zzDecode() {\r
92657 var mask = -(this.lo & 1);\r
92658 this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\r
92659 this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\r
92660 return this;\r
92661};\r
92662\r
92663/**\r
92664 * Calculates the length of this longbits when encoded as a varint.\r
92665 * @returns {number} Length\r
92666 */\r
92667LongBits.prototype.length = function length() {\r
92668 var part0 = this.lo,\r
92669 part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\r
92670 part2 = this.hi >>> 24;\r
92671 return part2 === 0\r
92672 ? part1 === 0\r
92673 ? part0 < 16384\r
92674 ? part0 < 128 ? 1 : 2\r
92675 : part0 < 2097152 ? 3 : 4\r
92676 : part1 < 16384\r
92677 ? part1 < 128 ? 5 : 6\r
92678 : part1 < 2097152 ? 7 : 8\r
92679 : part2 < 128 ? 9 : 10;\r
92680};\r
92681
92682},{"../util/minimal":708}],708:[function(require,module,exports){
92683(function (global){
92684"use strict";\r
92685var util = exports;\r
92686\r
92687// used to return a Promise where callback is omitted\r
92688util.asPromise = require("@protobufjs/aspromise");\r
92689\r
92690// converts to / from base64 encoded strings\r
92691util.base64 = require("@protobufjs/base64");\r
92692\r
92693// base class of rpc.Service\r
92694util.EventEmitter = require("@protobufjs/eventemitter");\r
92695\r
92696// float handling accross browsers\r
92697util.float = require("@protobufjs/float");\r
92698\r
92699// requires modules optionally and hides the call from bundlers\r
92700util.inquire = require("@protobufjs/inquire");\r
92701\r
92702// converts to / from utf8 encoded strings\r
92703util.utf8 = require("@protobufjs/utf8");\r
92704\r
92705// provides a node-like buffer pool in the browser\r
92706util.pool = require("@protobufjs/pool");\r
92707\r
92708// utility to work with the low and high bits of a 64 bit value\r
92709util.LongBits = require("./longbits");\r
92710\r
92711// global object reference\r
92712util.global = typeof window !== "undefined" && window\r
92713 || typeof global !== "undefined" && global\r
92714 || typeof self !== "undefined" && self\r
92715 || this; // eslint-disable-line no-invalid-this\r
92716\r
92717/**\r
92718 * An immuable empty array.\r
92719 * @memberof util\r
92720 * @type {Array.<*>}\r
92721 * @const\r
92722 */\r
92723util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\r
92724\r
92725/**\r
92726 * An immutable empty object.\r
92727 * @type {Object}\r
92728 * @const\r
92729 */\r
92730util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\r
92731\r
92732/**\r
92733 * Whether running within node or not.\r
92734 * @memberof util\r
92735 * @type {boolean}\r
92736 * @const\r
92737 */\r
92738util.isNode = Boolean(util.global.process && util.global.process.versions && util.global.process.versions.node);\r
92739\r
92740/**\r
92741 * Tests if the specified value is an integer.\r
92742 * @function\r
92743 * @param {*} value Value to test\r
92744 * @returns {boolean} `true` if the value is an integer\r
92745 */\r
92746util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\r
92747 return typeof value === "number" && isFinite(value) && Math.floor(value) === value;\r
92748};\r
92749\r
92750/**\r
92751 * Tests if the specified value is a string.\r
92752 * @param {*} value Value to test\r
92753 * @returns {boolean} `true` if the value is a string\r
92754 */\r
92755util.isString = function isString(value) {\r
92756 return typeof value === "string" || value instanceof String;\r
92757};\r
92758\r
92759/**\r
92760 * Tests if the specified value is a non-null object.\r
92761 * @param {*} value Value to test\r
92762 * @returns {boolean} `true` if the value is a non-null object\r
92763 */\r
92764util.isObject = function isObject(value) {\r
92765 return value && typeof value === "object";\r
92766};\r
92767\r
92768/**\r
92769 * Checks if a property on a message is considered to be present.\r
92770 * This is an alias of {@link util.isSet}.\r
92771 * @function\r
92772 * @param {Object} obj Plain object or message instance\r
92773 * @param {string} prop Property name\r
92774 * @returns {boolean} `true` if considered to be present, otherwise `false`\r
92775 */\r
92776util.isset =\r
92777\r
92778/**\r
92779 * Checks if a property on a message is considered to be present.\r
92780 * @param {Object} obj Plain object or message instance\r
92781 * @param {string} prop Property name\r
92782 * @returns {boolean} `true` if considered to be present, otherwise `false`\r
92783 */\r
92784util.isSet = function isSet(obj, prop) {\r
92785 var value = obj[prop];\r
92786 if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\r
92787 return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\r
92788 return false;\r
92789};\r
92790\r
92791/**\r
92792 * Any compatible Buffer instance.\r
92793 * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\r
92794 * @interface Buffer\r
92795 * @extends Uint8Array\r
92796 */\r
92797\r
92798/**\r
92799 * Node's Buffer class if available.\r
92800 * @type {Constructor<Buffer>}\r
92801 */\r
92802util.Buffer = (function() {\r
92803 try {\r
92804 var Buffer = util.inquire("buffer").Buffer;\r
92805 // refuse to use non-node buffers if not explicitly assigned (perf reasons):\r
92806 return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\r
92807 } catch (e) {\r
92808 /* istanbul ignore next */\r
92809 return null;\r
92810 }\r
92811})();\r
92812\r
92813// Internal alias of or polyfull for Buffer.from.\r
92814util._Buffer_from = null;\r
92815\r
92816// Internal alias of or polyfill for Buffer.allocUnsafe.\r
92817util._Buffer_allocUnsafe = null;\r
92818\r
92819/**\r
92820 * Creates a new buffer of whatever type supported by the environment.\r
92821 * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\r
92822 * @returns {Uint8Array|Buffer} Buffer\r
92823 */\r
92824util.newBuffer = function newBuffer(sizeOrArray) {\r
92825 /* istanbul ignore next */\r
92826 return typeof sizeOrArray === "number"\r
92827 ? util.Buffer\r
92828 ? util._Buffer_allocUnsafe(sizeOrArray)\r
92829 : new util.Array(sizeOrArray)\r
92830 : util.Buffer\r
92831 ? util._Buffer_from(sizeOrArray)\r
92832 : typeof Uint8Array === "undefined"\r
92833 ? sizeOrArray\r
92834 : new Uint8Array(sizeOrArray);\r
92835};\r
92836\r
92837/**\r
92838 * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\r
92839 * @type {Constructor<Uint8Array>}\r
92840 */\r
92841util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array;\r
92842\r
92843/**\r
92844 * Any compatible Long instance.\r
92845 * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\r
92846 * @interface Long\r
92847 * @property {number} low Low bits\r
92848 * @property {number} high High bits\r
92849 * @property {boolean} unsigned Whether unsigned or not\r
92850 */\r
92851\r
92852/**\r
92853 * Long.js's Long class if available.\r
92854 * @type {Constructor<Long>}\r
92855 */\r
92856util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\r
92857 || /* istanbul ignore next */ util.global.Long\r
92858 || util.inquire("long");\r
92859\r
92860/**\r
92861 * Regular expression used to verify 2 bit (`bool`) map keys.\r
92862 * @type {RegExp}\r
92863 * @const\r
92864 */\r
92865util.key2Re = /^true|false|0|1$/;\r
92866\r
92867/**\r
92868 * Regular expression used to verify 32 bit (`int32` etc.) map keys.\r
92869 * @type {RegExp}\r
92870 * @const\r
92871 */\r
92872util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\r
92873\r
92874/**\r
92875 * Regular expression used to verify 64 bit (`int64` etc.) map keys.\r
92876 * @type {RegExp}\r
92877 * @const\r
92878 */\r
92879util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\r
92880\r
92881/**\r
92882 * Converts a number or long to an 8 characters long hash string.\r
92883 * @param {Long|number} value Value to convert\r
92884 * @returns {string} Hash\r
92885 */\r
92886util.longToHash = function longToHash(value) {\r
92887 return value\r
92888 ? util.LongBits.from(value).toHash()\r
92889 : util.LongBits.zeroHash;\r
92890};\r
92891\r
92892/**\r
92893 * Converts an 8 characters long hash string to a long or number.\r
92894 * @param {string} hash Hash\r
92895 * @param {boolean} [unsigned=false] Whether unsigned or not\r
92896 * @returns {Long|number} Original value\r
92897 */\r
92898util.longFromHash = function longFromHash(hash, unsigned) {\r
92899 var bits = util.LongBits.fromHash(hash);\r
92900 if (util.Long)\r
92901 return util.Long.fromBits(bits.lo, bits.hi, unsigned);\r
92902 return bits.toNumber(Boolean(unsigned));\r
92903};\r
92904\r
92905/**\r
92906 * Merges the properties of the source object into the destination object.\r
92907 * @memberof util\r
92908 * @param {Object.<string,*>} dst Destination object\r
92909 * @param {Object.<string,*>} src Source object\r
92910 * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\r
92911 * @returns {Object.<string,*>} Destination object\r
92912 */\r
92913function merge(dst, src, ifNotSet) { // used by converters\r
92914 for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\r
92915 if (dst[keys[i]] === undefined || !ifNotSet)\r
92916 dst[keys[i]] = src[keys[i]];\r
92917 return dst;\r
92918}\r
92919\r
92920util.merge = merge;\r
92921\r
92922/**\r
92923 * Converts the first character of a string to lower case.\r
92924 * @param {string} str String to convert\r
92925 * @returns {string} Converted string\r
92926 */\r
92927util.lcFirst = function lcFirst(str) {\r
92928 return str.charAt(0).toLowerCase() + str.substring(1);\r
92929};\r
92930\r
92931/**\r
92932 * Creates a custom error constructor.\r
92933 * @memberof util\r
92934 * @param {string} name Error name\r
92935 * @returns {Constructor<Error>} Custom error constructor\r
92936 */\r
92937function newError(name) {\r
92938\r
92939 function CustomError(message, properties) {\r
92940\r
92941 if (!(this instanceof CustomError))\r
92942 return new CustomError(message, properties);\r
92943\r
92944 // Error.call(this, message);\r
92945 // ^ just returns a new error instance because the ctor can be called as a function\r
92946\r
92947 Object.defineProperty(this, "message", { get: function() { return message; } });\r
92948\r
92949 /* istanbul ignore next */\r
92950 if (Error.captureStackTrace) // node\r
92951 Error.captureStackTrace(this, CustomError);\r
92952 else\r
92953 Object.defineProperty(this, "stack", { value: (new Error()).stack || "" });\r
92954\r
92955 if (properties)\r
92956 merge(this, properties);\r
92957 }\r
92958\r
92959 (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\r
92960\r
92961 Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } });\r
92962\r
92963 CustomError.prototype.toString = function toString() {\r
92964 return this.name + ": " + this.message;\r
92965 };\r
92966\r
92967 return CustomError;\r
92968}\r
92969\r
92970util.newError = newError;\r
92971\r
92972/**\r
92973 * Constructs a new protocol error.\r
92974 * @classdesc Error subclass indicating a protocol specifc error.\r
92975 * @memberof util\r
92976 * @extends Error\r
92977 * @template T extends Message<T>\r
92978 * @constructor\r
92979 * @param {string} message Error message\r
92980 * @param {Object.<string,*>} [properties] Additional properties\r
92981 * @example\r
92982 * try {\r
92983 * MyMessage.decode(someBuffer); // throws if required fields are missing\r
92984 * } catch (e) {\r
92985 * if (e instanceof ProtocolError && e.instance)\r
92986 * console.log("decoded so far: " + JSON.stringify(e.instance));\r
92987 * }\r
92988 */\r
92989util.ProtocolError = newError("ProtocolError");\r
92990\r
92991/**\r
92992 * So far decoded message instance.\r
92993 * @name util.ProtocolError#instance\r
92994 * @type {Message<T>}\r
92995 */\r
92996\r
92997/**\r
92998 * A OneOf getter as returned by {@link util.oneOfGetter}.\r
92999 * @typedef OneOfGetter\r
93000 * @type {function}\r
93001 * @returns {string|undefined} Set field name, if any\r
93002 */\r
93003\r
93004/**\r
93005 * Builds a getter for a oneof's present field name.\r
93006 * @param {string[]} fieldNames Field names\r
93007 * @returns {OneOfGetter} Unbound getter\r
93008 */\r
93009util.oneOfGetter = function getOneOf(fieldNames) {\r
93010 var fieldMap = {};\r
93011 for (var i = 0; i < fieldNames.length; ++i)\r
93012 fieldMap[fieldNames[i]] = 1;\r
93013\r
93014 /**\r
93015 * @returns {string|undefined} Set field name, if any\r
93016 * @this Object\r
93017 * @ignore\r
93018 */\r
93019 return function() { // eslint-disable-line consistent-return\r
93020 for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\r
93021 if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\r
93022 return keys[i];\r
93023 };\r
93024};\r
93025\r
93026/**\r
93027 * A OneOf setter as returned by {@link util.oneOfSetter}.\r
93028 * @typedef OneOfSetter\r
93029 * @type {function}\r
93030 * @param {string|undefined} value Field name\r
93031 * @returns {undefined}\r
93032 */\r
93033\r
93034/**\r
93035 * Builds a setter for a oneof's present field name.\r
93036 * @param {string[]} fieldNames Field names\r
93037 * @returns {OneOfSetter} Unbound setter\r
93038 */\r
93039util.oneOfSetter = function setOneOf(fieldNames) {\r
93040\r
93041 /**\r
93042 * @param {string} name Field name\r
93043 * @returns {undefined}\r
93044 * @this Object\r
93045 * @ignore\r
93046 */\r
93047 return function(name) {\r
93048 for (var i = 0; i < fieldNames.length; ++i)\r
93049 if (fieldNames[i] !== name)\r
93050 delete this[fieldNames[i]];\r
93051 };\r
93052};\r
93053\r
93054/**\r
93055 * Default conversion options used for {@link Message#toJSON} implementations.\r
93056 *\r
93057 * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\r
93058 *\r
93059 * - Longs become strings\r
93060 * - Enums become string keys\r
93061 * - Bytes become base64 encoded strings\r
93062 * - (Sub-)Messages become plain objects\r
93063 * - Maps become plain objects with all string keys\r
93064 * - Repeated fields become arrays\r
93065 * - NaN and Infinity for float and double fields become strings\r
93066 *\r
93067 * @type {IConversionOptions}\r
93068 * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\r
93069 */\r
93070util.toJSONOptions = {\r
93071 longs: String,\r
93072 enums: String,\r
93073 bytes: String,\r
93074 json: true\r
93075};\r
93076\r
93077// Sets up buffer utility according to the environment (called in index-minimal)\r
93078util._configure = function() {\r
93079 var Buffer = util.Buffer;\r
93080 /* istanbul ignore if */\r
93081 if (!Buffer) {\r
93082 util._Buffer_from = util._Buffer_allocUnsafe = null;\r
93083 return;\r
93084 }\r
93085 // because node 4.x buffers are incompatible & immutable\r
93086 // see: https://github.com/dcodeIO/protobuf.js/pull/665\r
93087 util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\r
93088 /* istanbul ignore next */\r
93089 function Buffer_from(value, encoding) {\r
93090 return new Buffer(value, encoding);\r
93091 };\r
93092 util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\r
93093 /* istanbul ignore next */\r
93094 function Buffer_allocUnsafe(size) {\r
93095 return new Buffer(size);\r
93096 };\r
93097};\r
93098
93099}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
93100},{"./longbits":707,"@protobufjs/aspromise":2,"@protobufjs/base64":3,"@protobufjs/eventemitter":5,"@protobufjs/float":7,"@protobufjs/inquire":8,"@protobufjs/pool":10,"@protobufjs/utf8":11}],709:[function(require,module,exports){
93101"use strict";\r
93102module.exports = verifier;\r
93103\r
93104var Enum = require("./enum"),\r
93105 util = require("./util");\r
93106\r
93107function invalid(field, expected) {\r
93108 return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected";\r
93109}\r
93110\r
93111/**\r
93112 * Generates a partial value verifier.\r
93113 * @param {Codegen} gen Codegen instance\r
93114 * @param {Field} field Reflected field\r
93115 * @param {number} fieldIndex Field index\r
93116 * @param {string} ref Variable reference\r
93117 * @returns {Codegen} Codegen instance\r
93118 * @ignore\r
93119 */\r
93120function genVerifyValue(gen, field, fieldIndex, ref) {\r
93121 /* eslint-disable no-unexpected-multiline */\r
93122 if (field.resolvedType) {\r
93123 if (field.resolvedType instanceof Enum) { gen\r
93124 ("switch(%s){", ref)\r
93125 ("default:")\r
93126 ("return%j", invalid(field, "enum value"));\r
93127 for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\r
93128 ("case %i:", field.resolvedType.values[keys[j]]);\r
93129 gen\r
93130 ("break")\r
93131 ("}");\r
93132 } else {\r
93133 gen\r
93134 ("{")\r
93135 ("var e=types[%i].verify(%s);", fieldIndex, ref)\r
93136 ("if(e)")\r
93137 ("return%j+e", field.name + ".")\r
93138 ("}");\r
93139 }\r
93140 } else {\r
93141 switch (field.type) {\r
93142 case "int32":\r
93143 case "uint32":\r
93144 case "sint32":\r
93145 case "fixed32":\r
93146 case "sfixed32": gen\r
93147 ("if(!util.isInteger(%s))", ref)\r
93148 ("return%j", invalid(field, "integer"));\r
93149 break;\r
93150 case "int64":\r
93151 case "uint64":\r
93152 case "sint64":\r
93153 case "fixed64":\r
93154 case "sfixed64": gen\r
93155 ("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref)\r
93156 ("return%j", invalid(field, "integer|Long"));\r
93157 break;\r
93158 case "float":\r
93159 case "double": gen\r
93160 ("if(typeof %s!==\"number\")", ref)\r
93161 ("return%j", invalid(field, "number"));\r
93162 break;\r
93163 case "bool": gen\r
93164 ("if(typeof %s!==\"boolean\")", ref)\r
93165 ("return%j", invalid(field, "boolean"));\r
93166 break;\r
93167 case "string": gen\r
93168 ("if(!util.isString(%s))", ref)\r
93169 ("return%j", invalid(field, "string"));\r
93170 break;\r
93171 case "bytes": gen\r
93172 ("if(!(%s&&typeof %s.length===\"number\"||util.isString(%s)))", ref, ref, ref)\r
93173 ("return%j", invalid(field, "buffer"));\r
93174 break;\r
93175 }\r
93176 }\r
93177 return gen;\r
93178 /* eslint-enable no-unexpected-multiline */\r
93179}\r
93180\r
93181/**\r
93182 * Generates a partial key verifier.\r
93183 * @param {Codegen} gen Codegen instance\r
93184 * @param {Field} field Reflected field\r
93185 * @param {string} ref Variable reference\r
93186 * @returns {Codegen} Codegen instance\r
93187 * @ignore\r
93188 */\r
93189function genVerifyKey(gen, field, ref) {\r
93190 /* eslint-disable no-unexpected-multiline */\r
93191 switch (field.keyType) {\r
93192 case "int32":\r
93193 case "uint32":\r
93194 case "sint32":\r
93195 case "fixed32":\r
93196 case "sfixed32": gen\r
93197 ("if(!util.key32Re.test(%s))", ref)\r
93198 ("return%j", invalid(field, "integer key"));\r
93199 break;\r
93200 case "int64":\r
93201 case "uint64":\r
93202 case "sint64":\r
93203 case "fixed64":\r
93204 case "sfixed64": gen\r
93205 ("if(!util.key64Re.test(%s))", ref) // see comment above: x is ok, d is not\r
93206 ("return%j", invalid(field, "integer|Long key"));\r
93207 break;\r
93208 case "bool": gen\r
93209 ("if(!util.key2Re.test(%s))", ref)\r
93210 ("return%j", invalid(field, "boolean key"));\r
93211 break;\r
93212 }\r
93213 return gen;\r
93214 /* eslint-enable no-unexpected-multiline */\r
93215}\r
93216\r
93217/**\r
93218 * Generates a verifier specific to the specified message type.\r
93219 * @param {Type} mtype Message type\r
93220 * @returns {Codegen} Codegen instance\r
93221 */\r
93222function verifier(mtype) {\r
93223 /* eslint-disable no-unexpected-multiline */\r
93224\r
93225 var gen = util.codegen(["m"], mtype.name + "$verify")\r
93226 ("if(typeof m!==\"object\"||m===null)")\r
93227 ("return%j", "object expected");\r
93228 var oneofs = mtype.oneofsArray,\r
93229 seenFirstField = {};\r
93230 if (oneofs.length) gen\r
93231 ("var p={}");\r
93232\r
93233 for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\r
93234 var field = mtype._fieldsArray[i].resolve(),\r
93235 ref = "m" + util.safeProp(field.name);\r
93236\r
93237 if (field.optional) gen\r
93238 ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null\r
93239\r
93240 // map fields\r
93241 if (field.map) { gen\r
93242 ("if(!util.isObject(%s))", ref)\r
93243 ("return%j", invalid(field, "object"))\r
93244 ("var k=Object.keys(%s)", ref)\r
93245 ("for(var i=0;i<k.length;++i){");\r
93246 genVerifyKey(gen, field, "k[i]");\r
93247 genVerifyValue(gen, field, i, ref + "[k[i]]")\r
93248 ("}");\r
93249\r
93250 // repeated fields\r
93251 } else if (field.repeated) { gen\r
93252 ("if(!Array.isArray(%s))", ref)\r
93253 ("return%j", invalid(field, "array"))\r
93254 ("for(var i=0;i<%s.length;++i){", ref);\r
93255 genVerifyValue(gen, field, i, ref + "[i]")\r
93256 ("}");\r
93257\r
93258 // required or present fields\r
93259 } else {\r
93260 if (field.partOf) {\r
93261 var oneofProp = util.safeProp(field.partOf.name);\r
93262 if (seenFirstField[field.partOf.name] === 1) gen\r
93263 ("if(p%s===1)", oneofProp)\r
93264 ("return%j", field.partOf.name + ": multiple values");\r
93265 seenFirstField[field.partOf.name] = 1;\r
93266 gen\r
93267 ("p%s=1", oneofProp);\r
93268 }\r
93269 genVerifyValue(gen, field, i, ref);\r
93270 }\r
93271 if (field.optional) gen\r
93272 ("}");\r
93273 }\r
93274 return gen\r
93275 ("return null");\r
93276 /* eslint-enable no-unexpected-multiline */\r
93277}
93278},{"./enum":684,"./util":706}],710:[function(require,module,exports){
93279"use strict";\r
93280\r
93281/**\r
93282 * Wrappers for common types.\r
93283 * @type {Object.<string,IWrapper>}\r
93284 * @const\r
93285 */\r
93286var wrappers = exports;\r
93287\r
93288var Message = require("./message");\r
93289\r
93290/**\r
93291 * From object converter part of an {@link IWrapper}.\r
93292 * @typedef WrapperFromObjectConverter\r
93293 * @type {function}\r
93294 * @param {Object.<string,*>} object Plain object\r
93295 * @returns {Message<{}>} Message instance\r
93296 * @this Type\r
93297 */\r
93298\r
93299/**\r
93300 * To object converter part of an {@link IWrapper}.\r
93301 * @typedef WrapperToObjectConverter\r
93302 * @type {function}\r
93303 * @param {Message<{}>} message Message instance\r
93304 * @param {IConversionOptions} [options] Conversion options\r
93305 * @returns {Object.<string,*>} Plain object\r
93306 * @this Type\r
93307 */\r
93308\r
93309/**\r
93310 * Common type wrapper part of {@link wrappers}.\r
93311 * @interface IWrapper\r
93312 * @property {WrapperFromObjectConverter} [fromObject] From object converter\r
93313 * @property {WrapperToObjectConverter} [toObject] To object converter\r
93314 */\r
93315\r
93316// Custom wrapper for Any\r
93317wrappers[".google.protobuf.Any"] = {\r
93318\r
93319 fromObject: function(object) {\r
93320\r
93321 // unwrap value type if mapped\r
93322 if (object && object["@type"]) {\r
93323 var type = this.lookup(object["@type"]);\r
93324 /* istanbul ignore else */\r
93325 if (type) {\r
93326 // type_url does not accept leading "."\r
93327 var type_url = object["@type"].charAt(0) === "." ?\r
93328 object["@type"].substr(1) : object["@type"];\r
93329 // type_url prefix is optional, but path seperator is required\r
93330 return this.create({\r
93331 type_url: "/" + type_url,\r
93332 value: type.encode(type.fromObject(object)).finish()\r
93333 });\r
93334 }\r
93335 }\r
93336\r
93337 return this.fromObject(object);\r
93338 },\r
93339\r
93340 toObject: function(message, options) {\r
93341\r
93342 // decode value if requested and unmapped\r
93343 if (options && options.json && message.type_url && message.value) {\r
93344 // Only use fully qualified type name after the last '/'\r
93345 var name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1);\r
93346 var type = this.lookup(name);\r
93347 /* istanbul ignore else */\r
93348 if (type)\r
93349 message = type.decode(message.value);\r
93350 }\r
93351\r
93352 // wrap value if unmapped\r
93353 if (!(message instanceof this.ctor) && message instanceof Message) {\r
93354 var object = message.$type.toObject(message, options);\r
93355 object["@type"] = message.$type.fullName;\r
93356 return object;\r
93357 }\r
93358\r
93359 return this.toObject(message, options);\r
93360 }\r
93361};\r
93362
93363},{"./message":690}],711:[function(require,module,exports){
93364"use strict";\r
93365module.exports = Writer;\r
93366\r
93367var util = require("./util/minimal");\r
93368\r
93369var BufferWriter; // cyclic\r
93370\r
93371var LongBits = util.LongBits,\r
93372 base64 = util.base64,\r
93373 utf8 = util.utf8;\r
93374\r
93375/**\r
93376 * Constructs a new writer operation instance.\r
93377 * @classdesc Scheduled writer operation.\r
93378 * @constructor\r
93379 * @param {function(*, Uint8Array, number)} fn Function to call\r
93380 * @param {number} len Value byte length\r
93381 * @param {*} val Value to write\r
93382 * @ignore\r
93383 */\r
93384function Op(fn, len, val) {\r
93385\r
93386 /**\r
93387 * Function to call.\r
93388 * @type {function(Uint8Array, number, *)}\r
93389 */\r
93390 this.fn = fn;\r
93391\r
93392 /**\r
93393 * Value byte length.\r
93394 * @type {number}\r
93395 */\r
93396 this.len = len;\r
93397\r
93398 /**\r
93399 * Next operation.\r
93400 * @type {Writer.Op|undefined}\r
93401 */\r
93402 this.next = undefined;\r
93403\r
93404 /**\r
93405 * Value to write.\r
93406 * @type {*}\r
93407 */\r
93408 this.val = val; // type varies\r
93409}\r
93410\r
93411/* istanbul ignore next */\r
93412function noop() {} // eslint-disable-line no-empty-function\r
93413\r
93414/**\r
93415 * Constructs a new writer state instance.\r
93416 * @classdesc Copied writer state.\r
93417 * @memberof Writer\r
93418 * @constructor\r
93419 * @param {Writer} writer Writer to copy state from\r
93420 * @ignore\r
93421 */\r
93422function State(writer) {\r
93423\r
93424 /**\r
93425 * Current head.\r
93426 * @type {Writer.Op}\r
93427 */\r
93428 this.head = writer.head;\r
93429\r
93430 /**\r
93431 * Current tail.\r
93432 * @type {Writer.Op}\r
93433 */\r
93434 this.tail = writer.tail;\r
93435\r
93436 /**\r
93437 * Current buffer length.\r
93438 * @type {number}\r
93439 */\r
93440 this.len = writer.len;\r
93441\r
93442 /**\r
93443 * Next state.\r
93444 * @type {State|null}\r
93445 */\r
93446 this.next = writer.states;\r
93447}\r
93448\r
93449/**\r
93450 * Constructs a new writer instance.\r
93451 * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\r
93452 * @constructor\r
93453 */\r
93454function Writer() {\r
93455\r
93456 /**\r
93457 * Current length.\r
93458 * @type {number}\r
93459 */\r
93460 this.len = 0;\r
93461\r
93462 /**\r
93463 * Operations head.\r
93464 * @type {Object}\r
93465 */\r
93466 this.head = new Op(noop, 0, 0);\r
93467\r
93468 /**\r
93469 * Operations tail\r
93470 * @type {Object}\r
93471 */\r
93472 this.tail = this.head;\r
93473\r
93474 /**\r
93475 * Linked forked states.\r
93476 * @type {Object|null}\r
93477 */\r
93478 this.states = null;\r
93479\r
93480 // When a value is written, the writer calculates its byte length and puts it into a linked\r
93481 // list of operations to perform when finish() is called. This both allows us to allocate\r
93482 // buffers of the exact required size and reduces the amount of work we have to do compared\r
93483 // to first calculating over objects and then encoding over objects. In our case, the encoding\r
93484 // part is just a linked list walk calling operations with already prepared values.\r
93485}\r
93486\r
93487/**\r
93488 * Creates a new writer.\r
93489 * @function\r
93490 * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\r
93491 */\r
93492Writer.create = util.Buffer\r
93493 ? function create_buffer_setup() {\r
93494 return (Writer.create = function create_buffer() {\r
93495 return new BufferWriter();\r
93496 })();\r
93497 }\r
93498 /* istanbul ignore next */\r
93499 : function create_array() {\r
93500 return new Writer();\r
93501 };\r
93502\r
93503/**\r
93504 * Allocates a buffer of the specified size.\r
93505 * @param {number} size Buffer size\r
93506 * @returns {Uint8Array} Buffer\r
93507 */\r
93508Writer.alloc = function alloc(size) {\r
93509 return new util.Array(size);\r
93510};\r
93511\r
93512// Use Uint8Array buffer pool in the browser, just like node does with buffers\r
93513/* istanbul ignore else */\r
93514if (util.Array !== Array)\r
93515 Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\r
93516\r
93517/**\r
93518 * Pushes a new operation to the queue.\r
93519 * @param {function(Uint8Array, number, *)} fn Function to call\r
93520 * @param {number} len Value byte length\r
93521 * @param {number} val Value to write\r
93522 * @returns {Writer} `this`\r
93523 * @private\r
93524 */\r
93525Writer.prototype._push = function push(fn, len, val) {\r
93526 this.tail = this.tail.next = new Op(fn, len, val);\r
93527 this.len += len;\r
93528 return this;\r
93529};\r
93530\r
93531function writeByte(val, buf, pos) {\r
93532 buf[pos] = val & 255;\r
93533}\r
93534\r
93535function writeVarint32(val, buf, pos) {\r
93536 while (val > 127) {\r
93537 buf[pos++] = val & 127 | 128;\r
93538 val >>>= 7;\r
93539 }\r
93540 buf[pos] = val;\r
93541}\r
93542\r
93543/**\r
93544 * Constructs a new varint writer operation instance.\r
93545 * @classdesc Scheduled varint writer operation.\r
93546 * @extends Op\r
93547 * @constructor\r
93548 * @param {number} len Value byte length\r
93549 * @param {number} val Value to write\r
93550 * @ignore\r
93551 */\r
93552function VarintOp(len, val) {\r
93553 this.len = len;\r
93554 this.next = undefined;\r
93555 this.val = val;\r
93556}\r
93557\r
93558VarintOp.prototype = Object.create(Op.prototype);\r
93559VarintOp.prototype.fn = writeVarint32;\r
93560\r
93561/**\r
93562 * Writes an unsigned 32 bit value as a varint.\r
93563 * @param {number} value Value to write\r
93564 * @returns {Writer} `this`\r
93565 */\r
93566Writer.prototype.uint32 = function write_uint32(value) {\r
93567 // here, the call to this.push has been inlined and a varint specific Op subclass is used.\r
93568 // uint32 is by far the most frequently used operation and benefits significantly from this.\r
93569 this.len += (this.tail = this.tail.next = new VarintOp(\r
93570 (value = value >>> 0)\r
93571 < 128 ? 1\r
93572 : value < 16384 ? 2\r
93573 : value < 2097152 ? 3\r
93574 : value < 268435456 ? 4\r
93575 : 5,\r
93576 value)).len;\r
93577 return this;\r
93578};\r
93579\r
93580/**\r
93581 * Writes a signed 32 bit value as a varint.\r
93582 * @function\r
93583 * @param {number} value Value to write\r
93584 * @returns {Writer} `this`\r
93585 */\r
93586Writer.prototype.int32 = function write_int32(value) {\r
93587 return value < 0\r
93588 ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\r
93589 : this.uint32(value);\r
93590};\r
93591\r
93592/**\r
93593 * Writes a 32 bit value as a varint, zig-zag encoded.\r
93594 * @param {number} value Value to write\r
93595 * @returns {Writer} `this`\r
93596 */\r
93597Writer.prototype.sint32 = function write_sint32(value) {\r
93598 return this.uint32((value << 1 ^ value >> 31) >>> 0);\r
93599};\r
93600\r
93601function writeVarint64(val, buf, pos) {\r
93602 while (val.hi) {\r
93603 buf[pos++] = val.lo & 127 | 128;\r
93604 val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\r
93605 val.hi >>>= 7;\r
93606 }\r
93607 while (val.lo > 127) {\r
93608 buf[pos++] = val.lo & 127 | 128;\r
93609 val.lo = val.lo >>> 7;\r
93610 }\r
93611 buf[pos++] = val.lo;\r
93612}\r
93613\r
93614/**\r
93615 * Writes an unsigned 64 bit value as a varint.\r
93616 * @param {Long|number|string} value Value to write\r
93617 * @returns {Writer} `this`\r
93618 * @throws {TypeError} If `value` is a string and no long library is present.\r
93619 */\r
93620Writer.prototype.uint64 = function write_uint64(value) {\r
93621 var bits = LongBits.from(value);\r
93622 return this._push(writeVarint64, bits.length(), bits);\r
93623};\r
93624\r
93625/**\r
93626 * Writes a signed 64 bit value as a varint.\r
93627 * @function\r
93628 * @param {Long|number|string} value Value to write\r
93629 * @returns {Writer} `this`\r
93630 * @throws {TypeError} If `value` is a string and no long library is present.\r
93631 */\r
93632Writer.prototype.int64 = Writer.prototype.uint64;\r
93633\r
93634/**\r
93635 * Writes a signed 64 bit value as a varint, zig-zag encoded.\r
93636 * @param {Long|number|string} value Value to write\r
93637 * @returns {Writer} `this`\r
93638 * @throws {TypeError} If `value` is a string and no long library is present.\r
93639 */\r
93640Writer.prototype.sint64 = function write_sint64(value) {\r
93641 var bits = LongBits.from(value).zzEncode();\r
93642 return this._push(writeVarint64, bits.length(), bits);\r
93643};\r
93644\r
93645/**\r
93646 * Writes a boolish value as a varint.\r
93647 * @param {boolean} value Value to write\r
93648 * @returns {Writer} `this`\r
93649 */\r
93650Writer.prototype.bool = function write_bool(value) {\r
93651 return this._push(writeByte, 1, value ? 1 : 0);\r
93652};\r
93653\r
93654function writeFixed32(val, buf, pos) {\r
93655 buf[pos ] = val & 255;\r
93656 buf[pos + 1] = val >>> 8 & 255;\r
93657 buf[pos + 2] = val >>> 16 & 255;\r
93658 buf[pos + 3] = val >>> 24;\r
93659}\r
93660\r
93661/**\r
93662 * Writes an unsigned 32 bit value as fixed 32 bits.\r
93663 * @param {number} value Value to write\r
93664 * @returns {Writer} `this`\r
93665 */\r
93666Writer.prototype.fixed32 = function write_fixed32(value) {\r
93667 return this._push(writeFixed32, 4, value >>> 0);\r
93668};\r
93669\r
93670/**\r
93671 * Writes a signed 32 bit value as fixed 32 bits.\r
93672 * @function\r
93673 * @param {number} value Value to write\r
93674 * @returns {Writer} `this`\r
93675 */\r
93676Writer.prototype.sfixed32 = Writer.prototype.fixed32;\r
93677\r
93678/**\r
93679 * Writes an unsigned 64 bit value as fixed 64 bits.\r
93680 * @param {Long|number|string} value Value to write\r
93681 * @returns {Writer} `this`\r
93682 * @throws {TypeError} If `value` is a string and no long library is present.\r
93683 */\r
93684Writer.prototype.fixed64 = function write_fixed64(value) {\r
93685 var bits = LongBits.from(value);\r
93686 return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\r
93687};\r
93688\r
93689/**\r
93690 * Writes a signed 64 bit value as fixed 64 bits.\r
93691 * @function\r
93692 * @param {Long|number|string} value Value to write\r
93693 * @returns {Writer} `this`\r
93694 * @throws {TypeError} If `value` is a string and no long library is present.\r
93695 */\r
93696Writer.prototype.sfixed64 = Writer.prototype.fixed64;\r
93697\r
93698/**\r
93699 * Writes a float (32 bit).\r
93700 * @function\r
93701 * @param {number} value Value to write\r
93702 * @returns {Writer} `this`\r
93703 */\r
93704Writer.prototype.float = function write_float(value) {\r
93705 return this._push(util.float.writeFloatLE, 4, value);\r
93706};\r
93707\r
93708/**\r
93709 * Writes a double (64 bit float).\r
93710 * @function\r
93711 * @param {number} value Value to write\r
93712 * @returns {Writer} `this`\r
93713 */\r
93714Writer.prototype.double = function write_double(value) {\r
93715 return this._push(util.float.writeDoubleLE, 8, value);\r
93716};\r
93717\r
93718var writeBytes = util.Array.prototype.set\r
93719 ? function writeBytes_set(val, buf, pos) {\r
93720 buf.set(val, pos); // also works for plain array values\r
93721 }\r
93722 /* istanbul ignore next */\r
93723 : function writeBytes_for(val, buf, pos) {\r
93724 for (var i = 0; i < val.length; ++i)\r
93725 buf[pos + i] = val[i];\r
93726 };\r
93727\r
93728/**\r
93729 * Writes a sequence of bytes.\r
93730 * @param {Uint8Array|string} value Buffer or base64 encoded string to write\r
93731 * @returns {Writer} `this`\r
93732 */\r
93733Writer.prototype.bytes = function write_bytes(value) {\r
93734 var len = value.length >>> 0;\r
93735 if (!len)\r
93736 return this._push(writeByte, 1, 0);\r
93737 if (util.isString(value)) {\r
93738 var buf = Writer.alloc(len = base64.length(value));\r
93739 base64.decode(value, buf, 0);\r
93740 value = buf;\r
93741 }\r
93742 return this.uint32(len)._push(writeBytes, len, value);\r
93743};\r
93744\r
93745/**\r
93746 * Writes a string.\r
93747 * @param {string} value Value to write\r
93748 * @returns {Writer} `this`\r
93749 */\r
93750Writer.prototype.string = function write_string(value) {\r
93751 var len = utf8.length(value);\r
93752 return len\r
93753 ? this.uint32(len)._push(utf8.write, len, value)\r
93754 : this._push(writeByte, 1, 0);\r
93755};\r
93756\r
93757/**\r
93758 * Forks this writer's state by pushing it to a stack.\r
93759 * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\r
93760 * @returns {Writer} `this`\r
93761 */\r
93762Writer.prototype.fork = function fork() {\r
93763 this.states = new State(this);\r
93764 this.head = this.tail = new Op(noop, 0, 0);\r
93765 this.len = 0;\r
93766 return this;\r
93767};\r
93768\r
93769/**\r
93770 * Resets this instance to the last state.\r
93771 * @returns {Writer} `this`\r
93772 */\r
93773Writer.prototype.reset = function reset() {\r
93774 if (this.states) {\r
93775 this.head = this.states.head;\r
93776 this.tail = this.states.tail;\r
93777 this.len = this.states.len;\r
93778 this.states = this.states.next;\r
93779 } else {\r
93780 this.head = this.tail = new Op(noop, 0, 0);\r
93781 this.len = 0;\r
93782 }\r
93783 return this;\r
93784};\r
93785\r
93786/**\r
93787 * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\r
93788 * @returns {Writer} `this`\r
93789 */\r
93790Writer.prototype.ldelim = function ldelim() {\r
93791 var head = this.head,\r
93792 tail = this.tail,\r
93793 len = this.len;\r
93794 this.reset().uint32(len);\r
93795 if (len) {\r
93796 this.tail.next = head.next; // skip noop\r
93797 this.tail = tail;\r
93798 this.len += len;\r
93799 }\r
93800 return this;\r
93801};\r
93802\r
93803/**\r
93804 * Finishes the write operation.\r
93805 * @returns {Uint8Array} Finished buffer\r
93806 */\r
93807Writer.prototype.finish = function finish() {\r
93808 var head = this.head.next, // skip noop\r
93809 buf = this.constructor.alloc(this.len),\r
93810 pos = 0;\r
93811 while (head) {\r
93812 head.fn(head.val, buf, pos);\r
93813 pos += head.len;\r
93814 head = head.next;\r
93815 }\r
93816 // this.head = this.tail = null;\r
93817 return buf;\r
93818};\r
93819\r
93820Writer._configure = function(BufferWriter_) {\r
93821 BufferWriter = BufferWriter_;\r
93822};\r
93823
93824},{"./util/minimal":708}],712:[function(require,module,exports){
93825"use strict";\r
93826module.exports = BufferWriter;\r
93827\r
93828// extends Writer\r
93829var Writer = require("./writer");\r
93830(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\r
93831\r
93832var util = require("./util/minimal");\r
93833\r
93834var Buffer = util.Buffer;\r
93835\r
93836/**\r
93837 * Constructs a new buffer writer instance.\r
93838 * @classdesc Wire format writer using node buffers.\r
93839 * @extends Writer\r
93840 * @constructor\r
93841 */\r
93842function BufferWriter() {\r
93843 Writer.call(this);\r
93844}\r
93845\r
93846/**\r
93847 * Allocates a buffer of the specified size.\r
93848 * @param {number} size Buffer size\r
93849 * @returns {Buffer} Buffer\r
93850 */\r
93851BufferWriter.alloc = function alloc_buffer(size) {\r
93852 return (BufferWriter.alloc = util._Buffer_allocUnsafe)(size);\r
93853};\r
93854\r
93855var writeBytesBuffer = Buffer && Buffer.prototype instanceof Uint8Array && Buffer.prototype.set.name === "set"\r
93856 ? function writeBytesBuffer_set(val, buf, pos) {\r
93857 buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\r
93858 // also works for plain array values\r
93859 }\r
93860 /* istanbul ignore next */\r
93861 : function writeBytesBuffer_copy(val, buf, pos) {\r
93862 if (val.copy) // Buffer values\r
93863 val.copy(buf, pos, 0, val.length);\r
93864 else for (var i = 0; i < val.length;) // plain array values\r
93865 buf[pos++] = val[i++];\r
93866 };\r
93867\r
93868/**\r
93869 * @override\r
93870 */\r
93871BufferWriter.prototype.bytes = function write_bytes_buffer(value) {\r
93872 if (util.isString(value))\r
93873 value = util._Buffer_from(value, "base64");\r
93874 var len = value.length >>> 0;\r
93875 this.uint32(len);\r
93876 if (len)\r
93877 this._push(writeBytesBuffer, len, value);\r
93878 return this;\r
93879};\r
93880\r
93881function writeStringBuffer(val, buf, pos) {\r
93882 if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\r
93883 util.utf8.write(val, buf, pos);\r
93884 else\r
93885 buf.utf8Write(val, pos);\r
93886}\r
93887\r
93888/**\r
93889 * @override\r
93890 */\r
93891BufferWriter.prototype.string = function write_string_buffer(value) {\r
93892 var len = Buffer.byteLength(value);\r
93893 this.uint32(len);\r
93894 if (len)\r
93895 this._push(writeStringBuffer, len, value);\r
93896 return this;\r
93897};\r
93898\r
93899\r
93900/**\r
93901 * Finishes the write operation.\r
93902 * @name BufferWriter#finish\r
93903 * @function\r
93904 * @returns {Buffer} Finished buffer\r
93905 */\r
93906
93907},{"./util/minimal":708,"./writer":711}],713:[function(require,module,exports){
93908exports.publicEncrypt = require('./publicEncrypt')
93909exports.privateDecrypt = require('./privateDecrypt')
93910
93911exports.privateEncrypt = function privateEncrypt (key, buf) {
93912 return exports.publicEncrypt(key, buf, true)
93913}
93914
93915exports.publicDecrypt = function publicDecrypt (key, buf) {
93916 return exports.privateDecrypt(key, buf, true)
93917}
93918
93919},{"./privateDecrypt":715,"./publicEncrypt":716}],714:[function(require,module,exports){
93920var createHash = require('create-hash')
93921var Buffer = require('safe-buffer').Buffer
93922
93923module.exports = function (seed, len) {
93924 var t = Buffer.alloc(0)
93925 var i = 0
93926 var c
93927 while (t.length < len) {
93928 c = i2ops(i++)
93929 t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])
93930 }
93931 return t.slice(0, len)
93932}
93933
93934function i2ops (c) {
93935 var out = Buffer.allocUnsafe(4)
93936 out.writeUInt32BE(c, 0)
93937 return out
93938}
93939
93940},{"create-hash":239,"safe-buffer":742}],715:[function(require,module,exports){
93941var parseKeys = require('parse-asn1')
93942var mgf = require('./mgf')
93943var xor = require('./xor')
93944var BN = require('bn.js')
93945var crt = require('browserify-rsa')
93946var createHash = require('create-hash')
93947var withPublic = require('./withPublic')
93948var Buffer = require('safe-buffer').Buffer
93949
93950module.exports = function privateDecrypt (privateKey, enc, reverse) {
93951 var padding
93952 if (privateKey.padding) {
93953 padding = privateKey.padding
93954 } else if (reverse) {
93955 padding = 1
93956 } else {
93957 padding = 4
93958 }
93959
93960 var key = parseKeys(privateKey)
93961 var k = key.modulus.byteLength()
93962 if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {
93963 throw new Error('decryption error')
93964 }
93965 var msg
93966 if (reverse) {
93967 msg = withPublic(new BN(enc), key)
93968 } else {
93969 msg = crt(enc, key)
93970 }
93971 var zBuffer = Buffer.alloc(k - msg.length)
93972 msg = Buffer.concat([zBuffer, msg], k)
93973 if (padding === 4) {
93974 return oaep(key, msg)
93975 } else if (padding === 1) {
93976 return pkcs1(key, msg, reverse)
93977 } else if (padding === 3) {
93978 return msg
93979 } else {
93980 throw new Error('unknown padding')
93981 }
93982}
93983
93984function oaep (key, msg) {
93985 var k = key.modulus.byteLength()
93986 var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
93987 var hLen = iHash.length
93988 if (msg[0] !== 0) {
93989 throw new Error('decryption error')
93990 }
93991 var maskedSeed = msg.slice(1, hLen + 1)
93992 var maskedDb = msg.slice(hLen + 1)
93993 var seed = xor(maskedSeed, mgf(maskedDb, hLen))
93994 var db = xor(maskedDb, mgf(seed, k - hLen - 1))
93995 if (compare(iHash, db.slice(0, hLen))) {
93996 throw new Error('decryption error')
93997 }
93998 var i = hLen
93999 while (db[i] === 0) {
94000 i++
94001 }
94002 if (db[i++] !== 1) {
94003 throw new Error('decryption error')
94004 }
94005 return db.slice(i)
94006}
94007
94008function pkcs1 (key, msg, reverse) {
94009 var p1 = msg.slice(0, 2)
94010 var i = 2
94011 var status = 0
94012 while (msg[i++] !== 0) {
94013 if (i >= msg.length) {
94014 status++
94015 break
94016 }
94017 }
94018 var ps = msg.slice(2, i - 1)
94019
94020 if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {
94021 status++
94022 }
94023 if (ps.length < 8) {
94024 status++
94025 }
94026 if (status) {
94027 throw new Error('decryption error')
94028 }
94029 return msg.slice(i)
94030}
94031function compare (a, b) {
94032 a = Buffer.from(a)
94033 b = Buffer.from(b)
94034 var dif = 0
94035 var len = a.length
94036 if (a.length !== b.length) {
94037 dif++
94038 len = Math.min(a.length, b.length)
94039 }
94040 var i = -1
94041 while (++i < len) {
94042 dif += (a[i] ^ b[i])
94043 }
94044 return dif
94045}
94046
94047},{"./mgf":714,"./withPublic":717,"./xor":718,"bn.js":108,"browserify-rsa":131,"create-hash":239,"parse-asn1":670,"safe-buffer":742}],716:[function(require,module,exports){
94048var parseKeys = require('parse-asn1')
94049var randomBytes = require('randombytes')
94050var createHash = require('create-hash')
94051var mgf = require('./mgf')
94052var xor = require('./xor')
94053var BN = require('bn.js')
94054var withPublic = require('./withPublic')
94055var crt = require('browserify-rsa')
94056var Buffer = require('safe-buffer').Buffer
94057
94058module.exports = function publicEncrypt (publicKey, msg, reverse) {
94059 var padding
94060 if (publicKey.padding) {
94061 padding = publicKey.padding
94062 } else if (reverse) {
94063 padding = 1
94064 } else {
94065 padding = 4
94066 }
94067 var key = parseKeys(publicKey)
94068 var paddedMsg
94069 if (padding === 4) {
94070 paddedMsg = oaep(key, msg)
94071 } else if (padding === 1) {
94072 paddedMsg = pkcs1(key, msg, reverse)
94073 } else if (padding === 3) {
94074 paddedMsg = new BN(msg)
94075 if (paddedMsg.cmp(key.modulus) >= 0) {
94076 throw new Error('data too long for modulus')
94077 }
94078 } else {
94079 throw new Error('unknown padding')
94080 }
94081 if (reverse) {
94082 return crt(paddedMsg, key)
94083 } else {
94084 return withPublic(paddedMsg, key)
94085 }
94086}
94087
94088function oaep (key, msg) {
94089 var k = key.modulus.byteLength()
94090 var mLen = msg.length
94091 var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
94092 var hLen = iHash.length
94093 var hLen2 = 2 * hLen
94094 if (mLen > k - hLen2 - 2) {
94095 throw new Error('message too long')
94096 }
94097 var ps = Buffer.alloc(k - mLen - hLen2 - 2)
94098 var dblen = k - hLen - 1
94099 var seed = randomBytes(hLen)
94100 var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))
94101 var maskedSeed = xor(seed, mgf(maskedDb, hLen))
94102 return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))
94103}
94104function pkcs1 (key, msg, reverse) {
94105 var mLen = msg.length
94106 var k = key.modulus.byteLength()
94107 if (mLen > k - 11) {
94108 throw new Error('message too long')
94109 }
94110 var ps
94111 if (reverse) {
94112 ps = Buffer.alloc(k - mLen - 3, 0xff)
94113 } else {
94114 ps = nonZero(k - mLen - 3)
94115 }
94116 return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))
94117}
94118function nonZero (len) {
94119 var out = Buffer.allocUnsafe(len)
94120 var i = 0
94121 var cache = randomBytes(len * 2)
94122 var cur = 0
94123 var num
94124 while (i < len) {
94125 if (cur === cache.length) {
94126 cache = randomBytes(len * 2)
94127 cur = 0
94128 }
94129 num = cache[cur++]
94130 if (num) {
94131 out[i++] = num
94132 }
94133 }
94134 return out
94135}
94136
94137},{"./mgf":714,"./withPublic":717,"./xor":718,"bn.js":108,"browserify-rsa":131,"create-hash":239,"parse-asn1":670,"randombytes":724,"safe-buffer":742}],717:[function(require,module,exports){
94138var BN = require('bn.js')
94139var Buffer = require('safe-buffer').Buffer
94140
94141function withPublic (paddedMsg, key) {
94142 return Buffer.from(paddedMsg
94143 .toRed(BN.mont(key.modulus))
94144 .redPow(new BN(key.publicExponent))
94145 .fromRed()
94146 .toArray())
94147}
94148
94149module.exports = withPublic
94150
94151},{"bn.js":108,"safe-buffer":742}],718:[function(require,module,exports){
94152module.exports = function xor (a, b) {
94153 var len = a.length
94154 var i = -1
94155 while (++i < len) {
94156 a[i] ^= b[i]
94157 }
94158 return a
94159}
94160
94161},{}],719:[function(require,module,exports){
94162(function (global){
94163/*! https://mths.be/punycode v1.4.1 by @mathias */
94164;(function(root) {
94165
94166 /** Detect free variables */
94167 var freeExports = typeof exports == 'object' && exports &&
94168 !exports.nodeType && exports;
94169 var freeModule = typeof module == 'object' && module &&
94170 !module.nodeType && module;
94171 var freeGlobal = typeof global == 'object' && global;
94172 if (
94173 freeGlobal.global === freeGlobal ||
94174 freeGlobal.window === freeGlobal ||
94175 freeGlobal.self === freeGlobal
94176 ) {
94177 root = freeGlobal;
94178 }
94179
94180 /**
94181 * The `punycode` object.
94182 * @name punycode
94183 * @type Object
94184 */
94185 var punycode,
94186
94187 /** Highest positive signed 32-bit float value */
94188 maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
94189
94190 /** Bootstring parameters */
94191 base = 36,
94192 tMin = 1,
94193 tMax = 26,
94194 skew = 38,
94195 damp = 700,
94196 initialBias = 72,
94197 initialN = 128, // 0x80
94198 delimiter = '-', // '\x2D'
94199
94200 /** Regular expressions */
94201 regexPunycode = /^xn--/,
94202 regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
94203 regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
94204
94205 /** Error messages */
94206 errors = {
94207 'overflow': 'Overflow: input needs wider integers to process',
94208 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
94209 'invalid-input': 'Invalid input'
94210 },
94211
94212 /** Convenience shortcuts */
94213 baseMinusTMin = base - tMin,
94214 floor = Math.floor,
94215 stringFromCharCode = String.fromCharCode,
94216
94217 /** Temporary variable */
94218 key;
94219
94220 /*--------------------------------------------------------------------------*/
94221
94222 /**
94223 * A generic error utility function.
94224 * @private
94225 * @param {String} type The error type.
94226 * @returns {Error} Throws a `RangeError` with the applicable error message.
94227 */
94228 function error(type) {
94229 throw new RangeError(errors[type]);
94230 }
94231
94232 /**
94233 * A generic `Array#map` utility function.
94234 * @private
94235 * @param {Array} array The array to iterate over.
94236 * @param {Function} callback The function that gets called for every array
94237 * item.
94238 * @returns {Array} A new array of values returned by the callback function.
94239 */
94240 function map(array, fn) {
94241 var length = array.length;
94242 var result = [];
94243 while (length--) {
94244 result[length] = fn(array[length]);
94245 }
94246 return result;
94247 }
94248
94249 /**
94250 * A simple `Array#map`-like wrapper to work with domain name strings or email
94251 * addresses.
94252 * @private
94253 * @param {String} domain The domain name or email address.
94254 * @param {Function} callback The function that gets called for every
94255 * character.
94256 * @returns {Array} A new string of characters returned by the callback
94257 * function.
94258 */
94259 function mapDomain(string, fn) {
94260 var parts = string.split('@');
94261 var result = '';
94262 if (parts.length > 1) {
94263 // In email addresses, only the domain name should be punycoded. Leave
94264 // the local part (i.e. everything up to `@`) intact.
94265 result = parts[0] + '@';
94266 string = parts[1];
94267 }
94268 // Avoid `split(regex)` for IE8 compatibility. See #17.
94269 string = string.replace(regexSeparators, '\x2E');
94270 var labels = string.split('.');
94271 var encoded = map(labels, fn).join('.');
94272 return result + encoded;
94273 }
94274
94275 /**
94276 * Creates an array containing the numeric code points of each Unicode
94277 * character in the string. While JavaScript uses UCS-2 internally,
94278 * this function will convert a pair of surrogate halves (each of which
94279 * UCS-2 exposes as separate characters) into a single code point,
94280 * matching UTF-16.
94281 * @see `punycode.ucs2.encode`
94282 * @see <https://mathiasbynens.be/notes/javascript-encoding>
94283 * @memberOf punycode.ucs2
94284 * @name decode
94285 * @param {String} string The Unicode input string (UCS-2).
94286 * @returns {Array} The new array of code points.
94287 */
94288 function ucs2decode(string) {
94289 var output = [],
94290 counter = 0,
94291 length = string.length,
94292 value,
94293 extra;
94294 while (counter < length) {
94295 value = string.charCodeAt(counter++);
94296 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
94297 // high surrogate, and there is a next character
94298 extra = string.charCodeAt(counter++);
94299 if ((extra & 0xFC00) == 0xDC00) { // low surrogate
94300 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
94301 } else {
94302 // unmatched surrogate; only append this code unit, in case the next
94303 // code unit is the high surrogate of a surrogate pair
94304 output.push(value);
94305 counter--;
94306 }
94307 } else {
94308 output.push(value);
94309 }
94310 }
94311 return output;
94312 }
94313
94314 /**
94315 * Creates a string based on an array of numeric code points.
94316 * @see `punycode.ucs2.decode`
94317 * @memberOf punycode.ucs2
94318 * @name encode
94319 * @param {Array} codePoints The array of numeric code points.
94320 * @returns {String} The new Unicode string (UCS-2).
94321 */
94322 function ucs2encode(array) {
94323 return map(array, function(value) {
94324 var output = '';
94325 if (value > 0xFFFF) {
94326 value -= 0x10000;
94327 output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
94328 value = 0xDC00 | value & 0x3FF;
94329 }
94330 output += stringFromCharCode(value);
94331 return output;
94332 }).join('');
94333 }
94334
94335 /**
94336 * Converts a basic code point into a digit/integer.
94337 * @see `digitToBasic()`
94338 * @private
94339 * @param {Number} codePoint The basic numeric code point value.
94340 * @returns {Number} The numeric value of a basic code point (for use in
94341 * representing integers) in the range `0` to `base - 1`, or `base` if
94342 * the code point does not represent a value.
94343 */
94344 function basicToDigit(codePoint) {
94345 if (codePoint - 48 < 10) {
94346 return codePoint - 22;
94347 }
94348 if (codePoint - 65 < 26) {
94349 return codePoint - 65;
94350 }
94351 if (codePoint - 97 < 26) {
94352 return codePoint - 97;
94353 }
94354 return base;
94355 }
94356
94357 /**
94358 * Converts a digit/integer into a basic code point.
94359 * @see `basicToDigit()`
94360 * @private
94361 * @param {Number} digit The numeric value of a basic code point.
94362 * @returns {Number} The basic code point whose value (when used for
94363 * representing integers) is `digit`, which needs to be in the range
94364 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
94365 * used; else, the lowercase form is used. The behavior is undefined
94366 * if `flag` is non-zero and `digit` has no uppercase form.
94367 */
94368 function digitToBasic(digit, flag) {
94369 // 0..25 map to ASCII a..z or A..Z
94370 // 26..35 map to ASCII 0..9
94371 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
94372 }
94373
94374 /**
94375 * Bias adaptation function as per section 3.4 of RFC 3492.
94376 * https://tools.ietf.org/html/rfc3492#section-3.4
94377 * @private
94378 */
94379 function adapt(delta, numPoints, firstTime) {
94380 var k = 0;
94381 delta = firstTime ? floor(delta / damp) : delta >> 1;
94382 delta += floor(delta / numPoints);
94383 for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
94384 delta = floor(delta / baseMinusTMin);
94385 }
94386 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
94387 }
94388
94389 /**
94390 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
94391 * symbols.
94392 * @memberOf punycode
94393 * @param {String} input The Punycode string of ASCII-only symbols.
94394 * @returns {String} The resulting string of Unicode symbols.
94395 */
94396 function decode(input) {
94397 // Don't use UCS-2
94398 var output = [],
94399 inputLength = input.length,
94400 out,
94401 i = 0,
94402 n = initialN,
94403 bias = initialBias,
94404 basic,
94405 j,
94406 index,
94407 oldi,
94408 w,
94409 k,
94410 digit,
94411 t,
94412 /** Cached calculation results */
94413 baseMinusT;
94414
94415 // Handle the basic code points: let `basic` be the number of input code
94416 // points before the last delimiter, or `0` if there is none, then copy
94417 // the first basic code points to the output.
94418
94419 basic = input.lastIndexOf(delimiter);
94420 if (basic < 0) {
94421 basic = 0;
94422 }
94423
94424 for (j = 0; j < basic; ++j) {
94425 // if it's not a basic code point
94426 if (input.charCodeAt(j) >= 0x80) {
94427 error('not-basic');
94428 }
94429 output.push(input.charCodeAt(j));
94430 }
94431
94432 // Main decoding loop: start just after the last delimiter if any basic code
94433 // points were copied; start at the beginning otherwise.
94434
94435 for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
94436
94437 // `index` is the index of the next character to be consumed.
94438 // Decode a generalized variable-length integer into `delta`,
94439 // which gets added to `i`. The overflow checking is easier
94440 // if we increase `i` as we go, then subtract off its starting
94441 // value at the end to obtain `delta`.
94442 for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
94443
94444 if (index >= inputLength) {
94445 error('invalid-input');
94446 }
94447
94448 digit = basicToDigit(input.charCodeAt(index++));
94449
94450 if (digit >= base || digit > floor((maxInt - i) / w)) {
94451 error('overflow');
94452 }
94453
94454 i += digit * w;
94455 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
94456
94457 if (digit < t) {
94458 break;
94459 }
94460
94461 baseMinusT = base - t;
94462 if (w > floor(maxInt / baseMinusT)) {
94463 error('overflow');
94464 }
94465
94466 w *= baseMinusT;
94467
94468 }
94469
94470 out = output.length + 1;
94471 bias = adapt(i - oldi, out, oldi == 0);
94472
94473 // `i` was supposed to wrap around from `out` to `0`,
94474 // incrementing `n` each time, so we'll fix that now:
94475 if (floor(i / out) > maxInt - n) {
94476 error('overflow');
94477 }
94478
94479 n += floor(i / out);
94480 i %= out;
94481
94482 // Insert `n` at position `i` of the output
94483 output.splice(i++, 0, n);
94484
94485 }
94486
94487 return ucs2encode(output);
94488 }
94489
94490 /**
94491 * Converts a string of Unicode symbols (e.g. a domain name label) to a
94492 * Punycode string of ASCII-only symbols.
94493 * @memberOf punycode
94494 * @param {String} input The string of Unicode symbols.
94495 * @returns {String} The resulting Punycode string of ASCII-only symbols.
94496 */
94497 function encode(input) {
94498 var n,
94499 delta,
94500 handledCPCount,
94501 basicLength,
94502 bias,
94503 j,
94504 m,
94505 q,
94506 k,
94507 t,
94508 currentValue,
94509 output = [],
94510 /** `inputLength` will hold the number of code points in `input`. */
94511 inputLength,
94512 /** Cached calculation results */
94513 handledCPCountPlusOne,
94514 baseMinusT,
94515 qMinusT;
94516
94517 // Convert the input in UCS-2 to Unicode
94518 input = ucs2decode(input);
94519
94520 // Cache the length
94521 inputLength = input.length;
94522
94523 // Initialize the state
94524 n = initialN;
94525 delta = 0;
94526 bias = initialBias;
94527
94528 // Handle the basic code points
94529 for (j = 0; j < inputLength; ++j) {
94530 currentValue = input[j];
94531 if (currentValue < 0x80) {
94532 output.push(stringFromCharCode(currentValue));
94533 }
94534 }
94535
94536 handledCPCount = basicLength = output.length;
94537
94538 // `handledCPCount` is the number of code points that have been handled;
94539 // `basicLength` is the number of basic code points.
94540
94541 // Finish the basic string - if it is not empty - with a delimiter
94542 if (basicLength) {
94543 output.push(delimiter);
94544 }
94545
94546 // Main encoding loop:
94547 while (handledCPCount < inputLength) {
94548
94549 // All non-basic code points < n have been handled already. Find the next
94550 // larger one:
94551 for (m = maxInt, j = 0; j < inputLength; ++j) {
94552 currentValue = input[j];
94553 if (currentValue >= n && currentValue < m) {
94554 m = currentValue;
94555 }
94556 }
94557
94558 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
94559 // but guard against overflow
94560 handledCPCountPlusOne = handledCPCount + 1;
94561 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
94562 error('overflow');
94563 }
94564
94565 delta += (m - n) * handledCPCountPlusOne;
94566 n = m;
94567
94568 for (j = 0; j < inputLength; ++j) {
94569 currentValue = input[j];
94570
94571 if (currentValue < n && ++delta > maxInt) {
94572 error('overflow');
94573 }
94574
94575 if (currentValue == n) {
94576 // Represent delta as a generalized variable-length integer
94577 for (q = delta, k = base; /* no condition */; k += base) {
94578 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
94579 if (q < t) {
94580 break;
94581 }
94582 qMinusT = q - t;
94583 baseMinusT = base - t;
94584 output.push(
94585 stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
94586 );
94587 q = floor(qMinusT / baseMinusT);
94588 }
94589
94590 output.push(stringFromCharCode(digitToBasic(q, 0)));
94591 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
94592 delta = 0;
94593 ++handledCPCount;
94594 }
94595 }
94596
94597 ++delta;
94598 ++n;
94599
94600 }
94601 return output.join('');
94602 }
94603
94604 /**
94605 * Converts a Punycode string representing a domain name or an email address
94606 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
94607 * it doesn't matter if you call it on a string that has already been
94608 * converted to Unicode.
94609 * @memberOf punycode
94610 * @param {String} input The Punycoded domain name or email address to
94611 * convert to Unicode.
94612 * @returns {String} The Unicode representation of the given Punycode
94613 * string.
94614 */
94615 function toUnicode(input) {
94616 return mapDomain(input, function(string) {
94617 return regexPunycode.test(string)
94618 ? decode(string.slice(4).toLowerCase())
94619 : string;
94620 });
94621 }
94622
94623 /**
94624 * Converts a Unicode string representing a domain name or an email address to
94625 * Punycode. Only the non-ASCII parts of the domain name will be converted,
94626 * i.e. it doesn't matter if you call it with a domain that's already in
94627 * ASCII.
94628 * @memberOf punycode
94629 * @param {String} input The domain name or email address to convert, as a
94630 * Unicode string.
94631 * @returns {String} The Punycode representation of the given domain name or
94632 * email address.
94633 */
94634 function toASCII(input) {
94635 return mapDomain(input, function(string) {
94636 return regexNonASCII.test(string)
94637 ? 'xn--' + encode(string)
94638 : string;
94639 });
94640 }
94641
94642 /*--------------------------------------------------------------------------*/
94643
94644 /** Define the public API */
94645 punycode = {
94646 /**
94647 * A string representing the current Punycode.js version number.
94648 * @memberOf punycode
94649 * @type String
94650 */
94651 'version': '1.4.1',
94652 /**
94653 * An object of methods to convert from JavaScript's internal character
94654 * representation (UCS-2) to Unicode code points, and back.
94655 * @see <https://mathiasbynens.be/notes/javascript-encoding>
94656 * @memberOf punycode
94657 * @type Object
94658 */
94659 'ucs2': {
94660 'decode': ucs2decode,
94661 'encode': ucs2encode
94662 },
94663 'decode': decode,
94664 'encode': encode,
94665 'toASCII': toASCII,
94666 'toUnicode': toUnicode
94667 };
94668
94669 /** Expose `punycode` */
94670 // Some AMD build optimizers, like r.js, check for specific condition patterns
94671 // like the following:
94672 if (
94673 typeof define == 'function' &&
94674 typeof define.amd == 'object' &&
94675 define.amd
94676 ) {
94677 define('punycode', function() {
94678 return punycode;
94679 });
94680 } else if (freeExports && freeModule) {
94681 if (module.exports == freeExports) {
94682 // in Node.js, io.js, or RingoJS v0.8.0+
94683 freeModule.exports = punycode;
94684 } else {
94685 // in Narwhal or RingoJS v0.7.0-
94686 for (key in punycode) {
94687 punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
94688 }
94689 }
94690 } else {
94691 // in Rhino or a web browser
94692 root.punycode = punycode;
94693 }
94694
94695}(this));
94696
94697}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
94698},{}],720:[function(require,module,exports){
94699var OPS = require('bitcoin-ops')
94700
94701function encodingLength (i) {
94702 return i < OPS.OP_PUSHDATA1 ? 1
94703 : i <= 0xff ? 2
94704 : i <= 0xffff ? 3
94705 : 5
94706}
94707
94708function encode (buffer, number, offset) {
94709 var size = encodingLength(number)
94710
94711 // ~6 bit
94712 if (size === 1) {
94713 buffer.writeUInt8(number, offset)
94714
94715 // 8 bit
94716 } else if (size === 2) {
94717 buffer.writeUInt8(OPS.OP_PUSHDATA1, offset)
94718 buffer.writeUInt8(number, offset + 1)
94719
94720 // 16 bit
94721 } else if (size === 3) {
94722 buffer.writeUInt8(OPS.OP_PUSHDATA2, offset)
94723 buffer.writeUInt16LE(number, offset + 1)
94724
94725 // 32 bit
94726 } else {
94727 buffer.writeUInt8(OPS.OP_PUSHDATA4, offset)
94728 buffer.writeUInt32LE(number, offset + 1)
94729 }
94730
94731 return size
94732}
94733
94734function decode (buffer, offset) {
94735 var opcode = buffer.readUInt8(offset)
94736 var number, size
94737
94738 // ~6 bit
94739 if (opcode < OPS.OP_PUSHDATA1) {
94740 number = opcode
94741 size = 1
94742
94743 // 8 bit
94744 } else if (opcode === OPS.OP_PUSHDATA1) {
94745 if (offset + 2 > buffer.length) return null
94746 number = buffer.readUInt8(offset + 1)
94747 size = 2
94748
94749 // 16 bit
94750 } else if (opcode === OPS.OP_PUSHDATA2) {
94751 if (offset + 3 > buffer.length) return null
94752 number = buffer.readUInt16LE(offset + 1)
94753 size = 3
94754
94755 // 32 bit
94756 } else {
94757 if (offset + 5 > buffer.length) return null
94758 if (opcode !== OPS.OP_PUSHDATA4) throw new Error('Unexpected opcode')
94759
94760 number = buffer.readUInt32LE(offset + 1)
94761 size = 5
94762 }
94763
94764 return {
94765 opcode: opcode,
94766 number: number,
94767 size: size
94768 }
94769}
94770
94771module.exports = {
94772 encodingLength: encodingLength,
94773 encode: encode,
94774 decode: decode
94775}
94776
94777},{"bitcoin-ops":69}],721:[function(require,module,exports){
94778// Copyright Joyent, Inc. and other Node contributors.
94779//
94780// Permission is hereby granted, free of charge, to any person obtaining a
94781// copy of this software and associated documentation files (the
94782// "Software"), to deal in the Software without restriction, including
94783// without limitation the rights to use, copy, modify, merge, publish,
94784// distribute, sublicense, and/or sell copies of the Software, and to permit
94785// persons to whom the Software is furnished to do so, subject to the
94786// following conditions:
94787//
94788// The above copyright notice and this permission notice shall be included
94789// in all copies or substantial portions of the Software.
94790//
94791// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
94792// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94793// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
94794// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
94795// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94796// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
94797// USE OR OTHER DEALINGS IN THE SOFTWARE.
94798
94799'use strict';
94800
94801// If obj.hasOwnProperty has been overridden, then calling
94802// obj.hasOwnProperty(prop) will break.
94803// See: https://github.com/joyent/node/issues/1707
94804function hasOwnProperty(obj, prop) {
94805 return Object.prototype.hasOwnProperty.call(obj, prop);
94806}
94807
94808module.exports = function(qs, sep, eq, options) {
94809 sep = sep || '&';
94810 eq = eq || '=';
94811 var obj = {};
94812
94813 if (typeof qs !== 'string' || qs.length === 0) {
94814 return obj;
94815 }
94816
94817 var regexp = /\+/g;
94818 qs = qs.split(sep);
94819
94820 var maxKeys = 1000;
94821 if (options && typeof options.maxKeys === 'number') {
94822 maxKeys = options.maxKeys;
94823 }
94824
94825 var len = qs.length;
94826 // maxKeys <= 0 means that we should not limit keys count
94827 if (maxKeys > 0 && len > maxKeys) {
94828 len = maxKeys;
94829 }
94830
94831 for (var i = 0; i < len; ++i) {
94832 var x = qs[i].replace(regexp, '%20'),
94833 idx = x.indexOf(eq),
94834 kstr, vstr, k, v;
94835
94836 if (idx >= 0) {
94837 kstr = x.substr(0, idx);
94838 vstr = x.substr(idx + 1);
94839 } else {
94840 kstr = x;
94841 vstr = '';
94842 }
94843
94844 k = decodeURIComponent(kstr);
94845 v = decodeURIComponent(vstr);
94846
94847 if (!hasOwnProperty(obj, k)) {
94848 obj[k] = v;
94849 } else if (isArray(obj[k])) {
94850 obj[k].push(v);
94851 } else {
94852 obj[k] = [obj[k], v];
94853 }
94854 }
94855
94856 return obj;
94857};
94858
94859var isArray = Array.isArray || function (xs) {
94860 return Object.prototype.toString.call(xs) === '[object Array]';
94861};
94862
94863},{}],722:[function(require,module,exports){
94864// Copyright Joyent, Inc. and other Node contributors.
94865//
94866// Permission is hereby granted, free of charge, to any person obtaining a
94867// copy of this software and associated documentation files (the
94868// "Software"), to deal in the Software without restriction, including
94869// without limitation the rights to use, copy, modify, merge, publish,
94870// distribute, sublicense, and/or sell copies of the Software, and to permit
94871// persons to whom the Software is furnished to do so, subject to the
94872// following conditions:
94873//
94874// The above copyright notice and this permission notice shall be included
94875// in all copies or substantial portions of the Software.
94876//
94877// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
94878// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94879// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
94880// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
94881// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94882// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
94883// USE OR OTHER DEALINGS IN THE SOFTWARE.
94884
94885'use strict';
94886
94887var stringifyPrimitive = function(v) {
94888 switch (typeof v) {
94889 case 'string':
94890 return v;
94891
94892 case 'boolean':
94893 return v ? 'true' : 'false';
94894
94895 case 'number':
94896 return isFinite(v) ? v : '';
94897
94898 default:
94899 return '';
94900 }
94901};
94902
94903module.exports = function(obj, sep, eq, name) {
94904 sep = sep || '&';
94905 eq = eq || '=';
94906 if (obj === null) {
94907 obj = undefined;
94908 }
94909
94910 if (typeof obj === 'object') {
94911 return map(objectKeys(obj), function(k) {
94912 var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
94913 if (isArray(obj[k])) {
94914 return map(obj[k], function(v) {
94915 return ks + encodeURIComponent(stringifyPrimitive(v));
94916 }).join(sep);
94917 } else {
94918 return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
94919 }
94920 }).join(sep);
94921
94922 }
94923
94924 if (!name) return '';
94925 return encodeURIComponent(stringifyPrimitive(name)) + eq +
94926 encodeURIComponent(stringifyPrimitive(obj));
94927};
94928
94929var isArray = Array.isArray || function (xs) {
94930 return Object.prototype.toString.call(xs) === '[object Array]';
94931};
94932
94933function map (xs, f) {
94934 if (xs.map) return xs.map(f);
94935 var res = [];
94936 for (var i = 0; i < xs.length; i++) {
94937 res.push(f(xs[i], i));
94938 }
94939 return res;
94940}
94941
94942var objectKeys = Object.keys || function (obj) {
94943 var res = [];
94944 for (var key in obj) {
94945 if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
94946 }
94947 return res;
94948};
94949
94950},{}],723:[function(require,module,exports){
94951'use strict';
94952
94953exports.decode = exports.parse = require('./decode');
94954exports.encode = exports.stringify = require('./encode');
94955
94956},{"./decode":721,"./encode":722}],724:[function(require,module,exports){
94957(function (process,global){
94958'use strict'
94959
94960// limit of Crypto.getRandomValues()
94961// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
94962var MAX_BYTES = 65536
94963
94964// Node supports requesting up to this number of bytes
94965// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
94966var MAX_UINT32 = 4294967295
94967
94968function oldBrowser () {
94969 throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
94970}
94971
94972var Buffer = require('safe-buffer').Buffer
94973var crypto = global.crypto || global.msCrypto
94974
94975if (crypto && crypto.getRandomValues) {
94976 module.exports = randomBytes
94977} else {
94978 module.exports = oldBrowser
94979}
94980
94981function randomBytes (size, cb) {
94982 // phantomjs needs to throw
94983 if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
94984
94985 var bytes = Buffer.allocUnsafe(size)
94986
94987 if (size > 0) { // getRandomValues fails on IE if size == 0
94988 if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
94989 // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
94990 for (var generated = 0; generated < size; generated += MAX_BYTES) {
94991 // buffer.slice automatically checks if the end is past the end of
94992 // the buffer so we don't have to here
94993 crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
94994 }
94995 } else {
94996 crypto.getRandomValues(bytes)
94997 }
94998 }
94999
95000 if (typeof cb === 'function') {
95001 return process.nextTick(function () {
95002 cb(null, bytes)
95003 })
95004 }
95005
95006 return bytes
95007}
95008
95009}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
95010},{"_process":678,"safe-buffer":742}],725:[function(require,module,exports){
95011(function (process,global){
95012'use strict'
95013
95014function oldBrowser () {
95015 throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
95016}
95017var safeBuffer = require('safe-buffer')
95018var randombytes = require('randombytes')
95019var Buffer = safeBuffer.Buffer
95020var kBufferMaxLength = safeBuffer.kMaxLength
95021var crypto = global.crypto || global.msCrypto
95022var kMaxUint32 = Math.pow(2, 32) - 1
95023function assertOffset (offset, length) {
95024 if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare
95025 throw new TypeError('offset must be a number')
95026 }
95027
95028 if (offset > kMaxUint32 || offset < 0) {
95029 throw new TypeError('offset must be a uint32')
95030 }
95031
95032 if (offset > kBufferMaxLength || offset > length) {
95033 throw new RangeError('offset out of range')
95034 }
95035}
95036
95037function assertSize (size, offset, length) {
95038 if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare
95039 throw new TypeError('size must be a number')
95040 }
95041
95042 if (size > kMaxUint32 || size < 0) {
95043 throw new TypeError('size must be a uint32')
95044 }
95045
95046 if (size + offset > length || size > kBufferMaxLength) {
95047 throw new RangeError('buffer too small')
95048 }
95049}
95050if ((crypto && crypto.getRandomValues) || !process.browser) {
95051 exports.randomFill = randomFill
95052 exports.randomFillSync = randomFillSync
95053} else {
95054 exports.randomFill = oldBrowser
95055 exports.randomFillSync = oldBrowser
95056}
95057function randomFill (buf, offset, size, cb) {
95058 if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
95059 throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
95060 }
95061
95062 if (typeof offset === 'function') {
95063 cb = offset
95064 offset = 0
95065 size = buf.length
95066 } else if (typeof size === 'function') {
95067 cb = size
95068 size = buf.length - offset
95069 } else if (typeof cb !== 'function') {
95070 throw new TypeError('"cb" argument must be a function')
95071 }
95072 assertOffset(offset, buf.length)
95073 assertSize(size, offset, buf.length)
95074 return actualFill(buf, offset, size, cb)
95075}
95076
95077function actualFill (buf, offset, size, cb) {
95078 if (process.browser) {
95079 var ourBuf = buf.buffer
95080 var uint = new Uint8Array(ourBuf, offset, size)
95081 crypto.getRandomValues(uint)
95082 if (cb) {
95083 process.nextTick(function () {
95084 cb(null, buf)
95085 })
95086 return
95087 }
95088 return buf
95089 }
95090 if (cb) {
95091 randombytes(size, function (err, bytes) {
95092 if (err) {
95093 return cb(err)
95094 }
95095 bytes.copy(buf, offset)
95096 cb(null, buf)
95097 })
95098 return
95099 }
95100 var bytes = randombytes(size)
95101 bytes.copy(buf, offset)
95102 return buf
95103}
95104function randomFillSync (buf, offset, size) {
95105 if (typeof offset === 'undefined') {
95106 offset = 0
95107 }
95108 if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
95109 throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
95110 }
95111
95112 assertOffset(offset, buf.length)
95113
95114 if (size === undefined) size = buf.length - offset
95115
95116 assertSize(size, offset, buf.length)
95117
95118 return actualFill(buf, offset, size)
95119}
95120
95121}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
95122},{"_process":678,"randombytes":724,"safe-buffer":742}],726:[function(require,module,exports){
95123module.exports = require('./lib/_stream_duplex.js');
95124
95125},{"./lib/_stream_duplex.js":727}],727:[function(require,module,exports){
95126// Copyright Joyent, Inc. and other Node contributors.
95127//
95128// Permission is hereby granted, free of charge, to any person obtaining a
95129// copy of this software and associated documentation files (the
95130// "Software"), to deal in the Software without restriction, including
95131// without limitation the rights to use, copy, modify, merge, publish,
95132// distribute, sublicense, and/or sell copies of the Software, and to permit
95133// persons to whom the Software is furnished to do so, subject to the
95134// following conditions:
95135//
95136// The above copyright notice and this permission notice shall be included
95137// in all copies or substantial portions of the Software.
95138//
95139// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
95140// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
95141// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
95142// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
95143// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
95144// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95145// USE OR OTHER DEALINGS IN THE SOFTWARE.
95146
95147// a duplex stream is just a stream that is both readable and writable.
95148// Since JS doesn't have multiple prototypal inheritance, this class
95149// prototypally inherits from Readable, and then parasitically from
95150// Writable.
95151
95152'use strict';
95153
95154/*<replacement>*/
95155
95156var pna = require('process-nextick-args');
95157/*</replacement>*/
95158
95159/*<replacement>*/
95160var objectKeys = Object.keys || function (obj) {
95161 var keys = [];
95162 for (var key in obj) {
95163 keys.push(key);
95164 }return keys;
95165};
95166/*</replacement>*/
95167
95168module.exports = Duplex;
95169
95170/*<replacement>*/
95171var util = require('core-util-is');
95172util.inherits = require('inherits');
95173/*</replacement>*/
95174
95175var Readable = require('./_stream_readable');
95176var Writable = require('./_stream_writable');
95177
95178util.inherits(Duplex, Readable);
95179
95180{
95181 // avoid scope creep, the keys array can then be collected
95182 var keys = objectKeys(Writable.prototype);
95183 for (var v = 0; v < keys.length; v++) {
95184 var method = keys[v];
95185 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
95186 }
95187}
95188
95189function Duplex(options) {
95190 if (!(this instanceof Duplex)) return new Duplex(options);
95191
95192 Readable.call(this, options);
95193 Writable.call(this, options);
95194
95195 if (options && options.readable === false) this.readable = false;
95196
95197 if (options && options.writable === false) this.writable = false;
95198
95199 this.allowHalfOpen = true;
95200 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
95201
95202 this.once('end', onend);
95203}
95204
95205Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
95206 // making it explicit this property is not enumerable
95207 // because otherwise some prototype manipulation in
95208 // userland will fail
95209 enumerable: false,
95210 get: function () {
95211 return this._writableState.highWaterMark;
95212 }
95213});
95214
95215// the no-half-open enforcer
95216function onend() {
95217 // if we allow half-open state, or if the writable side ended,
95218 // then we're ok.
95219 if (this.allowHalfOpen || this._writableState.ended) return;
95220
95221 // no more data can be written.
95222 // But allow more writes to happen in this tick.
95223 pna.nextTick(onEndNT, this);
95224}
95225
95226function onEndNT(self) {
95227 self.end();
95228}
95229
95230Object.defineProperty(Duplex.prototype, 'destroyed', {
95231 get: function () {
95232 if (this._readableState === undefined || this._writableState === undefined) {
95233 return false;
95234 }
95235 return this._readableState.destroyed && this._writableState.destroyed;
95236 },
95237 set: function (value) {
95238 // we ignore the value if the stream
95239 // has not been initialized yet
95240 if (this._readableState === undefined || this._writableState === undefined) {
95241 return;
95242 }
95243
95244 // backward compatibility, the user is explicitly
95245 // managing destroyed
95246 this._readableState.destroyed = value;
95247 this._writableState.destroyed = value;
95248 }
95249});
95250
95251Duplex.prototype._destroy = function (err, cb) {
95252 this.push(null);
95253 this.end();
95254
95255 pna.nextTick(cb, err);
95256};
95257},{"./_stream_readable":729,"./_stream_writable":731,"core-util-is":223,"inherits":396,"process-nextick-args":677}],728:[function(require,module,exports){
95258// Copyright Joyent, Inc. and other Node contributors.
95259//
95260// Permission is hereby granted, free of charge, to any person obtaining a
95261// copy of this software and associated documentation files (the
95262// "Software"), to deal in the Software without restriction, including
95263// without limitation the rights to use, copy, modify, merge, publish,
95264// distribute, sublicense, and/or sell copies of the Software, and to permit
95265// persons to whom the Software is furnished to do so, subject to the
95266// following conditions:
95267//
95268// The above copyright notice and this permission notice shall be included
95269// in all copies or substantial portions of the Software.
95270//
95271// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
95272// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
95273// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
95274// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
95275// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
95276// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95277// USE OR OTHER DEALINGS IN THE SOFTWARE.
95278
95279// a passthrough stream.
95280// basically just the most minimal sort of Transform stream.
95281// Every written chunk gets output as-is.
95282
95283'use strict';
95284
95285module.exports = PassThrough;
95286
95287var Transform = require('./_stream_transform');
95288
95289/*<replacement>*/
95290var util = require('core-util-is');
95291util.inherits = require('inherits');
95292/*</replacement>*/
95293
95294util.inherits(PassThrough, Transform);
95295
95296function PassThrough(options) {
95297 if (!(this instanceof PassThrough)) return new PassThrough(options);
95298
95299 Transform.call(this, options);
95300}
95301
95302PassThrough.prototype._transform = function (chunk, encoding, cb) {
95303 cb(null, chunk);
95304};
95305},{"./_stream_transform":730,"core-util-is":223,"inherits":396}],729:[function(require,module,exports){
95306(function (process,global){
95307// Copyright Joyent, Inc. and other Node contributors.
95308//
95309// Permission is hereby granted, free of charge, to any person obtaining a
95310// copy of this software and associated documentation files (the
95311// "Software"), to deal in the Software without restriction, including
95312// without limitation the rights to use, copy, modify, merge, publish,
95313// distribute, sublicense, and/or sell copies of the Software, and to permit
95314// persons to whom the Software is furnished to do so, subject to the
95315// following conditions:
95316//
95317// The above copyright notice and this permission notice shall be included
95318// in all copies or substantial portions of the Software.
95319//
95320// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
95321// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
95322// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
95323// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
95324// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
95325// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95326// USE OR OTHER DEALINGS IN THE SOFTWARE.
95327
95328'use strict';
95329
95330/*<replacement>*/
95331
95332var pna = require('process-nextick-args');
95333/*</replacement>*/
95334
95335module.exports = Readable;
95336
95337/*<replacement>*/
95338var isArray = require('isarray');
95339/*</replacement>*/
95340
95341/*<replacement>*/
95342var Duplex;
95343/*</replacement>*/
95344
95345Readable.ReadableState = ReadableState;
95346
95347/*<replacement>*/
95348var EE = require('events').EventEmitter;
95349
95350var EElistenerCount = function (emitter, type) {
95351 return emitter.listeners(type).length;
95352};
95353/*</replacement>*/
95354
95355/*<replacement>*/
95356var Stream = require('./internal/streams/stream');
95357/*</replacement>*/
95358
95359/*<replacement>*/
95360
95361var Buffer = require('safe-buffer').Buffer;
95362var OurUint8Array = global.Uint8Array || function () {};
95363function _uint8ArrayToBuffer(chunk) {
95364 return Buffer.from(chunk);
95365}
95366function _isUint8Array(obj) {
95367 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
95368}
95369
95370/*</replacement>*/
95371
95372/*<replacement>*/
95373var util = require('core-util-is');
95374util.inherits = require('inherits');
95375/*</replacement>*/
95376
95377/*<replacement>*/
95378var debugUtil = require('util');
95379var debug = void 0;
95380if (debugUtil && debugUtil.debuglog) {
95381 debug = debugUtil.debuglog('stream');
95382} else {
95383 debug = function () {};
95384}
95385/*</replacement>*/
95386
95387var BufferList = require('./internal/streams/BufferList');
95388var destroyImpl = require('./internal/streams/destroy');
95389var StringDecoder;
95390
95391util.inherits(Readable, Stream);
95392
95393var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
95394
95395function prependListener(emitter, event, fn) {
95396 // Sadly this is not cacheable as some libraries bundle their own
95397 // event emitter implementation with them.
95398 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
95399
95400 // This is a hack to make sure that our error handler is attached before any
95401 // userland ones. NEVER DO THIS. This is here only because this code needs
95402 // to continue to work with older versions of Node.js that do not include
95403 // the prependListener() method. The goal is to eventually remove this hack.
95404 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
95405}
95406
95407function ReadableState(options, stream) {
95408 Duplex = Duplex || require('./_stream_duplex');
95409
95410 options = options || {};
95411
95412 // Duplex streams are both readable and writable, but share
95413 // the same options object.
95414 // However, some cases require setting options to different
95415 // values for the readable and the writable sides of the duplex stream.
95416 // These options can be provided separately as readableXXX and writableXXX.
95417 var isDuplex = stream instanceof Duplex;
95418
95419 // object stream flag. Used to make read(n) ignore n and to
95420 // make all the buffer merging and length checks go away
95421 this.objectMode = !!options.objectMode;
95422
95423 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
95424
95425 // the point at which it stops calling _read() to fill the buffer
95426 // Note: 0 is a valid value, means "don't call _read preemptively ever"
95427 var hwm = options.highWaterMark;
95428 var readableHwm = options.readableHighWaterMark;
95429 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
95430
95431 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
95432
95433 // cast to ints.
95434 this.highWaterMark = Math.floor(this.highWaterMark);
95435
95436 // A linked list is used to store data chunks instead of an array because the
95437 // linked list can remove elements from the beginning faster than
95438 // array.shift()
95439 this.buffer = new BufferList();
95440 this.length = 0;
95441 this.pipes = null;
95442 this.pipesCount = 0;
95443 this.flowing = null;
95444 this.ended = false;
95445 this.endEmitted = false;
95446 this.reading = false;
95447
95448 // a flag to be able to tell if the event 'readable'/'data' is emitted
95449 // immediately, or on a later tick. We set this to true at first, because
95450 // any actions that shouldn't happen until "later" should generally also
95451 // not happen before the first read call.
95452 this.sync = true;
95453
95454 // whenever we return null, then we set a flag to say
95455 // that we're awaiting a 'readable' event emission.
95456 this.needReadable = false;
95457 this.emittedReadable = false;
95458 this.readableListening = false;
95459 this.resumeScheduled = false;
95460
95461 // has it been destroyed
95462 this.destroyed = false;
95463
95464 // Crypto is kind of old and crusty. Historically, its default string
95465 // encoding is 'binary' so we have to make this configurable.
95466 // Everything else in the universe uses 'utf8', though.
95467 this.defaultEncoding = options.defaultEncoding || 'utf8';
95468
95469 // the number of writers that are awaiting a drain event in .pipe()s
95470 this.awaitDrain = 0;
95471
95472 // if true, a maybeReadMore has been scheduled
95473 this.readingMore = false;
95474
95475 this.decoder = null;
95476 this.encoding = null;
95477 if (options.encoding) {
95478 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
95479 this.decoder = new StringDecoder(options.encoding);
95480 this.encoding = options.encoding;
95481 }
95482}
95483
95484function Readable(options) {
95485 Duplex = Duplex || require('./_stream_duplex');
95486
95487 if (!(this instanceof Readable)) return new Readable(options);
95488
95489 this._readableState = new ReadableState(options, this);
95490
95491 // legacy
95492 this.readable = true;
95493
95494 if (options) {
95495 if (typeof options.read === 'function') this._read = options.read;
95496
95497 if (typeof options.destroy === 'function') this._destroy = options.destroy;
95498 }
95499
95500 Stream.call(this);
95501}
95502
95503Object.defineProperty(Readable.prototype, 'destroyed', {
95504 get: function () {
95505 if (this._readableState === undefined) {
95506 return false;
95507 }
95508 return this._readableState.destroyed;
95509 },
95510 set: function (value) {
95511 // we ignore the value if the stream
95512 // has not been initialized yet
95513 if (!this._readableState) {
95514 return;
95515 }
95516
95517 // backward compatibility, the user is explicitly
95518 // managing destroyed
95519 this._readableState.destroyed = value;
95520 }
95521});
95522
95523Readable.prototype.destroy = destroyImpl.destroy;
95524Readable.prototype._undestroy = destroyImpl.undestroy;
95525Readable.prototype._destroy = function (err, cb) {
95526 this.push(null);
95527 cb(err);
95528};
95529
95530// Manually shove something into the read() buffer.
95531// This returns true if the highWaterMark has not been hit yet,
95532// similar to how Writable.write() returns true if you should
95533// write() some more.
95534Readable.prototype.push = function (chunk, encoding) {
95535 var state = this._readableState;
95536 var skipChunkCheck;
95537
95538 if (!state.objectMode) {
95539 if (typeof chunk === 'string') {
95540 encoding = encoding || state.defaultEncoding;
95541 if (encoding !== state.encoding) {
95542 chunk = Buffer.from(chunk, encoding);
95543 encoding = '';
95544 }
95545 skipChunkCheck = true;
95546 }
95547 } else {
95548 skipChunkCheck = true;
95549 }
95550
95551 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
95552};
95553
95554// Unshift should *always* be something directly out of read()
95555Readable.prototype.unshift = function (chunk) {
95556 return readableAddChunk(this, chunk, null, true, false);
95557};
95558
95559function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
95560 var state = stream._readableState;
95561 if (chunk === null) {
95562 state.reading = false;
95563 onEofChunk(stream, state);
95564 } else {
95565 var er;
95566 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
95567 if (er) {
95568 stream.emit('error', er);
95569 } else if (state.objectMode || chunk && chunk.length > 0) {
95570 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
95571 chunk = _uint8ArrayToBuffer(chunk);
95572 }
95573
95574 if (addToFront) {
95575 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
95576 } else if (state.ended) {
95577 stream.emit('error', new Error('stream.push() after EOF'));
95578 } else {
95579 state.reading = false;
95580 if (state.decoder && !encoding) {
95581 chunk = state.decoder.write(chunk);
95582 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
95583 } else {
95584 addChunk(stream, state, chunk, false);
95585 }
95586 }
95587 } else if (!addToFront) {
95588 state.reading = false;
95589 }
95590 }
95591
95592 return needMoreData(state);
95593}
95594
95595function addChunk(stream, state, chunk, addToFront) {
95596 if (state.flowing && state.length === 0 && !state.sync) {
95597 stream.emit('data', chunk);
95598 stream.read(0);
95599 } else {
95600 // update the buffer info.
95601 state.length += state.objectMode ? 1 : chunk.length;
95602 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
95603
95604 if (state.needReadable) emitReadable(stream);
95605 }
95606 maybeReadMore(stream, state);
95607}
95608
95609function chunkInvalid(state, chunk) {
95610 var er;
95611 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
95612 er = new TypeError('Invalid non-string/buffer chunk');
95613 }
95614 return er;
95615}
95616
95617// if it's past the high water mark, we can push in some more.
95618// Also, if we have no data yet, we can stand some
95619// more bytes. This is to work around cases where hwm=0,
95620// such as the repl. Also, if the push() triggered a
95621// readable event, and the user called read(largeNumber) such that
95622// needReadable was set, then we ought to push more, so that another
95623// 'readable' event will be triggered.
95624function needMoreData(state) {
95625 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
95626}
95627
95628Readable.prototype.isPaused = function () {
95629 return this._readableState.flowing === false;
95630};
95631
95632// backwards compatibility.
95633Readable.prototype.setEncoding = function (enc) {
95634 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
95635 this._readableState.decoder = new StringDecoder(enc);
95636 this._readableState.encoding = enc;
95637 return this;
95638};
95639
95640// Don't raise the hwm > 8MB
95641var MAX_HWM = 0x800000;
95642function computeNewHighWaterMark(n) {
95643 if (n >= MAX_HWM) {
95644 n = MAX_HWM;
95645 } else {
95646 // Get the next highest power of 2 to prevent increasing hwm excessively in
95647 // tiny amounts
95648 n--;
95649 n |= n >>> 1;
95650 n |= n >>> 2;
95651 n |= n >>> 4;
95652 n |= n >>> 8;
95653 n |= n >>> 16;
95654 n++;
95655 }
95656 return n;
95657}
95658
95659// This function is designed to be inlinable, so please take care when making
95660// changes to the function body.
95661function howMuchToRead(n, state) {
95662 if (n <= 0 || state.length === 0 && state.ended) return 0;
95663 if (state.objectMode) return 1;
95664 if (n !== n) {
95665 // Only flow one buffer at a time
95666 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
95667 }
95668 // If we're asking for more than the current hwm, then raise the hwm.
95669 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
95670 if (n <= state.length) return n;
95671 // Don't have enough
95672 if (!state.ended) {
95673 state.needReadable = true;
95674 return 0;
95675 }
95676 return state.length;
95677}
95678
95679// you can override either this method, or the async _read(n) below.
95680Readable.prototype.read = function (n) {
95681 debug('read', n);
95682 n = parseInt(n, 10);
95683 var state = this._readableState;
95684 var nOrig = n;
95685
95686 if (n !== 0) state.emittedReadable = false;
95687
95688 // if we're doing read(0) to trigger a readable event, but we
95689 // already have a bunch of data in the buffer, then just trigger
95690 // the 'readable' event and move on.
95691 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
95692 debug('read: emitReadable', state.length, state.ended);
95693 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
95694 return null;
95695 }
95696
95697 n = howMuchToRead(n, state);
95698
95699 // if we've ended, and we're now clear, then finish it up.
95700 if (n === 0 && state.ended) {
95701 if (state.length === 0) endReadable(this);
95702 return null;
95703 }
95704
95705 // All the actual chunk generation logic needs to be
95706 // *below* the call to _read. The reason is that in certain
95707 // synthetic stream cases, such as passthrough streams, _read
95708 // may be a completely synchronous operation which may change
95709 // the state of the read buffer, providing enough data when
95710 // before there was *not* enough.
95711 //
95712 // So, the steps are:
95713 // 1. Figure out what the state of things will be after we do
95714 // a read from the buffer.
95715 //
95716 // 2. If that resulting state will trigger a _read, then call _read.
95717 // Note that this may be asynchronous, or synchronous. Yes, it is
95718 // deeply ugly to write APIs this way, but that still doesn't mean
95719 // that the Readable class should behave improperly, as streams are
95720 // designed to be sync/async agnostic.
95721 // Take note if the _read call is sync or async (ie, if the read call
95722 // has returned yet), so that we know whether or not it's safe to emit
95723 // 'readable' etc.
95724 //
95725 // 3. Actually pull the requested chunks out of the buffer and return.
95726
95727 // if we need a readable event, then we need to do some reading.
95728 var doRead = state.needReadable;
95729 debug('need readable', doRead);
95730
95731 // if we currently have less than the highWaterMark, then also read some
95732 if (state.length === 0 || state.length - n < state.highWaterMark) {
95733 doRead = true;
95734 debug('length less than watermark', doRead);
95735 }
95736
95737 // however, if we've ended, then there's no point, and if we're already
95738 // reading, then it's unnecessary.
95739 if (state.ended || state.reading) {
95740 doRead = false;
95741 debug('reading or ended', doRead);
95742 } else if (doRead) {
95743 debug('do read');
95744 state.reading = true;
95745 state.sync = true;
95746 // if the length is currently zero, then we *need* a readable event.
95747 if (state.length === 0) state.needReadable = true;
95748 // call internal read method
95749 this._read(state.highWaterMark);
95750 state.sync = false;
95751 // If _read pushed data synchronously, then `reading` will be false,
95752 // and we need to re-evaluate how much data we can return to the user.
95753 if (!state.reading) n = howMuchToRead(nOrig, state);
95754 }
95755
95756 var ret;
95757 if (n > 0) ret = fromList(n, state);else ret = null;
95758
95759 if (ret === null) {
95760 state.needReadable = true;
95761 n = 0;
95762 } else {
95763 state.length -= n;
95764 }
95765
95766 if (state.length === 0) {
95767 // If we have nothing in the buffer, then we want to know
95768 // as soon as we *do* get something into the buffer.
95769 if (!state.ended) state.needReadable = true;
95770
95771 // If we tried to read() past the EOF, then emit end on the next tick.
95772 if (nOrig !== n && state.ended) endReadable(this);
95773 }
95774
95775 if (ret !== null) this.emit('data', ret);
95776
95777 return ret;
95778};
95779
95780function onEofChunk(stream, state) {
95781 if (state.ended) return;
95782 if (state.decoder) {
95783 var chunk = state.decoder.end();
95784 if (chunk && chunk.length) {
95785 state.buffer.push(chunk);
95786 state.length += state.objectMode ? 1 : chunk.length;
95787 }
95788 }
95789 state.ended = true;
95790
95791 // emit 'readable' now to make sure it gets picked up.
95792 emitReadable(stream);
95793}
95794
95795// Don't emit readable right away in sync mode, because this can trigger
95796// another read() call => stack overflow. This way, it might trigger
95797// a nextTick recursion warning, but that's not so bad.
95798function emitReadable(stream) {
95799 var state = stream._readableState;
95800 state.needReadable = false;
95801 if (!state.emittedReadable) {
95802 debug('emitReadable', state.flowing);
95803 state.emittedReadable = true;
95804 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
95805 }
95806}
95807
95808function emitReadable_(stream) {
95809 debug('emit readable');
95810 stream.emit('readable');
95811 flow(stream);
95812}
95813
95814// at this point, the user has presumably seen the 'readable' event,
95815// and called read() to consume some data. that may have triggered
95816// in turn another _read(n) call, in which case reading = true if
95817// it's in progress.
95818// However, if we're not ended, or reading, and the length < hwm,
95819// then go ahead and try to read some more preemptively.
95820function maybeReadMore(stream, state) {
95821 if (!state.readingMore) {
95822 state.readingMore = true;
95823 pna.nextTick(maybeReadMore_, stream, state);
95824 }
95825}
95826
95827function maybeReadMore_(stream, state) {
95828 var len = state.length;
95829 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
95830 debug('maybeReadMore read 0');
95831 stream.read(0);
95832 if (len === state.length)
95833 // didn't get any data, stop spinning.
95834 break;else len = state.length;
95835 }
95836 state.readingMore = false;
95837}
95838
95839// abstract method. to be overridden in specific implementation classes.
95840// call cb(er, data) where data is <= n in length.
95841// for virtual (non-string, non-buffer) streams, "length" is somewhat
95842// arbitrary, and perhaps not very meaningful.
95843Readable.prototype._read = function (n) {
95844 this.emit('error', new Error('_read() is not implemented'));
95845};
95846
95847Readable.prototype.pipe = function (dest, pipeOpts) {
95848 var src = this;
95849 var state = this._readableState;
95850
95851 switch (state.pipesCount) {
95852 case 0:
95853 state.pipes = dest;
95854 break;
95855 case 1:
95856 state.pipes = [state.pipes, dest];
95857 break;
95858 default:
95859 state.pipes.push(dest);
95860 break;
95861 }
95862 state.pipesCount += 1;
95863 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
95864
95865 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
95866
95867 var endFn = doEnd ? onend : unpipe;
95868 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
95869
95870 dest.on('unpipe', onunpipe);
95871 function onunpipe(readable, unpipeInfo) {
95872 debug('onunpipe');
95873 if (readable === src) {
95874 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
95875 unpipeInfo.hasUnpiped = true;
95876 cleanup();
95877 }
95878 }
95879 }
95880
95881 function onend() {
95882 debug('onend');
95883 dest.end();
95884 }
95885
95886 // when the dest drains, it reduces the awaitDrain counter
95887 // on the source. This would be more elegant with a .once()
95888 // handler in flow(), but adding and removing repeatedly is
95889 // too slow.
95890 var ondrain = pipeOnDrain(src);
95891 dest.on('drain', ondrain);
95892
95893 var cleanedUp = false;
95894 function cleanup() {
95895 debug('cleanup');
95896 // cleanup event handlers once the pipe is broken
95897 dest.removeListener('close', onclose);
95898 dest.removeListener('finish', onfinish);
95899 dest.removeListener('drain', ondrain);
95900 dest.removeListener('error', onerror);
95901 dest.removeListener('unpipe', onunpipe);
95902 src.removeListener('end', onend);
95903 src.removeListener('end', unpipe);
95904 src.removeListener('data', ondata);
95905
95906 cleanedUp = true;
95907
95908 // if the reader is waiting for a drain event from this
95909 // specific writer, then it would cause it to never start
95910 // flowing again.
95911 // So, if this is awaiting a drain, then we just call it now.
95912 // If we don't know, then assume that we are waiting for one.
95913 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
95914 }
95915
95916 // If the user pushes more data while we're writing to dest then we'll end up
95917 // in ondata again. However, we only want to increase awaitDrain once because
95918 // dest will only emit one 'drain' event for the multiple writes.
95919 // => Introduce a guard on increasing awaitDrain.
95920 var increasedAwaitDrain = false;
95921 src.on('data', ondata);
95922 function ondata(chunk) {
95923 debug('ondata');
95924 increasedAwaitDrain = false;
95925 var ret = dest.write(chunk);
95926 if (false === ret && !increasedAwaitDrain) {
95927 // If the user unpiped during `dest.write()`, it is possible
95928 // to get stuck in a permanently paused state if that write
95929 // also returned false.
95930 // => Check whether `dest` is still a piping destination.
95931 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
95932 debug('false write response, pause', src._readableState.awaitDrain);
95933 src._readableState.awaitDrain++;
95934 increasedAwaitDrain = true;
95935 }
95936 src.pause();
95937 }
95938 }
95939
95940 // if the dest has an error, then stop piping into it.
95941 // however, don't suppress the throwing behavior for this.
95942 function onerror(er) {
95943 debug('onerror', er);
95944 unpipe();
95945 dest.removeListener('error', onerror);
95946 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
95947 }
95948
95949 // Make sure our error handler is attached before userland ones.
95950 prependListener(dest, 'error', onerror);
95951
95952 // Both close and finish should trigger unpipe, but only once.
95953 function onclose() {
95954 dest.removeListener('finish', onfinish);
95955 unpipe();
95956 }
95957 dest.once('close', onclose);
95958 function onfinish() {
95959 debug('onfinish');
95960 dest.removeListener('close', onclose);
95961 unpipe();
95962 }
95963 dest.once('finish', onfinish);
95964
95965 function unpipe() {
95966 debug('unpipe');
95967 src.unpipe(dest);
95968 }
95969
95970 // tell the dest that it's being piped to
95971 dest.emit('pipe', src);
95972
95973 // start the flow if it hasn't been started already.
95974 if (!state.flowing) {
95975 debug('pipe resume');
95976 src.resume();
95977 }
95978
95979 return dest;
95980};
95981
95982function pipeOnDrain(src) {
95983 return function () {
95984 var state = src._readableState;
95985 debug('pipeOnDrain', state.awaitDrain);
95986 if (state.awaitDrain) state.awaitDrain--;
95987 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
95988 state.flowing = true;
95989 flow(src);
95990 }
95991 };
95992}
95993
95994Readable.prototype.unpipe = function (dest) {
95995 var state = this._readableState;
95996 var unpipeInfo = { hasUnpiped: false };
95997
95998 // if we're not piping anywhere, then do nothing.
95999 if (state.pipesCount === 0) return this;
96000
96001 // just one destination. most common case.
96002 if (state.pipesCount === 1) {
96003 // passed in one, but it's not the right one.
96004 if (dest && dest !== state.pipes) return this;
96005
96006 if (!dest) dest = state.pipes;
96007
96008 // got a match.
96009 state.pipes = null;
96010 state.pipesCount = 0;
96011 state.flowing = false;
96012 if (dest) dest.emit('unpipe', this, unpipeInfo);
96013 return this;
96014 }
96015
96016 // slow case. multiple pipe destinations.
96017
96018 if (!dest) {
96019 // remove all.
96020 var dests = state.pipes;
96021 var len = state.pipesCount;
96022 state.pipes = null;
96023 state.pipesCount = 0;
96024 state.flowing = false;
96025
96026 for (var i = 0; i < len; i++) {
96027 dests[i].emit('unpipe', this, unpipeInfo);
96028 }return this;
96029 }
96030
96031 // try to find the right one.
96032 var index = indexOf(state.pipes, dest);
96033 if (index === -1) return this;
96034
96035 state.pipes.splice(index, 1);
96036 state.pipesCount -= 1;
96037 if (state.pipesCount === 1) state.pipes = state.pipes[0];
96038
96039 dest.emit('unpipe', this, unpipeInfo);
96040
96041 return this;
96042};
96043
96044// set up data events if they are asked for
96045// Ensure readable listeners eventually get something
96046Readable.prototype.on = function (ev, fn) {
96047 var res = Stream.prototype.on.call(this, ev, fn);
96048
96049 if (ev === 'data') {
96050 // Start flowing on next tick if stream isn't explicitly paused
96051 if (this._readableState.flowing !== false) this.resume();
96052 } else if (ev === 'readable') {
96053 var state = this._readableState;
96054 if (!state.endEmitted && !state.readableListening) {
96055 state.readableListening = state.needReadable = true;
96056 state.emittedReadable = false;
96057 if (!state.reading) {
96058 pna.nextTick(nReadingNextTick, this);
96059 } else if (state.length) {
96060 emitReadable(this);
96061 }
96062 }
96063 }
96064
96065 return res;
96066};
96067Readable.prototype.addListener = Readable.prototype.on;
96068
96069function nReadingNextTick(self) {
96070 debug('readable nexttick read 0');
96071 self.read(0);
96072}
96073
96074// pause() and resume() are remnants of the legacy readable stream API
96075// If the user uses them, then switch into old mode.
96076Readable.prototype.resume = function () {
96077 var state = this._readableState;
96078 if (!state.flowing) {
96079 debug('resume');
96080 state.flowing = true;
96081 resume(this, state);
96082 }
96083 return this;
96084};
96085
96086function resume(stream, state) {
96087 if (!state.resumeScheduled) {
96088 state.resumeScheduled = true;
96089 pna.nextTick(resume_, stream, state);
96090 }
96091}
96092
96093function resume_(stream, state) {
96094 if (!state.reading) {
96095 debug('resume read 0');
96096 stream.read(0);
96097 }
96098
96099 state.resumeScheduled = false;
96100 state.awaitDrain = 0;
96101 stream.emit('resume');
96102 flow(stream);
96103 if (state.flowing && !state.reading) stream.read(0);
96104}
96105
96106Readable.prototype.pause = function () {
96107 debug('call pause flowing=%j', this._readableState.flowing);
96108 if (false !== this._readableState.flowing) {
96109 debug('pause');
96110 this._readableState.flowing = false;
96111 this.emit('pause');
96112 }
96113 return this;
96114};
96115
96116function flow(stream) {
96117 var state = stream._readableState;
96118 debug('flow', state.flowing);
96119 while (state.flowing && stream.read() !== null) {}
96120}
96121
96122// wrap an old-style stream as the async data source.
96123// This is *not* part of the readable stream interface.
96124// It is an ugly unfortunate mess of history.
96125Readable.prototype.wrap = function (stream) {
96126 var _this = this;
96127
96128 var state = this._readableState;
96129 var paused = false;
96130
96131 stream.on('end', function () {
96132 debug('wrapped end');
96133 if (state.decoder && !state.ended) {
96134 var chunk = state.decoder.end();
96135 if (chunk && chunk.length) _this.push(chunk);
96136 }
96137
96138 _this.push(null);
96139 });
96140
96141 stream.on('data', function (chunk) {
96142 debug('wrapped data');
96143 if (state.decoder) chunk = state.decoder.write(chunk);
96144
96145 // don't skip over falsy values in objectMode
96146 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
96147
96148 var ret = _this.push(chunk);
96149 if (!ret) {
96150 paused = true;
96151 stream.pause();
96152 }
96153 });
96154
96155 // proxy all the other methods.
96156 // important when wrapping filters and duplexes.
96157 for (var i in stream) {
96158 if (this[i] === undefined && typeof stream[i] === 'function') {
96159 this[i] = function (method) {
96160 return function () {
96161 return stream[method].apply(stream, arguments);
96162 };
96163 }(i);
96164 }
96165 }
96166
96167 // proxy certain important events.
96168 for (var n = 0; n < kProxyEvents.length; n++) {
96169 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
96170 }
96171
96172 // when we try to consume some more bytes, simply unpause the
96173 // underlying stream.
96174 this._read = function (n) {
96175 debug('wrapped _read', n);
96176 if (paused) {
96177 paused = false;
96178 stream.resume();
96179 }
96180 };
96181
96182 return this;
96183};
96184
96185Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
96186 // making it explicit this property is not enumerable
96187 // because otherwise some prototype manipulation in
96188 // userland will fail
96189 enumerable: false,
96190 get: function () {
96191 return this._readableState.highWaterMark;
96192 }
96193});
96194
96195// exposed for testing purposes only.
96196Readable._fromList = fromList;
96197
96198// Pluck off n bytes from an array of buffers.
96199// Length is the combined lengths of all the buffers in the list.
96200// This function is designed to be inlinable, so please take care when making
96201// changes to the function body.
96202function fromList(n, state) {
96203 // nothing buffered
96204 if (state.length === 0) return null;
96205
96206 var ret;
96207 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
96208 // read it all, truncate the list
96209 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
96210 state.buffer.clear();
96211 } else {
96212 // read part of list
96213 ret = fromListPartial(n, state.buffer, state.decoder);
96214 }
96215
96216 return ret;
96217}
96218
96219// Extracts only enough buffered data to satisfy the amount requested.
96220// This function is designed to be inlinable, so please take care when making
96221// changes to the function body.
96222function fromListPartial(n, list, hasStrings) {
96223 var ret;
96224 if (n < list.head.data.length) {
96225 // slice is the same for buffers and strings
96226 ret = list.head.data.slice(0, n);
96227 list.head.data = list.head.data.slice(n);
96228 } else if (n === list.head.data.length) {
96229 // first chunk is a perfect match
96230 ret = list.shift();
96231 } else {
96232 // result spans more than one buffer
96233 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
96234 }
96235 return ret;
96236}
96237
96238// Copies a specified amount of characters from the list of buffered data
96239// chunks.
96240// This function is designed to be inlinable, so please take care when making
96241// changes to the function body.
96242function copyFromBufferString(n, list) {
96243 var p = list.head;
96244 var c = 1;
96245 var ret = p.data;
96246 n -= ret.length;
96247 while (p = p.next) {
96248 var str = p.data;
96249 var nb = n > str.length ? str.length : n;
96250 if (nb === str.length) ret += str;else ret += str.slice(0, n);
96251 n -= nb;
96252 if (n === 0) {
96253 if (nb === str.length) {
96254 ++c;
96255 if (p.next) list.head = p.next;else list.head = list.tail = null;
96256 } else {
96257 list.head = p;
96258 p.data = str.slice(nb);
96259 }
96260 break;
96261 }
96262 ++c;
96263 }
96264 list.length -= c;
96265 return ret;
96266}
96267
96268// Copies a specified amount of bytes from the list of buffered data chunks.
96269// This function is designed to be inlinable, so please take care when making
96270// changes to the function body.
96271function copyFromBuffer(n, list) {
96272 var ret = Buffer.allocUnsafe(n);
96273 var p = list.head;
96274 var c = 1;
96275 p.data.copy(ret);
96276 n -= p.data.length;
96277 while (p = p.next) {
96278 var buf = p.data;
96279 var nb = n > buf.length ? buf.length : n;
96280 buf.copy(ret, ret.length - n, 0, nb);
96281 n -= nb;
96282 if (n === 0) {
96283 if (nb === buf.length) {
96284 ++c;
96285 if (p.next) list.head = p.next;else list.head = list.tail = null;
96286 } else {
96287 list.head = p;
96288 p.data = buf.slice(nb);
96289 }
96290 break;
96291 }
96292 ++c;
96293 }
96294 list.length -= c;
96295 return ret;
96296}
96297
96298function endReadable(stream) {
96299 var state = stream._readableState;
96300
96301 // If we get here before consuming all the bytes, then that is a
96302 // bug in node. Should never happen.
96303 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
96304
96305 if (!state.endEmitted) {
96306 state.ended = true;
96307 pna.nextTick(endReadableNT, state, stream);
96308 }
96309}
96310
96311function endReadableNT(state, stream) {
96312 // Check that we didn't get one last unshift.
96313 if (!state.endEmitted && state.length === 0) {
96314 state.endEmitted = true;
96315 stream.readable = false;
96316 stream.emit('end');
96317 }
96318}
96319
96320function indexOf(xs, x) {
96321 for (var i = 0, l = xs.length; i < l; i++) {
96322 if (xs[i] === x) return i;
96323 }
96324 return -1;
96325}
96326}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
96327},{"./_stream_duplex":727,"./internal/streams/BufferList":732,"./internal/streams/destroy":733,"./internal/streams/stream":734,"_process":678,"core-util-is":223,"events":335,"inherits":396,"isarray":400,"process-nextick-args":677,"safe-buffer":735,"string_decoder/":809,"util":110}],730:[function(require,module,exports){
96328// Copyright Joyent, Inc. and other Node contributors.
96329//
96330// Permission is hereby granted, free of charge, to any person obtaining a
96331// copy of this software and associated documentation files (the
96332// "Software"), to deal in the Software without restriction, including
96333// without limitation the rights to use, copy, modify, merge, publish,
96334// distribute, sublicense, and/or sell copies of the Software, and to permit
96335// persons to whom the Software is furnished to do so, subject to the
96336// following conditions:
96337//
96338// The above copyright notice and this permission notice shall be included
96339// in all copies or substantial portions of the Software.
96340//
96341// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
96342// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
96343// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
96344// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
96345// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
96346// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
96347// USE OR OTHER DEALINGS IN THE SOFTWARE.
96348
96349// a transform stream is a readable/writable stream where you do
96350// something with the data. Sometimes it's called a "filter",
96351// but that's not a great name for it, since that implies a thing where
96352// some bits pass through, and others are simply ignored. (That would
96353// be a valid example of a transform, of course.)
96354//
96355// While the output is causally related to the input, it's not a
96356// necessarily symmetric or synchronous transformation. For example,
96357// a zlib stream might take multiple plain-text writes(), and then
96358// emit a single compressed chunk some time in the future.
96359//
96360// Here's how this works:
96361//
96362// The Transform stream has all the aspects of the readable and writable
96363// stream classes. When you write(chunk), that calls _write(chunk,cb)
96364// internally, and returns false if there's a lot of pending writes
96365// buffered up. When you call read(), that calls _read(n) until
96366// there's enough pending readable data buffered up.
96367//
96368// In a transform stream, the written data is placed in a buffer. When
96369// _read(n) is called, it transforms the queued up data, calling the
96370// buffered _write cb's as it consumes chunks. If consuming a single
96371// written chunk would result in multiple output chunks, then the first
96372// outputted bit calls the readcb, and subsequent chunks just go into
96373// the read buffer, and will cause it to emit 'readable' if necessary.
96374//
96375// This way, back-pressure is actually determined by the reading side,
96376// since _read has to be called to start processing a new chunk. However,
96377// a pathological inflate type of transform can cause excessive buffering
96378// here. For example, imagine a stream where every byte of input is
96379// interpreted as an integer from 0-255, and then results in that many
96380// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
96381// 1kb of data being output. In this case, you could write a very small
96382// amount of input, and end up with a very large amount of output. In
96383// such a pathological inflating mechanism, there'd be no way to tell
96384// the system to stop doing the transform. A single 4MB write could
96385// cause the system to run out of memory.
96386//
96387// However, even in such a pathological case, only a single written chunk
96388// would be consumed, and then the rest would wait (un-transformed) until
96389// the results of the previous transformed chunk were consumed.
96390
96391'use strict';
96392
96393module.exports = Transform;
96394
96395var Duplex = require('./_stream_duplex');
96396
96397/*<replacement>*/
96398var util = require('core-util-is');
96399util.inherits = require('inherits');
96400/*</replacement>*/
96401
96402util.inherits(Transform, Duplex);
96403
96404function afterTransform(er, data) {
96405 var ts = this._transformState;
96406 ts.transforming = false;
96407
96408 var cb = ts.writecb;
96409
96410 if (!cb) {
96411 return this.emit('error', new Error('write callback called multiple times'));
96412 }
96413
96414 ts.writechunk = null;
96415 ts.writecb = null;
96416
96417 if (data != null) // single equals check for both `null` and `undefined`
96418 this.push(data);
96419
96420 cb(er);
96421
96422 var rs = this._readableState;
96423 rs.reading = false;
96424 if (rs.needReadable || rs.length < rs.highWaterMark) {
96425 this._read(rs.highWaterMark);
96426 }
96427}
96428
96429function Transform(options) {
96430 if (!(this instanceof Transform)) return new Transform(options);
96431
96432 Duplex.call(this, options);
96433
96434 this._transformState = {
96435 afterTransform: afterTransform.bind(this),
96436 needTransform: false,
96437 transforming: false,
96438 writecb: null,
96439 writechunk: null,
96440 writeencoding: null
96441 };
96442
96443 // start out asking for a readable event once data is transformed.
96444 this._readableState.needReadable = true;
96445
96446 // we have implemented the _read method, and done the other things
96447 // that Readable wants before the first _read call, so unset the
96448 // sync guard flag.
96449 this._readableState.sync = false;
96450
96451 if (options) {
96452 if (typeof options.transform === 'function') this._transform = options.transform;
96453
96454 if (typeof options.flush === 'function') this._flush = options.flush;
96455 }
96456
96457 // When the writable side finishes, then flush out anything remaining.
96458 this.on('prefinish', prefinish);
96459}
96460
96461function prefinish() {
96462 var _this = this;
96463
96464 if (typeof this._flush === 'function') {
96465 this._flush(function (er, data) {
96466 done(_this, er, data);
96467 });
96468 } else {
96469 done(this, null, null);
96470 }
96471}
96472
96473Transform.prototype.push = function (chunk, encoding) {
96474 this._transformState.needTransform = false;
96475 return Duplex.prototype.push.call(this, chunk, encoding);
96476};
96477
96478// This is the part where you do stuff!
96479// override this function in implementation classes.
96480// 'chunk' is an input chunk.
96481//
96482// Call `push(newChunk)` to pass along transformed output
96483// to the readable side. You may call 'push' zero or more times.
96484//
96485// Call `cb(err)` when you are done with this chunk. If you pass
96486// an error, then that'll put the hurt on the whole operation. If you
96487// never call cb(), then you'll never get another chunk.
96488Transform.prototype._transform = function (chunk, encoding, cb) {
96489 throw new Error('_transform() is not implemented');
96490};
96491
96492Transform.prototype._write = function (chunk, encoding, cb) {
96493 var ts = this._transformState;
96494 ts.writecb = cb;
96495 ts.writechunk = chunk;
96496 ts.writeencoding = encoding;
96497 if (!ts.transforming) {
96498 var rs = this._readableState;
96499 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
96500 }
96501};
96502
96503// Doesn't matter what the args are here.
96504// _transform does all the work.
96505// That we got here means that the readable side wants more data.
96506Transform.prototype._read = function (n) {
96507 var ts = this._transformState;
96508
96509 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
96510 ts.transforming = true;
96511 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
96512 } else {
96513 // mark that we need a transform, so that any data that comes in
96514 // will get processed, now that we've asked for it.
96515 ts.needTransform = true;
96516 }
96517};
96518
96519Transform.prototype._destroy = function (err, cb) {
96520 var _this2 = this;
96521
96522 Duplex.prototype._destroy.call(this, err, function (err2) {
96523 cb(err2);
96524 _this2.emit('close');
96525 });
96526};
96527
96528function done(stream, er, data) {
96529 if (er) return stream.emit('error', er);
96530
96531 if (data != null) // single equals check for both `null` and `undefined`
96532 stream.push(data);
96533
96534 // if there's nothing in the write buffer, then that means
96535 // that nothing more will ever be provided
96536 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
96537
96538 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
96539
96540 return stream.push(null);
96541}
96542},{"./_stream_duplex":727,"core-util-is":223,"inherits":396}],731:[function(require,module,exports){
96543(function (process,global,setImmediate){
96544// Copyright Joyent, Inc. and other Node contributors.
96545//
96546// Permission is hereby granted, free of charge, to any person obtaining a
96547// copy of this software and associated documentation files (the
96548// "Software"), to deal in the Software without restriction, including
96549// without limitation the rights to use, copy, modify, merge, publish,
96550// distribute, sublicense, and/or sell copies of the Software, and to permit
96551// persons to whom the Software is furnished to do so, subject to the
96552// following conditions:
96553//
96554// The above copyright notice and this permission notice shall be included
96555// in all copies or substantial portions of the Software.
96556//
96557// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
96558// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
96559// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
96560// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
96561// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
96562// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
96563// USE OR OTHER DEALINGS IN THE SOFTWARE.
96564
96565// A bit simpler than readable streams.
96566// Implement an async ._write(chunk, encoding, cb), and it'll handle all
96567// the drain event emission and buffering.
96568
96569'use strict';
96570
96571/*<replacement>*/
96572
96573var pna = require('process-nextick-args');
96574/*</replacement>*/
96575
96576module.exports = Writable;
96577
96578/* <replacement> */
96579function WriteReq(chunk, encoding, cb) {
96580 this.chunk = chunk;
96581 this.encoding = encoding;
96582 this.callback = cb;
96583 this.next = null;
96584}
96585
96586// It seems a linked list but it is not
96587// there will be only 2 of these for each stream
96588function CorkedRequest(state) {
96589 var _this = this;
96590
96591 this.next = null;
96592 this.entry = null;
96593 this.finish = function () {
96594 onCorkedFinish(_this, state);
96595 };
96596}
96597/* </replacement> */
96598
96599/*<replacement>*/
96600var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
96601/*</replacement>*/
96602
96603/*<replacement>*/
96604var Duplex;
96605/*</replacement>*/
96606
96607Writable.WritableState = WritableState;
96608
96609/*<replacement>*/
96610var util = require('core-util-is');
96611util.inherits = require('inherits');
96612/*</replacement>*/
96613
96614/*<replacement>*/
96615var internalUtil = {
96616 deprecate: require('util-deprecate')
96617};
96618/*</replacement>*/
96619
96620/*<replacement>*/
96621var Stream = require('./internal/streams/stream');
96622/*</replacement>*/
96623
96624/*<replacement>*/
96625
96626var Buffer = require('safe-buffer').Buffer;
96627var OurUint8Array = global.Uint8Array || function () {};
96628function _uint8ArrayToBuffer(chunk) {
96629 return Buffer.from(chunk);
96630}
96631function _isUint8Array(obj) {
96632 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
96633}
96634
96635/*</replacement>*/
96636
96637var destroyImpl = require('./internal/streams/destroy');
96638
96639util.inherits(Writable, Stream);
96640
96641function nop() {}
96642
96643function WritableState(options, stream) {
96644 Duplex = Duplex || require('./_stream_duplex');
96645
96646 options = options || {};
96647
96648 // Duplex streams are both readable and writable, but share
96649 // the same options object.
96650 // However, some cases require setting options to different
96651 // values for the readable and the writable sides of the duplex stream.
96652 // These options can be provided separately as readableXXX and writableXXX.
96653 var isDuplex = stream instanceof Duplex;
96654
96655 // object stream flag to indicate whether or not this stream
96656 // contains buffers or objects.
96657 this.objectMode = !!options.objectMode;
96658
96659 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
96660
96661 // the point at which write() starts returning false
96662 // Note: 0 is a valid value, means that we always return false if
96663 // the entire buffer is not flushed immediately on write()
96664 var hwm = options.highWaterMark;
96665 var writableHwm = options.writableHighWaterMark;
96666 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
96667
96668 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
96669
96670 // cast to ints.
96671 this.highWaterMark = Math.floor(this.highWaterMark);
96672
96673 // if _final has been called
96674 this.finalCalled = false;
96675
96676 // drain event flag.
96677 this.needDrain = false;
96678 // at the start of calling end()
96679 this.ending = false;
96680 // when end() has been called, and returned
96681 this.ended = false;
96682 // when 'finish' is emitted
96683 this.finished = false;
96684
96685 // has it been destroyed
96686 this.destroyed = false;
96687
96688 // should we decode strings into buffers before passing to _write?
96689 // this is here so that some node-core streams can optimize string
96690 // handling at a lower level.
96691 var noDecode = options.decodeStrings === false;
96692 this.decodeStrings = !noDecode;
96693
96694 // Crypto is kind of old and crusty. Historically, its default string
96695 // encoding is 'binary' so we have to make this configurable.
96696 // Everything else in the universe uses 'utf8', though.
96697 this.defaultEncoding = options.defaultEncoding || 'utf8';
96698
96699 // not an actual buffer we keep track of, but a measurement
96700 // of how much we're waiting to get pushed to some underlying
96701 // socket or file.
96702 this.length = 0;
96703
96704 // a flag to see when we're in the middle of a write.
96705 this.writing = false;
96706
96707 // when true all writes will be buffered until .uncork() call
96708 this.corked = 0;
96709
96710 // a flag to be able to tell if the onwrite cb is called immediately,
96711 // or on a later tick. We set this to true at first, because any
96712 // actions that shouldn't happen until "later" should generally also
96713 // not happen before the first write call.
96714 this.sync = true;
96715
96716 // a flag to know if we're processing previously buffered items, which
96717 // may call the _write() callback in the same tick, so that we don't
96718 // end up in an overlapped onwrite situation.
96719 this.bufferProcessing = false;
96720
96721 // the callback that's passed to _write(chunk,cb)
96722 this.onwrite = function (er) {
96723 onwrite(stream, er);
96724 };
96725
96726 // the callback that the user supplies to write(chunk,encoding,cb)
96727 this.writecb = null;
96728
96729 // the amount that is being written when _write is called.
96730 this.writelen = 0;
96731
96732 this.bufferedRequest = null;
96733 this.lastBufferedRequest = null;
96734
96735 // number of pending user-supplied write callbacks
96736 // this must be 0 before 'finish' can be emitted
96737 this.pendingcb = 0;
96738
96739 // emit prefinish if the only thing we're waiting for is _write cbs
96740 // This is relevant for synchronous Transform streams
96741 this.prefinished = false;
96742
96743 // True if the error was already emitted and should not be thrown again
96744 this.errorEmitted = false;
96745
96746 // count buffered requests
96747 this.bufferedRequestCount = 0;
96748
96749 // allocate the first CorkedRequest, there is always
96750 // one allocated and free to use, and we maintain at most two
96751 this.corkedRequestsFree = new CorkedRequest(this);
96752}
96753
96754WritableState.prototype.getBuffer = function getBuffer() {
96755 var current = this.bufferedRequest;
96756 var out = [];
96757 while (current) {
96758 out.push(current);
96759 current = current.next;
96760 }
96761 return out;
96762};
96763
96764(function () {
96765 try {
96766 Object.defineProperty(WritableState.prototype, 'buffer', {
96767 get: internalUtil.deprecate(function () {
96768 return this.getBuffer();
96769 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
96770 });
96771 } catch (_) {}
96772})();
96773
96774// Test _writableState for inheritance to account for Duplex streams,
96775// whose prototype chain only points to Readable.
96776var realHasInstance;
96777if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
96778 realHasInstance = Function.prototype[Symbol.hasInstance];
96779 Object.defineProperty(Writable, Symbol.hasInstance, {
96780 value: function (object) {
96781 if (realHasInstance.call(this, object)) return true;
96782 if (this !== Writable) return false;
96783
96784 return object && object._writableState instanceof WritableState;
96785 }
96786 });
96787} else {
96788 realHasInstance = function (object) {
96789 return object instanceof this;
96790 };
96791}
96792
96793function Writable(options) {
96794 Duplex = Duplex || require('./_stream_duplex');
96795
96796 // Writable ctor is applied to Duplexes, too.
96797 // `realHasInstance` is necessary because using plain `instanceof`
96798 // would return false, as no `_writableState` property is attached.
96799
96800 // Trying to use the custom `instanceof` for Writable here will also break the
96801 // Node.js LazyTransform implementation, which has a non-trivial getter for
96802 // `_writableState` that would lead to infinite recursion.
96803 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
96804 return new Writable(options);
96805 }
96806
96807 this._writableState = new WritableState(options, this);
96808
96809 // legacy.
96810 this.writable = true;
96811
96812 if (options) {
96813 if (typeof options.write === 'function') this._write = options.write;
96814
96815 if (typeof options.writev === 'function') this._writev = options.writev;
96816
96817 if (typeof options.destroy === 'function') this._destroy = options.destroy;
96818
96819 if (typeof options.final === 'function') this._final = options.final;
96820 }
96821
96822 Stream.call(this);
96823}
96824
96825// Otherwise people can pipe Writable streams, which is just wrong.
96826Writable.prototype.pipe = function () {
96827 this.emit('error', new Error('Cannot pipe, not readable'));
96828};
96829
96830function writeAfterEnd(stream, cb) {
96831 var er = new Error('write after end');
96832 // TODO: defer error events consistently everywhere, not just the cb
96833 stream.emit('error', er);
96834 pna.nextTick(cb, er);
96835}
96836
96837// Checks that a user-supplied chunk is valid, especially for the particular
96838// mode the stream is in. Currently this means that `null` is never accepted
96839// and undefined/non-string values are only allowed in object mode.
96840function validChunk(stream, state, chunk, cb) {
96841 var valid = true;
96842 var er = false;
96843
96844 if (chunk === null) {
96845 er = new TypeError('May not write null values to stream');
96846 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
96847 er = new TypeError('Invalid non-string/buffer chunk');
96848 }
96849 if (er) {
96850 stream.emit('error', er);
96851 pna.nextTick(cb, er);
96852 valid = false;
96853 }
96854 return valid;
96855}
96856
96857Writable.prototype.write = function (chunk, encoding, cb) {
96858 var state = this._writableState;
96859 var ret = false;
96860 var isBuf = !state.objectMode && _isUint8Array(chunk);
96861
96862 if (isBuf && !Buffer.isBuffer(chunk)) {
96863 chunk = _uint8ArrayToBuffer(chunk);
96864 }
96865
96866 if (typeof encoding === 'function') {
96867 cb = encoding;
96868 encoding = null;
96869 }
96870
96871 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
96872
96873 if (typeof cb !== 'function') cb = nop;
96874
96875 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
96876 state.pendingcb++;
96877 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
96878 }
96879
96880 return ret;
96881};
96882
96883Writable.prototype.cork = function () {
96884 var state = this._writableState;
96885
96886 state.corked++;
96887};
96888
96889Writable.prototype.uncork = function () {
96890 var state = this._writableState;
96891
96892 if (state.corked) {
96893 state.corked--;
96894
96895 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
96896 }
96897};
96898
96899Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
96900 // node::ParseEncoding() requires lower case.
96901 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
96902 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
96903 this._writableState.defaultEncoding = encoding;
96904 return this;
96905};
96906
96907function decodeChunk(state, chunk, encoding) {
96908 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
96909 chunk = Buffer.from(chunk, encoding);
96910 }
96911 return chunk;
96912}
96913
96914Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
96915 // making it explicit this property is not enumerable
96916 // because otherwise some prototype manipulation in
96917 // userland will fail
96918 enumerable: false,
96919 get: function () {
96920 return this._writableState.highWaterMark;
96921 }
96922});
96923
96924// if we're already writing something, then just put this
96925// in the queue, and wait our turn. Otherwise, call _write
96926// If we return false, then we need a drain event, so set that flag.
96927function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
96928 if (!isBuf) {
96929 var newChunk = decodeChunk(state, chunk, encoding);
96930 if (chunk !== newChunk) {
96931 isBuf = true;
96932 encoding = 'buffer';
96933 chunk = newChunk;
96934 }
96935 }
96936 var len = state.objectMode ? 1 : chunk.length;
96937
96938 state.length += len;
96939
96940 var ret = state.length < state.highWaterMark;
96941 // we must ensure that previous needDrain will not be reset to false.
96942 if (!ret) state.needDrain = true;
96943
96944 if (state.writing || state.corked) {
96945 var last = state.lastBufferedRequest;
96946 state.lastBufferedRequest = {
96947 chunk: chunk,
96948 encoding: encoding,
96949 isBuf: isBuf,
96950 callback: cb,
96951 next: null
96952 };
96953 if (last) {
96954 last.next = state.lastBufferedRequest;
96955 } else {
96956 state.bufferedRequest = state.lastBufferedRequest;
96957 }
96958 state.bufferedRequestCount += 1;
96959 } else {
96960 doWrite(stream, state, false, len, chunk, encoding, cb);
96961 }
96962
96963 return ret;
96964}
96965
96966function doWrite(stream, state, writev, len, chunk, encoding, cb) {
96967 state.writelen = len;
96968 state.writecb = cb;
96969 state.writing = true;
96970 state.sync = true;
96971 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
96972 state.sync = false;
96973}
96974
96975function onwriteError(stream, state, sync, er, cb) {
96976 --state.pendingcb;
96977
96978 if (sync) {
96979 // defer the callback if we are being called synchronously
96980 // to avoid piling up things on the stack
96981 pna.nextTick(cb, er);
96982 // this can emit finish, and it will always happen
96983 // after error
96984 pna.nextTick(finishMaybe, stream, state);
96985 stream._writableState.errorEmitted = true;
96986 stream.emit('error', er);
96987 } else {
96988 // the caller expect this to happen before if
96989 // it is async
96990 cb(er);
96991 stream._writableState.errorEmitted = true;
96992 stream.emit('error', er);
96993 // this can emit finish, but finish must
96994 // always follow error
96995 finishMaybe(stream, state);
96996 }
96997}
96998
96999function onwriteStateUpdate(state) {
97000 state.writing = false;
97001 state.writecb = null;
97002 state.length -= state.writelen;
97003 state.writelen = 0;
97004}
97005
97006function onwrite(stream, er) {
97007 var state = stream._writableState;
97008 var sync = state.sync;
97009 var cb = state.writecb;
97010
97011 onwriteStateUpdate(state);
97012
97013 if (er) onwriteError(stream, state, sync, er, cb);else {
97014 // Check if we're actually ready to finish, but don't emit yet
97015 var finished = needFinish(state);
97016
97017 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
97018 clearBuffer(stream, state);
97019 }
97020
97021 if (sync) {
97022 /*<replacement>*/
97023 asyncWrite(afterWrite, stream, state, finished, cb);
97024 /*</replacement>*/
97025 } else {
97026 afterWrite(stream, state, finished, cb);
97027 }
97028 }
97029}
97030
97031function afterWrite(stream, state, finished, cb) {
97032 if (!finished) onwriteDrain(stream, state);
97033 state.pendingcb--;
97034 cb();
97035 finishMaybe(stream, state);
97036}
97037
97038// Must force callback to be called on nextTick, so that we don't
97039// emit 'drain' before the write() consumer gets the 'false' return
97040// value, and has a chance to attach a 'drain' listener.
97041function onwriteDrain(stream, state) {
97042 if (state.length === 0 && state.needDrain) {
97043 state.needDrain = false;
97044 stream.emit('drain');
97045 }
97046}
97047
97048// if there's something in the buffer waiting, then process it
97049function clearBuffer(stream, state) {
97050 state.bufferProcessing = true;
97051 var entry = state.bufferedRequest;
97052
97053 if (stream._writev && entry && entry.next) {
97054 // Fast case, write everything using _writev()
97055 var l = state.bufferedRequestCount;
97056 var buffer = new Array(l);
97057 var holder = state.corkedRequestsFree;
97058 holder.entry = entry;
97059
97060 var count = 0;
97061 var allBuffers = true;
97062 while (entry) {
97063 buffer[count] = entry;
97064 if (!entry.isBuf) allBuffers = false;
97065 entry = entry.next;
97066 count += 1;
97067 }
97068 buffer.allBuffers = allBuffers;
97069
97070 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
97071
97072 // doWrite is almost always async, defer these to save a bit of time
97073 // as the hot path ends with doWrite
97074 state.pendingcb++;
97075 state.lastBufferedRequest = null;
97076 if (holder.next) {
97077 state.corkedRequestsFree = holder.next;
97078 holder.next = null;
97079 } else {
97080 state.corkedRequestsFree = new CorkedRequest(state);
97081 }
97082 state.bufferedRequestCount = 0;
97083 } else {
97084 // Slow case, write chunks one-by-one
97085 while (entry) {
97086 var chunk = entry.chunk;
97087 var encoding = entry.encoding;
97088 var cb = entry.callback;
97089 var len = state.objectMode ? 1 : chunk.length;
97090
97091 doWrite(stream, state, false, len, chunk, encoding, cb);
97092 entry = entry.next;
97093 state.bufferedRequestCount--;
97094 // if we didn't call the onwrite immediately, then
97095 // it means that we need to wait until it does.
97096 // also, that means that the chunk and cb are currently
97097 // being processed, so move the buffer counter past them.
97098 if (state.writing) {
97099 break;
97100 }
97101 }
97102
97103 if (entry === null) state.lastBufferedRequest = null;
97104 }
97105
97106 state.bufferedRequest = entry;
97107 state.bufferProcessing = false;
97108}
97109
97110Writable.prototype._write = function (chunk, encoding, cb) {
97111 cb(new Error('_write() is not implemented'));
97112};
97113
97114Writable.prototype._writev = null;
97115
97116Writable.prototype.end = function (chunk, encoding, cb) {
97117 var state = this._writableState;
97118
97119 if (typeof chunk === 'function') {
97120 cb = chunk;
97121 chunk = null;
97122 encoding = null;
97123 } else if (typeof encoding === 'function') {
97124 cb = encoding;
97125 encoding = null;
97126 }
97127
97128 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
97129
97130 // .end() fully uncorks
97131 if (state.corked) {
97132 state.corked = 1;
97133 this.uncork();
97134 }
97135
97136 // ignore unnecessary end() calls.
97137 if (!state.ending && !state.finished) endWritable(this, state, cb);
97138};
97139
97140function needFinish(state) {
97141 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
97142}
97143function callFinal(stream, state) {
97144 stream._final(function (err) {
97145 state.pendingcb--;
97146 if (err) {
97147 stream.emit('error', err);
97148 }
97149 state.prefinished = true;
97150 stream.emit('prefinish');
97151 finishMaybe(stream, state);
97152 });
97153}
97154function prefinish(stream, state) {
97155 if (!state.prefinished && !state.finalCalled) {
97156 if (typeof stream._final === 'function') {
97157 state.pendingcb++;
97158 state.finalCalled = true;
97159 pna.nextTick(callFinal, stream, state);
97160 } else {
97161 state.prefinished = true;
97162 stream.emit('prefinish');
97163 }
97164 }
97165}
97166
97167function finishMaybe(stream, state) {
97168 var need = needFinish(state);
97169 if (need) {
97170 prefinish(stream, state);
97171 if (state.pendingcb === 0) {
97172 state.finished = true;
97173 stream.emit('finish');
97174 }
97175 }
97176 return need;
97177}
97178
97179function endWritable(stream, state, cb) {
97180 state.ending = true;
97181 finishMaybe(stream, state);
97182 if (cb) {
97183 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
97184 }
97185 state.ended = true;
97186 stream.writable = false;
97187}
97188
97189function onCorkedFinish(corkReq, state, err) {
97190 var entry = corkReq.entry;
97191 corkReq.entry = null;
97192 while (entry) {
97193 var cb = entry.callback;
97194 state.pendingcb--;
97195 cb(err);
97196 entry = entry.next;
97197 }
97198 if (state.corkedRequestsFree) {
97199 state.corkedRequestsFree.next = corkReq;
97200 } else {
97201 state.corkedRequestsFree = corkReq;
97202 }
97203}
97204
97205Object.defineProperty(Writable.prototype, 'destroyed', {
97206 get: function () {
97207 if (this._writableState === undefined) {
97208 return false;
97209 }
97210 return this._writableState.destroyed;
97211 },
97212 set: function (value) {
97213 // we ignore the value if the stream
97214 // has not been initialized yet
97215 if (!this._writableState) {
97216 return;
97217 }
97218
97219 // backward compatibility, the user is explicitly
97220 // managing destroyed
97221 this._writableState.destroyed = value;
97222 }
97223});
97224
97225Writable.prototype.destroy = destroyImpl.destroy;
97226Writable.prototype._undestroy = destroyImpl.undestroy;
97227Writable.prototype._destroy = function (err, cb) {
97228 this.end();
97229 cb(err);
97230};
97231}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
97232},{"./_stream_duplex":727,"./internal/streams/destroy":733,"./internal/streams/stream":734,"_process":678,"core-util-is":223,"inherits":396,"process-nextick-args":677,"safe-buffer":735,"timers":812,"util-deprecate":821}],732:[function(require,module,exports){
97233'use strict';
97234
97235function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
97236
97237var Buffer = require('safe-buffer').Buffer;
97238var util = require('util');
97239
97240function copyBuffer(src, target, offset) {
97241 src.copy(target, offset);
97242}
97243
97244module.exports = function () {
97245 function BufferList() {
97246 _classCallCheck(this, BufferList);
97247
97248 this.head = null;
97249 this.tail = null;
97250 this.length = 0;
97251 }
97252
97253 BufferList.prototype.push = function push(v) {
97254 var entry = { data: v, next: null };
97255 if (this.length > 0) this.tail.next = entry;else this.head = entry;
97256 this.tail = entry;
97257 ++this.length;
97258 };
97259
97260 BufferList.prototype.unshift = function unshift(v) {
97261 var entry = { data: v, next: this.head };
97262 if (this.length === 0) this.tail = entry;
97263 this.head = entry;
97264 ++this.length;
97265 };
97266
97267 BufferList.prototype.shift = function shift() {
97268 if (this.length === 0) return;
97269 var ret = this.head.data;
97270 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
97271 --this.length;
97272 return ret;
97273 };
97274
97275 BufferList.prototype.clear = function clear() {
97276 this.head = this.tail = null;
97277 this.length = 0;
97278 };
97279
97280 BufferList.prototype.join = function join(s) {
97281 if (this.length === 0) return '';
97282 var p = this.head;
97283 var ret = '' + p.data;
97284 while (p = p.next) {
97285 ret += s + p.data;
97286 }return ret;
97287 };
97288
97289 BufferList.prototype.concat = function concat(n) {
97290 if (this.length === 0) return Buffer.alloc(0);
97291 if (this.length === 1) return this.head.data;
97292 var ret = Buffer.allocUnsafe(n >>> 0);
97293 var p = this.head;
97294 var i = 0;
97295 while (p) {
97296 copyBuffer(p.data, ret, i);
97297 i += p.data.length;
97298 p = p.next;
97299 }
97300 return ret;
97301 };
97302
97303 return BufferList;
97304}();
97305
97306if (util && util.inspect && util.inspect.custom) {
97307 module.exports.prototype[util.inspect.custom] = function () {
97308 var obj = util.inspect({ length: this.length });
97309 return this.constructor.name + ' ' + obj;
97310 };
97311}
97312},{"safe-buffer":735,"util":110}],733:[function(require,module,exports){
97313'use strict';
97314
97315/*<replacement>*/
97316
97317var pna = require('process-nextick-args');
97318/*</replacement>*/
97319
97320// undocumented cb() API, needed for core, not for public API
97321function destroy(err, cb) {
97322 var _this = this;
97323
97324 var readableDestroyed = this._readableState && this._readableState.destroyed;
97325 var writableDestroyed = this._writableState && this._writableState.destroyed;
97326
97327 if (readableDestroyed || writableDestroyed) {
97328 if (cb) {
97329 cb(err);
97330 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
97331 pna.nextTick(emitErrorNT, this, err);
97332 }
97333 return this;
97334 }
97335
97336 // we set destroyed to true before firing error callbacks in order
97337 // to make it re-entrance safe in case destroy() is called within callbacks
97338
97339 if (this._readableState) {
97340 this._readableState.destroyed = true;
97341 }
97342
97343 // if this is a duplex stream mark the writable part as destroyed as well
97344 if (this._writableState) {
97345 this._writableState.destroyed = true;
97346 }
97347
97348 this._destroy(err || null, function (err) {
97349 if (!cb && err) {
97350 pna.nextTick(emitErrorNT, _this, err);
97351 if (_this._writableState) {
97352 _this._writableState.errorEmitted = true;
97353 }
97354 } else if (cb) {
97355 cb(err);
97356 }
97357 });
97358
97359 return this;
97360}
97361
97362function undestroy() {
97363 if (this._readableState) {
97364 this._readableState.destroyed = false;
97365 this._readableState.reading = false;
97366 this._readableState.ended = false;
97367 this._readableState.endEmitted = false;
97368 }
97369
97370 if (this._writableState) {
97371 this._writableState.destroyed = false;
97372 this._writableState.ended = false;
97373 this._writableState.ending = false;
97374 this._writableState.finished = false;
97375 this._writableState.errorEmitted = false;
97376 }
97377}
97378
97379function emitErrorNT(self, err) {
97380 self.emit('error', err);
97381}
97382
97383module.exports = {
97384 destroy: destroy,
97385 undestroy: undestroy
97386};
97387},{"process-nextick-args":677}],734:[function(require,module,exports){
97388module.exports = require('events').EventEmitter;
97389
97390},{"events":335}],735:[function(require,module,exports){
97391/* eslint-disable node/no-deprecated-api */
97392var buffer = require('buffer')
97393var Buffer = buffer.Buffer
97394
97395// alternative to using Object.keys for old browsers
97396function copyProps (src, dst) {
97397 for (var key in src) {
97398 dst[key] = src[key]
97399 }
97400}
97401if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
97402 module.exports = buffer
97403} else {
97404 // Copy properties from require('buffer')
97405 copyProps(buffer, exports)
97406 exports.Buffer = SafeBuffer
97407}
97408
97409function SafeBuffer (arg, encodingOrOffset, length) {
97410 return Buffer(arg, encodingOrOffset, length)
97411}
97412
97413// Copy static methods from Buffer
97414copyProps(Buffer, SafeBuffer)
97415
97416SafeBuffer.from = function (arg, encodingOrOffset, length) {
97417 if (typeof arg === 'number') {
97418 throw new TypeError('Argument must not be a number')
97419 }
97420 return Buffer(arg, encodingOrOffset, length)
97421}
97422
97423SafeBuffer.alloc = function (size, fill, encoding) {
97424 if (typeof size !== 'number') {
97425 throw new TypeError('Argument must be a number')
97426 }
97427 var buf = Buffer(size)
97428 if (fill !== undefined) {
97429 if (typeof encoding === 'string') {
97430 buf.fill(fill, encoding)
97431 } else {
97432 buf.fill(fill)
97433 }
97434 } else {
97435 buf.fill(0)
97436 }
97437 return buf
97438}
97439
97440SafeBuffer.allocUnsafe = function (size) {
97441 if (typeof size !== 'number') {
97442 throw new TypeError('Argument must be a number')
97443 }
97444 return Buffer(size)
97445}
97446
97447SafeBuffer.allocUnsafeSlow = function (size) {
97448 if (typeof size !== 'number') {
97449 throw new TypeError('Argument must be a number')
97450 }
97451 return buffer.SlowBuffer(size)
97452}
97453
97454},{"buffer":146}],736:[function(require,module,exports){
97455module.exports = require('./readable').PassThrough
97456
97457},{"./readable":737}],737:[function(require,module,exports){
97458exports = module.exports = require('./lib/_stream_readable.js');
97459exports.Stream = exports;
97460exports.Readable = exports;
97461exports.Writable = require('./lib/_stream_writable.js');
97462exports.Duplex = require('./lib/_stream_duplex.js');
97463exports.Transform = require('./lib/_stream_transform.js');
97464exports.PassThrough = require('./lib/_stream_passthrough.js');
97465
97466},{"./lib/_stream_duplex.js":727,"./lib/_stream_passthrough.js":728,"./lib/_stream_readable.js":729,"./lib/_stream_transform.js":730,"./lib/_stream_writable.js":731}],738:[function(require,module,exports){
97467module.exports = require('./readable').Transform
97468
97469},{"./readable":737}],739:[function(require,module,exports){
97470module.exports = require('./lib/_stream_writable.js');
97471
97472},{"./lib/_stream_writable.js":731}],740:[function(require,module,exports){
97473'use strict'
97474var Buffer = require('buffer').Buffer
97475var inherits = require('inherits')
97476var HashBase = require('hash-base')
97477
97478var ARRAY16 = new Array(16)
97479
97480var zl = [
97481 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
97482 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
97483 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
97484 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
97485 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
97486]
97487
97488var zr = [
97489 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
97490 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
97491 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
97492 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
97493 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
97494]
97495
97496var sl = [
97497 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
97498 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
97499 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
97500 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
97501 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
97502]
97503
97504var sr = [
97505 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
97506 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
97507 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
97508 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
97509 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
97510]
97511
97512var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
97513var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
97514
97515function RIPEMD160 () {
97516 HashBase.call(this, 64)
97517
97518 // state
97519 this._a = 0x67452301
97520 this._b = 0xefcdab89
97521 this._c = 0x98badcfe
97522 this._d = 0x10325476
97523 this._e = 0xc3d2e1f0
97524}
97525
97526inherits(RIPEMD160, HashBase)
97527
97528RIPEMD160.prototype._update = function () {
97529 var words = ARRAY16
97530 for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)
97531
97532 var al = this._a | 0
97533 var bl = this._b | 0
97534 var cl = this._c | 0
97535 var dl = this._d | 0
97536 var el = this._e | 0
97537
97538 var ar = this._a | 0
97539 var br = this._b | 0
97540 var cr = this._c | 0
97541 var dr = this._d | 0
97542 var er = this._e | 0
97543
97544 // computation
97545 for (var i = 0; i < 80; i += 1) {
97546 var tl
97547 var tr
97548 if (i < 16) {
97549 tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])
97550 tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])
97551 } else if (i < 32) {
97552 tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])
97553 tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])
97554 } else if (i < 48) {
97555 tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])
97556 tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])
97557 } else if (i < 64) {
97558 tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])
97559 tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])
97560 } else { // if (i<80) {
97561 tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])
97562 tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])
97563 }
97564
97565 al = el
97566 el = dl
97567 dl = rotl(cl, 10)
97568 cl = bl
97569 bl = tl
97570
97571 ar = er
97572 er = dr
97573 dr = rotl(cr, 10)
97574 cr = br
97575 br = tr
97576 }
97577
97578 // update state
97579 var t = (this._b + cl + dr) | 0
97580 this._b = (this._c + dl + er) | 0
97581 this._c = (this._d + el + ar) | 0
97582 this._d = (this._e + al + br) | 0
97583 this._e = (this._a + bl + cr) | 0
97584 this._a = t
97585}
97586
97587RIPEMD160.prototype._digest = function () {
97588 // create padding and handle blocks
97589 this._block[this._blockOffset++] = 0x80
97590 if (this._blockOffset > 56) {
97591 this._block.fill(0, this._blockOffset, 64)
97592 this._update()
97593 this._blockOffset = 0
97594 }
97595
97596 this._block.fill(0, this._blockOffset, 56)
97597 this._block.writeUInt32LE(this._length[0], 56)
97598 this._block.writeUInt32LE(this._length[1], 60)
97599 this._update()
97600
97601 // produce result
97602 var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)
97603 buffer.writeInt32LE(this._a, 0)
97604 buffer.writeInt32LE(this._b, 4)
97605 buffer.writeInt32LE(this._c, 8)
97606 buffer.writeInt32LE(this._d, 12)
97607 buffer.writeInt32LE(this._e, 16)
97608 return buffer
97609}
97610
97611function rotl (x, n) {
97612 return (x << n) | (x >>> (32 - n))
97613}
97614
97615function fn1 (a, b, c, d, e, m, k, s) {
97616 return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0
97617}
97618
97619function fn2 (a, b, c, d, e, m, k, s) {
97620 return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0
97621}
97622
97623function fn3 (a, b, c, d, e, m, k, s) {
97624 return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0
97625}
97626
97627function fn4 (a, b, c, d, e, m, k, s) {
97628 return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0
97629}
97630
97631function fn5 (a, b, c, d, e, m, k, s) {
97632 return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0
97633}
97634
97635module.exports = RIPEMD160
97636
97637},{"buffer":146,"hash-base":380,"inherits":396}],741:[function(require,module,exports){
97638(function (Buffer){
97639"use strict";
97640Object.defineProperty(exports, "__esModule", { value: true });
97641var BN = require("bn.js");
97642/**
97643 * RLP Encoding based on: https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP
97644 * This function takes in a data, convert it to buffer if not, and a length for recursion
97645 * @param input - will be converted to buffer
97646 * @returns returns buffer of encoded data
97647 **/
97648function encode(input) {
97649 if (Array.isArray(input)) {
97650 var output = [];
97651 for (var i = 0; i < input.length; i++) {
97652 output.push(encode(input[i]));
97653 }
97654 var buf = Buffer.concat(output);
97655 return Buffer.concat([encodeLength(buf.length, 192), buf]);
97656 }
97657 else {
97658 var inputBuf = toBuffer(input);
97659 return inputBuf.length === 1 && inputBuf[0] < 128
97660 ? inputBuf
97661 : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);
97662 }
97663}
97664exports.encode = encode;
97665/**
97666 * Parse integers. Check if there is no leading zeros
97667 * @param v The value to parse
97668 * @param base The base to parse the integer into
97669 */
97670function safeParseInt(v, base) {
97671 if (v.slice(0, 2) === '00') {
97672 throw new Error('invalid RLP: extra zeros');
97673 }
97674 return parseInt(v, base);
97675}
97676function encodeLength(len, offset) {
97677 if (len < 56) {
97678 return Buffer.from([len + offset]);
97679 }
97680 else {
97681 var hexLength = intToHex(len);
97682 var lLength = hexLength.length / 2;
97683 var firstByte = intToHex(offset + 55 + lLength);
97684 return Buffer.from(firstByte + hexLength, 'hex');
97685 }
97686}
97687function decode(input, stream) {
97688 if (stream === void 0) { stream = false; }
97689 if (!input || input.length === 0) {
97690 return Buffer.from([]);
97691 }
97692 var inputBuffer = toBuffer(input);
97693 var decoded = _decode(inputBuffer);
97694 if (stream) {
97695 return decoded;
97696 }
97697 if (decoded.remainder.length !== 0) {
97698 throw new Error('invalid remainder');
97699 }
97700 return decoded.data;
97701}
97702exports.decode = decode;
97703/**
97704 * Get the length of the RLP input
97705 * @param input
97706 * @returns The length of the input or an empty Buffer if no input
97707 */
97708function getLength(input) {
97709 if (!input || input.length === 0) {
97710 return Buffer.from([]);
97711 }
97712 var inputBuffer = toBuffer(input);
97713 var firstByte = inputBuffer[0];
97714 if (firstByte <= 0x7f) {
97715 return inputBuffer.length;
97716 }
97717 else if (firstByte <= 0xb7) {
97718 return firstByte - 0x7f;
97719 }
97720 else if (firstByte <= 0xbf) {
97721 return firstByte - 0xb6;
97722 }
97723 else if (firstByte <= 0xf7) {
97724 // a list between 0-55 bytes long
97725 return firstByte - 0xbf;
97726 }
97727 else {
97728 // a list over 55 bytes long
97729 var llength = firstByte - 0xf6;
97730 var length = safeParseInt(inputBuffer.slice(1, llength).toString('hex'), 16);
97731 return llength + length;
97732 }
97733}
97734exports.getLength = getLength;
97735/** Decode an input with RLP */
97736function _decode(input) {
97737 var length, llength, data, innerRemainder, d;
97738 var decoded = [];
97739 var firstByte = input[0];
97740 if (firstByte <= 0x7f) {
97741 // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.
97742 return {
97743 data: input.slice(0, 1),
97744 remainder: input.slice(1),
97745 };
97746 }
97747 else if (firstByte <= 0xb7) {
97748 // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string
97749 // The range of the first byte is [0x80, 0xb7]
97750 length = firstByte - 0x7f;
97751 // set 0x80 null to 0
97752 if (firstByte === 0x80) {
97753 data = Buffer.from([]);
97754 }
97755 else {
97756 data = input.slice(1, length);
97757 }
97758 if (length === 2 && data[0] < 0x80) {
97759 throw new Error('invalid rlp encoding: byte must be less 0x80');
97760 }
97761 return {
97762 data: data,
97763 remainder: input.slice(length),
97764 };
97765 }
97766 else if (firstByte <= 0xbf) {
97767 llength = firstByte - 0xb6;
97768 length = safeParseInt(input.slice(1, llength).toString('hex'), 16);
97769 data = input.slice(llength, length + llength);
97770 if (data.length < length) {
97771 throw new Error('invalid RLP');
97772 }
97773 return {
97774 data: data,
97775 remainder: input.slice(length + llength),
97776 };
97777 }
97778 else if (firstByte <= 0xf7) {
97779 // a list between 0-55 bytes long
97780 length = firstByte - 0xbf;
97781 innerRemainder = input.slice(1, length);
97782 while (innerRemainder.length) {
97783 d = _decode(innerRemainder);
97784 decoded.push(d.data);
97785 innerRemainder = d.remainder;
97786 }
97787 return {
97788 data: decoded,
97789 remainder: input.slice(length),
97790 };
97791 }
97792 else {
97793 // a list over 55 bytes long
97794 llength = firstByte - 0xf6;
97795 length = safeParseInt(input.slice(1, llength).toString('hex'), 16);
97796 var totalLength = llength + length;
97797 if (totalLength > input.length) {
97798 throw new Error('invalid rlp: total length is larger than the data');
97799 }
97800 innerRemainder = input.slice(llength, totalLength);
97801 if (innerRemainder.length === 0) {
97802 throw new Error('invalid rlp, List has a invalid length');
97803 }
97804 while (innerRemainder.length) {
97805 d = _decode(innerRemainder);
97806 decoded.push(d.data);
97807 innerRemainder = d.remainder;
97808 }
97809 return {
97810 data: decoded,
97811 remainder: input.slice(totalLength),
97812 };
97813 }
97814}
97815/** Check if a string is prefixed by 0x */
97816function isHexPrefixed(str) {
97817 return str.slice(0, 2) === '0x';
97818}
97819/** Removes 0x from a given String */
97820function stripHexPrefix(str) {
97821 if (typeof str !== 'string') {
97822 return str;
97823 }
97824 return isHexPrefixed(str) ? str.slice(2) : str;
97825}
97826/** Transform an integer into its hexadecimal value */
97827function intToHex(integer) {
97828 if (integer < 0) {
97829 throw new Error('Invalid integer as argument, must be unsigned!');
97830 }
97831 var hex = integer.toString(16);
97832 return hex.length % 2 ? "0" + hex : hex;
97833}
97834/** Pad a string to be even */
97835function padToEven(a) {
97836 return a.length % 2 ? "0" + a : a;
97837}
97838/** Transform an integer into a Buffer */
97839function intToBuffer(integer) {
97840 var hex = intToHex(integer);
97841 return Buffer.from(hex, 'hex');
97842}
97843/** Transform anything into a Buffer */
97844function toBuffer(v) {
97845 if (!Buffer.isBuffer(v)) {
97846 if (typeof v === 'string') {
97847 if (isHexPrefixed(v)) {
97848 return Buffer.from(padToEven(stripHexPrefix(v)), 'hex');
97849 }
97850 else {
97851 return Buffer.from(v);
97852 }
97853 }
97854 else if (typeof v === 'number') {
97855 if (!v) {
97856 return Buffer.from([]);
97857 }
97858 else {
97859 return intToBuffer(v);
97860 }
97861 }
97862 else if (v === null || v === undefined) {
97863 return Buffer.from([]);
97864 }
97865 else if (v instanceof Uint8Array) {
97866 return Buffer.from(v);
97867 }
97868 else if (BN.isBN(v)) {
97869 // converts a BN to a Buffer
97870 return Buffer.from(v.toArray());
97871 }
97872 else {
97873 throw new Error('invalid type');
97874 }
97875 }
97876 return v;
97877}
97878
97879}).call(this,require("buffer").Buffer)
97880},{"bn.js":108,"buffer":146}],742:[function(require,module,exports){
97881/* eslint-disable node/no-deprecated-api */
97882var buffer = require('buffer')
97883var Buffer = buffer.Buffer
97884
97885// alternative to using Object.keys for old browsers
97886function copyProps (src, dst) {
97887 for (var key in src) {
97888 dst[key] = src[key]
97889 }
97890}
97891if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
97892 module.exports = buffer
97893} else {
97894 // Copy properties from require('buffer')
97895 copyProps(buffer, exports)
97896 exports.Buffer = SafeBuffer
97897}
97898
97899function SafeBuffer (arg, encodingOrOffset, length) {
97900 return Buffer(arg, encodingOrOffset, length)
97901}
97902
97903SafeBuffer.prototype = Object.create(Buffer.prototype)
97904
97905// Copy static methods from Buffer
97906copyProps(Buffer, SafeBuffer)
97907
97908SafeBuffer.from = function (arg, encodingOrOffset, length) {
97909 if (typeof arg === 'number') {
97910 throw new TypeError('Argument must not be a number')
97911 }
97912 return Buffer(arg, encodingOrOffset, length)
97913}
97914
97915SafeBuffer.alloc = function (size, fill, encoding) {
97916 if (typeof size !== 'number') {
97917 throw new TypeError('Argument must be a number')
97918 }
97919 var buf = Buffer(size)
97920 if (fill !== undefined) {
97921 if (typeof encoding === 'string') {
97922 buf.fill(fill, encoding)
97923 } else {
97924 buf.fill(fill)
97925 }
97926 } else {
97927 buf.fill(0)
97928 }
97929 return buf
97930}
97931
97932SafeBuffer.allocUnsafe = function (size) {
97933 if (typeof size !== 'number') {
97934 throw new TypeError('Argument must be a number')
97935 }
97936 return Buffer(size)
97937}
97938
97939SafeBuffer.allocUnsafeSlow = function (size) {
97940 if (typeof size !== 'number') {
97941 throw new TypeError('Argument must be a number')
97942 }
97943 return buffer.SlowBuffer(size)
97944}
97945
97946},{"buffer":146}],743:[function(require,module,exports){
97947const scrypt = require('./scryptSync')
97948scrypt.async = require('./scrypt')
97949module.exports = scrypt
97950
97951},{"./scrypt":744,"./scryptSync":745}],744:[function(require,module,exports){
97952const crypto = require('crypto')
97953const {
97954 checkAndInit,
97955 smix
97956} = require('./utils')
97957
97958// N = Cpu cost, r = Memory cost, p = parallelization cost
97959async function scrypt (key, salt, N, r, p, dkLen, progressCallback, promiseInterval) {
97960 const {
97961 XY,
97962 V,
97963 B32,
97964 x,
97965 _X,
97966 B,
97967 tickCallback
97968 } = checkAndInit(key, salt, N, r, p, dkLen, progressCallback)
97969
97970 for (var i = 0; i < p; i++) {
97971 await smix(B, i * 128 * r, r, N, V, XY, _X, B32, x, tickCallback, promiseInterval)
97972 }
97973
97974 return crypto.pbkdf2Sync(key, B, 1, dkLen, 'sha256')
97975}
97976
97977module.exports = scrypt
97978
97979},{"./utils":746,"crypto":243}],745:[function(require,module,exports){
97980const crypto = require('crypto')
97981const {
97982 checkAndInit,
97983 smixSync
97984} = require('./utils')
97985
97986// N = Cpu cost, r = Memory cost, p = parallelization cost
97987function scrypt (key, salt, N, r, p, dkLen, progressCallback) {
97988 const {
97989 XY,
97990 V,
97991 B32,
97992 x,
97993 _X,
97994 B,
97995 tickCallback
97996 } = checkAndInit(key, salt, N, r, p, dkLen, progressCallback)
97997
97998 for (var i = 0; i < p; i++) {
97999 smixSync(B, i * 128 * r, r, N, V, XY, _X, B32, x, tickCallback)
98000 }
98001
98002 return crypto.pbkdf2Sync(key, B, 1, dkLen, 'sha256')
98003}
98004
98005module.exports = scrypt
98006
98007},{"./utils":746,"crypto":243}],746:[function(require,module,exports){
98008(function (Buffer,setImmediate){
98009const crypto = require('crypto')
98010const MAX_VALUE = 0x7fffffff
98011const DEFAULT_PROMISE_INTERVAL = 5000
98012/* eslint-disable camelcase */
98013
98014function checkAndInit (key, salt, N, r, p, dkLen, progressCallback) {
98015 if (N === 0 || (N & (N - 1)) !== 0) throw Error('N must be > 0 and a power of 2')
98016
98017 if (N > MAX_VALUE / 128 / r) throw Error('Parameter N is too large')
98018 if (r > MAX_VALUE / 128 / p) throw Error('Parameter r is too large')
98019
98020 let XY = Buffer.alloc(256 * r)
98021 let V = Buffer.alloc(128 * r * N)
98022
98023 // pseudo global
98024 let B32 = new Int32Array(16) // salsa20_8
98025 let x = new Int32Array(16) // salsa20_8
98026 let _X = Buffer.alloc(64) // blockmix_salsa8
98027
98028 // pseudo global
98029 let B = crypto.pbkdf2Sync(key, salt, 1, p * 128 * r, 'sha256')
98030
98031 let tickCallback
98032 if (progressCallback) {
98033 let totalOps = p * N * 2
98034 let currentOp = 0
98035
98036 tickCallback = function () {
98037 ++currentOp
98038
98039 // send progress notifications once every 1,000 ops
98040 if (currentOp % 1000 === 0) {
98041 progressCallback({
98042 current: currentOp,
98043 total: totalOps,
98044 percent: (currentOp / totalOps) * 100.0
98045 })
98046 }
98047 }
98048 }
98049 return {
98050 XY,
98051 V,
98052 B32,
98053 x,
98054 _X,
98055 B,
98056 tickCallback
98057 }
98058}
98059
98060async function smix (B, Bi, r, N, V, XY, _X, B32, x, tickCallback, promiseInterval) {
98061 promiseInterval = promiseInterval || DEFAULT_PROMISE_INTERVAL
98062 let Xi = 0
98063 let Yi = 128 * r
98064 let i
98065
98066 B.copy(XY, Xi, Bi, Bi + Yi)
98067
98068 for (i = 0; i < N; i++) {
98069 XY.copy(V, i * Yi, Xi, Xi + Yi)
98070 if (i % promiseInterval === 0) {
98071 await new Promise(resolve => setImmediate(resolve))
98072 }
98073 blockmix_salsa8(XY, Xi, Yi, r, _X, B32, x)
98074
98075 if (tickCallback) tickCallback()
98076 }
98077
98078 for (i = 0; i < N; i++) {
98079 let offset = Xi + (2 * r - 1) * 64
98080 let j = XY.readUInt32LE(offset) & (N - 1)
98081 blockxor(V, j * Yi, XY, Xi, Yi)
98082 if (i % promiseInterval === 0) {
98083 await new Promise(resolve => setImmediate(resolve))
98084 }
98085 blockmix_salsa8(XY, Xi, Yi, r, _X, B32, x)
98086
98087 if (tickCallback) tickCallback()
98088 }
98089
98090 XY.copy(B, Bi, Xi, Xi + Yi)
98091}
98092
98093function smixSync (B, Bi, r, N, V, XY, _X, B32, x, tickCallback) {
98094 let Xi = 0
98095 let Yi = 128 * r
98096 let i
98097
98098 B.copy(XY, Xi, Bi, Bi + Yi)
98099
98100 for (i = 0; i < N; i++) {
98101 XY.copy(V, i * Yi, Xi, Xi + Yi)
98102 blockmix_salsa8(XY, Xi, Yi, r, _X, B32, x)
98103
98104 if (tickCallback) tickCallback()
98105 }
98106
98107 for (i = 0; i < N; i++) {
98108 let offset = Xi + (2 * r - 1) * 64
98109 let j = XY.readUInt32LE(offset) & (N - 1)
98110 blockxor(V, j * Yi, XY, Xi, Yi)
98111 blockmix_salsa8(XY, Xi, Yi, r, _X, B32, x)
98112
98113 if (tickCallback) tickCallback()
98114 }
98115
98116 XY.copy(B, Bi, Xi, Xi + Yi)
98117}
98118
98119function blockmix_salsa8 (BY, Bi, Yi, r, _X, B32, x) {
98120 let i
98121
98122 arraycopy(BY, Bi + (2 * r - 1) * 64, _X, 0, 64)
98123
98124 for (i = 0; i < 2 * r; i++) {
98125 blockxor(BY, i * 64, _X, 0, 64)
98126 salsa20_8(_X, B32, x)
98127 arraycopy(_X, 0, BY, Yi + (i * 64), 64)
98128 }
98129
98130 for (i = 0; i < r; i++) {
98131 arraycopy(BY, Yi + (i * 2) * 64, BY, Bi + (i * 64), 64)
98132 }
98133
98134 for (i = 0; i < r; i++) {
98135 arraycopy(BY, Yi + (i * 2 + 1) * 64, BY, Bi + (i + r) * 64, 64)
98136 }
98137}
98138
98139function R (a, b) {
98140 return (a << b) | (a >>> (32 - b))
98141}
98142
98143function salsa20_8 (B, B32, x) {
98144 let i
98145
98146 for (i = 0; i < 16; i++) {
98147 B32[i] = (B[i * 4 + 0] & 0xff) << 0
98148 B32[i] |= (B[i * 4 + 1] & 0xff) << 8
98149 B32[i] |= (B[i * 4 + 2] & 0xff) << 16
98150 B32[i] |= (B[i * 4 + 3] & 0xff) << 24
98151 // B32[i] = B.readUInt32LE(i*4) <--- this is signficantly slower even in Node.js
98152 }
98153
98154 arraycopy(B32, 0, x, 0, 16)
98155
98156 for (i = 8; i > 0; i -= 2) {
98157 x[4] ^= R(x[0] + x[12], 7)
98158 x[8] ^= R(x[4] + x[0], 9)
98159 x[12] ^= R(x[8] + x[4], 13)
98160 x[0] ^= R(x[12] + x[8], 18)
98161 x[9] ^= R(x[5] + x[1], 7)
98162 x[13] ^= R(x[9] + x[5], 9)
98163 x[1] ^= R(x[13] + x[9], 13)
98164 x[5] ^= R(x[1] + x[13], 18)
98165 x[14] ^= R(x[10] + x[6], 7)
98166 x[2] ^= R(x[14] + x[10], 9)
98167 x[6] ^= R(x[2] + x[14], 13)
98168 x[10] ^= R(x[6] + x[2], 18)
98169 x[3] ^= R(x[15] + x[11], 7)
98170 x[7] ^= R(x[3] + x[15], 9)
98171 x[11] ^= R(x[7] + x[3], 13)
98172 x[15] ^= R(x[11] + x[7], 18)
98173 x[1] ^= R(x[0] + x[3], 7)
98174 x[2] ^= R(x[1] + x[0], 9)
98175 x[3] ^= R(x[2] + x[1], 13)
98176 x[0] ^= R(x[3] + x[2], 18)
98177 x[6] ^= R(x[5] + x[4], 7)
98178 x[7] ^= R(x[6] + x[5], 9)
98179 x[4] ^= R(x[7] + x[6], 13)
98180 x[5] ^= R(x[4] + x[7], 18)
98181 x[11] ^= R(x[10] + x[9], 7)
98182 x[8] ^= R(x[11] + x[10], 9)
98183 x[9] ^= R(x[8] + x[11], 13)
98184 x[10] ^= R(x[9] + x[8], 18)
98185 x[12] ^= R(x[15] + x[14], 7)
98186 x[13] ^= R(x[12] + x[15], 9)
98187 x[14] ^= R(x[13] + x[12], 13)
98188 x[15] ^= R(x[14] + x[13], 18)
98189 }
98190
98191 for (i = 0; i < 16; ++i) B32[i] = x[i] + B32[i]
98192
98193 for (i = 0; i < 16; i++) {
98194 let bi = i * 4
98195 B[bi + 0] = (B32[i] >> 0 & 0xff)
98196 B[bi + 1] = (B32[i] >> 8 & 0xff)
98197 B[bi + 2] = (B32[i] >> 16 & 0xff)
98198 B[bi + 3] = (B32[i] >> 24 & 0xff)
98199 // B.writeInt32LE(B32[i], i*4) //<--- this is signficantly slower even in Node.js
98200 }
98201}
98202
98203// naive approach... going back to loop unrolling may yield additional performance
98204function blockxor (S, Si, D, Di, len) {
98205 for (let i = 0; i < len; i++) {
98206 D[Di + i] ^= S[Si + i]
98207 }
98208}
98209
98210function arraycopy (src, srcPos, dest, destPos, length) {
98211 if (Buffer.isBuffer(src) && Buffer.isBuffer(dest)) {
98212 src.copy(dest, destPos, srcPos, srcPos + length)
98213 } else {
98214 while (length--) {
98215 dest[destPos++] = src[srcPos++]
98216 }
98217 }
98218}
98219
98220module.exports = {
98221 checkAndInit,
98222 smix,
98223 smixSync
98224}
98225
98226}).call(this,require("buffer").Buffer,require("timers").setImmediate)
98227},{"buffer":146,"crypto":243,"timers":812}],747:[function(require,module,exports){
98228'use strict'
98229module.exports = require('./lib')(require('./lib/elliptic'))
98230
98231},{"./lib":751,"./lib/elliptic":750}],748:[function(require,module,exports){
98232(function (Buffer){
98233'use strict'
98234var toString = Object.prototype.toString
98235
98236// TypeError
98237exports.isArray = function (value, message) {
98238 if (!Array.isArray(value)) throw TypeError(message)
98239}
98240
98241exports.isBoolean = function (value, message) {
98242 if (toString.call(value) !== '[object Boolean]') throw TypeError(message)
98243}
98244
98245exports.isBuffer = function (value, message) {
98246 if (!Buffer.isBuffer(value)) throw TypeError(message)
98247}
98248
98249exports.isFunction = function (value, message) {
98250 if (toString.call(value) !== '[object Function]') throw TypeError(message)
98251}
98252
98253exports.isNumber = function (value, message) {
98254 if (toString.call(value) !== '[object Number]') throw TypeError(message)
98255}
98256
98257exports.isObject = function (value, message) {
98258 if (toString.call(value) !== '[object Object]') throw TypeError(message)
98259}
98260
98261// RangeError
98262exports.isBufferLength = function (buffer, length, message) {
98263 if (buffer.length !== length) throw RangeError(message)
98264}
98265
98266exports.isBufferLength2 = function (buffer, length1, length2, message) {
98267 if (buffer.length !== length1 && buffer.length !== length2) throw RangeError(message)
98268}
98269
98270exports.isLengthGTZero = function (value, message) {
98271 if (value.length === 0) throw RangeError(message)
98272}
98273
98274exports.isNumberInInterval = function (number, x, y, message) {
98275 if (number <= x || number >= y) throw RangeError(message)
98276}
98277
98278}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")})
98279},{"../../insert-module-globals/node_modules/is-buffer/index.js":397}],749:[function(require,module,exports){
98280'use strict'
98281var Buffer = require('safe-buffer').Buffer
98282var bip66 = require('bip66')
98283
98284var EC_PRIVKEY_EXPORT_DER_COMPRESSED = Buffer.from([
98285 // begin
98286 0x30, 0x81, 0xd3, 0x02, 0x01, 0x01, 0x04, 0x20,
98287 // private key
98288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98290 // middle
98291 0xa0, 0x81, 0x85, 0x30, 0x81, 0x82, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,
98292 0xcE, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98293 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98294 0xff, 0xff, 0xfE, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,
98295 0x21, 0x02, 0x79, 0xbE, 0x66, 0x7E, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xcE, 0x87,
98296 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xcE, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8,
98297 0x17, 0x98, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98298 0xff, 0xff, 0xff, 0xff, 0xfE, 0xba, 0xaE, 0xdc, 0xE6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5E,
98299 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0xa1, 0x24, 0x03, 0x22, 0x00,
98300 // public key
98301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98303 0x00
98304])
98305
98306var EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED = Buffer.from([
98307 // begin
98308 0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20,
98309 // private key
98310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98312 // middle
98313 0xa0, 0x81, 0xa5, 0x30, 0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,
98314 0xcE, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98315 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98316 0xff, 0xff, 0xfE, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,
98317 0x41, 0x04, 0x79, 0xbE, 0x66, 0x7E, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xcE, 0x87,
98318 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xcE, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8,
98319 0x17, 0x98, 0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0E, 0x11,
98320 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10,
98321 0xd4, 0xb8, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98322 0xff, 0xff, 0xff, 0xff, 0xfE, 0xba, 0xaE, 0xdc, 0xE6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5E,
98323 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0xa1, 0x44, 0x03, 0x42, 0x00,
98324 // public key
98325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98329 0x00
98330])
98331
98332exports.privateKeyExport = function (privateKey, publicKey, compressed) {
98333 var result = Buffer.from(compressed ? EC_PRIVKEY_EXPORT_DER_COMPRESSED : EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED)
98334 privateKey.copy(result, compressed ? 8 : 9)
98335 publicKey.copy(result, compressed ? 181 : 214)
98336 return result
98337}
98338
98339exports.privateKeyImport = function (privateKey) {
98340 var length = privateKey.length
98341
98342 // sequence header
98343 var index = 0
98344 if (length < index + 1 || privateKey[index] !== 0x30) return
98345 index += 1
98346
98347 // sequence length constructor
98348 if (length < index + 1 || !(privateKey[index] & 0x80)) return
98349
98350 var lenb = privateKey[index] & 0x7f
98351 index += 1
98352 if (lenb < 1 || lenb > 2) return
98353 if (length < index + lenb) return
98354
98355 // sequence length
98356 var len = privateKey[index + lenb - 1] | (lenb > 1 ? privateKey[index + lenb - 2] << 8 : 0)
98357 index += lenb
98358 if (length < index + len) return
98359
98360 // sequence element 0: version number (=1)
98361 if (length < index + 3 ||
98362 privateKey[index] !== 0x02 ||
98363 privateKey[index + 1] !== 0x01 ||
98364 privateKey[index + 2] !== 0x01) {
98365 return
98366 }
98367 index += 3
98368
98369 // sequence element 1: octet string, up to 32 bytes
98370 if (length < index + 2 ||
98371 privateKey[index] !== 0x04 ||
98372 privateKey[index + 1] > 0x20 ||
98373 length < index + 2 + privateKey[index + 1]) {
98374 return
98375 }
98376
98377 return privateKey.slice(index + 2, index + 2 + privateKey[index + 1])
98378}
98379
98380exports.signatureExport = function (sigObj) {
98381 var r = Buffer.concat([Buffer.from([0]), sigObj.r])
98382 for (var lenR = 33, posR = 0; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);
98383
98384 var s = Buffer.concat([Buffer.from([0]), sigObj.s])
98385 for (var lenS = 33, posS = 0; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);
98386
98387 return bip66.encode(r.slice(posR), s.slice(posS))
98388}
98389
98390exports.signatureImport = function (sig) {
98391 var r = Buffer.alloc(32, 0)
98392 var s = Buffer.alloc(32, 0)
98393
98394 try {
98395 var sigObj = bip66.decode(sig)
98396 if (sigObj.r.length === 33 && sigObj.r[0] === 0x00) sigObj.r = sigObj.r.slice(1)
98397 if (sigObj.r.length > 32) throw new Error('R length is too long')
98398 if (sigObj.s.length === 33 && sigObj.s[0] === 0x00) sigObj.s = sigObj.s.slice(1)
98399 if (sigObj.s.length > 32) throw new Error('S length is too long')
98400 } catch (err) {
98401 return
98402 }
98403
98404 sigObj.r.copy(r, 32 - sigObj.r.length)
98405 sigObj.s.copy(s, 32 - sigObj.s.length)
98406
98407 return { r: r, s: s }
98408}
98409
98410exports.signatureImportLax = function (sig) {
98411 var r = Buffer.alloc(32, 0)
98412 var s = Buffer.alloc(32, 0)
98413
98414 var length = sig.length
98415 var index = 0
98416
98417 // sequence tag byte
98418 if (sig[index++] !== 0x30) return
98419
98420 // sequence length byte
98421 var lenbyte = sig[index++]
98422 if (lenbyte & 0x80) {
98423 index += lenbyte - 0x80
98424 if (index > length) return
98425 }
98426
98427 // sequence tag byte for r
98428 if (sig[index++] !== 0x02) return
98429
98430 // length for r
98431 var rlen = sig[index++]
98432 if (rlen & 0x80) {
98433 lenbyte = rlen - 0x80
98434 if (index + lenbyte > length) return
98435 for (; lenbyte > 0 && sig[index] === 0x00; index += 1, lenbyte -= 1);
98436 for (rlen = 0; lenbyte > 0; index += 1, lenbyte -= 1) rlen = (rlen << 8) + sig[index]
98437 }
98438 if (rlen > length - index) return
98439 var rindex = index
98440 index += rlen
98441
98442 // sequence tag byte for s
98443 if (sig[index++] !== 0x02) return
98444
98445 // length for s
98446 var slen = sig[index++]
98447 if (slen & 0x80) {
98448 lenbyte = slen - 0x80
98449 if (index + lenbyte > length) return
98450 for (; lenbyte > 0 && sig[index] === 0x00; index += 1, lenbyte -= 1);
98451 for (slen = 0; lenbyte > 0; index += 1, lenbyte -= 1) slen = (slen << 8) + sig[index]
98452 }
98453 if (slen > length - index) return
98454 var sindex = index
98455 index += slen
98456
98457 // ignore leading zeros in r
98458 for (; rlen > 0 && sig[rindex] === 0x00; rlen -= 1, rindex += 1);
98459 // copy r value
98460 if (rlen > 32) return
98461 var rvalue = sig.slice(rindex, rindex + rlen)
98462 rvalue.copy(r, 32 - rvalue.length)
98463
98464 // ignore leading zeros in s
98465 for (; slen > 0 && sig[sindex] === 0x00; slen -= 1, sindex += 1);
98466 // copy s value
98467 if (slen > 32) return
98468 var svalue = sig.slice(sindex, sindex + slen)
98469 svalue.copy(s, 32 - svalue.length)
98470
98471 return { r: r, s: s }
98472}
98473
98474},{"bip66":68,"safe-buffer":742}],750:[function(require,module,exports){
98475'use strict'
98476var Buffer = require('safe-buffer').Buffer
98477var createHash = require('create-hash')
98478var BN = require('bn.js')
98479var EC = require('elliptic').ec
98480
98481var messages = require('../messages.json')
98482
98483var ec = new EC('secp256k1')
98484var ecparams = ec.curve
98485
98486function loadCompressedPublicKey (first, xBuffer) {
98487 var x = new BN(xBuffer)
98488
98489 // overflow
98490 if (x.cmp(ecparams.p) >= 0) return null
98491 x = x.toRed(ecparams.red)
98492
98493 // compute corresponding Y
98494 var y = x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt()
98495 if ((first === 0x03) !== y.isOdd()) y = y.redNeg()
98496
98497 return ec.keyPair({ pub: { x: x, y: y } })
98498}
98499
98500function loadUncompressedPublicKey (first, xBuffer, yBuffer) {
98501 var x = new BN(xBuffer)
98502 var y = new BN(yBuffer)
98503
98504 // overflow
98505 if (x.cmp(ecparams.p) >= 0 || y.cmp(ecparams.p) >= 0) return null
98506
98507 x = x.toRed(ecparams.red)
98508 y = y.toRed(ecparams.red)
98509
98510 // is odd flag
98511 if ((first === 0x06 || first === 0x07) && y.isOdd() !== (first === 0x07)) return null
98512
98513 // x*x*x + b = y*y
98514 var x3 = x.redSqr().redIMul(x)
98515 if (!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()) return null
98516
98517 return ec.keyPair({ pub: { x: x, y: y } })
98518}
98519
98520function loadPublicKey (publicKey) {
98521 var first = publicKey[0]
98522 switch (first) {
98523 case 0x02:
98524 case 0x03:
98525 if (publicKey.length !== 33) return null
98526 return loadCompressedPublicKey(first, publicKey.slice(1, 33))
98527 case 0x04:
98528 case 0x06:
98529 case 0x07:
98530 if (publicKey.length !== 65) return null
98531 return loadUncompressedPublicKey(first, publicKey.slice(1, 33), publicKey.slice(33, 65))
98532 default:
98533 return null
98534 }
98535}
98536
98537exports.privateKeyVerify = function (privateKey) {
98538 var bn = new BN(privateKey)
98539 return bn.cmp(ecparams.n) < 0 && !bn.isZero()
98540}
98541
98542exports.privateKeyExport = function (privateKey, compressed) {
98543 var d = new BN(privateKey)
98544 if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.EC_PRIVATE_KEY_EXPORT_DER_FAIL)
98545
98546 return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed, true))
98547}
98548
98549exports.privateKeyNegate = function (privateKey) {
98550 var bn = new BN(privateKey)
98551 return bn.isZero() ? Buffer.alloc(32) : ecparams.n.sub(bn).umod(ecparams.n).toArrayLike(Buffer, 'be', 32)
98552}
98553
98554exports.privateKeyModInverse = function (privateKey) {
98555 var bn = new BN(privateKey)
98556 if (bn.cmp(ecparams.n) >= 0 || bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_RANGE_INVALID)
98557
98558 return bn.invm(ecparams.n).toArrayLike(Buffer, 'be', 32)
98559}
98560
98561exports.privateKeyTweakAdd = function (privateKey, tweak) {
98562 var bn = new BN(tweak)
98563 if (bn.cmp(ecparams.n) >= 0) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL)
98564
98565 bn.iadd(new BN(privateKey))
98566 if (bn.cmp(ecparams.n) >= 0) bn.isub(ecparams.n)
98567 if (bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL)
98568
98569 return bn.toArrayLike(Buffer, 'be', 32)
98570}
98571
98572exports.privateKeyTweakMul = function (privateKey, tweak) {
98573 var bn = new BN(tweak)
98574 if (bn.cmp(ecparams.n) >= 0 || bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_MUL_FAIL)
98575
98576 bn.imul(new BN(privateKey))
98577 if (bn.cmp(ecparams.n)) bn = bn.umod(ecparams.n)
98578
98579 return bn.toArrayLike(Buffer, 'be', 32)
98580}
98581
98582exports.publicKeyCreate = function (privateKey, compressed) {
98583 var d = new BN(privateKey)
98584 if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.EC_PUBLIC_KEY_CREATE_FAIL)
98585
98586 return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed, true))
98587}
98588
98589exports.publicKeyConvert = function (publicKey, compressed) {
98590 var pair = loadPublicKey(publicKey)
98591 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
98592
98593 return Buffer.from(pair.getPublic(compressed, true))
98594}
98595
98596exports.publicKeyVerify = function (publicKey) {
98597 return loadPublicKey(publicKey) !== null
98598}
98599
98600exports.publicKeyTweakAdd = function (publicKey, tweak, compressed) {
98601 var pair = loadPublicKey(publicKey)
98602 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
98603
98604 tweak = new BN(tweak)
98605 if (tweak.cmp(ecparams.n) >= 0) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL)
98606
98607 var point = ecparams.g.mul(tweak).add(pair.pub)
98608 if (point.isInfinity()) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL)
98609
98610 return Buffer.from(point.encode(true, compressed))
98611}
98612
98613exports.publicKeyTweakMul = function (publicKey, tweak, compressed) {
98614 var pair = loadPublicKey(publicKey)
98615 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
98616
98617 tweak = new BN(tweak)
98618 if (tweak.cmp(ecparams.n) >= 0 || tweak.isZero()) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_MUL_FAIL)
98619
98620 return Buffer.from(pair.pub.mul(tweak).encode(true, compressed))
98621}
98622
98623exports.publicKeyCombine = function (publicKeys, compressed) {
98624 var pairs = new Array(publicKeys.length)
98625 for (var i = 0; i < publicKeys.length; ++i) {
98626 pairs[i] = loadPublicKey(publicKeys[i])
98627 if (pairs[i] === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
98628 }
98629
98630 var point = pairs[0].pub
98631 for (var j = 1; j < pairs.length; ++j) point = point.add(pairs[j].pub)
98632 if (point.isInfinity()) throw new Error(messages.EC_PUBLIC_KEY_COMBINE_FAIL)
98633
98634 return Buffer.from(point.encode(true, compressed))
98635}
98636
98637exports.signatureNormalize = function (signature) {
98638 var r = new BN(signature.slice(0, 32))
98639 var s = new BN(signature.slice(32, 64))
98640 if (r.cmp(ecparams.n) >= 0 || s.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
98641
98642 var result = Buffer.from(signature)
98643 if (s.cmp(ec.nh) === 1) ecparams.n.sub(s).toArrayLike(Buffer, 'be', 32).copy(result, 32)
98644
98645 return result
98646}
98647
98648exports.signatureExport = function (signature) {
98649 var r = signature.slice(0, 32)
98650 var s = signature.slice(32, 64)
98651 if (new BN(r).cmp(ecparams.n) >= 0 || new BN(s).cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
98652
98653 return { r: r, s: s }
98654}
98655
98656exports.signatureImport = function (sigObj) {
98657 var r = new BN(sigObj.r)
98658 if (r.cmp(ecparams.n) >= 0) r = new BN(0)
98659
98660 var s = new BN(sigObj.s)
98661 if (s.cmp(ecparams.n) >= 0) s = new BN(0)
98662
98663 return Buffer.concat([
98664 r.toArrayLike(Buffer, 'be', 32),
98665 s.toArrayLike(Buffer, 'be', 32)
98666 ])
98667}
98668
98669exports.sign = function (message, privateKey, noncefn, data) {
98670 if (typeof noncefn === 'function') {
98671 var getNonce = noncefn
98672 noncefn = function (counter) {
98673 var nonce = getNonce(message, privateKey, null, data, counter)
98674 if (!Buffer.isBuffer(nonce) || nonce.length !== 32) throw new Error(messages.ECDSA_SIGN_FAIL)
98675
98676 return new BN(nonce)
98677 }
98678 }
98679
98680 var d = new BN(privateKey)
98681 if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.ECDSA_SIGN_FAIL)
98682
98683 var result = ec.sign(message, privateKey, { canonical: true, k: noncefn, pers: data })
98684 return {
98685 signature: Buffer.concat([
98686 result.r.toArrayLike(Buffer, 'be', 32),
98687 result.s.toArrayLike(Buffer, 'be', 32)
98688 ]),
98689 recovery: result.recoveryParam
98690 }
98691}
98692
98693exports.verify = function (message, signature, publicKey) {
98694 var sigObj = { r: signature.slice(0, 32), s: signature.slice(32, 64) }
98695
98696 var sigr = new BN(sigObj.r)
98697 var sigs = new BN(sigObj.s)
98698 if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
98699 if (sigs.cmp(ec.nh) === 1 || sigr.isZero() || sigs.isZero()) return false
98700
98701 var pair = loadPublicKey(publicKey)
98702 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
98703
98704 return ec.verify(message, sigObj, { x: pair.pub.x, y: pair.pub.y })
98705}
98706
98707exports.recover = function (message, signature, recovery, compressed) {
98708 var sigObj = { r: signature.slice(0, 32), s: signature.slice(32, 64) }
98709
98710 var sigr = new BN(sigObj.r)
98711 var sigs = new BN(sigObj.s)
98712 if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
98713
98714 try {
98715 if (sigr.isZero() || sigs.isZero()) throw new Error()
98716
98717 var point = ec.recoverPubKey(message, sigObj, recovery)
98718 return Buffer.from(point.encode(true, compressed))
98719 } catch (err) {
98720 throw new Error(messages.ECDSA_RECOVER_FAIL)
98721 }
98722}
98723
98724exports.ecdh = function (publicKey, privateKey) {
98725 var shared = exports.ecdhUnsafe(publicKey, privateKey, true)
98726 return createHash('sha256').update(shared).digest()
98727}
98728
98729exports.ecdhUnsafe = function (publicKey, privateKey, compressed) {
98730 var pair = loadPublicKey(publicKey)
98731 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
98732
98733 var scalar = new BN(privateKey)
98734 if (scalar.cmp(ecparams.n) >= 0 || scalar.isZero()) throw new Error(messages.ECDH_FAIL)
98735
98736 return Buffer.from(pair.pub.mul(scalar).encode(true, compressed))
98737}
98738
98739},{"../messages.json":752,"bn.js":108,"create-hash":239,"elliptic":753,"safe-buffer":742}],751:[function(require,module,exports){
98740'use strict'
98741var assert = require('./assert')
98742var der = require('./der')
98743var messages = require('./messages.json')
98744
98745function initCompressedValue (value, defaultValue) {
98746 if (value === undefined) return defaultValue
98747
98748 assert.isBoolean(value, messages.COMPRESSED_TYPE_INVALID)
98749 return value
98750}
98751
98752module.exports = function (secp256k1) {
98753 return {
98754 privateKeyVerify: function (privateKey) {
98755 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98756 return privateKey.length === 32 && secp256k1.privateKeyVerify(privateKey)
98757 },
98758
98759 privateKeyExport: function (privateKey, compressed) {
98760 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98761 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98762
98763 compressed = initCompressedValue(compressed, true)
98764 var publicKey = secp256k1.privateKeyExport(privateKey, compressed)
98765
98766 return der.privateKeyExport(privateKey, publicKey, compressed)
98767 },
98768
98769 privateKeyImport: function (privateKey) {
98770 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98771
98772 privateKey = der.privateKeyImport(privateKey)
98773 if (privateKey && privateKey.length === 32 && secp256k1.privateKeyVerify(privateKey)) return privateKey
98774
98775 throw new Error(messages.EC_PRIVATE_KEY_IMPORT_DER_FAIL)
98776 },
98777
98778 privateKeyNegate: function (privateKey) {
98779 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98780 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98781
98782 return secp256k1.privateKeyNegate(privateKey)
98783 },
98784
98785 privateKeyModInverse: function (privateKey) {
98786 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98787 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98788
98789 return secp256k1.privateKeyModInverse(privateKey)
98790 },
98791
98792 privateKeyTweakAdd: function (privateKey, tweak) {
98793 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98794 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98795
98796 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
98797 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
98798
98799 return secp256k1.privateKeyTweakAdd(privateKey, tweak)
98800 },
98801
98802 privateKeyTweakMul: function (privateKey, tweak) {
98803 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98804 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98805
98806 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
98807 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
98808
98809 return secp256k1.privateKeyTweakMul(privateKey, tweak)
98810 },
98811
98812 publicKeyCreate: function (privateKey, compressed) {
98813 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98814 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98815
98816 compressed = initCompressedValue(compressed, true)
98817
98818 return secp256k1.publicKeyCreate(privateKey, compressed)
98819 },
98820
98821 publicKeyConvert: function (publicKey, compressed) {
98822 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98823 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98824
98825 compressed = initCompressedValue(compressed, true)
98826
98827 return secp256k1.publicKeyConvert(publicKey, compressed)
98828 },
98829
98830 publicKeyVerify: function (publicKey) {
98831 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98832 return secp256k1.publicKeyVerify(publicKey)
98833 },
98834
98835 publicKeyTweakAdd: function (publicKey, tweak, compressed) {
98836 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98837 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98838
98839 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
98840 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
98841
98842 compressed = initCompressedValue(compressed, true)
98843
98844 return secp256k1.publicKeyTweakAdd(publicKey, tweak, compressed)
98845 },
98846
98847 publicKeyTweakMul: function (publicKey, tweak, compressed) {
98848 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98849 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98850
98851 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
98852 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
98853
98854 compressed = initCompressedValue(compressed, true)
98855
98856 return secp256k1.publicKeyTweakMul(publicKey, tweak, compressed)
98857 },
98858
98859 publicKeyCombine: function (publicKeys, compressed) {
98860 assert.isArray(publicKeys, messages.EC_PUBLIC_KEYS_TYPE_INVALID)
98861 assert.isLengthGTZero(publicKeys, messages.EC_PUBLIC_KEYS_LENGTH_INVALID)
98862 for (var i = 0; i < publicKeys.length; ++i) {
98863 assert.isBuffer(publicKeys[i], messages.EC_PUBLIC_KEY_TYPE_INVALID)
98864 assert.isBufferLength2(publicKeys[i], 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98865 }
98866
98867 compressed = initCompressedValue(compressed, true)
98868
98869 return secp256k1.publicKeyCombine(publicKeys, compressed)
98870 },
98871
98872 signatureNormalize: function (signature) {
98873 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
98874 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
98875
98876 return secp256k1.signatureNormalize(signature)
98877 },
98878
98879 signatureExport: function (signature) {
98880 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
98881 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
98882
98883 var sigObj = secp256k1.signatureExport(signature)
98884 return der.signatureExport(sigObj)
98885 },
98886
98887 signatureImport: function (sig) {
98888 assert.isBuffer(sig, messages.ECDSA_SIGNATURE_TYPE_INVALID)
98889 assert.isLengthGTZero(sig, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
98890
98891 var sigObj = der.signatureImport(sig)
98892 if (sigObj) return secp256k1.signatureImport(sigObj)
98893
98894 throw new Error(messages.ECDSA_SIGNATURE_PARSE_DER_FAIL)
98895 },
98896
98897 signatureImportLax: function (sig) {
98898 assert.isBuffer(sig, messages.ECDSA_SIGNATURE_TYPE_INVALID)
98899 assert.isLengthGTZero(sig, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
98900
98901 var sigObj = der.signatureImportLax(sig)
98902 if (sigObj) return secp256k1.signatureImport(sigObj)
98903
98904 throw new Error(messages.ECDSA_SIGNATURE_PARSE_DER_FAIL)
98905 },
98906
98907 sign: function (message, privateKey, options) {
98908 assert.isBuffer(message, messages.MSG32_TYPE_INVALID)
98909 assert.isBufferLength(message, 32, messages.MSG32_LENGTH_INVALID)
98910
98911 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98912 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98913
98914 var data = null
98915 var noncefn = null
98916 if (options !== undefined) {
98917 assert.isObject(options, messages.OPTIONS_TYPE_INVALID)
98918
98919 if (options.data !== undefined) {
98920 assert.isBuffer(options.data, messages.OPTIONS_DATA_TYPE_INVALID)
98921 assert.isBufferLength(options.data, 32, messages.OPTIONS_DATA_LENGTH_INVALID)
98922 data = options.data
98923 }
98924
98925 if (options.noncefn !== undefined) {
98926 assert.isFunction(options.noncefn, messages.OPTIONS_NONCEFN_TYPE_INVALID)
98927 noncefn = options.noncefn
98928 }
98929 }
98930
98931 return secp256k1.sign(message, privateKey, noncefn, data)
98932 },
98933
98934 verify: function (message, signature, publicKey) {
98935 assert.isBuffer(message, messages.MSG32_TYPE_INVALID)
98936 assert.isBufferLength(message, 32, messages.MSG32_LENGTH_INVALID)
98937
98938 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
98939 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
98940
98941 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98942 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98943
98944 return secp256k1.verify(message, signature, publicKey)
98945 },
98946
98947 recover: function (message, signature, recovery, compressed) {
98948 assert.isBuffer(message, messages.MSG32_TYPE_INVALID)
98949 assert.isBufferLength(message, 32, messages.MSG32_LENGTH_INVALID)
98950
98951 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
98952 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
98953
98954 assert.isNumber(recovery, messages.RECOVERY_ID_TYPE_INVALID)
98955 assert.isNumberInInterval(recovery, -1, 4, messages.RECOVERY_ID_VALUE_INVALID)
98956
98957 compressed = initCompressedValue(compressed, true)
98958
98959 return secp256k1.recover(message, signature, recovery, compressed)
98960 },
98961
98962 ecdh: function (publicKey, privateKey) {
98963 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98964 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98965
98966 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98967 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98968
98969 return secp256k1.ecdh(publicKey, privateKey)
98970 },
98971
98972 ecdhUnsafe: function (publicKey, privateKey, compressed) {
98973 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
98974 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
98975
98976 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
98977 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
98978
98979 compressed = initCompressedValue(compressed, true)
98980
98981 return secp256k1.ecdhUnsafe(publicKey, privateKey, compressed)
98982 }
98983 }
98984}
98985
98986},{"./assert":748,"./der":749,"./messages.json":752}],752:[function(require,module,exports){
98987module.exports={
98988 "COMPRESSED_TYPE_INVALID": "compressed should be a boolean",
98989 "EC_PRIVATE_KEY_TYPE_INVALID": "private key should be a Buffer",
98990 "EC_PRIVATE_KEY_LENGTH_INVALID": "private key length is invalid",
98991 "EC_PRIVATE_KEY_RANGE_INVALID": "private key range is invalid",
98992 "EC_PRIVATE_KEY_TWEAK_ADD_FAIL": "tweak out of range or resulting private key is invalid",
98993 "EC_PRIVATE_KEY_TWEAK_MUL_FAIL": "tweak out of range",
98994 "EC_PRIVATE_KEY_EXPORT_DER_FAIL": "couldn't export to DER format",
98995 "EC_PRIVATE_KEY_IMPORT_DER_FAIL": "couldn't import from DER format",
98996 "EC_PUBLIC_KEYS_TYPE_INVALID": "public keys should be an Array",
98997 "EC_PUBLIC_KEYS_LENGTH_INVALID": "public keys Array should have at least 1 element",
98998 "EC_PUBLIC_KEY_TYPE_INVALID": "public key should be a Buffer",
98999 "EC_PUBLIC_KEY_LENGTH_INVALID": "public key length is invalid",
99000 "EC_PUBLIC_KEY_PARSE_FAIL": "the public key could not be parsed or is invalid",
99001 "EC_PUBLIC_KEY_CREATE_FAIL": "private was invalid, try again",
99002 "EC_PUBLIC_KEY_TWEAK_ADD_FAIL": "tweak out of range or resulting public key is invalid",
99003 "EC_PUBLIC_KEY_TWEAK_MUL_FAIL": "tweak out of range",
99004 "EC_PUBLIC_KEY_COMBINE_FAIL": "the sum of the public keys is not valid",
99005 "ECDH_FAIL": "scalar was invalid (zero or overflow)",
99006 "ECDSA_SIGNATURE_TYPE_INVALID": "signature should be a Buffer",
99007 "ECDSA_SIGNATURE_LENGTH_INVALID": "signature length is invalid",
99008 "ECDSA_SIGNATURE_PARSE_FAIL": "couldn't parse signature",
99009 "ECDSA_SIGNATURE_PARSE_DER_FAIL": "couldn't parse DER signature",
99010 "ECDSA_SIGNATURE_SERIALIZE_DER_FAIL": "couldn't serialize signature to DER format",
99011 "ECDSA_SIGN_FAIL": "nonce generation function failed or private key is invalid",
99012 "ECDSA_RECOVER_FAIL": "couldn't recover public key from signature",
99013 "MSG32_TYPE_INVALID": "message should be a Buffer",
99014 "MSG32_LENGTH_INVALID": "message length is invalid",
99015 "OPTIONS_TYPE_INVALID": "options should be an Object",
99016 "OPTIONS_DATA_TYPE_INVALID": "options.data should be a Buffer",
99017 "OPTIONS_DATA_LENGTH_INVALID": "options.data length is invalid",
99018 "OPTIONS_NONCEFN_TYPE_INVALID": "options.noncefn should be a Function",
99019 "RECOVERY_ID_TYPE_INVALID": "recovery should be a Number",
99020 "RECOVERY_ID_VALUE_INVALID": "recovery should have value between -1 and 4",
99021 "TWEAK_TYPE_INVALID": "tweak should be a Buffer",
99022 "TWEAK_LENGTH_INVALID": "tweak length is invalid"
99023}
99024
99025},{}],753:[function(require,module,exports){
99026arguments[4][317][0].apply(exports,arguments)
99027},{"../package.json":768,"./elliptic/curve":756,"./elliptic/curves":759,"./elliptic/ec":760,"./elliptic/eddsa":763,"./elliptic/utils":767,"brorand":109,"dup":317}],754:[function(require,module,exports){
99028'use strict';
99029
99030var BN = require('bn.js');
99031var utils = require('../utils');
99032var getNAF = utils.getNAF;
99033var getJSF = utils.getJSF;
99034var assert = utils.assert;
99035
99036function BaseCurve(type, conf) {
99037 this.type = type;
99038 this.p = new BN(conf.p, 16);
99039
99040 // Use Montgomery, when there is no fast reduction for the prime
99041 this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
99042
99043 // Useful for many curves
99044 this.zero = new BN(0).toRed(this.red);
99045 this.one = new BN(1).toRed(this.red);
99046 this.two = new BN(2).toRed(this.red);
99047
99048 // Curve configuration, optional
99049 this.n = conf.n && new BN(conf.n, 16);
99050 this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
99051
99052 // Temporary arrays
99053 this._wnafT1 = new Array(4);
99054 this._wnafT2 = new Array(4);
99055 this._wnafT3 = new Array(4);
99056 this._wnafT4 = new Array(4);
99057
99058 this._bitLength = this.n ? this.n.bitLength() : 0;
99059
99060 // Generalized Greg Maxwell's trick
99061 var adjustCount = this.n && this.p.div(this.n);
99062 if (!adjustCount || adjustCount.cmpn(100) > 0) {
99063 this.redN = null;
99064 } else {
99065 this._maxwellTrick = true;
99066 this.redN = this.n.toRed(this.red);
99067 }
99068}
99069module.exports = BaseCurve;
99070
99071BaseCurve.prototype.point = function point() {
99072 throw new Error('Not implemented');
99073};
99074
99075BaseCurve.prototype.validate = function validate() {
99076 throw new Error('Not implemented');
99077};
99078
99079BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
99080 assert(p.precomputed);
99081 var doubles = p._getDoubles();
99082
99083 var naf = getNAF(k, 1, this._bitLength);
99084 var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
99085 I /= 3;
99086
99087 // Translate into more windowed form
99088 var repr = [];
99089 for (var j = 0; j < naf.length; j += doubles.step) {
99090 var nafW = 0;
99091 for (var k = j + doubles.step - 1; k >= j; k--)
99092 nafW = (nafW << 1) + naf[k];
99093 repr.push(nafW);
99094 }
99095
99096 var a = this.jpoint(null, null, null);
99097 var b = this.jpoint(null, null, null);
99098 for (var i = I; i > 0; i--) {
99099 for (var j = 0; j < repr.length; j++) {
99100 var nafW = repr[j];
99101 if (nafW === i)
99102 b = b.mixedAdd(doubles.points[j]);
99103 else if (nafW === -i)
99104 b = b.mixedAdd(doubles.points[j].neg());
99105 }
99106 a = a.add(b);
99107 }
99108 return a.toP();
99109};
99110
99111BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
99112 var w = 4;
99113
99114 // Precompute window
99115 var nafPoints = p._getNAFPoints(w);
99116 w = nafPoints.wnd;
99117 var wnd = nafPoints.points;
99118
99119 // Get NAF form
99120 var naf = getNAF(k, w, this._bitLength);
99121
99122 // Add `this`*(N+1) for every w-NAF index
99123 var acc = this.jpoint(null, null, null);
99124 for (var i = naf.length - 1; i >= 0; i--) {
99125 // Count zeroes
99126 for (var k = 0; i >= 0 && naf[i] === 0; i--)
99127 k++;
99128 if (i >= 0)
99129 k++;
99130 acc = acc.dblp(k);
99131
99132 if (i < 0)
99133 break;
99134 var z = naf[i];
99135 assert(z !== 0);
99136 if (p.type === 'affine') {
99137 // J +- P
99138 if (z > 0)
99139 acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
99140 else
99141 acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
99142 } else {
99143 // J +- J
99144 if (z > 0)
99145 acc = acc.add(wnd[(z - 1) >> 1]);
99146 else
99147 acc = acc.add(wnd[(-z - 1) >> 1].neg());
99148 }
99149 }
99150 return p.type === 'affine' ? acc.toP() : acc;
99151};
99152
99153BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
99154 points,
99155 coeffs,
99156 len,
99157 jacobianResult) {
99158 var wndWidth = this._wnafT1;
99159 var wnd = this._wnafT2;
99160 var naf = this._wnafT3;
99161
99162 // Fill all arrays
99163 var max = 0;
99164 for (var i = 0; i < len; i++) {
99165 var p = points[i];
99166 var nafPoints = p._getNAFPoints(defW);
99167 wndWidth[i] = nafPoints.wnd;
99168 wnd[i] = nafPoints.points;
99169 }
99170
99171 // Comb small window NAFs
99172 for (var i = len - 1; i >= 1; i -= 2) {
99173 var a = i - 1;
99174 var b = i;
99175 if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
99176 naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
99177 naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
99178 max = Math.max(naf[a].length, max);
99179 max = Math.max(naf[b].length, max);
99180 continue;
99181 }
99182
99183 var comb = [
99184 points[a], /* 1 */
99185 null, /* 3 */
99186 null, /* 5 */
99187 points[b] /* 7 */
99188 ];
99189
99190 // Try to avoid Projective points, if possible
99191 if (points[a].y.cmp(points[b].y) === 0) {
99192 comb[1] = points[a].add(points[b]);
99193 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
99194 } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
99195 comb[1] = points[a].toJ().mixedAdd(points[b]);
99196 comb[2] = points[a].add(points[b].neg());
99197 } else {
99198 comb[1] = points[a].toJ().mixedAdd(points[b]);
99199 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
99200 }
99201
99202 var index = [
99203 -3, /* -1 -1 */
99204 -1, /* -1 0 */
99205 -5, /* -1 1 */
99206 -7, /* 0 -1 */
99207 0, /* 0 0 */
99208 7, /* 0 1 */
99209 5, /* 1 -1 */
99210 1, /* 1 0 */
99211 3 /* 1 1 */
99212 ];
99213
99214 var jsf = getJSF(coeffs[a], coeffs[b]);
99215 max = Math.max(jsf[0].length, max);
99216 naf[a] = new Array(max);
99217 naf[b] = new Array(max);
99218 for (var j = 0; j < max; j++) {
99219 var ja = jsf[0][j] | 0;
99220 var jb = jsf[1][j] | 0;
99221
99222 naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
99223 naf[b][j] = 0;
99224 wnd[a] = comb;
99225 }
99226 }
99227
99228 var acc = this.jpoint(null, null, null);
99229 var tmp = this._wnafT4;
99230 for (var i = max; i >= 0; i--) {
99231 var k = 0;
99232
99233 while (i >= 0) {
99234 var zero = true;
99235 for (var j = 0; j < len; j++) {
99236 tmp[j] = naf[j][i] | 0;
99237 if (tmp[j] !== 0)
99238 zero = false;
99239 }
99240 if (!zero)
99241 break;
99242 k++;
99243 i--;
99244 }
99245 if (i >= 0)
99246 k++;
99247 acc = acc.dblp(k);
99248 if (i < 0)
99249 break;
99250
99251 for (var j = 0; j < len; j++) {
99252 var z = tmp[j];
99253 var p;
99254 if (z === 0)
99255 continue;
99256 else if (z > 0)
99257 p = wnd[j][(z - 1) >> 1];
99258 else if (z < 0)
99259 p = wnd[j][(-z - 1) >> 1].neg();
99260
99261 if (p.type === 'affine')
99262 acc = acc.mixedAdd(p);
99263 else
99264 acc = acc.add(p);
99265 }
99266 }
99267 // Zeroify references
99268 for (var i = 0; i < len; i++)
99269 wnd[i] = null;
99270
99271 if (jacobianResult)
99272 return acc;
99273 else
99274 return acc.toP();
99275};
99276
99277function BasePoint(curve, type) {
99278 this.curve = curve;
99279 this.type = type;
99280 this.precomputed = null;
99281}
99282BaseCurve.BasePoint = BasePoint;
99283
99284BasePoint.prototype.eq = function eq(/*other*/) {
99285 throw new Error('Not implemented');
99286};
99287
99288BasePoint.prototype.validate = function validate() {
99289 return this.curve.validate(this);
99290};
99291
99292BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
99293 bytes = utils.toArray(bytes, enc);
99294
99295 var len = this.p.byteLength();
99296
99297 // uncompressed, hybrid-odd, hybrid-even
99298 if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
99299 bytes.length - 1 === 2 * len) {
99300 if (bytes[0] === 0x06)
99301 assert(bytes[bytes.length - 1] % 2 === 0);
99302 else if (bytes[0] === 0x07)
99303 assert(bytes[bytes.length - 1] % 2 === 1);
99304
99305 var res = this.point(bytes.slice(1, 1 + len),
99306 bytes.slice(1 + len, 1 + 2 * len));
99307
99308 return res;
99309 } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
99310 bytes.length - 1 === len) {
99311 return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
99312 }
99313 throw new Error('Unknown point format');
99314};
99315
99316BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
99317 return this.encode(enc, true);
99318};
99319
99320BasePoint.prototype._encode = function _encode(compact) {
99321 var len = this.curve.p.byteLength();
99322 var x = this.getX().toArray('be', len);
99323
99324 if (compact)
99325 return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
99326
99327 return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
99328};
99329
99330BasePoint.prototype.encode = function encode(enc, compact) {
99331 return utils.encode(this._encode(compact), enc);
99332};
99333
99334BasePoint.prototype.precompute = function precompute(power) {
99335 if (this.precomputed)
99336 return this;
99337
99338 var precomputed = {
99339 doubles: null,
99340 naf: null,
99341 beta: null
99342 };
99343 precomputed.naf = this._getNAFPoints(8);
99344 precomputed.doubles = this._getDoubles(4, power);
99345 precomputed.beta = this._getBeta();
99346 this.precomputed = precomputed;
99347
99348 return this;
99349};
99350
99351BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
99352 if (!this.precomputed)
99353 return false;
99354
99355 var doubles = this.precomputed.doubles;
99356 if (!doubles)
99357 return false;
99358
99359 return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
99360};
99361
99362BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
99363 if (this.precomputed && this.precomputed.doubles)
99364 return this.precomputed.doubles;
99365
99366 var doubles = [ this ];
99367 var acc = this;
99368 for (var i = 0; i < power; i += step) {
99369 for (var j = 0; j < step; j++)
99370 acc = acc.dbl();
99371 doubles.push(acc);
99372 }
99373 return {
99374 step: step,
99375 points: doubles
99376 };
99377};
99378
99379BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
99380 if (this.precomputed && this.precomputed.naf)
99381 return this.precomputed.naf;
99382
99383 var res = [ this ];
99384 var max = (1 << wnd) - 1;
99385 var dbl = max === 1 ? null : this.dbl();
99386 for (var i = 1; i < max; i++)
99387 res[i] = res[i - 1].add(dbl);
99388 return {
99389 wnd: wnd,
99390 points: res
99391 };
99392};
99393
99394BasePoint.prototype._getBeta = function _getBeta() {
99395 return null;
99396};
99397
99398BasePoint.prototype.dblp = function dblp(k) {
99399 var r = this;
99400 for (var i = 0; i < k; i++)
99401 r = r.dbl();
99402 return r;
99403};
99404
99405},{"../utils":767,"bn.js":108}],755:[function(require,module,exports){
99406'use strict';
99407
99408var utils = require('../utils');
99409var BN = require('bn.js');
99410var inherits = require('inherits');
99411var Base = require('./base');
99412
99413var assert = utils.assert;
99414
99415function EdwardsCurve(conf) {
99416 // NOTE: Important as we are creating point in Base.call()
99417 this.twisted = (conf.a | 0) !== 1;
99418 this.mOneA = this.twisted && (conf.a | 0) === -1;
99419 this.extended = this.mOneA;
99420
99421 Base.call(this, 'edwards', conf);
99422
99423 this.a = new BN(conf.a, 16).umod(this.red.m);
99424 this.a = this.a.toRed(this.red);
99425 this.c = new BN(conf.c, 16).toRed(this.red);
99426 this.c2 = this.c.redSqr();
99427 this.d = new BN(conf.d, 16).toRed(this.red);
99428 this.dd = this.d.redAdd(this.d);
99429
99430 assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
99431 this.oneC = (conf.c | 0) === 1;
99432}
99433inherits(EdwardsCurve, Base);
99434module.exports = EdwardsCurve;
99435
99436EdwardsCurve.prototype._mulA = function _mulA(num) {
99437 if (this.mOneA)
99438 return num.redNeg();
99439 else
99440 return this.a.redMul(num);
99441};
99442
99443EdwardsCurve.prototype._mulC = function _mulC(num) {
99444 if (this.oneC)
99445 return num;
99446 else
99447 return this.c.redMul(num);
99448};
99449
99450// Just for compatibility with Short curve
99451EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
99452 return this.point(x, y, z, t);
99453};
99454
99455EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
99456 x = new BN(x, 16);
99457 if (!x.red)
99458 x = x.toRed(this.red);
99459
99460 var x2 = x.redSqr();
99461 var rhs = this.c2.redSub(this.a.redMul(x2));
99462 var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
99463
99464 var y2 = rhs.redMul(lhs.redInvm());
99465 var y = y2.redSqrt();
99466 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
99467 throw new Error('invalid point');
99468
99469 var isOdd = y.fromRed().isOdd();
99470 if (odd && !isOdd || !odd && isOdd)
99471 y = y.redNeg();
99472
99473 return this.point(x, y);
99474};
99475
99476EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
99477 y = new BN(y, 16);
99478 if (!y.red)
99479 y = y.toRed(this.red);
99480
99481 // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
99482 var y2 = y.redSqr();
99483 var lhs = y2.redSub(this.c2);
99484 var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
99485 var x2 = lhs.redMul(rhs.redInvm());
99486
99487 if (x2.cmp(this.zero) === 0) {
99488 if (odd)
99489 throw new Error('invalid point');
99490 else
99491 return this.point(this.zero, y);
99492 }
99493
99494 var x = x2.redSqrt();
99495 if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
99496 throw new Error('invalid point');
99497
99498 if (x.fromRed().isOdd() !== odd)
99499 x = x.redNeg();
99500
99501 return this.point(x, y);
99502};
99503
99504EdwardsCurve.prototype.validate = function validate(point) {
99505 if (point.isInfinity())
99506 return true;
99507
99508 // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
99509 point.normalize();
99510
99511 var x2 = point.x.redSqr();
99512 var y2 = point.y.redSqr();
99513 var lhs = x2.redMul(this.a).redAdd(y2);
99514 var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
99515
99516 return lhs.cmp(rhs) === 0;
99517};
99518
99519function Point(curve, x, y, z, t) {
99520 Base.BasePoint.call(this, curve, 'projective');
99521 if (x === null && y === null && z === null) {
99522 this.x = this.curve.zero;
99523 this.y = this.curve.one;
99524 this.z = this.curve.one;
99525 this.t = this.curve.zero;
99526 this.zOne = true;
99527 } else {
99528 this.x = new BN(x, 16);
99529 this.y = new BN(y, 16);
99530 this.z = z ? new BN(z, 16) : this.curve.one;
99531 this.t = t && new BN(t, 16);
99532 if (!this.x.red)
99533 this.x = this.x.toRed(this.curve.red);
99534 if (!this.y.red)
99535 this.y = this.y.toRed(this.curve.red);
99536 if (!this.z.red)
99537 this.z = this.z.toRed(this.curve.red);
99538 if (this.t && !this.t.red)
99539 this.t = this.t.toRed(this.curve.red);
99540 this.zOne = this.z === this.curve.one;
99541
99542 // Use extended coordinates
99543 if (this.curve.extended && !this.t) {
99544 this.t = this.x.redMul(this.y);
99545 if (!this.zOne)
99546 this.t = this.t.redMul(this.z.redInvm());
99547 }
99548 }
99549}
99550inherits(Point, Base.BasePoint);
99551
99552EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
99553 return Point.fromJSON(this, obj);
99554};
99555
99556EdwardsCurve.prototype.point = function point(x, y, z, t) {
99557 return new Point(this, x, y, z, t);
99558};
99559
99560Point.fromJSON = function fromJSON(curve, obj) {
99561 return new Point(curve, obj[0], obj[1], obj[2]);
99562};
99563
99564Point.prototype.inspect = function inspect() {
99565 if (this.isInfinity())
99566 return '<EC Point Infinity>';
99567 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
99568 ' y: ' + this.y.fromRed().toString(16, 2) +
99569 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
99570};
99571
99572Point.prototype.isInfinity = function isInfinity() {
99573 // XXX This code assumes that zero is always zero in red
99574 return this.x.cmpn(0) === 0 &&
99575 (this.y.cmp(this.z) === 0 ||
99576 (this.zOne && this.y.cmp(this.curve.c) === 0));
99577};
99578
99579Point.prototype._extDbl = function _extDbl() {
99580 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
99581 // #doubling-dbl-2008-hwcd
99582 // 4M + 4S
99583
99584 // A = X1^2
99585 var a = this.x.redSqr();
99586 // B = Y1^2
99587 var b = this.y.redSqr();
99588 // C = 2 * Z1^2
99589 var c = this.z.redSqr();
99590 c = c.redIAdd(c);
99591 // D = a * A
99592 var d = this.curve._mulA(a);
99593 // E = (X1 + Y1)^2 - A - B
99594 var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
99595 // G = D + B
99596 var g = d.redAdd(b);
99597 // F = G - C
99598 var f = g.redSub(c);
99599 // H = D - B
99600 var h = d.redSub(b);
99601 // X3 = E * F
99602 var nx = e.redMul(f);
99603 // Y3 = G * H
99604 var ny = g.redMul(h);
99605 // T3 = E * H
99606 var nt = e.redMul(h);
99607 // Z3 = F * G
99608 var nz = f.redMul(g);
99609 return this.curve.point(nx, ny, nz, nt);
99610};
99611
99612Point.prototype._projDbl = function _projDbl() {
99613 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
99614 // #doubling-dbl-2008-bbjlp
99615 // #doubling-dbl-2007-bl
99616 // and others
99617 // Generally 3M + 4S or 2M + 4S
99618
99619 // B = (X1 + Y1)^2
99620 var b = this.x.redAdd(this.y).redSqr();
99621 // C = X1^2
99622 var c = this.x.redSqr();
99623 // D = Y1^2
99624 var d = this.y.redSqr();
99625
99626 var nx;
99627 var ny;
99628 var nz;
99629 if (this.curve.twisted) {
99630 // E = a * C
99631 var e = this.curve._mulA(c);
99632 // F = E + D
99633 var f = e.redAdd(d);
99634 if (this.zOne) {
99635 // X3 = (B - C - D) * (F - 2)
99636 nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
99637 // Y3 = F * (E - D)
99638 ny = f.redMul(e.redSub(d));
99639 // Z3 = F^2 - 2 * F
99640 nz = f.redSqr().redSub(f).redSub(f);
99641 } else {
99642 // H = Z1^2
99643 var h = this.z.redSqr();
99644 // J = F - 2 * H
99645 var j = f.redSub(h).redISub(h);
99646 // X3 = (B-C-D)*J
99647 nx = b.redSub(c).redISub(d).redMul(j);
99648 // Y3 = F * (E - D)
99649 ny = f.redMul(e.redSub(d));
99650 // Z3 = F * J
99651 nz = f.redMul(j);
99652 }
99653 } else {
99654 // E = C + D
99655 var e = c.redAdd(d);
99656 // H = (c * Z1)^2
99657 var h = this.curve._mulC(this.z).redSqr();
99658 // J = E - 2 * H
99659 var j = e.redSub(h).redSub(h);
99660 // X3 = c * (B - E) * J
99661 nx = this.curve._mulC(b.redISub(e)).redMul(j);
99662 // Y3 = c * E * (C - D)
99663 ny = this.curve._mulC(e).redMul(c.redISub(d));
99664 // Z3 = E * J
99665 nz = e.redMul(j);
99666 }
99667 return this.curve.point(nx, ny, nz);
99668};
99669
99670Point.prototype.dbl = function dbl() {
99671 if (this.isInfinity())
99672 return this;
99673
99674 // Double in extended coordinates
99675 if (this.curve.extended)
99676 return this._extDbl();
99677 else
99678 return this._projDbl();
99679};
99680
99681Point.prototype._extAdd = function _extAdd(p) {
99682 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
99683 // #addition-add-2008-hwcd-3
99684 // 8M
99685
99686 // A = (Y1 - X1) * (Y2 - X2)
99687 var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
99688 // B = (Y1 + X1) * (Y2 + X2)
99689 var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
99690 // C = T1 * k * T2
99691 var c = this.t.redMul(this.curve.dd).redMul(p.t);
99692 // D = Z1 * 2 * Z2
99693 var d = this.z.redMul(p.z.redAdd(p.z));
99694 // E = B - A
99695 var e = b.redSub(a);
99696 // F = D - C
99697 var f = d.redSub(c);
99698 // G = D + C
99699 var g = d.redAdd(c);
99700 // H = B + A
99701 var h = b.redAdd(a);
99702 // X3 = E * F
99703 var nx = e.redMul(f);
99704 // Y3 = G * H
99705 var ny = g.redMul(h);
99706 // T3 = E * H
99707 var nt = e.redMul(h);
99708 // Z3 = F * G
99709 var nz = f.redMul(g);
99710 return this.curve.point(nx, ny, nz, nt);
99711};
99712
99713Point.prototype._projAdd = function _projAdd(p) {
99714 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
99715 // #addition-add-2008-bbjlp
99716 // #addition-add-2007-bl
99717 // 10M + 1S
99718
99719 // A = Z1 * Z2
99720 var a = this.z.redMul(p.z);
99721 // B = A^2
99722 var b = a.redSqr();
99723 // C = X1 * X2
99724 var c = this.x.redMul(p.x);
99725 // D = Y1 * Y2
99726 var d = this.y.redMul(p.y);
99727 // E = d * C * D
99728 var e = this.curve.d.redMul(c).redMul(d);
99729 // F = B - E
99730 var f = b.redSub(e);
99731 // G = B + E
99732 var g = b.redAdd(e);
99733 // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
99734 var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
99735 var nx = a.redMul(f).redMul(tmp);
99736 var ny;
99737 var nz;
99738 if (this.curve.twisted) {
99739 // Y3 = A * G * (D - a * C)
99740 ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
99741 // Z3 = F * G
99742 nz = f.redMul(g);
99743 } else {
99744 // Y3 = A * G * (D - C)
99745 ny = a.redMul(g).redMul(d.redSub(c));
99746 // Z3 = c * F * G
99747 nz = this.curve._mulC(f).redMul(g);
99748 }
99749 return this.curve.point(nx, ny, nz);
99750};
99751
99752Point.prototype.add = function add(p) {
99753 if (this.isInfinity())
99754 return p;
99755 if (p.isInfinity())
99756 return this;
99757
99758 if (this.curve.extended)
99759 return this._extAdd(p);
99760 else
99761 return this._projAdd(p);
99762};
99763
99764Point.prototype.mul = function mul(k) {
99765 if (this._hasDoubles(k))
99766 return this.curve._fixedNafMul(this, k);
99767 else
99768 return this.curve._wnafMul(this, k);
99769};
99770
99771Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
99772 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
99773};
99774
99775Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
99776 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
99777};
99778
99779Point.prototype.normalize = function normalize() {
99780 if (this.zOne)
99781 return this;
99782
99783 // Normalize coordinates
99784 var zi = this.z.redInvm();
99785 this.x = this.x.redMul(zi);
99786 this.y = this.y.redMul(zi);
99787 if (this.t)
99788 this.t = this.t.redMul(zi);
99789 this.z = this.curve.one;
99790 this.zOne = true;
99791 return this;
99792};
99793
99794Point.prototype.neg = function neg() {
99795 return this.curve.point(this.x.redNeg(),
99796 this.y,
99797 this.z,
99798 this.t && this.t.redNeg());
99799};
99800
99801Point.prototype.getX = function getX() {
99802 this.normalize();
99803 return this.x.fromRed();
99804};
99805
99806Point.prototype.getY = function getY() {
99807 this.normalize();
99808 return this.y.fromRed();
99809};
99810
99811Point.prototype.eq = function eq(other) {
99812 return this === other ||
99813 this.getX().cmp(other.getX()) === 0 &&
99814 this.getY().cmp(other.getY()) === 0;
99815};
99816
99817Point.prototype.eqXToP = function eqXToP(x) {
99818 var rx = x.toRed(this.curve.red).redMul(this.z);
99819 if (this.x.cmp(rx) === 0)
99820 return true;
99821
99822 var xc = x.clone();
99823 var t = this.curve.redN.redMul(this.z);
99824 for (;;) {
99825 xc.iadd(this.curve.n);
99826 if (xc.cmp(this.curve.p) >= 0)
99827 return false;
99828
99829 rx.redIAdd(t);
99830 if (this.x.cmp(rx) === 0)
99831 return true;
99832 }
99833};
99834
99835// Compatibility with BaseCurve
99836Point.prototype.toP = Point.prototype.normalize;
99837Point.prototype.mixedAdd = Point.prototype.add;
99838
99839},{"../utils":767,"./base":754,"bn.js":108,"inherits":396}],756:[function(require,module,exports){
99840arguments[4][320][0].apply(exports,arguments)
99841},{"./base":754,"./edwards":755,"./mont":757,"./short":758,"dup":320}],757:[function(require,module,exports){
99842'use strict';
99843
99844var BN = require('bn.js');
99845var inherits = require('inherits');
99846var Base = require('./base');
99847
99848var utils = require('../utils');
99849
99850function MontCurve(conf) {
99851 Base.call(this, 'mont', conf);
99852
99853 this.a = new BN(conf.a, 16).toRed(this.red);
99854 this.b = new BN(conf.b, 16).toRed(this.red);
99855 this.i4 = new BN(4).toRed(this.red).redInvm();
99856 this.two = new BN(2).toRed(this.red);
99857 this.a24 = this.i4.redMul(this.a.redAdd(this.two));
99858}
99859inherits(MontCurve, Base);
99860module.exports = MontCurve;
99861
99862MontCurve.prototype.validate = function validate(point) {
99863 var x = point.normalize().x;
99864 var x2 = x.redSqr();
99865 var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
99866 var y = rhs.redSqrt();
99867
99868 return y.redSqr().cmp(rhs) === 0;
99869};
99870
99871function Point(curve, x, z) {
99872 Base.BasePoint.call(this, curve, 'projective');
99873 if (x === null && z === null) {
99874 this.x = this.curve.one;
99875 this.z = this.curve.zero;
99876 } else {
99877 this.x = new BN(x, 16);
99878 this.z = new BN(z, 16);
99879 if (!this.x.red)
99880 this.x = this.x.toRed(this.curve.red);
99881 if (!this.z.red)
99882 this.z = this.z.toRed(this.curve.red);
99883 }
99884}
99885inherits(Point, Base.BasePoint);
99886
99887MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
99888 return this.point(utils.toArray(bytes, enc), 1);
99889};
99890
99891MontCurve.prototype.point = function point(x, z) {
99892 return new Point(this, x, z);
99893};
99894
99895MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
99896 return Point.fromJSON(this, obj);
99897};
99898
99899Point.prototype.precompute = function precompute() {
99900 // No-op
99901};
99902
99903Point.prototype._encode = function _encode() {
99904 return this.getX().toArray('be', this.curve.p.byteLength());
99905};
99906
99907Point.fromJSON = function fromJSON(curve, obj) {
99908 return new Point(curve, obj[0], obj[1] || curve.one);
99909};
99910
99911Point.prototype.inspect = function inspect() {
99912 if (this.isInfinity())
99913 return '<EC Point Infinity>';
99914 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
99915 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
99916};
99917
99918Point.prototype.isInfinity = function isInfinity() {
99919 // XXX This code assumes that zero is always zero in red
99920 return this.z.cmpn(0) === 0;
99921};
99922
99923Point.prototype.dbl = function dbl() {
99924 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
99925 // 2M + 2S + 4A
99926
99927 // A = X1 + Z1
99928 var a = this.x.redAdd(this.z);
99929 // AA = A^2
99930 var aa = a.redSqr();
99931 // B = X1 - Z1
99932 var b = this.x.redSub(this.z);
99933 // BB = B^2
99934 var bb = b.redSqr();
99935 // C = AA - BB
99936 var c = aa.redSub(bb);
99937 // X3 = AA * BB
99938 var nx = aa.redMul(bb);
99939 // Z3 = C * (BB + A24 * C)
99940 var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
99941 return this.curve.point(nx, nz);
99942};
99943
99944Point.prototype.add = function add() {
99945 throw new Error('Not supported on Montgomery curve');
99946};
99947
99948Point.prototype.diffAdd = function diffAdd(p, diff) {
99949 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
99950 // 4M + 2S + 6A
99951
99952 // A = X2 + Z2
99953 var a = this.x.redAdd(this.z);
99954 // B = X2 - Z2
99955 var b = this.x.redSub(this.z);
99956 // C = X3 + Z3
99957 var c = p.x.redAdd(p.z);
99958 // D = X3 - Z3
99959 var d = p.x.redSub(p.z);
99960 // DA = D * A
99961 var da = d.redMul(a);
99962 // CB = C * B
99963 var cb = c.redMul(b);
99964 // X5 = Z1 * (DA + CB)^2
99965 var nx = diff.z.redMul(da.redAdd(cb).redSqr());
99966 // Z5 = X1 * (DA - CB)^2
99967 var nz = diff.x.redMul(da.redISub(cb).redSqr());
99968 return this.curve.point(nx, nz);
99969};
99970
99971Point.prototype.mul = function mul(k) {
99972 var t = k.clone();
99973 var a = this; // (N / 2) * Q + Q
99974 var b = this.curve.point(null, null); // (N / 2) * Q
99975 var c = this; // Q
99976
99977 for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
99978 bits.push(t.andln(1));
99979
99980 for (var i = bits.length - 1; i >= 0; i--) {
99981 if (bits[i] === 0) {
99982 // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
99983 a = a.diffAdd(b, c);
99984 // N * Q = 2 * ((N / 2) * Q + Q))
99985 b = b.dbl();
99986 } else {
99987 // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
99988 b = a.diffAdd(b, c);
99989 // N * Q + Q = 2 * ((N / 2) * Q + Q)
99990 a = a.dbl();
99991 }
99992 }
99993 return b;
99994};
99995
99996Point.prototype.mulAdd = function mulAdd() {
99997 throw new Error('Not supported on Montgomery curve');
99998};
99999
100000Point.prototype.jumlAdd = function jumlAdd() {
100001 throw new Error('Not supported on Montgomery curve');
100002};
100003
100004Point.prototype.eq = function eq(other) {
100005 return this.getX().cmp(other.getX()) === 0;
100006};
100007
100008Point.prototype.normalize = function normalize() {
100009 this.x = this.x.redMul(this.z.redInvm());
100010 this.z = this.curve.one;
100011 return this;
100012};
100013
100014Point.prototype.getX = function getX() {
100015 // Normalize coordinates
100016 this.normalize();
100017
100018 return this.x.fromRed();
100019};
100020
100021},{"../utils":767,"./base":754,"bn.js":108,"inherits":396}],758:[function(require,module,exports){
100022'use strict';
100023
100024var utils = require('../utils');
100025var BN = require('bn.js');
100026var inherits = require('inherits');
100027var Base = require('./base');
100028
100029var assert = utils.assert;
100030
100031function ShortCurve(conf) {
100032 Base.call(this, 'short', conf);
100033
100034 this.a = new BN(conf.a, 16).toRed(this.red);
100035 this.b = new BN(conf.b, 16).toRed(this.red);
100036 this.tinv = this.two.redInvm();
100037
100038 this.zeroA = this.a.fromRed().cmpn(0) === 0;
100039 this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
100040
100041 // If the curve is endomorphic, precalculate beta and lambda
100042 this.endo = this._getEndomorphism(conf);
100043 this._endoWnafT1 = new Array(4);
100044 this._endoWnafT2 = new Array(4);
100045}
100046inherits(ShortCurve, Base);
100047module.exports = ShortCurve;
100048
100049ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
100050 // No efficient endomorphism
100051 if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
100052 return;
100053
100054 // Compute beta and lambda, that lambda * P = (beta * Px; Py)
100055 var beta;
100056 var lambda;
100057 if (conf.beta) {
100058 beta = new BN(conf.beta, 16).toRed(this.red);
100059 } else {
100060 var betas = this._getEndoRoots(this.p);
100061 // Choose the smallest beta
100062 beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
100063 beta = beta.toRed(this.red);
100064 }
100065 if (conf.lambda) {
100066 lambda = new BN(conf.lambda, 16);
100067 } else {
100068 // Choose the lambda that is matching selected beta
100069 var lambdas = this._getEndoRoots(this.n);
100070 if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
100071 lambda = lambdas[0];
100072 } else {
100073 lambda = lambdas[1];
100074 assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
100075 }
100076 }
100077
100078 // Get basis vectors, used for balanced length-two representation
100079 var basis;
100080 if (conf.basis) {
100081 basis = conf.basis.map(function(vec) {
100082 return {
100083 a: new BN(vec.a, 16),
100084 b: new BN(vec.b, 16)
100085 };
100086 });
100087 } else {
100088 basis = this._getEndoBasis(lambda);
100089 }
100090
100091 return {
100092 beta: beta,
100093 lambda: lambda,
100094 basis: basis
100095 };
100096};
100097
100098ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
100099 // Find roots of for x^2 + x + 1 in F
100100 // Root = (-1 +- Sqrt(-3)) / 2
100101 //
100102 var red = num === this.p ? this.red : BN.mont(num);
100103 var tinv = new BN(2).toRed(red).redInvm();
100104 var ntinv = tinv.redNeg();
100105
100106 var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
100107
100108 var l1 = ntinv.redAdd(s).fromRed();
100109 var l2 = ntinv.redSub(s).fromRed();
100110 return [ l1, l2 ];
100111};
100112
100113ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
100114 // aprxSqrt >= sqrt(this.n)
100115 var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
100116
100117 // 3.74
100118 // Run EGCD, until r(L + 1) < aprxSqrt
100119 var u = lambda;
100120 var v = this.n.clone();
100121 var x1 = new BN(1);
100122 var y1 = new BN(0);
100123 var x2 = new BN(0);
100124 var y2 = new BN(1);
100125
100126 // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
100127 var a0;
100128 var b0;
100129 // First vector
100130 var a1;
100131 var b1;
100132 // Second vector
100133 var a2;
100134 var b2;
100135
100136 var prevR;
100137 var i = 0;
100138 var r;
100139 var x;
100140 while (u.cmpn(0) !== 0) {
100141 var q = v.div(u);
100142 r = v.sub(q.mul(u));
100143 x = x2.sub(q.mul(x1));
100144 var y = y2.sub(q.mul(y1));
100145
100146 if (!a1 && r.cmp(aprxSqrt) < 0) {
100147 a0 = prevR.neg();
100148 b0 = x1;
100149 a1 = r.neg();
100150 b1 = x;
100151 } else if (a1 && ++i === 2) {
100152 break;
100153 }
100154 prevR = r;
100155
100156 v = u;
100157 u = r;
100158 x2 = x1;
100159 x1 = x;
100160 y2 = y1;
100161 y1 = y;
100162 }
100163 a2 = r.neg();
100164 b2 = x;
100165
100166 var len1 = a1.sqr().add(b1.sqr());
100167 var len2 = a2.sqr().add(b2.sqr());
100168 if (len2.cmp(len1) >= 0) {
100169 a2 = a0;
100170 b2 = b0;
100171 }
100172
100173 // Normalize signs
100174 if (a1.negative) {
100175 a1 = a1.neg();
100176 b1 = b1.neg();
100177 }
100178 if (a2.negative) {
100179 a2 = a2.neg();
100180 b2 = b2.neg();
100181 }
100182
100183 return [
100184 { a: a1, b: b1 },
100185 { a: a2, b: b2 }
100186 ];
100187};
100188
100189ShortCurve.prototype._endoSplit = function _endoSplit(k) {
100190 var basis = this.endo.basis;
100191 var v1 = basis[0];
100192 var v2 = basis[1];
100193
100194 var c1 = v2.b.mul(k).divRound(this.n);
100195 var c2 = v1.b.neg().mul(k).divRound(this.n);
100196
100197 var p1 = c1.mul(v1.a);
100198 var p2 = c2.mul(v2.a);
100199 var q1 = c1.mul(v1.b);
100200 var q2 = c2.mul(v2.b);
100201
100202 // Calculate answer
100203 var k1 = k.sub(p1).sub(p2);
100204 var k2 = q1.add(q2).neg();
100205 return { k1: k1, k2: k2 };
100206};
100207
100208ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
100209 x = new BN(x, 16);
100210 if (!x.red)
100211 x = x.toRed(this.red);
100212
100213 var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
100214 var y = y2.redSqrt();
100215 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
100216 throw new Error('invalid point');
100217
100218 // XXX Is there any way to tell if the number is odd without converting it
100219 // to non-red form?
100220 var isOdd = y.fromRed().isOdd();
100221 if (odd && !isOdd || !odd && isOdd)
100222 y = y.redNeg();
100223
100224 return this.point(x, y);
100225};
100226
100227ShortCurve.prototype.validate = function validate(point) {
100228 if (point.inf)
100229 return true;
100230
100231 var x = point.x;
100232 var y = point.y;
100233
100234 var ax = this.a.redMul(x);
100235 var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
100236 return y.redSqr().redISub(rhs).cmpn(0) === 0;
100237};
100238
100239ShortCurve.prototype._endoWnafMulAdd =
100240 function _endoWnafMulAdd(points, coeffs, jacobianResult) {
100241 var npoints = this._endoWnafT1;
100242 var ncoeffs = this._endoWnafT2;
100243 for (var i = 0; i < points.length; i++) {
100244 var split = this._endoSplit(coeffs[i]);
100245 var p = points[i];
100246 var beta = p._getBeta();
100247
100248 if (split.k1.negative) {
100249 split.k1.ineg();
100250 p = p.neg(true);
100251 }
100252 if (split.k2.negative) {
100253 split.k2.ineg();
100254 beta = beta.neg(true);
100255 }
100256
100257 npoints[i * 2] = p;
100258 npoints[i * 2 + 1] = beta;
100259 ncoeffs[i * 2] = split.k1;
100260 ncoeffs[i * 2 + 1] = split.k2;
100261 }
100262 var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
100263
100264 // Clean-up references to points and coefficients
100265 for (var j = 0; j < i * 2; j++) {
100266 npoints[j] = null;
100267 ncoeffs[j] = null;
100268 }
100269 return res;
100270};
100271
100272function Point(curve, x, y, isRed) {
100273 Base.BasePoint.call(this, curve, 'affine');
100274 if (x === null && y === null) {
100275 this.x = null;
100276 this.y = null;
100277 this.inf = true;
100278 } else {
100279 this.x = new BN(x, 16);
100280 this.y = new BN(y, 16);
100281 // Force redgomery representation when loading from JSON
100282 if (isRed) {
100283 this.x.forceRed(this.curve.red);
100284 this.y.forceRed(this.curve.red);
100285 }
100286 if (!this.x.red)
100287 this.x = this.x.toRed(this.curve.red);
100288 if (!this.y.red)
100289 this.y = this.y.toRed(this.curve.red);
100290 this.inf = false;
100291 }
100292}
100293inherits(Point, Base.BasePoint);
100294
100295ShortCurve.prototype.point = function point(x, y, isRed) {
100296 return new Point(this, x, y, isRed);
100297};
100298
100299ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
100300 return Point.fromJSON(this, obj, red);
100301};
100302
100303Point.prototype._getBeta = function _getBeta() {
100304 if (!this.curve.endo)
100305 return;
100306
100307 var pre = this.precomputed;
100308 if (pre && pre.beta)
100309 return pre.beta;
100310
100311 var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
100312 if (pre) {
100313 var curve = this.curve;
100314 var endoMul = function(p) {
100315 return curve.point(p.x.redMul(curve.endo.beta), p.y);
100316 };
100317 pre.beta = beta;
100318 beta.precomputed = {
100319 beta: null,
100320 naf: pre.naf && {
100321 wnd: pre.naf.wnd,
100322 points: pre.naf.points.map(endoMul)
100323 },
100324 doubles: pre.doubles && {
100325 step: pre.doubles.step,
100326 points: pre.doubles.points.map(endoMul)
100327 }
100328 };
100329 }
100330 return beta;
100331};
100332
100333Point.prototype.toJSON = function toJSON() {
100334 if (!this.precomputed)
100335 return [ this.x, this.y ];
100336
100337 return [ this.x, this.y, this.precomputed && {
100338 doubles: this.precomputed.doubles && {
100339 step: this.precomputed.doubles.step,
100340 points: this.precomputed.doubles.points.slice(1)
100341 },
100342 naf: this.precomputed.naf && {
100343 wnd: this.precomputed.naf.wnd,
100344 points: this.precomputed.naf.points.slice(1)
100345 }
100346 } ];
100347};
100348
100349Point.fromJSON = function fromJSON(curve, obj, red) {
100350 if (typeof obj === 'string')
100351 obj = JSON.parse(obj);
100352 var res = curve.point(obj[0], obj[1], red);
100353 if (!obj[2])
100354 return res;
100355
100356 function obj2point(obj) {
100357 return curve.point(obj[0], obj[1], red);
100358 }
100359
100360 var pre = obj[2];
100361 res.precomputed = {
100362 beta: null,
100363 doubles: pre.doubles && {
100364 step: pre.doubles.step,
100365 points: [ res ].concat(pre.doubles.points.map(obj2point))
100366 },
100367 naf: pre.naf && {
100368 wnd: pre.naf.wnd,
100369 points: [ res ].concat(pre.naf.points.map(obj2point))
100370 }
100371 };
100372 return res;
100373};
100374
100375Point.prototype.inspect = function inspect() {
100376 if (this.isInfinity())
100377 return '<EC Point Infinity>';
100378 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
100379 ' y: ' + this.y.fromRed().toString(16, 2) + '>';
100380};
100381
100382Point.prototype.isInfinity = function isInfinity() {
100383 return this.inf;
100384};
100385
100386Point.prototype.add = function add(p) {
100387 // O + P = P
100388 if (this.inf)
100389 return p;
100390
100391 // P + O = P
100392 if (p.inf)
100393 return this;
100394
100395 // P + P = 2P
100396 if (this.eq(p))
100397 return this.dbl();
100398
100399 // P + (-P) = O
100400 if (this.neg().eq(p))
100401 return this.curve.point(null, null);
100402
100403 // P + Q = O
100404 if (this.x.cmp(p.x) === 0)
100405 return this.curve.point(null, null);
100406
100407 var c = this.y.redSub(p.y);
100408 if (c.cmpn(0) !== 0)
100409 c = c.redMul(this.x.redSub(p.x).redInvm());
100410 var nx = c.redSqr().redISub(this.x).redISub(p.x);
100411 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
100412 return this.curve.point(nx, ny);
100413};
100414
100415Point.prototype.dbl = function dbl() {
100416 if (this.inf)
100417 return this;
100418
100419 // 2P = O
100420 var ys1 = this.y.redAdd(this.y);
100421 if (ys1.cmpn(0) === 0)
100422 return this.curve.point(null, null);
100423
100424 var a = this.curve.a;
100425
100426 var x2 = this.x.redSqr();
100427 var dyinv = ys1.redInvm();
100428 var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
100429
100430 var nx = c.redSqr().redISub(this.x.redAdd(this.x));
100431 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
100432 return this.curve.point(nx, ny);
100433};
100434
100435Point.prototype.getX = function getX() {
100436 return this.x.fromRed();
100437};
100438
100439Point.prototype.getY = function getY() {
100440 return this.y.fromRed();
100441};
100442
100443Point.prototype.mul = function mul(k) {
100444 k = new BN(k, 16);
100445 if (this.isInfinity())
100446 return this;
100447 else if (this._hasDoubles(k))
100448 return this.curve._fixedNafMul(this, k);
100449 else if (this.curve.endo)
100450 return this.curve._endoWnafMulAdd([ this ], [ k ]);
100451 else
100452 return this.curve._wnafMul(this, k);
100453};
100454
100455Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
100456 var points = [ this, p2 ];
100457 var coeffs = [ k1, k2 ];
100458 if (this.curve.endo)
100459 return this.curve._endoWnafMulAdd(points, coeffs);
100460 else
100461 return this.curve._wnafMulAdd(1, points, coeffs, 2);
100462};
100463
100464Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
100465 var points = [ this, p2 ];
100466 var coeffs = [ k1, k2 ];
100467 if (this.curve.endo)
100468 return this.curve._endoWnafMulAdd(points, coeffs, true);
100469 else
100470 return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
100471};
100472
100473Point.prototype.eq = function eq(p) {
100474 return this === p ||
100475 this.inf === p.inf &&
100476 (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
100477};
100478
100479Point.prototype.neg = function neg(_precompute) {
100480 if (this.inf)
100481 return this;
100482
100483 var res = this.curve.point(this.x, this.y.redNeg());
100484 if (_precompute && this.precomputed) {
100485 var pre = this.precomputed;
100486 var negate = function(p) {
100487 return p.neg();
100488 };
100489 res.precomputed = {
100490 naf: pre.naf && {
100491 wnd: pre.naf.wnd,
100492 points: pre.naf.points.map(negate)
100493 },
100494 doubles: pre.doubles && {
100495 step: pre.doubles.step,
100496 points: pre.doubles.points.map(negate)
100497 }
100498 };
100499 }
100500 return res;
100501};
100502
100503Point.prototype.toJ = function toJ() {
100504 if (this.inf)
100505 return this.curve.jpoint(null, null, null);
100506
100507 var res = this.curve.jpoint(this.x, this.y, this.curve.one);
100508 return res;
100509};
100510
100511function JPoint(curve, x, y, z) {
100512 Base.BasePoint.call(this, curve, 'jacobian');
100513 if (x === null && y === null && z === null) {
100514 this.x = this.curve.one;
100515 this.y = this.curve.one;
100516 this.z = new BN(0);
100517 } else {
100518 this.x = new BN(x, 16);
100519 this.y = new BN(y, 16);
100520 this.z = new BN(z, 16);
100521 }
100522 if (!this.x.red)
100523 this.x = this.x.toRed(this.curve.red);
100524 if (!this.y.red)
100525 this.y = this.y.toRed(this.curve.red);
100526 if (!this.z.red)
100527 this.z = this.z.toRed(this.curve.red);
100528
100529 this.zOne = this.z === this.curve.one;
100530}
100531inherits(JPoint, Base.BasePoint);
100532
100533ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
100534 return new JPoint(this, x, y, z);
100535};
100536
100537JPoint.prototype.toP = function toP() {
100538 if (this.isInfinity())
100539 return this.curve.point(null, null);
100540
100541 var zinv = this.z.redInvm();
100542 var zinv2 = zinv.redSqr();
100543 var ax = this.x.redMul(zinv2);
100544 var ay = this.y.redMul(zinv2).redMul(zinv);
100545
100546 return this.curve.point(ax, ay);
100547};
100548
100549JPoint.prototype.neg = function neg() {
100550 return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
100551};
100552
100553JPoint.prototype.add = function add(p) {
100554 // O + P = P
100555 if (this.isInfinity())
100556 return p;
100557
100558 // P + O = P
100559 if (p.isInfinity())
100560 return this;
100561
100562 // 12M + 4S + 7A
100563 var pz2 = p.z.redSqr();
100564 var z2 = this.z.redSqr();
100565 var u1 = this.x.redMul(pz2);
100566 var u2 = p.x.redMul(z2);
100567 var s1 = this.y.redMul(pz2.redMul(p.z));
100568 var s2 = p.y.redMul(z2.redMul(this.z));
100569
100570 var h = u1.redSub(u2);
100571 var r = s1.redSub(s2);
100572 if (h.cmpn(0) === 0) {
100573 if (r.cmpn(0) !== 0)
100574 return this.curve.jpoint(null, null, null);
100575 else
100576 return this.dbl();
100577 }
100578
100579 var h2 = h.redSqr();
100580 var h3 = h2.redMul(h);
100581 var v = u1.redMul(h2);
100582
100583 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
100584 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
100585 var nz = this.z.redMul(p.z).redMul(h);
100586
100587 return this.curve.jpoint(nx, ny, nz);
100588};
100589
100590JPoint.prototype.mixedAdd = function mixedAdd(p) {
100591 // O + P = P
100592 if (this.isInfinity())
100593 return p.toJ();
100594
100595 // P + O = P
100596 if (p.isInfinity())
100597 return this;
100598
100599 // 8M + 3S + 7A
100600 var z2 = this.z.redSqr();
100601 var u1 = this.x;
100602 var u2 = p.x.redMul(z2);
100603 var s1 = this.y;
100604 var s2 = p.y.redMul(z2).redMul(this.z);
100605
100606 var h = u1.redSub(u2);
100607 var r = s1.redSub(s2);
100608 if (h.cmpn(0) === 0) {
100609 if (r.cmpn(0) !== 0)
100610 return this.curve.jpoint(null, null, null);
100611 else
100612 return this.dbl();
100613 }
100614
100615 var h2 = h.redSqr();
100616 var h3 = h2.redMul(h);
100617 var v = u1.redMul(h2);
100618
100619 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
100620 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
100621 var nz = this.z.redMul(h);
100622
100623 return this.curve.jpoint(nx, ny, nz);
100624};
100625
100626JPoint.prototype.dblp = function dblp(pow) {
100627 if (pow === 0)
100628 return this;
100629 if (this.isInfinity())
100630 return this;
100631 if (!pow)
100632 return this.dbl();
100633
100634 if (this.curve.zeroA || this.curve.threeA) {
100635 var r = this;
100636 for (var i = 0; i < pow; i++)
100637 r = r.dbl();
100638 return r;
100639 }
100640
100641 // 1M + 2S + 1A + N * (4S + 5M + 8A)
100642 // N = 1 => 6M + 6S + 9A
100643 var a = this.curve.a;
100644 var tinv = this.curve.tinv;
100645
100646 var jx = this.x;
100647 var jy = this.y;
100648 var jz = this.z;
100649 var jz4 = jz.redSqr().redSqr();
100650
100651 // Reuse results
100652 var jyd = jy.redAdd(jy);
100653 for (var i = 0; i < pow; i++) {
100654 var jx2 = jx.redSqr();
100655 var jyd2 = jyd.redSqr();
100656 var jyd4 = jyd2.redSqr();
100657 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
100658
100659 var t1 = jx.redMul(jyd2);
100660 var nx = c.redSqr().redISub(t1.redAdd(t1));
100661 var t2 = t1.redISub(nx);
100662 var dny = c.redMul(t2);
100663 dny = dny.redIAdd(dny).redISub(jyd4);
100664 var nz = jyd.redMul(jz);
100665 if (i + 1 < pow)
100666 jz4 = jz4.redMul(jyd4);
100667
100668 jx = nx;
100669 jz = nz;
100670 jyd = dny;
100671 }
100672
100673 return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
100674};
100675
100676JPoint.prototype.dbl = function dbl() {
100677 if (this.isInfinity())
100678 return this;
100679
100680 if (this.curve.zeroA)
100681 return this._zeroDbl();
100682 else if (this.curve.threeA)
100683 return this._threeDbl();
100684 else
100685 return this._dbl();
100686};
100687
100688JPoint.prototype._zeroDbl = function _zeroDbl() {
100689 var nx;
100690 var ny;
100691 var nz;
100692 // Z = 1
100693 if (this.zOne) {
100694 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
100695 // #doubling-mdbl-2007-bl
100696 // 1M + 5S + 14A
100697
100698 // XX = X1^2
100699 var xx = this.x.redSqr();
100700 // YY = Y1^2
100701 var yy = this.y.redSqr();
100702 // YYYY = YY^2
100703 var yyyy = yy.redSqr();
100704 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
100705 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
100706 s = s.redIAdd(s);
100707 // M = 3 * XX + a; a = 0
100708 var m = xx.redAdd(xx).redIAdd(xx);
100709 // T = M ^ 2 - 2*S
100710 var t = m.redSqr().redISub(s).redISub(s);
100711
100712 // 8 * YYYY
100713 var yyyy8 = yyyy.redIAdd(yyyy);
100714 yyyy8 = yyyy8.redIAdd(yyyy8);
100715 yyyy8 = yyyy8.redIAdd(yyyy8);
100716
100717 // X3 = T
100718 nx = t;
100719 // Y3 = M * (S - T) - 8 * YYYY
100720 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
100721 // Z3 = 2*Y1
100722 nz = this.y.redAdd(this.y);
100723 } else {
100724 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
100725 // #doubling-dbl-2009-l
100726 // 2M + 5S + 13A
100727
100728 // A = X1^2
100729 var a = this.x.redSqr();
100730 // B = Y1^2
100731 var b = this.y.redSqr();
100732 // C = B^2
100733 var c = b.redSqr();
100734 // D = 2 * ((X1 + B)^2 - A - C)
100735 var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
100736 d = d.redIAdd(d);
100737 // E = 3 * A
100738 var e = a.redAdd(a).redIAdd(a);
100739 // F = E^2
100740 var f = e.redSqr();
100741
100742 // 8 * C
100743 var c8 = c.redIAdd(c);
100744 c8 = c8.redIAdd(c8);
100745 c8 = c8.redIAdd(c8);
100746
100747 // X3 = F - 2 * D
100748 nx = f.redISub(d).redISub(d);
100749 // Y3 = E * (D - X3) - 8 * C
100750 ny = e.redMul(d.redISub(nx)).redISub(c8);
100751 // Z3 = 2 * Y1 * Z1
100752 nz = this.y.redMul(this.z);
100753 nz = nz.redIAdd(nz);
100754 }
100755
100756 return this.curve.jpoint(nx, ny, nz);
100757};
100758
100759JPoint.prototype._threeDbl = function _threeDbl() {
100760 var nx;
100761 var ny;
100762 var nz;
100763 // Z = 1
100764 if (this.zOne) {
100765 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
100766 // #doubling-mdbl-2007-bl
100767 // 1M + 5S + 15A
100768
100769 // XX = X1^2
100770 var xx = this.x.redSqr();
100771 // YY = Y1^2
100772 var yy = this.y.redSqr();
100773 // YYYY = YY^2
100774 var yyyy = yy.redSqr();
100775 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
100776 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
100777 s = s.redIAdd(s);
100778 // M = 3 * XX + a
100779 var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
100780 // T = M^2 - 2 * S
100781 var t = m.redSqr().redISub(s).redISub(s);
100782 // X3 = T
100783 nx = t;
100784 // Y3 = M * (S - T) - 8 * YYYY
100785 var yyyy8 = yyyy.redIAdd(yyyy);
100786 yyyy8 = yyyy8.redIAdd(yyyy8);
100787 yyyy8 = yyyy8.redIAdd(yyyy8);
100788 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
100789 // Z3 = 2 * Y1
100790 nz = this.y.redAdd(this.y);
100791 } else {
100792 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
100793 // 3M + 5S
100794
100795 // delta = Z1^2
100796 var delta = this.z.redSqr();
100797 // gamma = Y1^2
100798 var gamma = this.y.redSqr();
100799 // beta = X1 * gamma
100800 var beta = this.x.redMul(gamma);
100801 // alpha = 3 * (X1 - delta) * (X1 + delta)
100802 var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
100803 alpha = alpha.redAdd(alpha).redIAdd(alpha);
100804 // X3 = alpha^2 - 8 * beta
100805 var beta4 = beta.redIAdd(beta);
100806 beta4 = beta4.redIAdd(beta4);
100807 var beta8 = beta4.redAdd(beta4);
100808 nx = alpha.redSqr().redISub(beta8);
100809 // Z3 = (Y1 + Z1)^2 - gamma - delta
100810 nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
100811 // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
100812 var ggamma8 = gamma.redSqr();
100813 ggamma8 = ggamma8.redIAdd(ggamma8);
100814 ggamma8 = ggamma8.redIAdd(ggamma8);
100815 ggamma8 = ggamma8.redIAdd(ggamma8);
100816 ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
100817 }
100818
100819 return this.curve.jpoint(nx, ny, nz);
100820};
100821
100822JPoint.prototype._dbl = function _dbl() {
100823 var a = this.curve.a;
100824
100825 // 4M + 6S + 10A
100826 var jx = this.x;
100827 var jy = this.y;
100828 var jz = this.z;
100829 var jz4 = jz.redSqr().redSqr();
100830
100831 var jx2 = jx.redSqr();
100832 var jy2 = jy.redSqr();
100833
100834 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
100835
100836 var jxd4 = jx.redAdd(jx);
100837 jxd4 = jxd4.redIAdd(jxd4);
100838 var t1 = jxd4.redMul(jy2);
100839 var nx = c.redSqr().redISub(t1.redAdd(t1));
100840 var t2 = t1.redISub(nx);
100841
100842 var jyd8 = jy2.redSqr();
100843 jyd8 = jyd8.redIAdd(jyd8);
100844 jyd8 = jyd8.redIAdd(jyd8);
100845 jyd8 = jyd8.redIAdd(jyd8);
100846 var ny = c.redMul(t2).redISub(jyd8);
100847 var nz = jy.redAdd(jy).redMul(jz);
100848
100849 return this.curve.jpoint(nx, ny, nz);
100850};
100851
100852JPoint.prototype.trpl = function trpl() {
100853 if (!this.curve.zeroA)
100854 return this.dbl().add(this);
100855
100856 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
100857 // 5M + 10S + ...
100858
100859 // XX = X1^2
100860 var xx = this.x.redSqr();
100861 // YY = Y1^2
100862 var yy = this.y.redSqr();
100863 // ZZ = Z1^2
100864 var zz = this.z.redSqr();
100865 // YYYY = YY^2
100866 var yyyy = yy.redSqr();
100867 // M = 3 * XX + a * ZZ2; a = 0
100868 var m = xx.redAdd(xx).redIAdd(xx);
100869 // MM = M^2
100870 var mm = m.redSqr();
100871 // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
100872 var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
100873 e = e.redIAdd(e);
100874 e = e.redAdd(e).redIAdd(e);
100875 e = e.redISub(mm);
100876 // EE = E^2
100877 var ee = e.redSqr();
100878 // T = 16*YYYY
100879 var t = yyyy.redIAdd(yyyy);
100880 t = t.redIAdd(t);
100881 t = t.redIAdd(t);
100882 t = t.redIAdd(t);
100883 // U = (M + E)^2 - MM - EE - T
100884 var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
100885 // X3 = 4 * (X1 * EE - 4 * YY * U)
100886 var yyu4 = yy.redMul(u);
100887 yyu4 = yyu4.redIAdd(yyu4);
100888 yyu4 = yyu4.redIAdd(yyu4);
100889 var nx = this.x.redMul(ee).redISub(yyu4);
100890 nx = nx.redIAdd(nx);
100891 nx = nx.redIAdd(nx);
100892 // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
100893 var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
100894 ny = ny.redIAdd(ny);
100895 ny = ny.redIAdd(ny);
100896 ny = ny.redIAdd(ny);
100897 // Z3 = (Z1 + E)^2 - ZZ - EE
100898 var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
100899
100900 return this.curve.jpoint(nx, ny, nz);
100901};
100902
100903JPoint.prototype.mul = function mul(k, kbase) {
100904 k = new BN(k, kbase);
100905
100906 return this.curve._wnafMul(this, k);
100907};
100908
100909JPoint.prototype.eq = function eq(p) {
100910 if (p.type === 'affine')
100911 return this.eq(p.toJ());
100912
100913 if (this === p)
100914 return true;
100915
100916 // x1 * z2^2 == x2 * z1^2
100917 var z2 = this.z.redSqr();
100918 var pz2 = p.z.redSqr();
100919 if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
100920 return false;
100921
100922 // y1 * z2^3 == y2 * z1^3
100923 var z3 = z2.redMul(this.z);
100924 var pz3 = pz2.redMul(p.z);
100925 return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
100926};
100927
100928JPoint.prototype.eqXToP = function eqXToP(x) {
100929 var zs = this.z.redSqr();
100930 var rx = x.toRed(this.curve.red).redMul(zs);
100931 if (this.x.cmp(rx) === 0)
100932 return true;
100933
100934 var xc = x.clone();
100935 var t = this.curve.redN.redMul(zs);
100936 for (;;) {
100937 xc.iadd(this.curve.n);
100938 if (xc.cmp(this.curve.p) >= 0)
100939 return false;
100940
100941 rx.redIAdd(t);
100942 if (this.x.cmp(rx) === 0)
100943 return true;
100944 }
100945};
100946
100947JPoint.prototype.inspect = function inspect() {
100948 if (this.isInfinity())
100949 return '<EC JPoint Infinity>';
100950 return '<EC JPoint x: ' + this.x.toString(16, 2) +
100951 ' y: ' + this.y.toString(16, 2) +
100952 ' z: ' + this.z.toString(16, 2) + '>';
100953};
100954
100955JPoint.prototype.isInfinity = function isInfinity() {
100956 // XXX This code assumes that zero is always zero in red
100957 return this.z.cmpn(0) === 0;
100958};
100959
100960},{"../utils":767,"./base":754,"bn.js":108,"inherits":396}],759:[function(require,module,exports){
100961'use strict';
100962
100963var curves = exports;
100964
100965var hash = require('hash.js');
100966var curve = require('./curve');
100967var utils = require('./utils');
100968
100969var assert = utils.assert;
100970
100971function PresetCurve(options) {
100972 if (options.type === 'short')
100973 this.curve = new curve.short(options);
100974 else if (options.type === 'edwards')
100975 this.curve = new curve.edwards(options);
100976 else
100977 this.curve = new curve.mont(options);
100978 this.g = this.curve.g;
100979 this.n = this.curve.n;
100980 this.hash = options.hash;
100981
100982 assert(this.g.validate(), 'Invalid curve');
100983 assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
100984}
100985curves.PresetCurve = PresetCurve;
100986
100987function defineCurve(name, options) {
100988 Object.defineProperty(curves, name, {
100989 configurable: true,
100990 enumerable: true,
100991 get: function() {
100992 var curve = new PresetCurve(options);
100993 Object.defineProperty(curves, name, {
100994 configurable: true,
100995 enumerable: true,
100996 value: curve
100997 });
100998 return curve;
100999 }
101000 });
101001}
101002
101003defineCurve('p192', {
101004 type: 'short',
101005 prime: 'p192',
101006 p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
101007 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
101008 b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
101009 n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
101010 hash: hash.sha256,
101011 gRed: false,
101012 g: [
101013 '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
101014 '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
101015 ]
101016});
101017
101018defineCurve('p224', {
101019 type: 'short',
101020 prime: 'p224',
101021 p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
101022 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
101023 b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
101024 n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
101025 hash: hash.sha256,
101026 gRed: false,
101027 g: [
101028 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
101029 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
101030 ]
101031});
101032
101033defineCurve('p256', {
101034 type: 'short',
101035 prime: null,
101036 p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
101037 a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
101038 b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
101039 n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
101040 hash: hash.sha256,
101041 gRed: false,
101042 g: [
101043 '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
101044 '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
101045 ]
101046});
101047
101048defineCurve('p384', {
101049 type: 'short',
101050 prime: null,
101051 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101052 'fffffffe ffffffff 00000000 00000000 ffffffff',
101053 a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101054 'fffffffe ffffffff 00000000 00000000 fffffffc',
101055 b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
101056 '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
101057 n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
101058 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
101059 hash: hash.sha384,
101060 gRed: false,
101061 g: [
101062 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
101063 '5502f25d bf55296c 3a545e38 72760ab7',
101064 '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
101065 '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
101066 ]
101067});
101068
101069defineCurve('p521', {
101070 type: 'short',
101071 prime: null,
101072 p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101073 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101074 'ffffffff ffffffff ffffffff ffffffff ffffffff',
101075 a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101076 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101077 'ffffffff ffffffff ffffffff ffffffff fffffffc',
101078 b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
101079 '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
101080 '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
101081 n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
101082 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
101083 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
101084 hash: hash.sha512,
101085 gRed: false,
101086 g: [
101087 '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
101088 '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
101089 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
101090 '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
101091 '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
101092 '3fad0761 353c7086 a272c240 88be9476 9fd16650'
101093 ]
101094});
101095
101096defineCurve('curve25519', {
101097 type: 'mont',
101098 prime: 'p25519',
101099 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
101100 a: '76d06',
101101 b: '1',
101102 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
101103 hash: hash.sha256,
101104 gRed: false,
101105 g: [
101106 '9'
101107 ]
101108});
101109
101110defineCurve('ed25519', {
101111 type: 'edwards',
101112 prime: 'p25519',
101113 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
101114 a: '-1',
101115 c: '1',
101116 // -121665 * (121666^(-1)) (mod P)
101117 d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
101118 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
101119 hash: hash.sha256,
101120 gRed: false,
101121 g: [
101122 '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
101123
101124 // 4/5
101125 '6666666666666666666666666666666666666666666666666666666666666658'
101126 ]
101127});
101128
101129var pre;
101130try {
101131 pre = require('./precomputed/secp256k1');
101132} catch (e) {
101133 pre = undefined;
101134}
101135
101136defineCurve('secp256k1', {
101137 type: 'short',
101138 prime: 'k256',
101139 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
101140 a: '0',
101141 b: '7',
101142 n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
101143 h: '1',
101144 hash: hash.sha256,
101145
101146 // Precomputed endomorphism
101147 beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
101148 lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
101149 basis: [
101150 {
101151 a: '3086d221a7d46bcde86c90e49284eb15',
101152 b: '-e4437ed6010e88286f547fa90abfe4c3'
101153 },
101154 {
101155 a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
101156 b: '3086d221a7d46bcde86c90e49284eb15'
101157 }
101158 ],
101159
101160 gRed: false,
101161 g: [
101162 '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
101163 '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
101164 pre
101165 ]
101166});
101167
101168},{"./curve":756,"./precomputed/secp256k1":766,"./utils":767,"hash.js":381}],760:[function(require,module,exports){
101169'use strict';
101170
101171var BN = require('bn.js');
101172var HmacDRBG = require('hmac-drbg');
101173var utils = require('../utils');
101174var curves = require('../curves');
101175var rand = require('brorand');
101176var assert = utils.assert;
101177
101178var KeyPair = require('./key');
101179var Signature = require('./signature');
101180
101181function EC(options) {
101182 if (!(this instanceof EC))
101183 return new EC(options);
101184
101185 // Shortcut `elliptic.ec(curve-name)`
101186 if (typeof options === 'string') {
101187 assert(curves.hasOwnProperty(options), 'Unknown curve ' + options);
101188
101189 options = curves[options];
101190 }
101191
101192 // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
101193 if (options instanceof curves.PresetCurve)
101194 options = { curve: options };
101195
101196 this.curve = options.curve.curve;
101197 this.n = this.curve.n;
101198 this.nh = this.n.ushrn(1);
101199 this.g = this.curve.g;
101200
101201 // Point on curve
101202 this.g = options.curve.g;
101203 this.g.precompute(options.curve.n.bitLength() + 1);
101204
101205 // Hash for function for DRBG
101206 this.hash = options.hash || options.curve.hash;
101207}
101208module.exports = EC;
101209
101210EC.prototype.keyPair = function keyPair(options) {
101211 return new KeyPair(this, options);
101212};
101213
101214EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
101215 return KeyPair.fromPrivate(this, priv, enc);
101216};
101217
101218EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
101219 return KeyPair.fromPublic(this, pub, enc);
101220};
101221
101222EC.prototype.genKeyPair = function genKeyPair(options) {
101223 if (!options)
101224 options = {};
101225
101226 // Instantiate Hmac_DRBG
101227 var drbg = new HmacDRBG({
101228 hash: this.hash,
101229 pers: options.pers,
101230 persEnc: options.persEnc || 'utf8',
101231 entropy: options.entropy || rand(this.hash.hmacStrength),
101232 entropyEnc: options.entropy && options.entropyEnc || 'utf8',
101233 nonce: this.n.toArray()
101234 });
101235
101236 var bytes = this.n.byteLength();
101237 var ns2 = this.n.sub(new BN(2));
101238 do {
101239 var priv = new BN(drbg.generate(bytes));
101240 if (priv.cmp(ns2) > 0)
101241 continue;
101242
101243 priv.iaddn(1);
101244 return this.keyFromPrivate(priv);
101245 } while (true);
101246};
101247
101248EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
101249 var delta = msg.byteLength() * 8 - this.n.bitLength();
101250 if (delta > 0)
101251 msg = msg.ushrn(delta);
101252 if (!truncOnly && msg.cmp(this.n) >= 0)
101253 return msg.sub(this.n);
101254 else
101255 return msg;
101256};
101257
101258EC.prototype.sign = function sign(msg, key, enc, options) {
101259 if (typeof enc === 'object') {
101260 options = enc;
101261 enc = null;
101262 }
101263 if (!options)
101264 options = {};
101265
101266 key = this.keyFromPrivate(key, enc);
101267 msg = this._truncateToN(new BN(msg, 16));
101268
101269 // Zero-extend key to provide enough entropy
101270 var bytes = this.n.byteLength();
101271 var bkey = key.getPrivate().toArray('be', bytes);
101272
101273 // Zero-extend nonce to have the same byte size as N
101274 var nonce = msg.toArray('be', bytes);
101275
101276 // Instantiate Hmac_DRBG
101277 var drbg = new HmacDRBG({
101278 hash: this.hash,
101279 entropy: bkey,
101280 nonce: nonce,
101281 pers: options.pers,
101282 persEnc: options.persEnc || 'utf8'
101283 });
101284
101285 // Number of bytes to generate
101286 var ns1 = this.n.sub(new BN(1));
101287
101288 for (var iter = 0; true; iter++) {
101289 var k = options.k ?
101290 options.k(iter) :
101291 new BN(drbg.generate(this.n.byteLength()));
101292 k = this._truncateToN(k, true);
101293 if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
101294 continue;
101295
101296 var kp = this.g.mul(k);
101297 if (kp.isInfinity())
101298 continue;
101299
101300 var kpX = kp.getX();
101301 var r = kpX.umod(this.n);
101302 if (r.cmpn(0) === 0)
101303 continue;
101304
101305 var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
101306 s = s.umod(this.n);
101307 if (s.cmpn(0) === 0)
101308 continue;
101309
101310 var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
101311 (kpX.cmp(r) !== 0 ? 2 : 0);
101312
101313 // Use complement of `s`, if it is > `n / 2`
101314 if (options.canonical && s.cmp(this.nh) > 0) {
101315 s = this.n.sub(s);
101316 recoveryParam ^= 1;
101317 }
101318
101319 return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
101320 }
101321};
101322
101323EC.prototype.verify = function verify(msg, signature, key, enc) {
101324 msg = this._truncateToN(new BN(msg, 16));
101325 key = this.keyFromPublic(key, enc);
101326 signature = new Signature(signature, 'hex');
101327
101328 // Perform primitive values validation
101329 var r = signature.r;
101330 var s = signature.s;
101331 if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
101332 return false;
101333 if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
101334 return false;
101335
101336 // Validate signature
101337 var sinv = s.invm(this.n);
101338 var u1 = sinv.mul(msg).umod(this.n);
101339 var u2 = sinv.mul(r).umod(this.n);
101340
101341 if (!this.curve._maxwellTrick) {
101342 var p = this.g.mulAdd(u1, key.getPublic(), u2);
101343 if (p.isInfinity())
101344 return false;
101345
101346 return p.getX().umod(this.n).cmp(r) === 0;
101347 }
101348
101349 // NOTE: Greg Maxwell's trick, inspired by:
101350 // https://git.io/vad3K
101351
101352 var p = this.g.jmulAdd(u1, key.getPublic(), u2);
101353 if (p.isInfinity())
101354 return false;
101355
101356 // Compare `p.x` of Jacobian point with `r`,
101357 // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
101358 // inverse of `p.z^2`
101359 return p.eqXToP(r);
101360};
101361
101362EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
101363 assert((3 & j) === j, 'The recovery param is more than two bits');
101364 signature = new Signature(signature, enc);
101365
101366 var n = this.n;
101367 var e = new BN(msg);
101368 var r = signature.r;
101369 var s = signature.s;
101370
101371 // A set LSB signifies that the y-coordinate is odd
101372 var isYOdd = j & 1;
101373 var isSecondKey = j >> 1;
101374 if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
101375 throw new Error('Unable to find sencond key candinate');
101376
101377 // 1.1. Let x = r + jn.
101378 if (isSecondKey)
101379 r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
101380 else
101381 r = this.curve.pointFromX(r, isYOdd);
101382
101383 var rInv = signature.r.invm(n);
101384 var s1 = n.sub(e).mul(rInv).umod(n);
101385 var s2 = s.mul(rInv).umod(n);
101386
101387 // 1.6.1 Compute Q = r^-1 (sR - eG)
101388 // Q = r^-1 (sR + -eG)
101389 return this.g.mulAdd(s1, r, s2);
101390};
101391
101392EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
101393 signature = new Signature(signature, enc);
101394 if (signature.recoveryParam !== null)
101395 return signature.recoveryParam;
101396
101397 for (var i = 0; i < 4; i++) {
101398 var Qprime;
101399 try {
101400 Qprime = this.recoverPubKey(e, signature, i);
101401 } catch (e) {
101402 continue;
101403 }
101404
101405 if (Qprime.eq(Q))
101406 return i;
101407 }
101408 throw new Error('Unable to find valid recovery factor');
101409};
101410
101411},{"../curves":759,"../utils":767,"./key":761,"./signature":762,"bn.js":108,"brorand":109,"hmac-drbg":393}],761:[function(require,module,exports){
101412'use strict';
101413
101414var BN = require('bn.js');
101415var utils = require('../utils');
101416var assert = utils.assert;
101417
101418function KeyPair(ec, options) {
101419 this.ec = ec;
101420 this.priv = null;
101421 this.pub = null;
101422
101423 // KeyPair(ec, { priv: ..., pub: ... })
101424 if (options.priv)
101425 this._importPrivate(options.priv, options.privEnc);
101426 if (options.pub)
101427 this._importPublic(options.pub, options.pubEnc);
101428}
101429module.exports = KeyPair;
101430
101431KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
101432 if (pub instanceof KeyPair)
101433 return pub;
101434
101435 return new KeyPair(ec, {
101436 pub: pub,
101437 pubEnc: enc
101438 });
101439};
101440
101441KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
101442 if (priv instanceof KeyPair)
101443 return priv;
101444
101445 return new KeyPair(ec, {
101446 priv: priv,
101447 privEnc: enc
101448 });
101449};
101450
101451KeyPair.prototype.validate = function validate() {
101452 var pub = this.getPublic();
101453
101454 if (pub.isInfinity())
101455 return { result: false, reason: 'Invalid public key' };
101456 if (!pub.validate())
101457 return { result: false, reason: 'Public key is not a point' };
101458 if (!pub.mul(this.ec.curve.n).isInfinity())
101459 return { result: false, reason: 'Public key * N != O' };
101460
101461 return { result: true, reason: null };
101462};
101463
101464KeyPair.prototype.getPublic = function getPublic(compact, enc) {
101465 // compact is optional argument
101466 if (typeof compact === 'string') {
101467 enc = compact;
101468 compact = null;
101469 }
101470
101471 if (!this.pub)
101472 this.pub = this.ec.g.mul(this.priv);
101473
101474 if (!enc)
101475 return this.pub;
101476
101477 return this.pub.encode(enc, compact);
101478};
101479
101480KeyPair.prototype.getPrivate = function getPrivate(enc) {
101481 if (enc === 'hex')
101482 return this.priv.toString(16, 2);
101483 else
101484 return this.priv;
101485};
101486
101487KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
101488 this.priv = new BN(key, enc || 16);
101489
101490 // Ensure that the priv won't be bigger than n, otherwise we may fail
101491 // in fixed multiplication method
101492 this.priv = this.priv.umod(this.ec.curve.n);
101493};
101494
101495KeyPair.prototype._importPublic = function _importPublic(key, enc) {
101496 if (key.x || key.y) {
101497 // Montgomery points only have an `x` coordinate.
101498 // Weierstrass/Edwards points on the other hand have both `x` and
101499 // `y` coordinates.
101500 if (this.ec.curve.type === 'mont') {
101501 assert(key.x, 'Need x coordinate');
101502 } else if (this.ec.curve.type === 'short' ||
101503 this.ec.curve.type === 'edwards') {
101504 assert(key.x && key.y, 'Need both x and y coordinate');
101505 }
101506 this.pub = this.ec.curve.point(key.x, key.y);
101507 return;
101508 }
101509 this.pub = this.ec.curve.decodePoint(key, enc);
101510};
101511
101512// ECDH
101513KeyPair.prototype.derive = function derive(pub) {
101514 return pub.mul(this.priv).getX();
101515};
101516
101517// ECDSA
101518KeyPair.prototype.sign = function sign(msg, enc, options) {
101519 return this.ec.sign(msg, this, enc, options);
101520};
101521
101522KeyPair.prototype.verify = function verify(msg, signature) {
101523 return this.ec.verify(msg, signature, this);
101524};
101525
101526KeyPair.prototype.inspect = function inspect() {
101527 return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
101528 ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
101529};
101530
101531},{"../utils":767,"bn.js":108}],762:[function(require,module,exports){
101532'use strict';
101533
101534var BN = require('bn.js');
101535
101536var utils = require('../utils');
101537var assert = utils.assert;
101538
101539function Signature(options, enc) {
101540 if (options instanceof Signature)
101541 return options;
101542
101543 if (this._importDER(options, enc))
101544 return;
101545
101546 assert(options.r && options.s, 'Signature without r or s');
101547 this.r = new BN(options.r, 16);
101548 this.s = new BN(options.s, 16);
101549 if (options.recoveryParam === undefined)
101550 this.recoveryParam = null;
101551 else
101552 this.recoveryParam = options.recoveryParam;
101553}
101554module.exports = Signature;
101555
101556function Position() {
101557 this.place = 0;
101558}
101559
101560function getLength(buf, p) {
101561 var initial = buf[p.place++];
101562 if (!(initial & 0x80)) {
101563 return initial;
101564 }
101565 var octetLen = initial & 0xf;
101566 var val = 0;
101567 for (var i = 0, off = p.place; i < octetLen; i++, off++) {
101568 val <<= 8;
101569 val |= buf[off];
101570 }
101571 p.place = off;
101572 return val;
101573}
101574
101575function rmPadding(buf) {
101576 var i = 0;
101577 var len = buf.length - 1;
101578 while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
101579 i++;
101580 }
101581 if (i === 0) {
101582 return buf;
101583 }
101584 return buf.slice(i);
101585}
101586
101587Signature.prototype._importDER = function _importDER(data, enc) {
101588 data = utils.toArray(data, enc);
101589 var p = new Position();
101590 if (data[p.place++] !== 0x30) {
101591 return false;
101592 }
101593 var len = getLength(data, p);
101594 if ((len + p.place) !== data.length) {
101595 return false;
101596 }
101597 if (data[p.place++] !== 0x02) {
101598 return false;
101599 }
101600 var rlen = getLength(data, p);
101601 var r = data.slice(p.place, rlen + p.place);
101602 p.place += rlen;
101603 if (data[p.place++] !== 0x02) {
101604 return false;
101605 }
101606 var slen = getLength(data, p);
101607 if (data.length !== slen + p.place) {
101608 return false;
101609 }
101610 var s = data.slice(p.place, slen + p.place);
101611 if (r[0] === 0 && (r[1] & 0x80)) {
101612 r = r.slice(1);
101613 }
101614 if (s[0] === 0 && (s[1] & 0x80)) {
101615 s = s.slice(1);
101616 }
101617
101618 this.r = new BN(r);
101619 this.s = new BN(s);
101620 this.recoveryParam = null;
101621
101622 return true;
101623};
101624
101625function constructLength(arr, len) {
101626 if (len < 0x80) {
101627 arr.push(len);
101628 return;
101629 }
101630 var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
101631 arr.push(octets | 0x80);
101632 while (--octets) {
101633 arr.push((len >>> (octets << 3)) & 0xff);
101634 }
101635 arr.push(len);
101636}
101637
101638Signature.prototype.toDER = function toDER(enc) {
101639 var r = this.r.toArray();
101640 var s = this.s.toArray();
101641
101642 // Pad values
101643 if (r[0] & 0x80)
101644 r = [ 0 ].concat(r);
101645 // Pad values
101646 if (s[0] & 0x80)
101647 s = [ 0 ].concat(s);
101648
101649 r = rmPadding(r);
101650 s = rmPadding(s);
101651
101652 while (!s[0] && !(s[1] & 0x80)) {
101653 s = s.slice(1);
101654 }
101655 var arr = [ 0x02 ];
101656 constructLength(arr, r.length);
101657 arr = arr.concat(r);
101658 arr.push(0x02);
101659 constructLength(arr, s.length);
101660 var backHalf = arr.concat(s);
101661 var res = [ 0x30 ];
101662 constructLength(res, backHalf.length);
101663 res = res.concat(backHalf);
101664 return utils.encode(res, enc);
101665};
101666
101667},{"../utils":767,"bn.js":108}],763:[function(require,module,exports){
101668'use strict';
101669
101670var hash = require('hash.js');
101671var curves = require('../curves');
101672var utils = require('../utils');
101673var assert = utils.assert;
101674var parseBytes = utils.parseBytes;
101675var KeyPair = require('./key');
101676var Signature = require('./signature');
101677
101678function EDDSA(curve) {
101679 assert(curve === 'ed25519', 'only tested with ed25519 so far');
101680
101681 if (!(this instanceof EDDSA))
101682 return new EDDSA(curve);
101683
101684 var curve = curves[curve].curve;
101685 this.curve = curve;
101686 this.g = curve.g;
101687 this.g.precompute(curve.n.bitLength() + 1);
101688
101689 this.pointClass = curve.point().constructor;
101690 this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
101691 this.hash = hash.sha512;
101692}
101693
101694module.exports = EDDSA;
101695
101696/**
101697* @param {Array|String} message - message bytes
101698* @param {Array|String|KeyPair} secret - secret bytes or a keypair
101699* @returns {Signature} - signature
101700*/
101701EDDSA.prototype.sign = function sign(message, secret) {
101702 message = parseBytes(message);
101703 var key = this.keyFromSecret(secret);
101704 var r = this.hashInt(key.messagePrefix(), message);
101705 var R = this.g.mul(r);
101706 var Rencoded = this.encodePoint(R);
101707 var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
101708 .mul(key.priv());
101709 var S = r.add(s_).umod(this.curve.n);
101710 return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
101711};
101712
101713/**
101714* @param {Array} message - message bytes
101715* @param {Array|String|Signature} sig - sig bytes
101716* @param {Array|String|Point|KeyPair} pub - public key
101717* @returns {Boolean} - true if public key matches sig of message
101718*/
101719EDDSA.prototype.verify = function verify(message, sig, pub) {
101720 message = parseBytes(message);
101721 sig = this.makeSignature(sig);
101722 var key = this.keyFromPublic(pub);
101723 var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
101724 var SG = this.g.mul(sig.S());
101725 var RplusAh = sig.R().add(key.pub().mul(h));
101726 return RplusAh.eq(SG);
101727};
101728
101729EDDSA.prototype.hashInt = function hashInt() {
101730 var hash = this.hash();
101731 for (var i = 0; i < arguments.length; i++)
101732 hash.update(arguments[i]);
101733 return utils.intFromLE(hash.digest()).umod(this.curve.n);
101734};
101735
101736EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
101737 return KeyPair.fromPublic(this, pub);
101738};
101739
101740EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
101741 return KeyPair.fromSecret(this, secret);
101742};
101743
101744EDDSA.prototype.makeSignature = function makeSignature(sig) {
101745 if (sig instanceof Signature)
101746 return sig;
101747 return new Signature(this, sig);
101748};
101749
101750/**
101751* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
101752*
101753* EDDSA defines methods for encoding and decoding points and integers. These are
101754* helper convenience methods, that pass along to utility functions implied
101755* parameters.
101756*
101757*/
101758EDDSA.prototype.encodePoint = function encodePoint(point) {
101759 var enc = point.getY().toArray('le', this.encodingLength);
101760 enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
101761 return enc;
101762};
101763
101764EDDSA.prototype.decodePoint = function decodePoint(bytes) {
101765 bytes = utils.parseBytes(bytes);
101766
101767 var lastIx = bytes.length - 1;
101768 var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
101769 var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
101770
101771 var y = utils.intFromLE(normed);
101772 return this.curve.pointFromY(y, xIsOdd);
101773};
101774
101775EDDSA.prototype.encodeInt = function encodeInt(num) {
101776 return num.toArray('le', this.encodingLength);
101777};
101778
101779EDDSA.prototype.decodeInt = function decodeInt(bytes) {
101780 return utils.intFromLE(bytes);
101781};
101782
101783EDDSA.prototype.isPoint = function isPoint(val) {
101784 return val instanceof this.pointClass;
101785};
101786
101787},{"../curves":759,"../utils":767,"./key":764,"./signature":765,"hash.js":381}],764:[function(require,module,exports){
101788'use strict';
101789
101790var utils = require('../utils');
101791var assert = utils.assert;
101792var parseBytes = utils.parseBytes;
101793var cachedProperty = utils.cachedProperty;
101794
101795/**
101796* @param {EDDSA} eddsa - instance
101797* @param {Object} params - public/private key parameters
101798*
101799* @param {Array<Byte>} [params.secret] - secret seed bytes
101800* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
101801* @param {Array<Byte>} [params.pub] - public key point encoded as bytes
101802*
101803*/
101804function KeyPair(eddsa, params) {
101805 this.eddsa = eddsa;
101806 this._secret = parseBytes(params.secret);
101807 if (eddsa.isPoint(params.pub))
101808 this._pub = params.pub;
101809 else
101810 this._pubBytes = parseBytes(params.pub);
101811}
101812
101813KeyPair.fromPublic = function fromPublic(eddsa, pub) {
101814 if (pub instanceof KeyPair)
101815 return pub;
101816 return new KeyPair(eddsa, { pub: pub });
101817};
101818
101819KeyPair.fromSecret = function fromSecret(eddsa, secret) {
101820 if (secret instanceof KeyPair)
101821 return secret;
101822 return new KeyPair(eddsa, { secret: secret });
101823};
101824
101825KeyPair.prototype.secret = function secret() {
101826 return this._secret;
101827};
101828
101829cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
101830 return this.eddsa.encodePoint(this.pub());
101831});
101832
101833cachedProperty(KeyPair, 'pub', function pub() {
101834 if (this._pubBytes)
101835 return this.eddsa.decodePoint(this._pubBytes);
101836 return this.eddsa.g.mul(this.priv());
101837});
101838
101839cachedProperty(KeyPair, 'privBytes', function privBytes() {
101840 var eddsa = this.eddsa;
101841 var hash = this.hash();
101842 var lastIx = eddsa.encodingLength - 1;
101843
101844 var a = hash.slice(0, eddsa.encodingLength);
101845 a[0] &= 248;
101846 a[lastIx] &= 127;
101847 a[lastIx] |= 64;
101848
101849 return a;
101850});
101851
101852cachedProperty(KeyPair, 'priv', function priv() {
101853 return this.eddsa.decodeInt(this.privBytes());
101854});
101855
101856cachedProperty(KeyPair, 'hash', function hash() {
101857 return this.eddsa.hash().update(this.secret()).digest();
101858});
101859
101860cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
101861 return this.hash().slice(this.eddsa.encodingLength);
101862});
101863
101864KeyPair.prototype.sign = function sign(message) {
101865 assert(this._secret, 'KeyPair can only verify');
101866 return this.eddsa.sign(message, this);
101867};
101868
101869KeyPair.prototype.verify = function verify(message, sig) {
101870 return this.eddsa.verify(message, sig, this);
101871};
101872
101873KeyPair.prototype.getSecret = function getSecret(enc) {
101874 assert(this._secret, 'KeyPair is public only');
101875 return utils.encode(this.secret(), enc);
101876};
101877
101878KeyPair.prototype.getPublic = function getPublic(enc) {
101879 return utils.encode(this.pubBytes(), enc);
101880};
101881
101882module.exports = KeyPair;
101883
101884},{"../utils":767}],765:[function(require,module,exports){
101885'use strict';
101886
101887var BN = require('bn.js');
101888var utils = require('../utils');
101889var assert = utils.assert;
101890var cachedProperty = utils.cachedProperty;
101891var parseBytes = utils.parseBytes;
101892
101893/**
101894* @param {EDDSA} eddsa - eddsa instance
101895* @param {Array<Bytes>|Object} sig -
101896* @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
101897* @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
101898* @param {Array<Bytes>} [sig.Rencoded] - R point encoded
101899* @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
101900*/
101901function Signature(eddsa, sig) {
101902 this.eddsa = eddsa;
101903
101904 if (typeof sig !== 'object')
101905 sig = parseBytes(sig);
101906
101907 if (Array.isArray(sig)) {
101908 sig = {
101909 R: sig.slice(0, eddsa.encodingLength),
101910 S: sig.slice(eddsa.encodingLength)
101911 };
101912 }
101913
101914 assert(sig.R && sig.S, 'Signature without R or S');
101915
101916 if (eddsa.isPoint(sig.R))
101917 this._R = sig.R;
101918 if (sig.S instanceof BN)
101919 this._S = sig.S;
101920
101921 this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
101922 this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
101923}
101924
101925cachedProperty(Signature, 'S', function S() {
101926 return this.eddsa.decodeInt(this.Sencoded());
101927});
101928
101929cachedProperty(Signature, 'R', function R() {
101930 return this.eddsa.decodePoint(this.Rencoded());
101931});
101932
101933cachedProperty(Signature, 'Rencoded', function Rencoded() {
101934 return this.eddsa.encodePoint(this.R());
101935});
101936
101937cachedProperty(Signature, 'Sencoded', function Sencoded() {
101938 return this.eddsa.encodeInt(this.S());
101939});
101940
101941Signature.prototype.toBytes = function toBytes() {
101942 return this.Rencoded().concat(this.Sencoded());
101943};
101944
101945Signature.prototype.toHex = function toHex() {
101946 return utils.encode(this.toBytes(), 'hex').toUpperCase();
101947};
101948
101949module.exports = Signature;
101950
101951},{"../utils":767,"bn.js":108}],766:[function(require,module,exports){
101952arguments[4][330][0].apply(exports,arguments)
101953},{"dup":330}],767:[function(require,module,exports){
101954'use strict';
101955
101956var utils = exports;
101957var BN = require('bn.js');
101958var minAssert = require('minimalistic-assert');
101959var minUtils = require('minimalistic-crypto-utils');
101960
101961utils.assert = minAssert;
101962utils.toArray = minUtils.toArray;
101963utils.zero2 = minUtils.zero2;
101964utils.toHex = minUtils.toHex;
101965utils.encode = minUtils.encode;
101966
101967// Represent num in a w-NAF form
101968function getNAF(num, w, bits) {
101969 var naf = new Array(Math.max(num.bitLength(), bits) + 1);
101970 naf.fill(0);
101971
101972 var ws = 1 << (w + 1);
101973 var k = num.clone();
101974
101975 for (var i = 0; i < naf.length; i++) {
101976 var z;
101977 var mod = k.andln(ws - 1);
101978 if (k.isOdd()) {
101979 if (mod > (ws >> 1) - 1)
101980 z = (ws >> 1) - mod;
101981 else
101982 z = mod;
101983 k.isubn(z);
101984 } else {
101985 z = 0;
101986 }
101987
101988 naf[i] = z;
101989 k.iushrn(1);
101990 }
101991
101992 return naf;
101993}
101994utils.getNAF = getNAF;
101995
101996// Represent k1, k2 in a Joint Sparse Form
101997function getJSF(k1, k2) {
101998 var jsf = [
101999 [],
102000 []
102001 ];
102002
102003 k1 = k1.clone();
102004 k2 = k2.clone();
102005 var d1 = 0;
102006 var d2 = 0;
102007 while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
102008
102009 // First phase
102010 var m14 = (k1.andln(3) + d1) & 3;
102011 var m24 = (k2.andln(3) + d2) & 3;
102012 if (m14 === 3)
102013 m14 = -1;
102014 if (m24 === 3)
102015 m24 = -1;
102016 var u1;
102017 if ((m14 & 1) === 0) {
102018 u1 = 0;
102019 } else {
102020 var m8 = (k1.andln(7) + d1) & 7;
102021 if ((m8 === 3 || m8 === 5) && m24 === 2)
102022 u1 = -m14;
102023 else
102024 u1 = m14;
102025 }
102026 jsf[0].push(u1);
102027
102028 var u2;
102029 if ((m24 & 1) === 0) {
102030 u2 = 0;
102031 } else {
102032 var m8 = (k2.andln(7) + d2) & 7;
102033 if ((m8 === 3 || m8 === 5) && m14 === 2)
102034 u2 = -m24;
102035 else
102036 u2 = m24;
102037 }
102038 jsf[1].push(u2);
102039
102040 // Second phase
102041 if (2 * d1 === u1 + 1)
102042 d1 = 1 - d1;
102043 if (2 * d2 === u2 + 1)
102044 d2 = 1 - d2;
102045 k1.iushrn(1);
102046 k2.iushrn(1);
102047 }
102048
102049 return jsf;
102050}
102051utils.getJSF = getJSF;
102052
102053function cachedProperty(obj, name, computer) {
102054 var key = '_' + name;
102055 obj.prototype[name] = function cachedProperty() {
102056 return this[key] !== undefined ? this[key] :
102057 this[key] = computer.call(this);
102058 };
102059}
102060utils.cachedProperty = cachedProperty;
102061
102062function parseBytes(bytes) {
102063 return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
102064 bytes;
102065}
102066utils.parseBytes = parseBytes;
102067
102068function intFromLE(bytes) {
102069 return new BN(bytes, 'hex', 'le');
102070}
102071utils.intFromLE = intFromLE;
102072
102073
102074},{"bn.js":108,"minimalistic-assert":640,"minimalistic-crypto-utils":641}],768:[function(require,module,exports){
102075module.exports={
102076 "_from": "elliptic@^6.4.1",
102077 "_id": "elliptic@6.5.2",
102078 "_inBundle": false,
102079 "_integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
102080 "_location": "/secp256k1/elliptic",
102081 "_phantomChildren": {},
102082 "_requested": {
102083 "type": "range",
102084 "registry": true,
102085 "raw": "elliptic@^6.4.1",
102086 "name": "elliptic",
102087 "escapedName": "elliptic",
102088 "rawSpec": "^6.4.1",
102089 "saveSpec": null,
102090 "fetchSpec": "^6.4.1"
102091 },
102092 "_requiredBy": [
102093 "/secp256k1"
102094 ],
102095 "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
102096 "_shasum": "05c5678d7173c049d8ca433552224a495d0e3762",
102097 "_spec": "elliptic@^6.4.1",
102098 "_where": "/home/ian/git/bitcoin/bip39/libs/combined/node_modules/secp256k1",
102099 "author": {
102100 "name": "Fedor Indutny",
102101 "email": "fedor@indutny.com"
102102 },
102103 "bugs": {
102104 "url": "https://github.com/indutny/elliptic/issues"
102105 },
102106 "bundleDependencies": false,
102107 "dependencies": {
102108 "bn.js": "^4.4.0",
102109 "brorand": "^1.0.1",
102110 "hash.js": "^1.0.0",
102111 "hmac-drbg": "^1.0.0",
102112 "inherits": "^2.0.1",
102113 "minimalistic-assert": "^1.0.0",
102114 "minimalistic-crypto-utils": "^1.0.0"
102115 },
102116 "deprecated": false,
102117 "description": "EC cryptography",
102118 "devDependencies": {
102119 "brfs": "^1.4.3",
102120 "coveralls": "^3.0.8",
102121 "grunt": "^1.0.4",
102122 "grunt-browserify": "^5.0.0",
102123 "grunt-cli": "^1.2.0",
102124 "grunt-contrib-connect": "^1.0.0",
102125 "grunt-contrib-copy": "^1.0.0",
102126 "grunt-contrib-uglify": "^1.0.1",
102127 "grunt-mocha-istanbul": "^3.0.1",
102128 "grunt-saucelabs": "^9.0.1",
102129 "istanbul": "^0.4.2",
102130 "jscs": "^3.0.7",
102131 "jshint": "^2.10.3",
102132 "mocha": "^6.2.2"
102133 },
102134 "files": [
102135 "lib"
102136 ],
102137 "homepage": "https://github.com/indutny/elliptic",
102138 "keywords": [
102139 "EC",
102140 "Elliptic",
102141 "curve",
102142 "Cryptography"
102143 ],
102144 "license": "MIT",
102145 "main": "lib/elliptic.js",
102146 "name": "elliptic",
102147 "repository": {
102148 "type": "git",
102149 "url": "git+ssh://git@github.com/indutny/elliptic.git"
102150 },
102151 "scripts": {
102152 "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
102153 "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
102154 "lint": "npm run jscs && npm run jshint",
102155 "test": "npm run lint && npm run unit",
102156 "unit": "istanbul test _mocha --reporter=spec test/index.js",
102157 "version": "grunt dist && git add dist/"
102158 },
102159 "version": "6.5.2"
102160}
102161
102162},{}],769:[function(require,module,exports){
102163var Buffer = require('safe-buffer').Buffer
102164
102165// prototype class for hash functions
102166function Hash (blockSize, finalSize) {
102167 this._block = Buffer.alloc(blockSize)
102168 this._finalSize = finalSize
102169 this._blockSize = blockSize
102170 this._len = 0
102171}
102172
102173Hash.prototype.update = function (data, enc) {
102174 if (typeof data === 'string') {
102175 enc = enc || 'utf8'
102176 data = Buffer.from(data, enc)
102177 }
102178
102179 var block = this._block
102180 var blockSize = this._blockSize
102181 var length = data.length
102182 var accum = this._len
102183
102184 for (var offset = 0; offset < length;) {
102185 var assigned = accum % blockSize
102186 var remainder = Math.min(length - offset, blockSize - assigned)
102187
102188 for (var i = 0; i < remainder; i++) {
102189 block[assigned + i] = data[offset + i]
102190 }
102191
102192 accum += remainder
102193 offset += remainder
102194
102195 if ((accum % blockSize) === 0) {
102196 this._update(block)
102197 }
102198 }
102199
102200 this._len += length
102201 return this
102202}
102203
102204Hash.prototype.digest = function (enc) {
102205 var rem = this._len % this._blockSize
102206
102207 this._block[rem] = 0x80
102208
102209 // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
102210 // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
102211 this._block.fill(0, rem + 1)
102212
102213 if (rem >= this._finalSize) {
102214 this._update(this._block)
102215 this._block.fill(0)
102216 }
102217
102218 var bits = this._len * 8
102219
102220 // uint32
102221 if (bits <= 0xffffffff) {
102222 this._block.writeUInt32BE(bits, this._blockSize - 4)
102223
102224 // uint64
102225 } else {
102226 var lowBits = (bits & 0xffffffff) >>> 0
102227 var highBits = (bits - lowBits) / 0x100000000
102228
102229 this._block.writeUInt32BE(highBits, this._blockSize - 8)
102230 this._block.writeUInt32BE(lowBits, this._blockSize - 4)
102231 }
102232
102233 this._update(this._block)
102234 var hash = this._hash()
102235
102236 return enc ? hash.toString(enc) : hash
102237}
102238
102239Hash.prototype._update = function () {
102240 throw new Error('_update must be implemented by subclass')
102241}
102242
102243module.exports = Hash
102244
102245},{"safe-buffer":742}],770:[function(require,module,exports){
102246var exports = module.exports = function SHA (algorithm) {
102247 algorithm = algorithm.toLowerCase()
102248
102249 var Algorithm = exports[algorithm]
102250 if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
102251
102252 return new Algorithm()
102253}
102254
102255exports.sha = require('./sha')
102256exports.sha1 = require('./sha1')
102257exports.sha224 = require('./sha224')
102258exports.sha256 = require('./sha256')
102259exports.sha384 = require('./sha384')
102260exports.sha512 = require('./sha512')
102261
102262},{"./sha":771,"./sha1":772,"./sha224":773,"./sha256":774,"./sha384":775,"./sha512":776}],771:[function(require,module,exports){
102263/*
102264 * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
102265 * in FIPS PUB 180-1
102266 * This source code is derived from sha1.js of the same repository.
102267 * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
102268 * operation was added.
102269 */
102270
102271var inherits = require('inherits')
102272var Hash = require('./hash')
102273var Buffer = require('safe-buffer').Buffer
102274
102275var K = [
102276 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
102277]
102278
102279var W = new Array(80)
102280
102281function Sha () {
102282 this.init()
102283 this._w = W
102284
102285 Hash.call(this, 64, 56)
102286}
102287
102288inherits(Sha, Hash)
102289
102290Sha.prototype.init = function () {
102291 this._a = 0x67452301
102292 this._b = 0xefcdab89
102293 this._c = 0x98badcfe
102294 this._d = 0x10325476
102295 this._e = 0xc3d2e1f0
102296
102297 return this
102298}
102299
102300function rotl5 (num) {
102301 return (num << 5) | (num >>> 27)
102302}
102303
102304function rotl30 (num) {
102305 return (num << 30) | (num >>> 2)
102306}
102307
102308function ft (s, b, c, d) {
102309 if (s === 0) return (b & c) | ((~b) & d)
102310 if (s === 2) return (b & c) | (b & d) | (c & d)
102311 return b ^ c ^ d
102312}
102313
102314Sha.prototype._update = function (M) {
102315 var W = this._w
102316
102317 var a = this._a | 0
102318 var b = this._b | 0
102319 var c = this._c | 0
102320 var d = this._d | 0
102321 var e = this._e | 0
102322
102323 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
102324 for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
102325
102326 for (var j = 0; j < 80; ++j) {
102327 var s = ~~(j / 20)
102328 var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
102329
102330 e = d
102331 d = c
102332 c = rotl30(b)
102333 b = a
102334 a = t
102335 }
102336
102337 this._a = (a + this._a) | 0
102338 this._b = (b + this._b) | 0
102339 this._c = (c + this._c) | 0
102340 this._d = (d + this._d) | 0
102341 this._e = (e + this._e) | 0
102342}
102343
102344Sha.prototype._hash = function () {
102345 var H = Buffer.allocUnsafe(20)
102346
102347 H.writeInt32BE(this._a | 0, 0)
102348 H.writeInt32BE(this._b | 0, 4)
102349 H.writeInt32BE(this._c | 0, 8)
102350 H.writeInt32BE(this._d | 0, 12)
102351 H.writeInt32BE(this._e | 0, 16)
102352
102353 return H
102354}
102355
102356module.exports = Sha
102357
102358},{"./hash":769,"inherits":396,"safe-buffer":742}],772:[function(require,module,exports){
102359/*
102360 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
102361 * in FIPS PUB 180-1
102362 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
102363 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
102364 * Distributed under the BSD License
102365 * See http://pajhome.org.uk/crypt/md5 for details.
102366 */
102367
102368var inherits = require('inherits')
102369var Hash = require('./hash')
102370var Buffer = require('safe-buffer').Buffer
102371
102372var K = [
102373 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
102374]
102375
102376var W = new Array(80)
102377
102378function Sha1 () {
102379 this.init()
102380 this._w = W
102381
102382 Hash.call(this, 64, 56)
102383}
102384
102385inherits(Sha1, Hash)
102386
102387Sha1.prototype.init = function () {
102388 this._a = 0x67452301
102389 this._b = 0xefcdab89
102390 this._c = 0x98badcfe
102391 this._d = 0x10325476
102392 this._e = 0xc3d2e1f0
102393
102394 return this
102395}
102396
102397function rotl1 (num) {
102398 return (num << 1) | (num >>> 31)
102399}
102400
102401function rotl5 (num) {
102402 return (num << 5) | (num >>> 27)
102403}
102404
102405function rotl30 (num) {
102406 return (num << 30) | (num >>> 2)
102407}
102408
102409function ft (s, b, c, d) {
102410 if (s === 0) return (b & c) | ((~b) & d)
102411 if (s === 2) return (b & c) | (b & d) | (c & d)
102412 return b ^ c ^ d
102413}
102414
102415Sha1.prototype._update = function (M) {
102416 var W = this._w
102417
102418 var a = this._a | 0
102419 var b = this._b | 0
102420 var c = this._c | 0
102421 var d = this._d | 0
102422 var e = this._e | 0
102423
102424 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
102425 for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
102426
102427 for (var j = 0; j < 80; ++j) {
102428 var s = ~~(j / 20)
102429 var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
102430
102431 e = d
102432 d = c
102433 c = rotl30(b)
102434 b = a
102435 a = t
102436 }
102437
102438 this._a = (a + this._a) | 0
102439 this._b = (b + this._b) | 0
102440 this._c = (c + this._c) | 0
102441 this._d = (d + this._d) | 0
102442 this._e = (e + this._e) | 0
102443}
102444
102445Sha1.prototype._hash = function () {
102446 var H = Buffer.allocUnsafe(20)
102447
102448 H.writeInt32BE(this._a | 0, 0)
102449 H.writeInt32BE(this._b | 0, 4)
102450 H.writeInt32BE(this._c | 0, 8)
102451 H.writeInt32BE(this._d | 0, 12)
102452 H.writeInt32BE(this._e | 0, 16)
102453
102454 return H
102455}
102456
102457module.exports = Sha1
102458
102459},{"./hash":769,"inherits":396,"safe-buffer":742}],773:[function(require,module,exports){
102460/**
102461 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
102462 * in FIPS 180-2
102463 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
102464 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
102465 *
102466 */
102467
102468var inherits = require('inherits')
102469var Sha256 = require('./sha256')
102470var Hash = require('./hash')
102471var Buffer = require('safe-buffer').Buffer
102472
102473var W = new Array(64)
102474
102475function Sha224 () {
102476 this.init()
102477
102478 this._w = W // new Array(64)
102479
102480 Hash.call(this, 64, 56)
102481}
102482
102483inherits(Sha224, Sha256)
102484
102485Sha224.prototype.init = function () {
102486 this._a = 0xc1059ed8
102487 this._b = 0x367cd507
102488 this._c = 0x3070dd17
102489 this._d = 0xf70e5939
102490 this._e = 0xffc00b31
102491 this._f = 0x68581511
102492 this._g = 0x64f98fa7
102493 this._h = 0xbefa4fa4
102494
102495 return this
102496}
102497
102498Sha224.prototype._hash = function () {
102499 var H = Buffer.allocUnsafe(28)
102500
102501 H.writeInt32BE(this._a, 0)
102502 H.writeInt32BE(this._b, 4)
102503 H.writeInt32BE(this._c, 8)
102504 H.writeInt32BE(this._d, 12)
102505 H.writeInt32BE(this._e, 16)
102506 H.writeInt32BE(this._f, 20)
102507 H.writeInt32BE(this._g, 24)
102508
102509 return H
102510}
102511
102512module.exports = Sha224
102513
102514},{"./hash":769,"./sha256":774,"inherits":396,"safe-buffer":742}],774:[function(require,module,exports){
102515/**
102516 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
102517 * in FIPS 180-2
102518 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
102519 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
102520 *
102521 */
102522
102523var inherits = require('inherits')
102524var Hash = require('./hash')
102525var Buffer = require('safe-buffer').Buffer
102526
102527var K = [
102528 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
102529 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
102530 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
102531 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
102532 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
102533 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
102534 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
102535 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
102536 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
102537 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
102538 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
102539 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
102540 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
102541 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
102542 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
102543 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
102544]
102545
102546var W = new Array(64)
102547
102548function Sha256 () {
102549 this.init()
102550
102551 this._w = W // new Array(64)
102552
102553 Hash.call(this, 64, 56)
102554}
102555
102556inherits(Sha256, Hash)
102557
102558Sha256.prototype.init = function () {
102559 this._a = 0x6a09e667
102560 this._b = 0xbb67ae85
102561 this._c = 0x3c6ef372
102562 this._d = 0xa54ff53a
102563 this._e = 0x510e527f
102564 this._f = 0x9b05688c
102565 this._g = 0x1f83d9ab
102566 this._h = 0x5be0cd19
102567
102568 return this
102569}
102570
102571function ch (x, y, z) {
102572 return z ^ (x & (y ^ z))
102573}
102574
102575function maj (x, y, z) {
102576 return (x & y) | (z & (x | y))
102577}
102578
102579function sigma0 (x) {
102580 return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
102581}
102582
102583function sigma1 (x) {
102584 return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
102585}
102586
102587function gamma0 (x) {
102588 return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
102589}
102590
102591function gamma1 (x) {
102592 return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
102593}
102594
102595Sha256.prototype._update = function (M) {
102596 var W = this._w
102597
102598 var a = this._a | 0
102599 var b = this._b | 0
102600 var c = this._c | 0
102601 var d = this._d | 0
102602 var e = this._e | 0
102603 var f = this._f | 0
102604 var g = this._g | 0
102605 var h = this._h | 0
102606
102607 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
102608 for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
102609
102610 for (var j = 0; j < 64; ++j) {
102611 var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
102612 var T2 = (sigma0(a) + maj(a, b, c)) | 0
102613
102614 h = g
102615 g = f
102616 f = e
102617 e = (d + T1) | 0
102618 d = c
102619 c = b
102620 b = a
102621 a = (T1 + T2) | 0
102622 }
102623
102624 this._a = (a + this._a) | 0
102625 this._b = (b + this._b) | 0
102626 this._c = (c + this._c) | 0
102627 this._d = (d + this._d) | 0
102628 this._e = (e + this._e) | 0
102629 this._f = (f + this._f) | 0
102630 this._g = (g + this._g) | 0
102631 this._h = (h + this._h) | 0
102632}
102633
102634Sha256.prototype._hash = function () {
102635 var H = Buffer.allocUnsafe(32)
102636
102637 H.writeInt32BE(this._a, 0)
102638 H.writeInt32BE(this._b, 4)
102639 H.writeInt32BE(this._c, 8)
102640 H.writeInt32BE(this._d, 12)
102641 H.writeInt32BE(this._e, 16)
102642 H.writeInt32BE(this._f, 20)
102643 H.writeInt32BE(this._g, 24)
102644 H.writeInt32BE(this._h, 28)
102645
102646 return H
102647}
102648
102649module.exports = Sha256
102650
102651},{"./hash":769,"inherits":396,"safe-buffer":742}],775:[function(require,module,exports){
102652var inherits = require('inherits')
102653var SHA512 = require('./sha512')
102654var Hash = require('./hash')
102655var Buffer = require('safe-buffer').Buffer
102656
102657var W = new Array(160)
102658
102659function Sha384 () {
102660 this.init()
102661 this._w = W
102662
102663 Hash.call(this, 128, 112)
102664}
102665
102666inherits(Sha384, SHA512)
102667
102668Sha384.prototype.init = function () {
102669 this._ah = 0xcbbb9d5d
102670 this._bh = 0x629a292a
102671 this._ch = 0x9159015a
102672 this._dh = 0x152fecd8
102673 this._eh = 0x67332667
102674 this._fh = 0x8eb44a87
102675 this._gh = 0xdb0c2e0d
102676 this._hh = 0x47b5481d
102677
102678 this._al = 0xc1059ed8
102679 this._bl = 0x367cd507
102680 this._cl = 0x3070dd17
102681 this._dl = 0xf70e5939
102682 this._el = 0xffc00b31
102683 this._fl = 0x68581511
102684 this._gl = 0x64f98fa7
102685 this._hl = 0xbefa4fa4
102686
102687 return this
102688}
102689
102690Sha384.prototype._hash = function () {
102691 var H = Buffer.allocUnsafe(48)
102692
102693 function writeInt64BE (h, l, offset) {
102694 H.writeInt32BE(h, offset)
102695 H.writeInt32BE(l, offset + 4)
102696 }
102697
102698 writeInt64BE(this._ah, this._al, 0)
102699 writeInt64BE(this._bh, this._bl, 8)
102700 writeInt64BE(this._ch, this._cl, 16)
102701 writeInt64BE(this._dh, this._dl, 24)
102702 writeInt64BE(this._eh, this._el, 32)
102703 writeInt64BE(this._fh, this._fl, 40)
102704
102705 return H
102706}
102707
102708module.exports = Sha384
102709
102710},{"./hash":769,"./sha512":776,"inherits":396,"safe-buffer":742}],776:[function(require,module,exports){
102711var inherits = require('inherits')
102712var Hash = require('./hash')
102713var Buffer = require('safe-buffer').Buffer
102714
102715var K = [
102716 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
102717 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
102718 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
102719 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
102720 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
102721 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
102722 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
102723 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
102724 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
102725 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
102726 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
102727 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
102728 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
102729 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
102730 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
102731 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
102732 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
102733 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
102734 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
102735 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
102736 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
102737 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
102738 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
102739 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
102740 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
102741 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
102742 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
102743 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
102744 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
102745 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
102746 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
102747 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
102748 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
102749 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
102750 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
102751 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
102752 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
102753 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
102754 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
102755 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
102756]
102757
102758var W = new Array(160)
102759
102760function Sha512 () {
102761 this.init()
102762 this._w = W
102763
102764 Hash.call(this, 128, 112)
102765}
102766
102767inherits(Sha512, Hash)
102768
102769Sha512.prototype.init = function () {
102770 this._ah = 0x6a09e667
102771 this._bh = 0xbb67ae85
102772 this._ch = 0x3c6ef372
102773 this._dh = 0xa54ff53a
102774 this._eh = 0x510e527f
102775 this._fh = 0x9b05688c
102776 this._gh = 0x1f83d9ab
102777 this._hh = 0x5be0cd19
102778
102779 this._al = 0xf3bcc908
102780 this._bl = 0x84caa73b
102781 this._cl = 0xfe94f82b
102782 this._dl = 0x5f1d36f1
102783 this._el = 0xade682d1
102784 this._fl = 0x2b3e6c1f
102785 this._gl = 0xfb41bd6b
102786 this._hl = 0x137e2179
102787
102788 return this
102789}
102790
102791function Ch (x, y, z) {
102792 return z ^ (x & (y ^ z))
102793}
102794
102795function maj (x, y, z) {
102796 return (x & y) | (z & (x | y))
102797}
102798
102799function sigma0 (x, xl) {
102800 return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
102801}
102802
102803function sigma1 (x, xl) {
102804 return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
102805}
102806
102807function Gamma0 (x, xl) {
102808 return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
102809}
102810
102811function Gamma0l (x, xl) {
102812 return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
102813}
102814
102815function Gamma1 (x, xl) {
102816 return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
102817}
102818
102819function Gamma1l (x, xl) {
102820 return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
102821}
102822
102823function getCarry (a, b) {
102824 return (a >>> 0) < (b >>> 0) ? 1 : 0
102825}
102826
102827Sha512.prototype._update = function (M) {
102828 var W = this._w
102829
102830 var ah = this._ah | 0
102831 var bh = this._bh | 0
102832 var ch = this._ch | 0
102833 var dh = this._dh | 0
102834 var eh = this._eh | 0
102835 var fh = this._fh | 0
102836 var gh = this._gh | 0
102837 var hh = this._hh | 0
102838
102839 var al = this._al | 0
102840 var bl = this._bl | 0
102841 var cl = this._cl | 0
102842 var dl = this._dl | 0
102843 var el = this._el | 0
102844 var fl = this._fl | 0
102845 var gl = this._gl | 0
102846 var hl = this._hl | 0
102847
102848 for (var i = 0; i < 32; i += 2) {
102849 W[i] = M.readInt32BE(i * 4)
102850 W[i + 1] = M.readInt32BE(i * 4 + 4)
102851 }
102852 for (; i < 160; i += 2) {
102853 var xh = W[i - 15 * 2]
102854 var xl = W[i - 15 * 2 + 1]
102855 var gamma0 = Gamma0(xh, xl)
102856 var gamma0l = Gamma0l(xl, xh)
102857
102858 xh = W[i - 2 * 2]
102859 xl = W[i - 2 * 2 + 1]
102860 var gamma1 = Gamma1(xh, xl)
102861 var gamma1l = Gamma1l(xl, xh)
102862
102863 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
102864 var Wi7h = W[i - 7 * 2]
102865 var Wi7l = W[i - 7 * 2 + 1]
102866
102867 var Wi16h = W[i - 16 * 2]
102868 var Wi16l = W[i - 16 * 2 + 1]
102869
102870 var Wil = (gamma0l + Wi7l) | 0
102871 var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
102872 Wil = (Wil + gamma1l) | 0
102873 Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
102874 Wil = (Wil + Wi16l) | 0
102875 Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
102876
102877 W[i] = Wih
102878 W[i + 1] = Wil
102879 }
102880
102881 for (var j = 0; j < 160; j += 2) {
102882 Wih = W[j]
102883 Wil = W[j + 1]
102884
102885 var majh = maj(ah, bh, ch)
102886 var majl = maj(al, bl, cl)
102887
102888 var sigma0h = sigma0(ah, al)
102889 var sigma0l = sigma0(al, ah)
102890 var sigma1h = sigma1(eh, el)
102891 var sigma1l = sigma1(el, eh)
102892
102893 // t1 = h + sigma1 + ch + K[j] + W[j]
102894 var Kih = K[j]
102895 var Kil = K[j + 1]
102896
102897 var chh = Ch(eh, fh, gh)
102898 var chl = Ch(el, fl, gl)
102899
102900 var t1l = (hl + sigma1l) | 0
102901 var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
102902 t1l = (t1l + chl) | 0
102903 t1h = (t1h + chh + getCarry(t1l, chl)) | 0
102904 t1l = (t1l + Kil) | 0
102905 t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
102906 t1l = (t1l + Wil) | 0
102907 t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
102908
102909 // t2 = sigma0 + maj
102910 var t2l = (sigma0l + majl) | 0
102911 var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
102912
102913 hh = gh
102914 hl = gl
102915 gh = fh
102916 gl = fl
102917 fh = eh
102918 fl = el
102919 el = (dl + t1l) | 0
102920 eh = (dh + t1h + getCarry(el, dl)) | 0
102921 dh = ch
102922 dl = cl
102923 ch = bh
102924 cl = bl
102925 bh = ah
102926 bl = al
102927 al = (t1l + t2l) | 0
102928 ah = (t1h + t2h + getCarry(al, t1l)) | 0
102929 }
102930
102931 this._al = (this._al + al) | 0
102932 this._bl = (this._bl + bl) | 0
102933 this._cl = (this._cl + cl) | 0
102934 this._dl = (this._dl + dl) | 0
102935 this._el = (this._el + el) | 0
102936 this._fl = (this._fl + fl) | 0
102937 this._gl = (this._gl + gl) | 0
102938 this._hl = (this._hl + hl) | 0
102939
102940 this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
102941 this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
102942 this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
102943 this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
102944 this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
102945 this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
102946 this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
102947 this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
102948}
102949
102950Sha512.prototype._hash = function () {
102951 var H = Buffer.allocUnsafe(64)
102952
102953 function writeInt64BE (h, l, offset) {
102954 H.writeInt32BE(h, offset)
102955 H.writeInt32BE(l, offset + 4)
102956 }
102957
102958 writeInt64BE(this._ah, this._al, 0)
102959 writeInt64BE(this._bh, this._bl, 8)
102960 writeInt64BE(this._ch, this._cl, 16)
102961 writeInt64BE(this._dh, this._dl, 24)
102962 writeInt64BE(this._eh, this._el, 32)
102963 writeInt64BE(this._fh, this._fl, 40)
102964 writeInt64BE(this._gh, this._gl, 48)
102965 writeInt64BE(this._hh, this._hl, 56)
102966
102967 return H
102968}
102969
102970module.exports = Sha512
102971
102972},{"./hash":769,"inherits":396,"safe-buffer":742}],777:[function(require,module,exports){
102973"use strict";
102974
102975var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
102976
102977var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
102978
102979var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
102980
102981Object.defineProperty(exports, "__esModule", {
102982 value: true
102983});
102984
102985var BigNumber = _interopRequire(require("bignumber.js"));
102986
102987var isString = _interopRequire(require("lodash/isString"));
102988
102989var Keypair = require("./keypair").Keypair;
102990
102991var StrKey = require("./strkey").StrKey;
102992
102993/**
102994 * Create a new Account object.
102995 *
102996 * `Account` represents a single account in Stellar network and its sequence number.
102997 * Account tracks the sequence number as it is used by {@link TransactionBuilder}.
102998 * See [Accounts](https://stellar.org/developers/learn/concepts/accounts.html) for more information about how
102999 * accounts work in Stellar.
103000 * @constructor
103001 * @param {string} accountId ID of the account (ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`)
103002 * @param {string} sequence current sequence number of the account
103003 */
103004
103005var Account = exports.Account = (function () {
103006 function Account(accountId, sequence) {
103007 _classCallCheck(this, Account);
103008
103009 if (!StrKey.isValidEd25519PublicKey(accountId)) {
103010 throw new Error("accountId is invalid");
103011 }
103012 if (!isString(sequence)) {
103013 throw new Error("sequence must be of type string");
103014 }
103015 this._accountId = accountId;
103016 this.sequence = new BigNumber(sequence);
103017 }
103018
103019 _createClass(Account, {
103020 accountId: {
103021
103022 /**
103023 * Returns Stellar account ID, ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`
103024 * @returns {string}
103025 */
103026
103027 value: function accountId() {
103028 return this._accountId;
103029 }
103030 },
103031 sequenceNumber: {
103032
103033 /**
103034 * @returns {string}
103035 */
103036
103037 value: function sequenceNumber() {
103038 return this.sequence.toString();
103039 }
103040 },
103041 incrementSequenceNumber: {
103042
103043 /**
103044 * Increments sequence number in this object by one.
103045 */
103046
103047 value: function incrementSequenceNumber() {
103048 this.sequence = this.sequence.add(1);
103049 }
103050 }
103051 });
103052
103053 return Account;
103054})();
103055},{"./keypair":783,"./strkey":801,"bignumber.js":807,"lodash/isString":618}],778:[function(require,module,exports){
103056"use strict";
103057
103058var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
103059
103060var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
103061
103062var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
103063
103064Object.defineProperty(exports, "__esModule", {
103065 value: true
103066});
103067
103068var xdr = _interopRequire(require("./generated/stellar-xdr_generated"));
103069
103070var Keypair = require("./keypair").Keypair;
103071
103072var StrKey = require("./strkey").StrKey;
103073
103074var clone = _interopRequire(require("lodash/clone"));
103075
103076var padEnd = _interopRequire(require("lodash/padEnd"));
103077
103078var trimEnd = _interopRequire(require("lodash/trimEnd"));
103079
103080/**
103081 * Asset class represents an asset, either the native asset (`XLM`)
103082 * or an asset code / issuer account ID pair.
103083 *
103084 * An asset code describes an asset code and issuer pair. In the case of the native
103085 * asset XLM, the issuer will be null.
103086 *
103087 * @constructor
103088 * @param {string} code - The asset code.
103089 * @param {string} issuer - The account ID of the issuer.
103090 */
103091
103092var Asset = exports.Asset = (function () {
103093 function Asset(code, issuer) {
103094 _classCallCheck(this, Asset);
103095
103096 if (!/^[a-zA-Z0-9]{1,12}$/.test(code)) {
103097 throw new Error("Asset code is invalid (maximum alphanumeric, 12 characters at max)");
103098 }
103099 if (String(code).toLowerCase() !== "xlm" && !issuer) {
103100 throw new Error("Issuer cannot be null");
103101 }
103102 if (issuer && !StrKey.isValidEd25519PublicKey(issuer)) {
103103 throw new Error("Issuer is invalid");
103104 }
103105
103106 this.code = code;
103107 this.issuer = issuer;
103108 }
103109
103110 _createClass(Asset, {
103111 toXDRObject: {
103112
103113 /**
103114 * Returns the xdr object for this asset.
103115 * @returns {xdr.Asset}
103116 */
103117
103118 value: function toXDRObject() {
103119 if (this.isNative()) {
103120 return xdr.Asset.assetTypeNative();
103121 }
103122
103123 var xdrType = undefined,
103124 xdrTypeString = undefined;
103125 if (this.code.length <= 4) {
103126 xdrType = xdr.AssetAlphaNum4;
103127 xdrTypeString = "assetTypeCreditAlphanum4";
103128 } else {
103129 xdrType = xdr.AssetAlphaNum12;
103130 xdrTypeString = "assetTypeCreditAlphanum12";
103131 }
103132
103133 // pad code with null bytes if necessary
103134 var padLength = this.code.length <= 4 ? 4 : 12;
103135 var paddedCode = padEnd(this.code, padLength, "\u0000");
103136
103137 var assetType = new xdrType({
103138 assetCode: paddedCode,
103139 issuer: Keypair.fromPublicKey(this.issuer).xdrAccountId()
103140 });
103141
103142 return new xdr.Asset(xdrTypeString, assetType);
103143 }
103144 },
103145 getCode: {
103146
103147 /**
103148 * Return the asset code
103149 * @returns {string}
103150 */
103151
103152 value: function getCode() {
103153 return clone(this.code);
103154 }
103155 },
103156 getIssuer: {
103157
103158 /**
103159 * Return the asset issuer
103160 * @returns {string}
103161 */
103162
103163 value: function getIssuer() {
103164 return clone(this.issuer);
103165 }
103166 },
103167 getAssetType: {
103168
103169 /**
103170 * Return the asset type. Can be one of following types:
103171 *
103172 * * `native`
103173 * * `credit_alphanum4`
103174 * * `credit_alphanum12`
103175 *
103176 * @see [Assets concept](https://www.stellar.org/developers/learn/concepts/assets.html)
103177 * @returns {string}
103178 */
103179
103180 value: function getAssetType() {
103181 if (this.isNative()) {
103182 return "native";
103183 }
103184 if (this.code.length >= 1 && this.code.length <= 4) {
103185 return "credit_alphanum4";
103186 }
103187 if (this.code.length >= 5 && this.code.length <= 12) {
103188 return "credit_alphanum12";
103189 }
103190 }
103191 },
103192 isNative: {
103193
103194 /**
103195 * Returns true if this asset object is the native asset.
103196 * @returns {boolean}
103197 */
103198
103199 value: function isNative() {
103200 return !this.issuer;
103201 }
103202 },
103203 equals: {
103204
103205 /**
103206 * Returns true if this asset equals the given asset.
103207 * @param {Asset} asset Asset to compare
103208 * @returns {boolean}
103209 */
103210
103211 value: function equals(asset) {
103212 return this.code == asset.getCode() && this.issuer == asset.getIssuer();
103213 }
103214 }
103215 }, {
103216 native: {
103217
103218 /**
103219 * Returns an asset object for the native asset.
103220 * @Return {Asset}
103221 */
103222
103223 value: function native() {
103224 return new Asset("XLM");
103225 }
103226 },
103227 fromOperation: {
103228
103229 /**
103230 * Returns an asset object from its XDR object representation.
103231 * @param {xdr.Asset} assetXdr - The asset xdr object.
103232 * @returns {Asset}
103233 */
103234
103235 value: function fromOperation(assetXdr) {
103236 var anum = undefined,
103237 code = undefined,
103238 issuer = undefined;
103239 switch (assetXdr["switch"]()) {
103240 case xdr.AssetType.assetTypeNative():
103241 return this.native();
103242 case xdr.AssetType.assetTypeCreditAlphanum4():
103243 anum = assetXdr.alphaNum4();
103244 /* falls through */
103245 case xdr.AssetType.assetTypeCreditAlphanum12():
103246 anum = anum || assetXdr.alphaNum12();
103247 issuer = StrKey.encodeEd25519PublicKey(anum.issuer().ed25519());
103248 code = trimEnd(anum.assetCode(), "\u0000");
103249 return new this(code, issuer);
103250 default:
103251 throw new Error("Invalid asset type: " + assetXdr["switch"]().name);
103252 }
103253 }
103254 }
103255 });
103256
103257 return Asset;
103258})();
103259},{"./generated/stellar-xdr_generated":780,"./keypair":783,"./strkey":801,"lodash/clone":593,"lodash/padEnd":626,"lodash/trimEnd":635}],779:[function(require,module,exports){
103260(function (Buffer){
103261"use strict";
103262
103263var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
103264
103265exports.decodeBase58Check = decodeBase58Check;
103266Object.defineProperty(exports, "__esModule", {
103267 value: true
103268});
103269
103270var bs58 = _interopRequire(require("./vendor/bs58"));
103271
103272var isUndefined = _interopRequire(require("lodash/isUndefined"));
103273
103274var hash = require("./hashing").hash;
103275
103276var verifyChecksum = require("./util/checksum").verifyChecksum;
103277
103278var versionBytes = {
103279 accountId: 0, // decimal 0
103280 none: 1, // decimal 1
103281 seed: 33 };
103282
103283function decodeBase58Check(versionByteName, encoded) {
103284 var decoded = bs58.decode(encoded);
103285 var versionByte = decoded[0];
103286 var payload = decoded.slice(0, decoded.length - 4);
103287 var data = payload.slice(1);
103288 var checksum = decoded.slice(decoded.length - 4);
103289
103290 var expectedVersion = versionBytes[versionByteName];
103291
103292 if (isUndefined(expectedVersion)) {
103293 throw new Error("" + versionByteName + " is not a valid version byte name. expected one of \"accountId\", \"seed\", or \"none\"");
103294 }
103295
103296 if (versionByte !== expectedVersion) {
103297 throw new Error("invalid version byte. expected " + expectedVersion + ", got " + versionByte);
103298 }
103299
103300 var expectedChecksum = calculateChecksum(payload);
103301
103302 if (!verifyChecksum(expectedChecksum, checksum)) {
103303 throw new Error("invalid checksum");
103304 }
103305
103306 if (versionByteName === "accountId" && decoded.length !== 37) {
103307 throw new Error("Decoded address length is invalid. Expected 37, got " + decoded.length);
103308 }
103309
103310 return Buffer.from(data);
103311}
103312
103313function calculateChecksum(payload) {
103314 var inner = hash(payload);
103315 var outer = hash(inner);
103316 return outer.slice(0, 4);
103317}
103318// decimal 33
103319}).call(this,require("buffer").Buffer)
103320},{"./hashing":781,"./util/checksum":804,"./vendor/bs58":806,"buffer":146,"lodash/isUndefined":621}],780:[function(require,module,exports){
103321"use strict";var _interopRequireWildcard=function(obj){return obj && obj.__esModule?obj:{"default":obj};};var XDR=_interopRequireWildcard(require("js-xdr"));var types=XDR.config(function(xdr){xdr.typedef("Value", xdr.varOpaque());xdr.struct("ScpBallot", [["counter", xdr.lookup("Uint32")], ["value", xdr.lookup("Value")]]);xdr["enum"]("ScpStatementType", {scpStPrepare:0, scpStConfirm:1, scpStExternalize:2, scpStNominate:3});xdr.struct("ScpNomination", [["quorumSetHash", xdr.lookup("Hash")], ["votes", xdr.varArray(xdr.lookup("Value"), 2147483647)], ["accepted", xdr.varArray(xdr.lookup("Value"), 2147483647)]]);xdr.struct("ScpStatementPrepare", [["quorumSetHash", xdr.lookup("Hash")], ["ballot", xdr.lookup("ScpBallot")], ["prepared", xdr.option(xdr.lookup("ScpBallot"))], ["preparedPrime", xdr.option(xdr.lookup("ScpBallot"))], ["nC", xdr.lookup("Uint32")], ["nH", xdr.lookup("Uint32")]]);xdr.struct("ScpStatementConfirm", [["ballot", xdr.lookup("ScpBallot")], ["nPrepared", xdr.lookup("Uint32")], ["nCommit", xdr.lookup("Uint32")], ["nH", xdr.lookup("Uint32")], ["quorumSetHash", xdr.lookup("Hash")]]);xdr.struct("ScpStatementExternalize", [["commit", xdr.lookup("ScpBallot")], ["nH", xdr.lookup("Uint32")], ["commitQuorumSetHash", xdr.lookup("Hash")]]);xdr.union("ScpStatementPledges", {switchOn:xdr.lookup("ScpStatementType"), switchName:"type", switches:[["scpStPrepare", "prepare"], ["scpStConfirm", "confirm"], ["scpStExternalize", "externalize"], ["scpStNominate", "nominate"]], arms:{prepare:xdr.lookup("ScpStatementPrepare"), confirm:xdr.lookup("ScpStatementConfirm"), externalize:xdr.lookup("ScpStatementExternalize"), nominate:xdr.lookup("ScpNomination")}});xdr.struct("ScpStatement", [["nodeId", xdr.lookup("NodeId")], ["slotIndex", xdr.lookup("Uint64")], ["pledges", xdr.lookup("ScpStatementPledges")]]);xdr.struct("ScpEnvelope", [["statement", xdr.lookup("ScpStatement")], ["signature", xdr.lookup("Signature")]]);xdr.struct("ScpQuorumSet", [["threshold", xdr.lookup("Uint32")], ["validators", xdr.varArray(xdr.lookup("PublicKey"), 2147483647)], ["innerSets", xdr.varArray(xdr.lookup("ScpQuorumSet"), 2147483647)]]);xdr.typedef("AccountId", xdr.lookup("PublicKey"));xdr.typedef("Thresholds", xdr.opaque(4));xdr.typedef("String32", xdr.string(32));xdr.typedef("String64", xdr.string(64));xdr.typedef("SequenceNumber", xdr.lookup("Int64"));xdr.typedef("DataValue", xdr.varOpaque(64));xdr["enum"]("AssetType", {assetTypeNative:0, assetTypeCreditAlphanum4:1, assetTypeCreditAlphanum12:2});xdr.struct("AssetAlphaNum4", [["assetCode", xdr.opaque(4)], ["issuer", xdr.lookup("AccountId")]]);xdr.struct("AssetAlphaNum12", [["assetCode", xdr.opaque(12)], ["issuer", xdr.lookup("AccountId")]]);xdr.union("Asset", {switchOn:xdr.lookup("AssetType"), switchName:"type", switches:[["assetTypeNative", xdr["void"]()], ["assetTypeCreditAlphanum4", "alphaNum4"], ["assetTypeCreditAlphanum12", "alphaNum12"]], arms:{alphaNum4:xdr.lookup("AssetAlphaNum4"), alphaNum12:xdr.lookup("AssetAlphaNum12")}});xdr.struct("Price", [["n", xdr.lookup("Int32")], ["d", xdr.lookup("Int32")]]);xdr.struct("Liabilities", [["buying", xdr.lookup("Int64")], ["selling", xdr.lookup("Int64")]]);xdr["enum"]("ThresholdIndices", {thresholdMasterWeight:0, thresholdLow:1, thresholdMed:2, thresholdHigh:3});xdr["enum"]("LedgerEntryType", {account:0, trustline:1, offer:2, datum:3});xdr.struct("Signer", [["key", xdr.lookup("SignerKey")], ["weight", xdr.lookup("Uint32")]]);xdr["enum"]("AccountFlags", {authRequiredFlag:1, authRevocableFlag:2, authImmutableFlag:4});xdr["const"]("MASK_ACCOUNT_FLAGS", 7);xdr.union("AccountEntryV1Ext", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("AccountEntryV1", [["liabilities", xdr.lookup("Liabilities")], ["ext", xdr.lookup("AccountEntryV1Ext")]]);xdr.union("AccountEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()], [1, "v1"]], arms:{v1:xdr.lookup("AccountEntryV1")}});xdr.struct("AccountEntry", [["accountId", xdr.lookup("AccountId")], ["balance", xdr.lookup("Int64")], ["seqNum", xdr.lookup("SequenceNumber")], ["numSubEntries", xdr.lookup("Uint32")], ["inflationDest", xdr.option(xdr.lookup("AccountId"))], ["flags", xdr.lookup("Uint32")], ["homeDomain", xdr.lookup("String32")], ["thresholds", xdr.lookup("Thresholds")], ["signers", xdr.varArray(xdr.lookup("Signer"), 20)], ["ext", xdr.lookup("AccountEntryExt")]]);xdr["enum"]("TrustLineFlags", {authorizedFlag:1});xdr["const"]("MASK_TRUSTLINE_FLAGS", 1);xdr.union("TrustLineEntryV1Ext", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("TrustLineEntryV1", [["liabilities", xdr.lookup("Liabilities")], ["ext", xdr.lookup("TrustLineEntryV1Ext")]]);xdr.union("TrustLineEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()], [1, "v1"]], arms:{v1:xdr.lookup("TrustLineEntryV1")}});xdr.struct("TrustLineEntry", [["accountId", xdr.lookup("AccountId")], ["asset", xdr.lookup("Asset")], ["balance", xdr.lookup("Int64")], ["limit", xdr.lookup("Int64")], ["flags", xdr.lookup("Uint32")], ["ext", xdr.lookup("TrustLineEntryExt")]]);xdr["enum"]("OfferEntryFlags", {passiveFlag:1});xdr["const"]("MASK_OFFERENTRY_FLAGS", 1);xdr.union("OfferEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("OfferEntry", [["sellerId", xdr.lookup("AccountId")], ["offerId", xdr.lookup("Uint64")], ["selling", xdr.lookup("Asset")], ["buying", xdr.lookup("Asset")], ["amount", xdr.lookup("Int64")], ["price", xdr.lookup("Price")], ["flags", xdr.lookup("Uint32")], ["ext", xdr.lookup("OfferEntryExt")]]);xdr.union("DataEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("DataEntry", [["accountId", xdr.lookup("AccountId")], ["dataName", xdr.lookup("String64")], ["dataValue", xdr.lookup("DataValue")], ["ext", xdr.lookup("DataEntryExt")]]);xdr.union("LedgerEntryData", {switchOn:xdr.lookup("LedgerEntryType"), switchName:"type", switches:[["account", "account"], ["trustline", "trustLine"], ["offer", "offer"], ["datum", "data"]], arms:{account:xdr.lookup("AccountEntry"), trustLine:xdr.lookup("TrustLineEntry"), offer:xdr.lookup("OfferEntry"), data:xdr.lookup("DataEntry")}});xdr.union("LedgerEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("LedgerEntry", [["lastModifiedLedgerSeq", xdr.lookup("Uint32")], ["data", xdr.lookup("LedgerEntryData")], ["ext", xdr.lookup("LedgerEntryExt")]]);xdr["enum"]("EnvelopeType", {envelopeTypeScp:1, envelopeTypeTx:2, envelopeTypeAuth:3});xdr.typedef("UpgradeType", xdr.varOpaque(128));xdr.union("StellarValueExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("StellarValue", [["txSetHash", xdr.lookup("Hash")], ["closeTime", xdr.lookup("Uint64")], ["upgrades", xdr.varArray(xdr.lookup("UpgradeType"), 6)], ["ext", xdr.lookup("StellarValueExt")]]);xdr.union("LedgerHeaderExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("LedgerHeader", [["ledgerVersion", xdr.lookup("Uint32")], ["previousLedgerHash", xdr.lookup("Hash")], ["scpValue", xdr.lookup("StellarValue")], ["txSetResultHash", xdr.lookup("Hash")], ["bucketListHash", xdr.lookup("Hash")], ["ledgerSeq", xdr.lookup("Uint32")], ["totalCoins", xdr.lookup("Int64")], ["feePool", xdr.lookup("Int64")], ["inflationSeq", xdr.lookup("Uint32")], ["idPool", xdr.lookup("Uint64")], ["baseFee", xdr.lookup("Uint32")], ["baseReserve", xdr.lookup("Uint32")], ["maxTxSetSize", xdr.lookup("Uint32")], ["skipList", xdr.array(xdr.lookup("Hash"), 4)], ["ext", xdr.lookup("LedgerHeaderExt")]]);xdr["enum"]("LedgerUpgradeType", {ledgerUpgradeVersion:1, ledgerUpgradeBaseFee:2, ledgerUpgradeMaxTxSetSize:3, ledgerUpgradeBaseReserve:4});xdr.union("LedgerUpgrade", {switchOn:xdr.lookup("LedgerUpgradeType"), switchName:"type", switches:[["ledgerUpgradeVersion", "newLedgerVersion"], ["ledgerUpgradeBaseFee", "newBaseFee"], ["ledgerUpgradeMaxTxSetSize", "newMaxTxSetSize"], ["ledgerUpgradeBaseReserve", "newBaseReserve"]], arms:{newLedgerVersion:xdr.lookup("Uint32"), newBaseFee:xdr.lookup("Uint32"), newMaxTxSetSize:xdr.lookup("Uint32"), newBaseReserve:xdr.lookup("Uint32")}});xdr.struct("LedgerKeyAccount", [["accountId", xdr.lookup("AccountId")]]);xdr.struct("LedgerKeyTrustLine", [["accountId", xdr.lookup("AccountId")], ["asset", xdr.lookup("Asset")]]);xdr.struct("LedgerKeyOffer", [["sellerId", xdr.lookup("AccountId")], ["offerId", xdr.lookup("Uint64")]]);xdr.struct("LedgerKeyData", [["accountId", xdr.lookup("AccountId")], ["dataName", xdr.lookup("String64")]]);xdr.union("LedgerKey", {switchOn:xdr.lookup("LedgerEntryType"), switchName:"type", switches:[["account", "account"], ["trustline", "trustLine"], ["offer", "offer"], ["datum", "data"]], arms:{account:xdr.lookup("LedgerKeyAccount"), trustLine:xdr.lookup("LedgerKeyTrustLine"), offer:xdr.lookup("LedgerKeyOffer"), data:xdr.lookup("LedgerKeyData")}});xdr["enum"]("BucketEntryType", {liveentry:0, deadentry:1});xdr.union("BucketEntry", {switchOn:xdr.lookup("BucketEntryType"), switchName:"type", switches:[["liveentry", "liveEntry"], ["deadentry", "deadEntry"]], arms:{liveEntry:xdr.lookup("LedgerEntry"), deadEntry:xdr.lookup("LedgerKey")}});xdr.struct("TransactionSet", [["previousLedgerHash", xdr.lookup("Hash")], ["txes", xdr.varArray(xdr.lookup("TransactionEnvelope"), 2147483647)]]);xdr.struct("TransactionResultPair", [["transactionHash", xdr.lookup("Hash")], ["result", xdr.lookup("TransactionResult")]]);xdr.struct("TransactionResultSet", [["results", xdr.varArray(xdr.lookup("TransactionResultPair"), 2147483647)]]);xdr.union("TransactionHistoryEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("TransactionHistoryEntry", [["ledgerSeq", xdr.lookup("Uint32")], ["txSet", xdr.lookup("TransactionSet")], ["ext", xdr.lookup("TransactionHistoryEntryExt")]]);xdr.union("TransactionHistoryResultEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("TransactionHistoryResultEntry", [["ledgerSeq", xdr.lookup("Uint32")], ["txResultSet", xdr.lookup("TransactionResultSet")], ["ext", xdr.lookup("TransactionHistoryResultEntryExt")]]);xdr.union("LedgerHeaderHistoryEntryExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("LedgerHeaderHistoryEntry", [["hash", xdr.lookup("Hash")], ["header", xdr.lookup("LedgerHeader")], ["ext", xdr.lookup("LedgerHeaderHistoryEntryExt")]]);xdr.struct("LedgerScpMessages", [["ledgerSeq", xdr.lookup("Uint32")], ["messages", xdr.varArray(xdr.lookup("ScpEnvelope"), 2147483647)]]);xdr.struct("ScpHistoryEntryV0", [["quorumSets", xdr.varArray(xdr.lookup("ScpQuorumSet"), 2147483647)], ["ledgerMessages", xdr.lookup("LedgerScpMessages")]]);xdr.union("ScpHistoryEntry", {switchOn:xdr.int(), switchName:"v", switches:[[0, "v0"]], arms:{v0:xdr.lookup("ScpHistoryEntryV0")}});xdr["enum"]("LedgerEntryChangeType", {ledgerEntryCreated:0, ledgerEntryUpdated:1, ledgerEntryRemoved:2, ledgerEntryState:3});xdr.union("LedgerEntryChange", {switchOn:xdr.lookup("LedgerEntryChangeType"), switchName:"type", switches:[["ledgerEntryCreated", "created"], ["ledgerEntryUpdated", "updated"], ["ledgerEntryRemoved", "removed"], ["ledgerEntryState", "state"]], arms:{created:xdr.lookup("LedgerEntry"), updated:xdr.lookup("LedgerEntry"), removed:xdr.lookup("LedgerKey"), state:xdr.lookup("LedgerEntry")}});xdr.typedef("LedgerEntryChanges", xdr.varArray(xdr.lookup("LedgerEntryChange"), 2147483647));xdr.struct("OperationMeta", [["changes", xdr.lookup("LedgerEntryChanges")]]);xdr.struct("TransactionMetaV1", [["txChanges", xdr.lookup("LedgerEntryChanges")], ["operations", xdr.varArray(xdr.lookup("OperationMeta"), 2147483647)]]);xdr.union("TransactionMeta", {switchOn:xdr.int(), switchName:"v", switches:[[0, "operations"], [1, "v1"]], arms:{operations:xdr.varArray(xdr.lookup("OperationMeta"), 2147483647), v1:xdr.lookup("TransactionMetaV1")}});xdr["enum"]("ErrorCode", {errMisc:0, errDatum:1, errConf:2, errAuth:3, errLoad:4});xdr.struct("Error", [["code", xdr.lookup("ErrorCode")], ["msg", xdr.string(100)]]);xdr.struct("AuthCert", [["pubkey", xdr.lookup("Curve25519Public")], ["expiration", xdr.lookup("Uint64")], ["sig", xdr.lookup("Signature")]]);xdr.struct("Hello", [["ledgerVersion", xdr.lookup("Uint32")], ["overlayVersion", xdr.lookup("Uint32")], ["overlayMinVersion", xdr.lookup("Uint32")], ["networkId", xdr.lookup("Hash")], ["versionStr", xdr.string(100)], ["listeningPort", xdr.int()], ["peerId", xdr.lookup("NodeId")], ["cert", xdr.lookup("AuthCert")], ["nonce", xdr.lookup("Uint256")]]);xdr.struct("Auth", [["unused", xdr.int()]]);xdr["enum"]("IpAddrType", {iPv4:0, iPv6:1});xdr.union("PeerAddressIp", {switchOn:xdr.lookup("IpAddrType"), switchName:"type", switches:[["iPv4", "ipv4"], ["iPv6", "ipv6"]], arms:{ipv4:xdr.opaque(4), ipv6:xdr.opaque(16)}});xdr.struct("PeerAddress", [["ip", xdr.lookup("PeerAddressIp")], ["port", xdr.lookup("Uint32")], ["numFailures", xdr.lookup("Uint32")]]);xdr["enum"]("MessageType", {errorMsg:0, auth:2, dontHave:3, getPeer:4, peer:5, getTxSet:6, txSet:7, transaction:8, getScpQuorumset:9, scpQuorumset:10, scpMessage:11, getScpState:12, hello:13});xdr.struct("DontHave", [["type", xdr.lookup("MessageType")], ["reqHash", xdr.lookup("Uint256")]]);xdr.union("StellarMessage", {switchOn:xdr.lookup("MessageType"), switchName:"type", switches:[["errorMsg", "error"], ["hello", "hello"], ["auth", "auth"], ["dontHave", "dontHave"], ["getPeer", xdr["void"]()], ["peer", "peers"], ["getTxSet", "txSetHash"], ["txSet", "txSet"], ["transaction", "transaction"], ["getScpQuorumset", "qSetHash"], ["scpQuorumset", "qSet"], ["scpMessage", "envelope"], ["getScpState", "getScpLedgerSeq"]], arms:{error:xdr.lookup("Error"), hello:xdr.lookup("Hello"), auth:xdr.lookup("Auth"), dontHave:xdr.lookup("DontHave"), peers:xdr.varArray(xdr.lookup("PeerAddress"), 100), txSetHash:xdr.lookup("Uint256"), txSet:xdr.lookup("TransactionSet"), transaction:xdr.lookup("TransactionEnvelope"), qSetHash:xdr.lookup("Uint256"), qSet:xdr.lookup("ScpQuorumSet"), envelope:xdr.lookup("StellarMessage"), getScpLedgerSeq:xdr.lookup("Uint32")}});xdr.struct("AuthenticatedMessageV0", [["sequence", xdr.lookup("Uint64")], ["message", xdr.lookup("StellarMessage")], ["mac", xdr.lookup("HmacSha256Mac")]]);xdr.union("AuthenticatedMessage", {switchOn:xdr.lookup("Uint32"), switchName:"v", switches:[[0, "v0"]], arms:{v0:xdr.lookup("AuthenticatedMessageV0")}});xdr.struct("DecoratedSignature", [["hint", xdr.lookup("SignatureHint")], ["signature", xdr.lookup("Signature")]]);xdr["enum"]("OperationType", {createAccount:0, payment:1, pathPayment:2, manageOffer:3, createPassiveOffer:4, setOption:5, changeTrust:6, allowTrust:7, accountMerge:8, inflation:9, manageDatum:10, bumpSequence:11});xdr.struct("CreateAccountOp", [["destination", xdr.lookup("AccountId")], ["startingBalance", xdr.lookup("Int64")]]);xdr.struct("PaymentOp", [["destination", xdr.lookup("AccountId")], ["asset", xdr.lookup("Asset")], ["amount", xdr.lookup("Int64")]]);xdr.struct("PathPaymentOp", [["sendAsset", xdr.lookup("Asset")], ["sendMax", xdr.lookup("Int64")], ["destination", xdr.lookup("AccountId")], ["destAsset", xdr.lookup("Asset")], ["destAmount", xdr.lookup("Int64")], ["path", xdr.varArray(xdr.lookup("Asset"), 5)]]);xdr.struct("ManageOfferOp", [["selling", xdr.lookup("Asset")], ["buying", xdr.lookup("Asset")], ["amount", xdr.lookup("Int64")], ["price", xdr.lookup("Price")], ["offerId", xdr.lookup("Uint64")]]);xdr.struct("CreatePassiveOfferOp", [["selling", xdr.lookup("Asset")], ["buying", xdr.lookup("Asset")], ["amount", xdr.lookup("Int64")], ["price", xdr.lookup("Price")]]);xdr.struct("SetOptionsOp", [["inflationDest", xdr.option(xdr.lookup("AccountId"))], ["clearFlags", xdr.option(xdr.lookup("Uint32"))], ["setFlags", xdr.option(xdr.lookup("Uint32"))], ["masterWeight", xdr.option(xdr.lookup("Uint32"))], ["lowThreshold", xdr.option(xdr.lookup("Uint32"))], ["medThreshold", xdr.option(xdr.lookup("Uint32"))], ["highThreshold", xdr.option(xdr.lookup("Uint32"))], ["homeDomain", xdr.option(xdr.lookup("String32"))], ["signer", xdr.option(xdr.lookup("Signer"))]]);xdr.struct("ChangeTrustOp", [["line", xdr.lookup("Asset")], ["limit", xdr.lookup("Int64")]]);xdr.union("AllowTrustOpAsset", {switchOn:xdr.lookup("AssetType"), switchName:"type", switches:[["assetTypeCreditAlphanum4", "assetCode4"], ["assetTypeCreditAlphanum12", "assetCode12"]], arms:{assetCode4:xdr.opaque(4), assetCode12:xdr.opaque(12)}});xdr.struct("AllowTrustOp", [["trustor", xdr.lookup("AccountId")], ["asset", xdr.lookup("AllowTrustOpAsset")], ["authorize", xdr.bool()]]);xdr.struct("ManageDataOp", [["dataName", xdr.lookup("String64")], ["dataValue", xdr.option(xdr.lookup("DataValue"))]]);xdr.struct("BumpSequenceOp", [["bumpTo", xdr.lookup("SequenceNumber")]]);xdr.union("OperationBody", {switchOn:xdr.lookup("OperationType"), switchName:"type", switches:[["createAccount", "createAccountOp"], ["payment", "paymentOp"], ["pathPayment", "pathPaymentOp"], ["manageOffer", "manageOfferOp"], ["createPassiveOffer", "createPassiveOfferOp"], ["setOption", "setOptionsOp"], ["changeTrust", "changeTrustOp"], ["allowTrust", "allowTrustOp"], ["accountMerge", "destination"], ["inflation", xdr["void"]()], ["manageDatum", "manageDataOp"], ["bumpSequence", "bumpSequenceOp"]], arms:{createAccountOp:xdr.lookup("CreateAccountOp"), paymentOp:xdr.lookup("PaymentOp"), pathPaymentOp:xdr.lookup("PathPaymentOp"), manageOfferOp:xdr.lookup("ManageOfferOp"), createPassiveOfferOp:xdr.lookup("CreatePassiveOfferOp"), setOptionsOp:xdr.lookup("SetOptionsOp"), changeTrustOp:xdr.lookup("ChangeTrustOp"), allowTrustOp:xdr.lookup("AllowTrustOp"), destination:xdr.lookup("AccountId"), manageDataOp:xdr.lookup("ManageDataOp"), bumpSequenceOp:xdr.lookup("BumpSequenceOp")}});xdr.struct("Operation", [["sourceAccount", xdr.option(xdr.lookup("AccountId"))], ["body", xdr.lookup("OperationBody")]]);xdr["enum"]("MemoType", {memoNone:0, memoText:1, memoId:2, memoHash:3, memoReturn:4});xdr.union("Memo", {switchOn:xdr.lookup("MemoType"), switchName:"type", switches:[["memoNone", xdr["void"]()], ["memoText", "text"], ["memoId", "id"], ["memoHash", "hash"], ["memoReturn", "retHash"]], arms:{text:xdr.string(28), id:xdr.lookup("Uint64"), hash:xdr.lookup("Hash"), retHash:xdr.lookup("Hash")}});xdr.struct("TimeBounds", [["minTime", xdr.lookup("Uint64")], ["maxTime", xdr.lookup("Uint64")]]);xdr.union("TransactionExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("Transaction", [["sourceAccount", xdr.lookup("AccountId")], ["fee", xdr.lookup("Uint32")], ["seqNum", xdr.lookup("SequenceNumber")], ["timeBounds", xdr.option(xdr.lookup("TimeBounds"))], ["memo", xdr.lookup("Memo")], ["operations", xdr.varArray(xdr.lookup("Operation"), 100)], ["ext", xdr.lookup("TransactionExt")]]);xdr.union("TransactionSignaturePayloadTaggedTransaction", {switchOn:xdr.lookup("EnvelopeType"), switchName:"type", switches:[["envelopeTypeTx", "tx"]], arms:{tx:xdr.lookup("Transaction")}});xdr.struct("TransactionSignaturePayload", [["networkId", xdr.lookup("Hash")], ["taggedTransaction", xdr.lookup("TransactionSignaturePayloadTaggedTransaction")]]);xdr.struct("TransactionEnvelope", [["tx", xdr.lookup("Transaction")], ["signatures", xdr.varArray(xdr.lookup("DecoratedSignature"), 20)]]);xdr.struct("ClaimOfferAtom", [["sellerId", xdr.lookup("AccountId")], ["offerId", xdr.lookup("Uint64")], ["assetSold", xdr.lookup("Asset")], ["amountSold", xdr.lookup("Int64")], ["assetBought", xdr.lookup("Asset")], ["amountBought", xdr.lookup("Int64")]]);xdr["enum"]("CreateAccountResultCode", {createAccountSuccess:0, createAccountMalformed:-1, createAccountUnderfunded:-2, createAccountLowReserve:-3, createAccountAlreadyExist:-4});xdr.union("CreateAccountResult", {switchOn:xdr.lookup("CreateAccountResultCode"), switchName:"code", switches:[["createAccountSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("PaymentResultCode", {paymentSuccess:0, paymentMalformed:-1, paymentUnderfunded:-2, paymentSrcNoTrust:-3, paymentSrcNotAuthorized:-4, paymentNoDestination:-5, paymentNoTrust:-6, paymentNotAuthorized:-7, paymentLineFull:-8, paymentNoIssuer:-9});xdr.union("PaymentResult", {switchOn:xdr.lookup("PaymentResultCode"), switchName:"code", switches:[["paymentSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("PathPaymentResultCode", {pathPaymentSuccess:0, pathPaymentMalformed:-1, pathPaymentUnderfunded:-2, pathPaymentSrcNoTrust:-3, pathPaymentSrcNotAuthorized:-4, pathPaymentNoDestination:-5, pathPaymentNoTrust:-6, pathPaymentNotAuthorized:-7, pathPaymentLineFull:-8, pathPaymentNoIssuer:-9, pathPaymentTooFewOffer:-10, pathPaymentOfferCrossSelf:-11, pathPaymentOverSendmax:-12});xdr.struct("SimplePaymentResult", [["destination", xdr.lookup("AccountId")], ["asset", xdr.lookup("Asset")], ["amount", xdr.lookup("Int64")]]);xdr.struct("PathPaymentResultSuccess", [["offers", xdr.varArray(xdr.lookup("ClaimOfferAtom"), 2147483647)], ["last", xdr.lookup("SimplePaymentResult")]]);xdr.union("PathPaymentResult", {switchOn:xdr.lookup("PathPaymentResultCode"), switchName:"code", switches:[["pathPaymentSuccess", "success"], ["pathPaymentNoIssuer", "noIssuer"]], arms:{success:xdr.lookup("PathPaymentResultSuccess"), noIssuer:xdr.lookup("Asset")}, defaultArm:xdr["void"]()});xdr["enum"]("ManageOfferResultCode", {manageOfferSuccess:0, manageOfferMalformed:-1, manageOfferSellNoTrust:-2, manageOfferBuyNoTrust:-3, manageOfferSellNotAuthorized:-4, manageOfferBuyNotAuthorized:-5, manageOfferLineFull:-6, manageOfferUnderfunded:-7, manageOfferCrossSelf:-8, manageOfferSellNoIssuer:-9, manageOfferBuyNoIssuer:-10, manageOfferNotFound:-11, manageOfferLowReserve:-12});xdr["enum"]("ManageOfferEffect", {manageOfferCreated:0, manageOfferUpdated:1, manageOfferDeleted:2});xdr.union("ManageOfferSuccessResultOffer", {switchOn:xdr.lookup("ManageOfferEffect"), switchName:"effect", switches:[["manageOfferCreated", "offer"], ["manageOfferUpdated", "offer"]], arms:{offer:xdr.lookup("OfferEntry")}, defaultArm:xdr["void"]()});xdr.struct("ManageOfferSuccessResult", [["offersClaimed", xdr.varArray(xdr.lookup("ClaimOfferAtom"), 2147483647)], ["offer", xdr.lookup("ManageOfferSuccessResultOffer")]]);xdr.union("ManageOfferResult", {switchOn:xdr.lookup("ManageOfferResultCode"), switchName:"code", switches:[["manageOfferSuccess", "success"]], arms:{success:xdr.lookup("ManageOfferSuccessResult")}, defaultArm:xdr["void"]()});xdr["enum"]("SetOptionsResultCode", {setOptionsSuccess:0, setOptionsLowReserve:-1, setOptionsTooManySigner:-2, setOptionsBadFlag:-3, setOptionsInvalidInflation:-4, setOptionsCantChange:-5, setOptionsUnknownFlag:-6, setOptionsThresholdOutOfRange:-7, setOptionsBadSigner:-8, setOptionsInvalidHomeDomain:-9});xdr.union("SetOptionsResult", {switchOn:xdr.lookup("SetOptionsResultCode"), switchName:"code", switches:[["setOptionsSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("ChangeTrustResultCode", {changeTrustSuccess:0, changeTrustMalformed:-1, changeTrustNoIssuer:-2, changeTrustInvalidLimit:-3, changeTrustLowReserve:-4, changeTrustSelfNotAllowed:-5});xdr.union("ChangeTrustResult", {switchOn:xdr.lookup("ChangeTrustResultCode"), switchName:"code", switches:[["changeTrustSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("AllowTrustResultCode", {allowTrustSuccess:0, allowTrustMalformed:-1, allowTrustNoTrustLine:-2, allowTrustTrustNotRequired:-3, allowTrustCantRevoke:-4, allowTrustSelfNotAllowed:-5});xdr.union("AllowTrustResult", {switchOn:xdr.lookup("AllowTrustResultCode"), switchName:"code", switches:[["allowTrustSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("AccountMergeResultCode", {accountMergeSuccess:0, accountMergeMalformed:-1, accountMergeNoAccount:-2, accountMergeImmutableSet:-3, accountMergeHasSubEntry:-4, accountMergeSeqnumTooFar:-5, accountMergeDestFull:-6});xdr.union("AccountMergeResult", {switchOn:xdr.lookup("AccountMergeResultCode"), switchName:"code", switches:[["accountMergeSuccess", "sourceAccountBalance"]], arms:{sourceAccountBalance:xdr.lookup("Int64")}, defaultArm:xdr["void"]()});xdr["enum"]("InflationResultCode", {inflationSuccess:0, inflationNotTime:-1});xdr.struct("InflationPayout", [["destination", xdr.lookup("AccountId")], ["amount", xdr.lookup("Int64")]]);xdr.union("InflationResult", {switchOn:xdr.lookup("InflationResultCode"), switchName:"code", switches:[["inflationSuccess", "payouts"]], arms:{payouts:xdr.varArray(xdr.lookup("InflationPayout"), 2147483647)}, defaultArm:xdr["void"]()});xdr["enum"]("ManageDataResultCode", {manageDataSuccess:0, manageDataNotSupportedYet:-1, manageDataNameNotFound:-2, manageDataLowReserve:-3, manageDataInvalidName:-4});xdr.union("ManageDataResult", {switchOn:xdr.lookup("ManageDataResultCode"), switchName:"code", switches:[["manageDataSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("BumpSequenceResultCode", {bumpSequenceSuccess:0, bumpSequenceBadSeq:-1});xdr.union("BumpSequenceResult", {switchOn:xdr.lookup("BumpSequenceResultCode"), switchName:"code", switches:[["bumpSequenceSuccess", xdr["void"]()]], arms:{}, defaultArm:xdr["void"]()});xdr["enum"]("OperationResultCode", {opInner:0, opBadAuth:-1, opNoAccount:-2, opNotSupported:-3});xdr.union("OperationResultTr", {switchOn:xdr.lookup("OperationType"), switchName:"type", switches:[["createAccount", "createAccountResult"], ["payment", "paymentResult"], ["pathPayment", "pathPaymentResult"], ["manageOffer", "manageOfferResult"], ["createPassiveOffer", "createPassiveOfferResult"], ["setOption", "setOptionsResult"], ["changeTrust", "changeTrustResult"], ["allowTrust", "allowTrustResult"], ["accountMerge", "accountMergeResult"], ["inflation", "inflationResult"], ["manageDatum", "manageDataResult"], ["bumpSequence", "bumpSeqResult"]], arms:{createAccountResult:xdr.lookup("CreateAccountResult"), paymentResult:xdr.lookup("PaymentResult"), pathPaymentResult:xdr.lookup("PathPaymentResult"), manageOfferResult:xdr.lookup("ManageOfferResult"), createPassiveOfferResult:xdr.lookup("ManageOfferResult"), setOptionsResult:xdr.lookup("SetOptionsResult"), changeTrustResult:xdr.lookup("ChangeTrustResult"), allowTrustResult:xdr.lookup("AllowTrustResult"), accountMergeResult:xdr.lookup("AccountMergeResult"), inflationResult:xdr.lookup("InflationResult"), manageDataResult:xdr.lookup("ManageDataResult"), bumpSeqResult:xdr.lookup("BumpSequenceResult")}});xdr.union("OperationResult", {switchOn:xdr.lookup("OperationResultCode"), switchName:"code", switches:[["opInner", "tr"]], arms:{tr:xdr.lookup("OperationResultTr")}, defaultArm:xdr["void"]()});xdr["enum"]("TransactionResultCode", {txSuccess:0, txFailed:-1, txTooEarly:-2, txTooLate:-3, txMissingOperation:-4, txBadSeq:-5, txBadAuth:-6, txInsufficientBalance:-7, txNoAccount:-8, txInsufficientFee:-9, txBadAuthExtra:-10, txInternalError:-11});xdr.union("TransactionResultResult", {switchOn:xdr.lookup("TransactionResultCode"), switchName:"code", switches:[["txSuccess", "results"], ["txFailed", "results"]], arms:{results:xdr.varArray(xdr.lookup("OperationResult"), 2147483647)}, defaultArm:xdr["void"]()});xdr.union("TransactionResultExt", {switchOn:xdr.int(), switchName:"v", switches:[[0, xdr["void"]()]], arms:{}});xdr.struct("TransactionResult", [["feeCharged", xdr.lookup("Int64")], ["result", xdr.lookup("TransactionResultResult")], ["ext", xdr.lookup("TransactionResultExt")]]);xdr.typedef("Hash", xdr.opaque(32));xdr.typedef("Uint256", xdr.opaque(32));xdr.typedef("Uint32", xdr.uint());xdr.typedef("Int32", xdr.int());xdr.typedef("Uint64", xdr.uhyper());xdr.typedef("Int64", xdr.hyper());xdr["enum"]("CryptoKeyType", {keyTypeEd25519:0, keyTypePreAuthTx:1, keyTypeHashX:2});xdr["enum"]("PublicKeyType", {publicKeyTypeEd25519:0});xdr["enum"]("SignerKeyType", {signerKeyTypeEd25519:0, signerKeyTypePreAuthTx:1, signerKeyTypeHashX:2});xdr.union("PublicKey", {switchOn:xdr.lookup("PublicKeyType"), switchName:"type", switches:[["publicKeyTypeEd25519", "ed25519"]], arms:{ed25519:xdr.lookup("Uint256")}});xdr.union("SignerKey", {switchOn:xdr.lookup("SignerKeyType"), switchName:"type", switches:[["signerKeyTypeEd25519", "ed25519"], ["signerKeyTypePreAuthTx", "preAuthTx"], ["signerKeyTypeHashX", "hashX"]], arms:{ed25519:xdr.lookup("Uint256"), preAuthTx:xdr.lookup("Uint256"), hashX:xdr.lookup("Uint256")}});xdr.typedef("Signature", xdr.varOpaque(64));xdr.typedef("SignatureHint", xdr.opaque(4));xdr.typedef("NodeId", xdr.lookup("PublicKey"));xdr.struct("Curve25519Secret", [["key", xdr.opaque(32)]]);xdr.struct("Curve25519Public", [["key", xdr.opaque(32)]]);xdr.struct("HmacSha256Key", [["key", xdr.opaque(32)]]);xdr.struct("HmacSha256Mac", [["mac", xdr.opaque(32)]]);});module.exports = types;
103322},{"js-xdr":410}],781:[function(require,module,exports){
103323"use strict";
103324
103325exports.hash = hash;
103326Object.defineProperty(exports, "__esModule", {
103327 value: true
103328});
103329
103330var sha256 = require("sha.js").sha256;
103331
103332function hash(data) {
103333 var hasher = new sha256();
103334 hasher.update(data, "utf8");
103335 return hasher.digest();
103336}
103337},{"sha.js":770}],782:[function(require,module,exports){
103338"use strict";
103339
103340var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
103341
103342var _defaults = function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; };
103343
103344var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
103345
103346Object.defineProperty(exports, "__esModule", {
103347 value: true
103348});
103349
103350var xdr = _interopRequire(require("./generated/stellar-xdr_generated"));
103351
103352exports.xdr = xdr;
103353exports.hash = require("./hashing").hash;
103354
103355var _signing = require("./signing");
103356
103357exports.sign = _signing.sign;
103358exports.verify = _signing.verify;
103359exports.FastSigning = _signing.FastSigning;
103360exports.Keypair = require("./keypair").Keypair;
103361
103362var _jsXdr = require("js-xdr");
103363
103364exports.UnsignedHyper = _jsXdr.UnsignedHyper;
103365exports.Hyper = _jsXdr.Hyper;
103366exports.Transaction = require("./transaction").Transaction;
103367
103368var _transaction_builder = require("./transaction_builder");
103369
103370exports.TransactionBuilder = _transaction_builder.TransactionBuilder;
103371exports.TimeoutInfinite = _transaction_builder.TimeoutInfinite;
103372exports.Asset = require("./asset").Asset;
103373
103374var _operation = require("./operation");
103375
103376exports.Operation = _operation.Operation;
103377exports.AuthRequiredFlag = _operation.AuthRequiredFlag;
103378exports.AuthRevocableFlag = _operation.AuthRevocableFlag;
103379exports.AuthImmutableFlag = _operation.AuthImmutableFlag;
103380
103381_defaults(exports, _interopRequireWildcard(require("./memo")));
103382
103383exports.Account = require("./account").Account;
103384
103385var _network = require("./network");
103386
103387exports.Network = _network.Network;
103388exports.Networks = _network.Networks;
103389exports.StrKey = require("./strkey").StrKey;
103390exports["default"] = module.exports;
103391},{"./account":777,"./asset":778,"./generated/stellar-xdr_generated":780,"./hashing":781,"./keypair":783,"./memo":784,"./network":785,"./operation":786,"./signing":800,"./strkey":801,"./transaction":802,"./transaction_builder":803,"js-xdr":410}],783:[function(require,module,exports){
103392(function (Buffer){
103393"use strict";
103394
103395var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
103396
103397var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
103398
103399var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
103400
103401var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
103402
103403Object.defineProperty(exports, "__esModule", {
103404 value: true
103405});
103406
103407var Network = require("./network").Network;
103408
103409var _signing = require("./signing");
103410
103411var sign = _signing.sign;
103412var verify = _signing.verify;
103413
103414var base58 = _interopRequireWildcard(require("./base58"));
103415
103416var StrKey = require("./strkey").StrKey;
103417
103418var xdr = _interopRequire(require("./generated/stellar-xdr_generated"));
103419
103420var nacl = _interopRequire(require("tweetnacl"));
103421
103422/**
103423 * `Keypair` represents public (and secret) keys of the account.
103424 *
103425 * Currently `Keypair` only supports ed25519 but in a future this class can be abstraction layer for other
103426 * public-key signature systems.
103427 *
103428 * Use more convenient methods to create `Keypair` object:
103429 * * `{@link Keypair.fromPublicKey}`
103430 * * `{@link Keypair.fromSecret}`
103431 * * `{@link Keypair.random}`
103432 *
103433 * @constructor
103434 * @param {object} keys At least one of keys must be provided.
103435 * @param {string} keys.type Public-key signature system name. (currently only `ed25519` keys are supported)
103436 * @param {Buffer} [keys.publicKey] Raw public key
103437 * @param {Buffer} [keys.secretKey] Raw secret key (32-byte secret seed in ed25519`)
103438 */
103439
103440var Keypair = exports.Keypair = (function () {
103441 function Keypair(keys) {
103442 _classCallCheck(this, Keypair);
103443
103444 if (keys.type != "ed25519") {
103445 throw new Error("Invalid keys type");
103446 }
103447
103448 this.type = keys.type;
103449
103450 if (keys.secretKey) {
103451 keys.secretKey = Buffer.from(keys.secretKey);
103452
103453 if (keys.secretKey.length != 32) {
103454 throw new Error("secretKey length is invalid");
103455 }
103456
103457 var secretKeyUint8 = new Uint8Array(keys.secretKey);
103458 var naclKeys = nacl.sign.keyPair.fromSeed(secretKeyUint8);
103459
103460 this._secretSeed = keys.secretKey;
103461 this._secretKey = Buffer.from(naclKeys.secretKey);
103462 this._publicKey = Buffer.from(naclKeys.publicKey);
103463
103464 if (keys.publicKey && !this._publicKey.equals(Buffer.from(keys.publicKey))) {
103465 throw new Error("secretKey does not match publicKey");
103466 }
103467 } else {
103468 this._publicKey = Buffer.from(keys.publicKey);
103469
103470 if (this._publicKey.length != 32) {
103471 throw new Error("publicKey length is invalid");
103472 }
103473 }
103474 }
103475
103476 _createClass(Keypair, {
103477 xdrAccountId: {
103478 value: function xdrAccountId() {
103479 return new xdr.AccountId.publicKeyTypeEd25519(this._publicKey);
103480 }
103481 },
103482 xdrPublicKey: {
103483 value: function xdrPublicKey() {
103484 return new xdr.PublicKey.publicKeyTypeEd25519(this._publicKey);
103485 }
103486 },
103487 rawPublicKey: {
103488
103489 /**
103490 * Returns raw public key
103491 * @returns {Buffer}
103492 */
103493
103494 value: function rawPublicKey() {
103495 return this._publicKey;
103496 }
103497 },
103498 signatureHint: {
103499 value: function signatureHint() {
103500 var a = this.xdrAccountId().toXDR();
103501
103502 return a.slice(a.length - 4);
103503 }
103504 },
103505 publicKey: {
103506
103507 /**
103508 * Returns public key associated with this `Keypair` object.
103509 * @returns {string}
103510 */
103511
103512 value: function publicKey() {
103513 return StrKey.encodeEd25519PublicKey(this._publicKey);
103514 }
103515 },
103516 secret: {
103517
103518 /**
103519 * Returns secret key associated with this `Keypair` object
103520 * @returns {string}
103521 */
103522
103523 value: function secret() {
103524 if (!this._secretSeed) {
103525 throw new Error("no secret key available");
103526 }
103527
103528 if (this.type == "ed25519") {
103529 return StrKey.encodeEd25519SecretSeed(this._secretSeed);
103530 }
103531
103532 throw new Error("Invalid Keypair type");
103533 }
103534 },
103535 rawSecretKey: {
103536
103537 /**
103538 * Returns raw secret key.
103539 * @returns {Buffer}
103540 */
103541
103542 value: function rawSecretKey() {
103543 return this._secretSeed;
103544 }
103545 },
103546 canSign: {
103547
103548 /**
103549 * Returns `true` if this `Keypair` object contains secret key and can sign.
103550 * @returns {boolean}
103551 */
103552
103553 value: function canSign() {
103554 return !!this._secretKey;
103555 }
103556 },
103557 sign: {
103558
103559 /**
103560 * Signs data.
103561 * @param {Buffer} data Data to sign
103562 * @returns {Buffer}
103563 */
103564
103565 value: (function (_sign) {
103566 var _signWrapper = function sign(_x) {
103567 return _sign.apply(this, arguments);
103568 };
103569
103570 _signWrapper.toString = function () {
103571 return _sign.toString();
103572 };
103573
103574 return _signWrapper;
103575 })(function (data) {
103576 if (!this.canSign()) {
103577 throw new Error("cannot sign: no secret key available");
103578 }
103579
103580 return sign(data, this._secretKey);
103581 })
103582 },
103583 verify: {
103584
103585 /**
103586 * Verifies if `signature` for `data` is valid.
103587 * @param {Buffer} data Signed data
103588 * @param {Buffer} signature Signature
103589 * @returns {boolean}
103590 */
103591
103592 value: (function (_verify) {
103593 var _verifyWrapper = function verify(_x2, _x3) {
103594 return _verify.apply(this, arguments);
103595 };
103596
103597 _verifyWrapper.toString = function () {
103598 return _verify.toString();
103599 };
103600
103601 return _verifyWrapper;
103602 })(function (data, signature) {
103603 return verify(data, signature, this._publicKey);
103604 })
103605 },
103606 signDecorated: {
103607 value: function signDecorated(data) {
103608 var signature = this.sign(data);
103609 var hint = this.signatureHint();
103610
103611 return new xdr.DecoratedSignature({ hint: hint, signature: signature });
103612 }
103613 }
103614 }, {
103615 fromSecret: {
103616
103617 /**
103618 * Creates a new `Keypair` instance from secret. This can either be secret key or secret seed depending
103619 * on underlying public-key signature system. Currently `Keypair` only supports ed25519.
103620 * @param {string} secret secret key (ex. `SDAKFNYEIAORZKKCYRILFQKLLOCNPL5SWJ3YY5NM3ZH6GJSZGXHZEPQS`)
103621 * @returns {Keypair}
103622 */
103623
103624 value: function fromSecret(secret) {
103625 var rawSecret = StrKey.decodeEd25519SecretSeed(secret);
103626 return this.fromRawEd25519Seed(rawSecret);
103627 }
103628 },
103629 fromBase58Seed: {
103630
103631 /**
103632 * Base58 address encoding is **DEPRECATED**! Use this method only for transition to strkey encoding.
103633 * @param {string} seed Base58 secret seed
103634 * @deprecated Use {@link Keypair.fromSecret}
103635 * @returns {Keypair}
103636 */
103637
103638 value: function fromBase58Seed(seed) {
103639 var rawSeed = base58.decodeBase58Check("seed", seed);
103640 return this.fromRawEd25519Seed(rawSeed);
103641 }
103642 },
103643 fromRawEd25519Seed: {
103644
103645 /**
103646 * Creates a new `Keypair` object from ed25519 secret key seed raw bytes.
103647 *
103648 * @param {Buffer} rawSeed Raw 32-byte ed25519 secret key seed
103649 * @returns {Keypair}
103650 */
103651
103652 value: function fromRawEd25519Seed(rawSeed) {
103653 return new this({ type: "ed25519", secretKey: rawSeed });
103654 }
103655 },
103656 master: {
103657
103658 /**
103659 * Returns `Keypair` object representing network master key.
103660 * @returns {Keypair}
103661 */
103662
103663 value: function master() {
103664 if (Network.current() === null) {
103665 throw new Error("No network selected. Use `Network.use`, `Network.usePublicNetwork` or `Network.useTestNetwork` helper methods to select network.");
103666 }
103667 return this.fromRawEd25519Seed(Network.current().networkId());
103668 }
103669 },
103670 fromPublicKey: {
103671
103672 /**
103673 * Creates a new `Keypair` object from public key.
103674 * @param {string} publicKey public key (ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`)
103675 * @returns {Keypair}
103676 */
103677
103678 value: function fromPublicKey(publicKey) {
103679 publicKey = StrKey.decodeEd25519PublicKey(publicKey);
103680 if (publicKey.length !== 32) {
103681 throw new Error("Invalid Stellar public key");
103682 }
103683 return new this({ type: "ed25519", publicKey: publicKey });
103684 }
103685 },
103686 random: {
103687
103688 /**
103689 * Create a random `Keypair` object.
103690 * @returns {Keypair}
103691 */
103692
103693 value: function random() {
103694 var secret = nacl.randomBytes(32);
103695 return this.fromRawEd25519Seed(secret);
103696 }
103697 }
103698 });
103699
103700 return Keypair;
103701})();
103702}).call(this,require("buffer").Buffer)
103703},{"./base58":779,"./generated/stellar-xdr_generated":780,"./network":785,"./signing":800,"./strkey":801,"buffer":146,"tweetnacl":813}],784:[function(require,module,exports){
103704(function (Buffer){
103705"use strict";
103706
103707var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
103708
103709var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
103710
103711var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
103712
103713Object.defineProperty(exports, "__esModule", {
103714 value: true
103715});
103716
103717var xdr = _interopRequire(require("./generated/stellar-xdr_generated"));
103718
103719var isUndefined = _interopRequire(require("lodash/isUndefined"));
103720
103721var isNull = _interopRequire(require("lodash/isNull"));
103722
103723var isString = _interopRequire(require("lodash/isString"));
103724
103725var clone = _interopRequire(require("lodash/clone"));
103726
103727var UnsignedHyper = require("js-xdr").UnsignedHyper;
103728
103729var BigNumber = _interopRequire(require("bignumber.js"));
103730
103731/**
103732 * Type of {@link Memo}.
103733 */
103734var MemoNone = "none";
103735exports.MemoNone = MemoNone;
103736/**
103737 * Type of {@link Memo}.
103738 */
103739var MemoID = "id";
103740exports.MemoID = MemoID;
103741/**
103742 * Type of {@link Memo}.
103743 */
103744var MemoText = "text";
103745exports.MemoText = MemoText;
103746/**
103747 * Type of {@link Memo}.
103748 */
103749var MemoHash = "hash";
103750exports.MemoHash = MemoHash;
103751/**
103752 * Type of {@link Memo}.
103753 */
103754var MemoReturn = "return";
103755
103756exports.MemoReturn = MemoReturn;
103757/**
103758 * `Memo` represents memos attached to transactions.
103759 *
103760 * @param {string} type - `MemoNone`, `MemoID`, `MemoText`, `MemoHash` or `MemoReturn`
103761 * @param {*} value - `string` for `MemoID`, `MemoText`, buffer of hex string for `MemoHash` or `MemoReturn`
103762 * @see [Transactions concept](https://www.stellar.org/developers/learn/concepts/transactions.html)
103763 * @class Memo
103764 */
103765
103766var Memo = exports.Memo = (function () {
103767 function Memo(type) {
103768 var value = arguments[1] === undefined ? null : arguments[1];
103769
103770 _classCallCheck(this, Memo);
103771
103772 this._type = type;
103773 this._value = value;
103774
103775 switch (this._type) {
103776 case MemoNone:
103777 break;
103778 case MemoID:
103779 Memo._validateIdValue(value);
103780 break;
103781 case MemoText:
103782 Memo._validateTextValue(value);
103783 break;
103784 case MemoHash:
103785 case MemoReturn:
103786 Memo._validateHashValue(value);
103787 // We want MemoHash and MemoReturn to have Buffer as a value
103788 if (isString(value)) {
103789 this._value = Buffer.from(value, "hex");
103790 }
103791 break;
103792 default:
103793 throw new Error("Invalid memo type");
103794 }
103795 }
103796
103797 _createClass(Memo, {
103798 type: {
103799
103800 /**
103801 * Contains memo type: `MemoNone`, `MemoID`, `MemoText`, `MemoHash` or `MemoReturn`
103802 */
103803
103804 get: function () {
103805 return clone(this._type);
103806 },
103807 set: function (type) {
103808 throw new Error("Memo is immutable");
103809 }
103810 },
103811 value: {
103812
103813 /**
103814 * Contains memo value:
103815 * * `null` for `MemoNone`,
103816 * * `string` for `MemoID`,
103817 * * `Buffer` for `MemoText` after decoding using `fromXDRObject`, original value otherwise,
103818 * * `Buffer` for `MemoHash`, `MemoReturn`.
103819 */
103820
103821 get: function () {
103822 switch (this._type) {
103823 case MemoNone:
103824 return null;
103825 case MemoID:
103826 case MemoText:
103827 return clone(this._value);
103828 case MemoHash:
103829 case MemoReturn:
103830 return Buffer.from(this._value);
103831 default:
103832 throw new Error("Invalid memo type");
103833 }
103834 },
103835 set: function (value) {
103836 throw new Error("Memo is immutable");
103837 }
103838 },
103839 toXDRObject: {
103840
103841 /**
103842 * Returns XDR memo object.
103843 * @returns {xdr.Memo}
103844 */
103845
103846 value: function toXDRObject() {
103847 switch (this._type) {
103848 case MemoNone:
103849 return xdr.Memo.memoNone();
103850 case MemoID:
103851 return xdr.Memo.memoId(UnsignedHyper.fromString(this._value));
103852 case MemoText:
103853 return xdr.Memo.memoText(this._value);
103854 case MemoHash:
103855 return xdr.Memo.memoHash(this._value);
103856 case MemoReturn:
103857 return xdr.Memo.memoReturn(this._value);
103858 }
103859 }
103860 }
103861 }, {
103862 _validateIdValue: {
103863 value: function _validateIdValue(value) {
103864 var error = new Error("Expects a int64 as a string. Got " + value);
103865
103866 if (!isString(value)) {
103867 throw error;
103868 }
103869
103870 var number = undefined;
103871 try {
103872 number = new BigNumber(value);
103873 } catch (e) {
103874 throw error;
103875 }
103876
103877 // Infinity
103878 if (!number.isFinite()) {
103879 throw error;
103880 }
103881
103882 // NaN
103883 if (number.isNaN()) {
103884 throw error;
103885 }
103886 }
103887 },
103888 _validateTextValue: {
103889 value: function _validateTextValue(value) {
103890 if (!xdr.Memo.armTypeForArm("text").isValid(value)) {
103891 throw new Error("Expects string, array or buffer, max 28 bytes");
103892 }
103893 }
103894 },
103895 _validateHashValue: {
103896 value: function _validateHashValue(value) {
103897 var error = new Error("Expects a 32 byte hash value or hex encoded string. Got " + value);
103898
103899 if (value === null || isUndefined(value)) {
103900 throw error;
103901 }
103902
103903 var valueBuffer = undefined;
103904 if (isString(value)) {
103905 if (!/^[0-9A-Fa-f]{64}$/g.test(value)) {
103906 throw error;
103907 }
103908 valueBuffer = Buffer.from(value, "hex");
103909 } else if (Buffer.isBuffer(value)) {
103910 valueBuffer = Buffer.from(value);
103911 } else {
103912 throw error;
103913 }
103914
103915 if (!valueBuffer.length || valueBuffer.length != 32) {
103916 throw error;
103917 }
103918 }
103919 },
103920 none: {
103921
103922 /**
103923 * Returns an empty memo (`MemoNone`).
103924 * @returns {Memo}
103925 */
103926
103927 value: function none() {
103928 return new Memo(MemoNone);
103929 }
103930 },
103931 text: {
103932
103933 /**
103934 * Creates and returns a `MemoText` memo.
103935 * @param {string} text - memo text
103936 * @returns {Memo}
103937 */
103938
103939 value: (function (_text) {
103940 var _textWrapper = function text(_x) {
103941 return _text.apply(this, arguments);
103942 };
103943
103944 _textWrapper.toString = function () {
103945 return _text.toString();
103946 };
103947
103948 return _textWrapper;
103949 })(function (text) {
103950 return new Memo(MemoText, text);
103951 })
103952 },
103953 id: {
103954
103955 /**
103956 * Creates and returns a `MemoID` memo.
103957 * @param {string} id - 64-bit number represented as a string
103958 * @returns {Memo}
103959 */
103960
103961 value: (function (_id) {
103962 var _idWrapper = function id(_x2) {
103963 return _id.apply(this, arguments);
103964 };
103965
103966 _idWrapper.toString = function () {
103967 return _id.toString();
103968 };
103969
103970 return _idWrapper;
103971 })(function (id) {
103972 return new Memo(MemoID, id);
103973 })
103974 },
103975 hash: {
103976
103977 /**
103978 * Creates and returns a `MemoHash` memo.
103979 * @param {array|string} hash - 32 byte hash or hex encoded string
103980 * @returns {Memo}
103981 */
103982
103983 value: (function (_hash) {
103984 var _hashWrapper = function hash(_x3) {
103985 return _hash.apply(this, arguments);
103986 };
103987
103988 _hashWrapper.toString = function () {
103989 return _hash.toString();
103990 };
103991
103992 return _hashWrapper;
103993 })(function (hash) {
103994 return new Memo(MemoHash, hash);
103995 })
103996 },
103997 "return": {
103998
103999 /**
104000 * Creates and returns a `MemoReturn` memo.
104001 * @param {array|string} hash - 32 byte hash or hex encoded string
104002 * @returns {Memo}
104003 */
104004
104005 value: function _return(hash) {
104006 return new Memo(MemoReturn, hash);
104007 }
104008 },
104009 fromXDRObject: {
104010
104011 /**
104012 * Returns {@link Memo} from XDR memo object.
104013 * @param {xdr.Memo}
104014 * @returns {Memo}
104015 */
104016
104017 value: function fromXDRObject(object) {
104018 switch (object.arm()) {
104019 case "id":
104020 return Memo.id(object.value().toString());
104021 case "text":
104022 return Memo.text(object.value());
104023 case "hash":
104024 return Memo.hash(object.value());
104025 case "retHash":
104026 return Memo["return"](object.value());
104027 }
104028
104029 if (typeof object.value() === "undefined") {
104030 return Memo.none();
104031 }
104032
104033 throw new Error("Unknown type");
104034 }
104035 }
104036 });
104037
104038 return Memo;
104039})();
104040}).call(this,require("buffer").Buffer)
104041},{"./generated/stellar-xdr_generated":780,"bignumber.js":807,"buffer":146,"js-xdr":410,"lodash/clone":593,"lodash/isNull":613,"lodash/isString":618,"lodash/isUndefined":621}],785:[function(require,module,exports){
104042"use strict";
104043
104044var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
104045
104046var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
104047
104048Object.defineProperty(exports, "__esModule", {
104049 value: true
104050});
104051
104052var hash = require("./hashing").hash;
104053
104054/**
104055 * Contains passphrases for common networks:
104056 * * `Networks.PUBLIC`: `Public Global Stellar Network ; September 2015`
104057 * * `Networks.TESTNET`: `Test SDF Network ; September 2015`
104058 * @type {{PUBLIC: string, TESTNET: string}}
104059 */
104060var Networks = {
104061 PUBLIC: "Public Global Stellar Network ; September 2015",
104062 TESTNET: "Test SDF Network ; September 2015"
104063};
104064
104065exports.Networks = Networks;
104066var current = null;
104067
104068/**
104069 * The Network class provides helper methods to get the passphrase or id for different
104070 * stellar networks. It also provides the {@link Network.current} class method that returns the network
104071 * that will be used by this process for the purposes of generating signatures.
104072 *
104073 * You should select network your app will use before adding the first signature. You can use the `use`,
104074 * `usePublicNetwork` and `useTestNetwork` helper methods.
104075 *
104076 * Creates a new `Network` object.
104077 * @constructor
104078 * @param {string} networkPassphrase Network passphrase
104079 */
104080
104081var Network = exports.Network = (function () {
104082 function Network(networkPassphrase) {
104083 _classCallCheck(this, Network);
104084
104085 this._networkPassphrase = networkPassphrase;
104086 }
104087
104088 _createClass(Network, {
104089 networkPassphrase: {
104090
104091 /**
104092 * Returns network passphrase.
104093 * @returns {string}
104094 */
104095
104096 value: function networkPassphrase() {
104097 return this._networkPassphrase;
104098 }
104099 },
104100 networkId: {
104101
104102 /**
104103 * Returns Network ID. Network ID is SHA-256 hash of network passphrase.
104104 * @returns {string}
104105 */
104106
104107 value: function networkId() {
104108 return hash(this.networkPassphrase());
104109 }
104110 }
104111 }, {
104112 usePublicNetwork: {
104113
104114 /**
104115 * Use Stellar Public Network
104116 */
104117
104118 value: function usePublicNetwork() {
104119 this.use(new Network(Networks.PUBLIC));
104120 }
104121 },
104122 useTestNetwork: {
104123
104124 /**
104125 * Use test network.
104126 */
104127
104128 value: function useTestNetwork() {
104129 this.use(new Network(Networks.TESTNET));
104130 }
104131 },
104132 use: {
104133
104134 /**
104135 * Use network defined by Network object.
104136 * @param {Network} network Network to use
104137 */
104138
104139 value: function use(network) {
104140 current = network;
104141 }
104142 },
104143 current: {
104144
104145 /**
104146 * Returns currently selected network.
104147 * @returns {Network}
104148 */
104149
104150 value: (function (_current) {
104151 var _currentWrapper = function current() {
104152 return _current.apply(this, arguments);
104153 };
104154
104155 _currentWrapper.toString = function () {
104156 return _current.toString();
104157 };
104158
104159 return _currentWrapper;
104160 })(function () {
104161 return current;
104162 })
104163 }
104164 });
104165
104166 return Network;
104167})();
104168},{"./hashing":781}],786:[function(require,module,exports){
104169"use strict";
104170
104171var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
104172
104173var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104174
104175var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
104176
104177var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
104178
104179Object.defineProperty(exports, "__esModule", {
104180 value: true
104181});
104182
104183var xdr = _interopRequire(require("./generated/stellar-xdr_generated"));
104184
104185var Keypair = require("./keypair").Keypair;
104186
104187var hash = require("./hashing").hash;
104188
104189var StrKey = require("./strkey").StrKey;
104190
104191var Hyper = require("js-xdr").Hyper;
104192
104193var Asset = require("./asset").Asset;
104194
104195var BigNumber = _interopRequire(require("bignumber.js"));
104196
104197var best_r = require("./util/continued_fraction").best_r;
104198
104199var trimEnd = _interopRequire(require("lodash/trimEnd"));
104200
104201var isUndefined = _interopRequire(require("lodash/isUndefined"));
104202
104203var isString = _interopRequire(require("lodash/isString"));
104204
104205var isNumber = _interopRequire(require("lodash/isNumber"));
104206
104207var isFinite = _interopRequire(require("lodash/isFinite"));
104208
104209var ops = _interopRequireWildcard(require("./operations/index"));
104210
104211var ONE = 10000000;
104212var MAX_INT64 = "9223372036854775807";
104213
104214/**
104215 * When set using `{@link Operation.setOptions}` option, requires the issuing account to
104216 * give other accounts permission before they can hold the issuing account’s credit.
104217 * @constant
104218 * @see [Account flags](https://www.stellar.org/developers/guides/concepts/accounts.html#flags)
104219 */
104220var AuthRequiredFlag = 1 << 0;
104221exports.AuthRequiredFlag = AuthRequiredFlag;
104222/**
104223 * When set using `{@link Operation.setOptions}` option, allows the issuing account to
104224 * revoke its credit held by other accounts.
104225 * @constant
104226 * @see [Account flags](https://www.stellar.org/developers/guides/concepts/accounts.html#flags)
104227 */
104228var AuthRevocableFlag = 1 << 1;
104229exports.AuthRevocableFlag = AuthRevocableFlag;
104230/**
104231 * When set using `{@link Operation.setOptions}` option, then none of the authorization flags
104232 * can be set and the account can never be deleted.
104233 * @constant
104234 * @see [Account flags](https://www.stellar.org/developers/guides/concepts/accounts.html#flags)
104235 */
104236var AuthImmutableFlag = 1 << 2;
104237
104238exports.AuthImmutableFlag = AuthImmutableFlag;
104239/**
104240 * `Operation` class represents [operations](https://www.stellar.org/developers/learn/concepts/operations.html) in Stellar network.
104241 * Use one of static methods to create operations:
104242 * * `{@link Operation.createAccount}`
104243 * * `{@link Operation.payment}`
104244 * * `{@link Operation.pathPayment}`
104245 * * `{@link Operation.manageOffer}`
104246 * * `{@link Operation.createPassiveOffer}`
104247 * * `{@link Operation.setOptions}`
104248 * * `{@link Operation.changeTrust}`
104249 * * `{@link Operation.allowTrust}`
104250 * * `{@link Operation.accountMerge}`
104251 * * `{@link Operation.inflation}`
104252 * * `{@link Operation.manageData}`
104253 * * `{@link Operation.bumpSequence}`
104254 *
104255 * @class Operation
104256 */
104257
104258var Operation = exports.Operation = (function () {
104259 function Operation() {
104260 _classCallCheck(this, Operation);
104261 }
104262
104263 _createClass(Operation, null, {
104264 setSourceAccount: {
104265 value: function setSourceAccount(opAttributes, opts) {
104266 if (opts.source) {
104267 if (!StrKey.isValidEd25519PublicKey(opts.source)) {
104268 throw new Error("Source address is invalid");
104269 }
104270 opAttributes.sourceAccount = Keypair.fromPublicKey(opts.source).xdrAccountId();
104271 }
104272 }
104273 },
104274 fromXDRObject: {
104275
104276 /**
104277 * Converts the XDR Operation object to the opts object used to create the XDR
104278 * operation.
104279 * @param {xdr.Operation} operation - An XDR Operation.
104280 * @return {Operation}
104281 */
104282
104283 value: function fromXDRObject(operation) {
104284 function accountIdtoAddress(accountId) {
104285 return StrKey.encodeEd25519PublicKey(accountId.ed25519());
104286 }
104287
104288 var result = {};
104289 if (operation.sourceAccount()) {
104290 result.source = accountIdtoAddress(operation.sourceAccount());
104291 }
104292
104293 var attrs = operation.body().value();
104294 switch (operation.body()["switch"]().name) {
104295 case "createAccount":
104296 result.type = "createAccount";
104297 result.destination = accountIdtoAddress(attrs.destination());
104298 result.startingBalance = this._fromXDRAmount(attrs.startingBalance());
104299 break;
104300 case "payment":
104301 result.type = "payment";
104302 result.destination = accountIdtoAddress(attrs.destination());
104303 result.asset = Asset.fromOperation(attrs.asset());
104304 result.amount = this._fromXDRAmount(attrs.amount());
104305 break;
104306 case "pathPayment":
104307 result.type = "pathPayment";
104308 result.sendAsset = Asset.fromOperation(attrs.sendAsset());
104309 result.sendMax = this._fromXDRAmount(attrs.sendMax());
104310 result.destination = accountIdtoAddress(attrs.destination());
104311 result.destAsset = Asset.fromOperation(attrs.destAsset());
104312 result.destAmount = this._fromXDRAmount(attrs.destAmount());
104313 var path = attrs.path();
104314 result.path = [];
104315 for (var i in path) {
104316 result.path.push(Asset.fromOperation(path[i]));
104317 }
104318 break;
104319 case "changeTrust":
104320 result.type = "changeTrust";
104321 result.line = Asset.fromOperation(attrs.line());
104322 result.limit = this._fromXDRAmount(attrs.limit());
104323 break;
104324 case "allowTrust":
104325 result.type = "allowTrust";
104326 result.trustor = accountIdtoAddress(attrs.trustor());
104327 result.assetCode = attrs.asset().value().toString();
104328 result.assetCode = trimEnd(result.assetCode, "\u0000");
104329 result.authorize = attrs.authorize();
104330 break;
104331 case "setOption":
104332 result.type = "setOptions";
104333 if (attrs.inflationDest()) {
104334 result.inflationDest = accountIdtoAddress(attrs.inflationDest());
104335 }
104336
104337 result.clearFlags = attrs.clearFlags();
104338 result.setFlags = attrs.setFlags();
104339 result.masterWeight = attrs.masterWeight();
104340 result.lowThreshold = attrs.lowThreshold();
104341 result.medThreshold = attrs.medThreshold();
104342 result.highThreshold = attrs.highThreshold();
104343 // home_domain is checked by iscntrl in stellar-core
104344 result.homeDomain = attrs.homeDomain() !== undefined ? attrs.homeDomain().toString("ascii") : undefined;
104345
104346 if (attrs.signer()) {
104347 var signer = {};
104348 var arm = attrs.signer().key().arm();
104349 if (arm == "ed25519") {
104350 signer.ed25519PublicKey = accountIdtoAddress(attrs.signer().key());
104351 } else if (arm == "preAuthTx") {
104352 signer.preAuthTx = attrs.signer().key().preAuthTx();
104353 } else if (arm == "hashX") {
104354 signer.sha256Hash = attrs.signer().key().hashX();
104355 }
104356
104357 signer.weight = attrs.signer().weight();
104358 result.signer = signer;
104359 }
104360 break;
104361 case "manageOffer":
104362 result.type = "manageOffer";
104363 result.selling = Asset.fromOperation(attrs.selling());
104364 result.buying = Asset.fromOperation(attrs.buying());
104365 result.amount = this._fromXDRAmount(attrs.amount());
104366 result.price = this._fromXDRPrice(attrs.price());
104367 result.offerId = attrs.offerId().toString();
104368 break;
104369 case "createPassiveOffer":
104370 result.type = "createPassiveOffer";
104371 result.selling = Asset.fromOperation(attrs.selling());
104372 result.buying = Asset.fromOperation(attrs.buying());
104373 result.amount = this._fromXDRAmount(attrs.amount());
104374 result.price = this._fromXDRPrice(attrs.price());
104375 break;
104376 case "accountMerge":
104377 result.type = "accountMerge";
104378 result.destination = accountIdtoAddress(attrs);
104379 break;
104380 case "manageDatum":
104381 result.type = "manageData";
104382 // manage_data.name is checked by iscntrl in stellar-core
104383 result.name = attrs.dataName().toString("ascii");
104384 result.value = attrs.dataValue();
104385 break;
104386 case "inflation":
104387 result.type = "inflation";
104388 break;
104389 case "bumpSequence":
104390 result.type = "bumpSequence";
104391 result.bumpTo = attrs.bumpTo().toString();
104392 break;
104393 default:
104394 throw new Error("Unknown operation");
104395 }
104396 return result;
104397 }
104398 },
104399 isValidAmount: {
104400 value: function isValidAmount(value) {
104401 var allowZero = arguments[1] === undefined ? false : arguments[1];
104402
104403 if (!isString(value)) {
104404 return false;
104405 }
104406
104407 var amount = undefined;
104408 try {
104409 amount = new BigNumber(value);
104410 } catch (e) {
104411 return false;
104412 }
104413
104414 switch (true) {
104415 // == 0
104416 case !allowZero && amount.isZero():
104417 // < 0
104418 case amount.isNegative():
104419 // > Max value
104420 case amount.times(ONE).greaterThan(new BigNumber(MAX_INT64).toString()):
104421 // Decimal places (max 7)
104422 case amount.decimalPlaces() > 7:
104423 // NaN or Infinity
104424 case amount.isNaN() || !amount.isFinite():
104425 return false;
104426 default:
104427 return true;
104428 }
104429 }
104430 },
104431 constructAmountRequirementsError: {
104432 value: function constructAmountRequirementsError(arg) {
104433 return "" + arg + " argument must be of type String, represent a positive number and have at most 7 digits after the decimal";
104434 }
104435 },
104436 _checkUnsignedIntValue: {
104437
104438 /**
104439 * Returns value converted to uint32 value or undefined.
104440 * If `value` is not `Number`, `String` or `Undefined` then throws an error.
104441 * Used in {@link Operation.setOptions}.
104442 * @private
104443 * @param {string} name Name of the property (used in error message only)
104444 * @param {*} value Value to check
104445 * @param {function(value, name)} isValidFunction Function to check other constraints (the argument will be a `Number`)
104446 * @returns {undefined|Number}
104447 * @private
104448 */
104449
104450 value: function _checkUnsignedIntValue(name, value) {
104451 var isValidFunction = arguments[2] === undefined ? null : arguments[2];
104452
104453 if (isUndefined(value)) {
104454 return undefined;
104455 }
104456
104457 if (isString(value)) {
104458 value = parseFloat(value);
104459 }
104460
104461 switch (true) {
104462 case !isNumber(value) || !isFinite(value) || value % 1 !== 0:
104463 throw new Error("" + name + " value is invalid");
104464 case value < 0:
104465 throw new Error("" + name + " value must be unsigned");
104466 case !isValidFunction || isValidFunction && isValidFunction(value, name):
104467 return value;
104468 default:
104469 throw new Error("" + name + " value is invalid");
104470 }
104471 }
104472 },
104473 _toXDRAmount: {
104474
104475 /**
104476 * @private
104477 */
104478
104479 value: function _toXDRAmount(value) {
104480 var amount = new BigNumber(value).mul(ONE);
104481 return Hyper.fromString(amount.toString());
104482 }
104483 },
104484 _fromXDRAmount: {
104485
104486 /**
104487 * @private
104488 */
104489
104490 value: function _fromXDRAmount(value) {
104491 return new BigNumber(value).div(ONE).toString();
104492 }
104493 },
104494 _fromXDRPrice: {
104495
104496 /**
104497 * @private
104498 */
104499
104500 value: function _fromXDRPrice(price) {
104501 var n = new BigNumber(price.n());
104502 return n.div(new BigNumber(price.d())).toString();
104503 }
104504 },
104505 _toXDRPrice: {
104506
104507 /**
104508 * @private
104509 */
104510
104511 value: function _toXDRPrice(price) {
104512 var xdrObject = undefined;
104513 if (price.n && price.d) {
104514 xdrObject = new xdr.Price(price);
104515 } else {
104516 price = new BigNumber(price);
104517 var approx = best_r(price);
104518 xdrObject = new xdr.Price({
104519 n: parseInt(approx[0]),
104520 d: parseInt(approx[1])
104521 });
104522 }
104523
104524 if (xdrObject.n() < 0 || xdrObject.d() < 0) {
104525 throw new Error("price must be positive");
104526 }
104527
104528 return xdrObject;
104529 }
104530 }
104531 });
104532
104533 return Operation;
104534})();
104535
104536// Attach all imported operations as static methods on the Operation class
104537Operation.accountMerge = ops.accountMerge;
104538Operation.allowTrust = ops.allowTrust;
104539Operation.bumpSequence = ops.bumpSequence;
104540Operation.changeTrust = ops.changeTrust;
104541Operation.createAccount = ops.createAccount;
104542Operation.createPassiveOffer = ops.createPassiveOffer;
104543Operation.inflation = ops.inflation;
104544Operation.manageData = ops.manageData;
104545Operation.manageOffer = ops.manageOffer;
104546Operation.pathPayment = ops.pathPayment;
104547Operation.payment = ops.payment;
104548Operation.setOptions = ops.setOptions;
104549},{"./asset":778,"./generated/stellar-xdr_generated":780,"./hashing":781,"./keypair":783,"./operations/index":793,"./strkey":801,"./util/continued_fraction":805,"bignumber.js":807,"js-xdr":410,"lodash/isFinite":609,"lodash/isNumber":614,"lodash/isString":618,"lodash/isUndefined":621,"lodash/trimEnd":635}],787:[function(require,module,exports){
104550"use strict";
104551
104552var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104553
104554Object.defineProperty(exports, "__esModule", {
104555 value: true
104556});
104557
104558var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104559
104560var Keypair = require("../keypair").Keypair;
104561
104562var StrKey = require("../strkey").StrKey;
104563
104564/**
104565 * Transfers native balance to destination account.
104566 * @function
104567 * @alias Operation.accountMerge
104568 * @param {object} opts
104569 * @param {string} opts.destination - Destination to merge the source account into.
104570 * @param {string} [opts.source] - The source account (defaults to transaction source).
104571 * @returns {xdr.AccountMergeOp}
104572 */
104573var accountMerge = function accountMerge(opts) {
104574 var opAttributes = {};
104575 if (!StrKey.isValidEd25519PublicKey(opts.destination)) {
104576 throw new Error("destination is invalid");
104577 }
104578 opAttributes.body = xdr.OperationBody.accountMerge(Keypair.fromPublicKey(opts.destination).xdrAccountId());
104579 this.setSourceAccount(opAttributes, opts);
104580
104581 return new xdr.Operation(opAttributes);
104582};
104583exports.accountMerge = accountMerge;
104584},{"../generated/stellar-xdr_generated":780,"../keypair":783,"../strkey":801}],788:[function(require,module,exports){
104585"use strict";
104586
104587var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104588
104589Object.defineProperty(exports, "__esModule", {
104590 value: true
104591});
104592
104593var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104594
104595var Keypair = require("../keypair").Keypair;
104596
104597var StrKey = require("../strkey").StrKey;
104598
104599var padEnd = _interopRequire(require("lodash/padEnd"));
104600
104601/**
104602 * Returns an XDR AllowTrustOp. An "allow trust" operation authorizes another
104603 * account to hold your account's credit for a given asset.
104604 * @function
104605 * @alias Operation.allowTrust
104606 * @param {object} opts
104607 * @param {string} opts.trustor - The trusting account (the one being authorized)
104608 * @param {string} opts.assetCode - The asset code being authorized.
104609 * @param {boolean} opts.authorize - True to authorize the line, false to deauthorize.
104610 * @param {string} [opts.source] - The source account (defaults to transaction source).
104611 * @returns {xdr.AllowTrustOp}
104612 */
104613var allowTrust = function allowTrust(opts) {
104614 if (!StrKey.isValidEd25519PublicKey(opts.trustor)) {
104615 throw new Error("trustor is invalid");
104616 }
104617 var attributes = {};
104618 attributes.trustor = Keypair.fromPublicKey(opts.trustor).xdrAccountId();
104619 if (opts.assetCode.length <= 4) {
104620 var code = padEnd(opts.assetCode, 4, "\u0000");
104621 attributes.asset = xdr.AllowTrustOpAsset.assetTypeCreditAlphanum4(code);
104622 } else if (opts.assetCode.length <= 12) {
104623 var code = padEnd(opts.assetCode, 12, "\u0000");
104624 attributes.asset = xdr.AllowTrustOpAsset.assetTypeCreditAlphanum12(code);
104625 } else {
104626 throw new Error("Asset code must be 12 characters at max.");
104627 }
104628 attributes.authorize = opts.authorize;
104629 var allowTrustOp = new xdr.AllowTrustOp(attributes);
104630
104631 var opAttributes = {};
104632 opAttributes.body = xdr.OperationBody.allowTrust(allowTrustOp);
104633 this.setSourceAccount(opAttributes, opts);
104634
104635 return new xdr.Operation(opAttributes);
104636};
104637exports.allowTrust = allowTrust;
104638},{"../generated/stellar-xdr_generated":780,"../keypair":783,"../strkey":801,"lodash/padEnd":626}],789:[function(require,module,exports){
104639"use strict";
104640
104641var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104642
104643Object.defineProperty(exports, "__esModule", {
104644 value: true
104645});
104646
104647var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104648
104649var Hyper = require("js-xdr").Hyper;
104650
104651var BigNumber = _interopRequire(require("bignumber.js"));
104652
104653var isString = _interopRequire(require("lodash/isString"));
104654
104655/**
104656 * This operation bumps sequence number.
104657 * @function
104658 * @alias Operation.bumpSequence
104659 * @param {object} opts
104660 * @param {string} opts.bumpTo - Sequence number to bump to.
104661 * @param {string} [opts.source] - The optional source account.
104662 * @returns {xdr.BumpSequenceOp}
104663 */
104664var bumpSequence = function bumpSequence(opts) {
104665 var attributes = {};
104666
104667 if (!isString(opts.bumpTo)) {
104668 throw new Error("bumpTo must be a string");
104669 }
104670
104671 try {
104672 new BigNumber(opts.bumpTo);
104673 } catch (e) {
104674 throw new Error("bumpTo must be a stringified number");
104675 }
104676
104677 attributes.bumpTo = Hyper.fromString(opts.bumpTo);
104678
104679 var bumpSequenceOp = new xdr.BumpSequenceOp(attributes);
104680
104681 var opAttributes = {};
104682 opAttributes.body = xdr.OperationBody.bumpSequence(bumpSequenceOp);
104683 this.setSourceAccount(opAttributes, opts);
104684
104685 return new xdr.Operation(opAttributes);
104686};
104687exports.bumpSequence = bumpSequence;
104688},{"../generated/stellar-xdr_generated":780,"bignumber.js":807,"js-xdr":410,"lodash/isString":618}],790:[function(require,module,exports){
104689"use strict";
104690
104691var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104692
104693Object.defineProperty(exports, "__esModule", {
104694 value: true
104695});
104696
104697var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104698
104699var Keypair = require("../keypair").Keypair;
104700
104701var isUndefined = _interopRequire(require("lodash/isUndefined"));
104702
104703var Hyper = require("js-xdr").Hyper;
104704
104705var BigNumber = _interopRequire(require("bignumber.js"));
104706
104707var MAX_INT64 = "9223372036854775807";
104708
104709/**
104710 * Returns an XDR ChangeTrustOp. A "change trust" operation adds, removes, or updates a
104711 * trust line for a given asset from the source account to another. The issuer being
104712 * trusted and the asset code are in the given Asset object.
104713 * @function
104714 * @alias Operation.changeTrust
104715 * @param {object} opts
104716 * @param {Asset} opts.asset - The asset for the trust line.
104717 * @param {string} [opts.limit] - The limit for the asset, defaults to max int64.
104718 * If the limit is set to "0" it deletes the trustline.
104719 * @param {string} [opts.source] - The source account (defaults to transaction source).
104720 * @returns {xdr.ChangeTrustOp}
104721 */
104722var changeTrust = function changeTrust(opts) {
104723 var attributes = {};
104724 attributes.line = opts.asset.toXDRObject();
104725 if (!isUndefined(opts.limit) && !this.isValidAmount(opts.limit, true)) {
104726 throw new TypeError(this.constructAmountRequirementsError("limit"));
104727 }
104728
104729 if (opts.limit) {
104730 attributes.limit = this._toXDRAmount(opts.limit);
104731 } else {
104732 attributes.limit = Hyper.fromString(new BigNumber(MAX_INT64).toString());
104733 }
104734
104735 if (opts.source) {
104736 attributes.source = opts.source.masterKeypair;
104737 }
104738 var changeTrustOP = new xdr.ChangeTrustOp(attributes);
104739
104740 var opAttributes = {};
104741 opAttributes.body = xdr.OperationBody.changeTrust(changeTrustOP);
104742 this.setSourceAccount(opAttributes, opts);
104743
104744 return new xdr.Operation(opAttributes);
104745};
104746exports.changeTrust = changeTrust;
104747},{"../generated/stellar-xdr_generated":780,"../keypair":783,"bignumber.js":807,"js-xdr":410,"lodash/isUndefined":621}],791:[function(require,module,exports){
104748"use strict";
104749
104750var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104751
104752Object.defineProperty(exports, "__esModule", {
104753 value: true
104754});
104755
104756var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104757
104758var Keypair = require("../keypair").Keypair;
104759
104760var StrKey = require("../strkey").StrKey;
104761
104762/**
104763 * Create and fund a non existent account.
104764 * @function
104765 * @alias Operation.createAccount
104766 * @param {object} opts
104767 * @param {string} opts.destination - Destination account ID to create an account for.
104768 * @param {string} opts.startingBalance - Amount in XLM the account should be funded for. Must be greater
104769 * than the [reserve balance amount](https://www.stellar.org/developers/learn/concepts/fees.html).
104770 * @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account.
104771 * @returns {xdr.CreateAccountOp}
104772 */
104773var createAccount = (function (_createAccount) {
104774 var _createAccountWrapper = function createAccount(_x) {
104775 return _createAccount.apply(this, arguments);
104776 };
104777
104778 _createAccountWrapper.toString = function () {
104779 return _createAccount.toString();
104780 };
104781
104782 return _createAccountWrapper;
104783})(function (opts) {
104784 if (!StrKey.isValidEd25519PublicKey(opts.destination)) {
104785 throw new Error("destination is invalid");
104786 }
104787 if (!this.isValidAmount(opts.startingBalance)) {
104788 throw new TypeError(this.constructAmountRequirementsError("startingBalance"));
104789 }
104790 var attributes = {};
104791 attributes.destination = Keypair.fromPublicKey(opts.destination).xdrAccountId();
104792 attributes.startingBalance = this._toXDRAmount(opts.startingBalance);
104793 var createAccount = new xdr.CreateAccountOp(attributes);
104794
104795 var opAttributes = {};
104796 opAttributes.body = xdr.OperationBody.createAccount(createAccount);
104797 this.setSourceAccount(opAttributes, opts);
104798
104799 return new xdr.Operation(opAttributes);
104800});
104801exports.createAccount = createAccount;
104802},{"../generated/stellar-xdr_generated":780,"../keypair":783,"../strkey":801}],792:[function(require,module,exports){
104803"use strict";
104804
104805var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104806
104807Object.defineProperty(exports, "__esModule", {
104808 value: true
104809});
104810
104811var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104812
104813var isUndefined = _interopRequire(require("lodash/isUndefined"));
104814
104815/**
104816 * Returns a XDR CreatePasiveOfferOp. A "create passive offer" operation creates an
104817 * offer that won't consume a counter offer that exactly matches this offer. This is
104818 * useful for offers just used as 1:1 exchanges for path payments. Use manage offer
104819 * to manage this offer after using this operation to create it.
104820 * @function
104821 * @alias Operation.createPassiveOffer
104822 * @param {object} opts
104823 * @param {Asset} opts.selling - What you're selling.
104824 * @param {Asset} opts.buying - What you're buying.
104825 * @param {string} opts.amount - The total amount you're selling. If 0, deletes the offer.
104826 * @param {number|string|BigNumber|Object} opts.price - Price of 1 unit of `selling` in terms of `buying`.
104827 * @param {number} opts.price.n - If `opts.price` is an object: the price numerator
104828 * @param {number} opts.price.d - If `opts.price` is an object: the price denominator
104829 * @param {string} [opts.source] - The source account (defaults to transaction source).
104830 * @throws {Error} Throws `Error` when the best rational approximation of `price` cannot be found.
104831 * @returns {xdr.CreatePassiveOfferOp}
104832 */
104833var createPassiveOffer = function createPassiveOffer(opts) {
104834 var attributes = {};
104835 attributes.selling = opts.selling.toXDRObject();
104836 attributes.buying = opts.buying.toXDRObject();
104837 if (!this.isValidAmount(opts.amount)) {
104838 throw new TypeError(this.constructAmountRequirementsError("amount"));
104839 }
104840 attributes.amount = this._toXDRAmount(opts.amount);
104841 if (isUndefined(opts.price)) {
104842 throw new TypeError("price argument is required");
104843 }
104844 attributes.price = this._toXDRPrice(opts.price);
104845 var createPassiveOfferOp = new xdr.CreatePassiveOfferOp(attributes);
104846
104847 var opAttributes = {};
104848 opAttributes.body = xdr.OperationBody.createPassiveOffer(createPassiveOfferOp);
104849 this.setSourceAccount(opAttributes, opts);
104850
104851 return new xdr.Operation(opAttributes);
104852};
104853exports.createPassiveOffer = createPassiveOffer;
104854},{"../generated/stellar-xdr_generated":780,"lodash/isUndefined":621}],793:[function(require,module,exports){
104855"use strict";
104856
104857Object.defineProperty(exports, "__esModule", {
104858 value: true
104859});
104860exports.accountMerge = require("./account_merge").accountMerge;
104861exports.allowTrust = require("./allow_trust").allowTrust;
104862exports.bumpSequence = require("./bump_sequence").bumpSequence;
104863exports.changeTrust = require("./change_trust").changeTrust;
104864exports.createAccount = require("./create_account").createAccount;
104865exports.createPassiveOffer = require("./create_passive_offer").createPassiveOffer;
104866exports.inflation = require("./inflation").inflation;
104867exports.manageData = require("./manage_data").manageData;
104868exports.manageOffer = require("./manage_offer").manageOffer;
104869exports.pathPayment = require("./path_payment").pathPayment;
104870exports.payment = require("./payment").payment;
104871exports.setOptions = require("./set_options").setOptions;
104872},{"./account_merge":787,"./allow_trust":788,"./bump_sequence":789,"./change_trust":790,"./create_account":791,"./create_passive_offer":792,"./inflation":794,"./manage_data":795,"./manage_offer":796,"./path_payment":797,"./payment":798,"./set_options":799}],794:[function(require,module,exports){
104873"use strict";
104874
104875var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104876
104877Object.defineProperty(exports, "__esModule", {
104878 value: true
104879});
104880
104881var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104882
104883/**
104884 * This operation generates the inflation.
104885 * @function
104886 * @alias Operation.inflation
104887 * @param {object} [opts]
104888 * @param {string} [opts.source] - The optional source account.
104889 * @returns {xdr.InflationOp}
104890 */
104891var inflation = function inflation() {
104892 var opts = arguments[0] === undefined ? {} : arguments[0];
104893
104894 var opAttributes = {};
104895 opAttributes.body = xdr.OperationBody.inflation();
104896 this.setSourceAccount(opAttributes, opts);
104897 return new xdr.Operation(opAttributes);
104898};
104899exports.inflation = inflation;
104900},{"../generated/stellar-xdr_generated":780}],795:[function(require,module,exports){
104901(function (Buffer){
104902"use strict";
104903
104904var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104905
104906Object.defineProperty(exports, "__esModule", {
104907 value: true
104908});
104909
104910var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104911
104912var isString = _interopRequire(require("lodash/isString"));
104913
104914/**
104915 * This operation adds data entry to the ledger.
104916 * @function
104917 * @alias Operation.manageData
104918 * @param {object} opts
104919 * @param {string} opts.name - The name of the data entry.
104920 * @param {string|Buffer} opts.value - The value of the data entry.
104921 * @param {string} [opts.source] - The optional source account.
104922 * @returns {xdr.ManageDataOp}
104923 */
104924var manageData = function manageData(opts) {
104925 var attributes = {};
104926
104927 if (!(isString(opts.name) && opts.name.length <= 64)) {
104928 throw new Error("name must be a string, up to 64 characters");
104929 }
104930 attributes.dataName = opts.name;
104931
104932 if (!isString(opts.value) && !Buffer.isBuffer(opts.value) && opts.value !== null) {
104933 throw new Error("value must be a string, Buffer or null");
104934 }
104935
104936 if (isString(opts.value)) {
104937 attributes.dataValue = Buffer.from(opts.value);
104938 } else {
104939 attributes.dataValue = opts.value;
104940 }
104941
104942 if (attributes.dataValue !== null && attributes.dataValue.length > 64) {
104943 throw new Error("value cannot be longer that 64 bytes");
104944 }
104945
104946 var manageDataOp = new xdr.ManageDataOp(attributes);
104947
104948 var opAttributes = {};
104949 opAttributes.body = xdr.OperationBody.manageDatum(manageDataOp);
104950 this.setSourceAccount(opAttributes, opts);
104951
104952 return new xdr.Operation(opAttributes);
104953};
104954exports.manageData = manageData;
104955}).call(this,require("buffer").Buffer)
104956},{"../generated/stellar-xdr_generated":780,"buffer":146,"lodash/isString":618}],796:[function(require,module,exports){
104957"use strict";
104958
104959var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
104960
104961Object.defineProperty(exports, "__esModule", {
104962 value: true
104963});
104964
104965var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
104966
104967var isUndefined = _interopRequire(require("lodash/isUndefined"));
104968
104969var UnsignedHyper = require("js-xdr").UnsignedHyper;
104970
104971/**
104972 * Returns a XDR ManageOfferOp. A "manage offer" operation creates, updates, or
104973 * deletes an offer.
104974 * @function
104975 * @alias Operation.manageOffer
104976 * @param {object} opts
104977 * @param {Asset} opts.selling - What you're selling.
104978 * @param {Asset} opts.buying - What you're buying.
104979 * @param {string} opts.amount - The total amount you're selling. If 0, deletes the offer.
104980 * @param {number|string|BigNumber|Object} opts.price - Price of 1 unit of `selling` in terms of `buying`.
104981 * @param {number} opts.price.n - If `opts.price` is an object: the price numerator
104982 * @param {number} opts.price.d - If `opts.price` is an object: the price denominator
104983 * @param {number|string} [opts.offerId ] - If `0`, will create a new offer (default). Otherwise, edits an exisiting offer.
104984 * @param {string} [opts.source] - The source account (defaults to transaction source).
104985 * @throws {Error} Throws `Error` when the best rational approximation of `price` cannot be found.
104986 * @returns {xdr.ManageOfferOp}
104987 */
104988var manageOffer = function manageOffer(opts) {
104989 var attributes = {};
104990 attributes.selling = opts.selling.toXDRObject();
104991 attributes.buying = opts.buying.toXDRObject();
104992 if (!this.isValidAmount(opts.amount, true)) {
104993 throw new TypeError(this.constructAmountRequirementsError("amount"));
104994 }
104995 attributes.amount = this._toXDRAmount(opts.amount);
104996 if (isUndefined(opts.price)) {
104997 throw new TypeError("price argument is required");
104998 }
104999 attributes.price = this._toXDRPrice(opts.price);
105000
105001 if (!isUndefined(opts.offerId)) {
105002 opts.offerId = opts.offerId.toString();
105003 } else {
105004 opts.offerId = "0";
105005 }
105006 attributes.offerId = UnsignedHyper.fromString(opts.offerId);
105007 var manageOfferOp = new xdr.ManageOfferOp(attributes);
105008
105009 var opAttributes = {};
105010 opAttributes.body = xdr.OperationBody.manageOffer(manageOfferOp);
105011 this.setSourceAccount(opAttributes, opts);
105012
105013 return new xdr.Operation(opAttributes);
105014};
105015exports.manageOffer = manageOffer;
105016},{"../generated/stellar-xdr_generated":780,"js-xdr":410,"lodash/isUndefined":621}],797:[function(require,module,exports){
105017"use strict";
105018
105019var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
105020
105021Object.defineProperty(exports, "__esModule", {
105022 value: true
105023});
105024
105025var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
105026
105027var Keypair = require("../keypair").Keypair;
105028
105029var StrKey = require("../strkey").StrKey;
105030
105031/**
105032 * Returns a XDR PaymentOp. A "payment" operation send the specified amount to the
105033 * destination account, optionally through a path. XLM payments create the destination
105034 * account if it does not exist.
105035 * @function
105036 * @alias Operation.pathPayment
105037 * @param {object} opts
105038 * @param {Asset} opts.sendAsset - The asset to pay with.
105039 * @param {string} opts.sendMax - The maximum amount of sendAsset to send.
105040 * @param {string} opts.destination - The destination account to send to.
105041 * @param {Asset} opts.destAsset - The asset the destination will receive.
105042 * @param {string} opts.destAmount - The amount the destination receives.
105043 * @param {Asset[]} opts.path - An array of Asset objects to use as the path.
105044 * @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account.
105045 * @returns {xdr.PathPaymentOp}
105046 */
105047var pathPayment = function pathPayment(opts) {
105048 switch (true) {
105049 case !opts.sendAsset:
105050 throw new Error("Must specify a send asset");
105051 case !this.isValidAmount(opts.sendMax):
105052 throw new TypeError(this.constructAmountRequirementsError("sendMax"));
105053 case !StrKey.isValidEd25519PublicKey(opts.destination):
105054 throw new Error("destination is invalid");
105055 case !opts.destAsset:
105056 throw new Error("Must provide a destAsset for a payment operation");
105057 case !this.isValidAmount(opts.destAmount):
105058 throw new TypeError(this.constructAmountRequirementsError("destAmount"));
105059 }
105060
105061 var attributes = {};
105062 attributes.sendAsset = opts.sendAsset.toXDRObject();
105063 attributes.sendMax = this._toXDRAmount(opts.sendMax);
105064 attributes.destination = Keypair.fromPublicKey(opts.destination).xdrAccountId();
105065 attributes.destAsset = opts.destAsset.toXDRObject();
105066 attributes.destAmount = this._toXDRAmount(opts.destAmount);
105067
105068 var path = opts.path ? opts.path : [];
105069 attributes.path = path.map(function (x) {
105070 return x.toXDRObject();
105071 });
105072
105073 var payment = new xdr.PathPaymentOp(attributes);
105074
105075 var opAttributes = {};
105076 opAttributes.body = xdr.OperationBody.pathPayment(payment);
105077 this.setSourceAccount(opAttributes, opts);
105078
105079 return new xdr.Operation(opAttributes);
105080};
105081exports.pathPayment = pathPayment;
105082},{"../generated/stellar-xdr_generated":780,"../keypair":783,"../strkey":801}],798:[function(require,module,exports){
105083"use strict";
105084
105085var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
105086
105087Object.defineProperty(exports, "__esModule", {
105088 value: true
105089});
105090
105091var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
105092
105093var Keypair = require("../keypair").Keypair;
105094
105095var StrKey = require("../strkey").StrKey;
105096
105097/**
105098 * Create a payment operation.
105099 * @function
105100 * @alias Operation.payment
105101 * @param {object} opts
105102 * @param {string} opts.destination - The destination account ID.
105103 * @param {Asset} opts.asset - The asset to send.
105104 * @param {string} opts.amount - The amount to send.
105105 * @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account.
105106 * @returns {xdr.PaymentOp}
105107 */
105108var payment = (function (_payment) {
105109 var _paymentWrapper = function payment(_x) {
105110 return _payment.apply(this, arguments);
105111 };
105112
105113 _paymentWrapper.toString = function () {
105114 return _payment.toString();
105115 };
105116
105117 return _paymentWrapper;
105118})(function (opts) {
105119 if (!StrKey.isValidEd25519PublicKey(opts.destination)) {
105120 throw new Error("destination is invalid");
105121 }
105122 if (!opts.asset) {
105123 throw new Error("Must provide an asset for a payment operation");
105124 }
105125 if (!this.isValidAmount(opts.amount)) {
105126 throw new TypeError(this.constructAmountRequirementsError("amount"));
105127 }
105128
105129 var attributes = {};
105130 attributes.destination = Keypair.fromPublicKey(opts.destination).xdrAccountId();
105131 attributes.asset = opts.asset.toXDRObject();
105132 attributes.amount = this._toXDRAmount(opts.amount);
105133 var payment = new xdr.PaymentOp(attributes);
105134
105135 var opAttributes = {};
105136 opAttributes.body = xdr.OperationBody.payment(payment);
105137 this.setSourceAccount(opAttributes, opts);
105138
105139 return new xdr.Operation(opAttributes);
105140});
105141exports.payment = payment;
105142},{"../generated/stellar-xdr_generated":780,"../keypair":783,"../strkey":801}],799:[function(require,module,exports){
105143(function (Buffer){
105144"use strict";
105145
105146var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
105147
105148Object.defineProperty(exports, "__esModule", {
105149 value: true
105150});
105151
105152var xdr = _interopRequire(require("../generated/stellar-xdr_generated"));
105153
105154var Keypair = require("../keypair").Keypair;
105155
105156var StrKey = require("../strkey").StrKey;
105157
105158var isUndefined = _interopRequire(require("lodash/isUndefined"));
105159
105160var isString = _interopRequire(require("lodash/isString"));
105161
105162/**
105163 * Returns an XDR SetOptionsOp. A "set options" operations set or clear account flags,
105164 * set the account's inflation destination, and/or add new signers to the account.
105165 * The flags used in `opts.clearFlags` and `opts.setFlags` can be the following:
105166 * - `{@link AuthRequiredFlag}`
105167 * - `{@link AuthRevocableFlag}`
105168 * - `{@link AuthImmutableFlag}`
105169 *
105170 * It's possible to set/clear multiple flags at once using logical or.
105171 * @function
105172 * @alias Operation.setOptions
105173 * @param {object} opts
105174 * @param {string} [opts.inflationDest] - Set this account ID as the account's inflation destination.
105175 * @param {(number|string)} [opts.clearFlags] - Bitmap integer for which account flags to clear.
105176 * @param {(number|string)} [opts.setFlags] - Bitmap integer for which account flags to set.
105177 * @param {number|string} [opts.masterWeight] - The master key weight.
105178 * @param {number|string} [opts.lowThreshold] - The sum weight for the low threshold.
105179 * @param {number|string} [opts.medThreshold] - The sum weight for the medium threshold.
105180 * @param {number|string} [opts.highThreshold] - The sum weight for the high threshold.
105181 * @param {object} [opts.signer] - Add or remove a signer from the account. The signer is
105182 * deleted if the weight is 0. Only one of `ed25519PublicKey`, `sha256Hash`, `preAuthTx` should be defined.
105183 * @param {string} [opts.signer.ed25519PublicKey] - The ed25519 public key of the signer.
105184 * @param {Buffer|string} [opts.signer.sha256Hash] - sha256 hash (Buffer or hex string) of preimage that will unlock funds. Preimage should be used as signature of future transaction.
105185 * @param {Buffer|string} [opts.signer.preAuthTx] - Hash (Buffer or hex string) of transaction that will unlock funds.
105186 * @param {number|string} [opts.signer.weight] - The weight of the new signer (0 to delete or 1-255)
105187 * @param {string} [opts.homeDomain] - sets the home domain used for reverse federation lookup.
105188 * @param {string} [opts.source] - The source account (defaults to transaction source).
105189 * @returns {xdr.SetOptionsOp}
105190 * @see [Account flags](https://www.stellar.org/developers/guides/concepts/accounts.html#flags)
105191 */
105192var setOptions = function setOptions(opts) {
105193 var attributes = {};
105194
105195 if (opts.inflationDest) {
105196 if (!StrKey.isValidEd25519PublicKey(opts.inflationDest)) {
105197 throw new Error("inflationDest is invalid");
105198 }
105199 attributes.inflationDest = Keypair.fromPublicKey(opts.inflationDest).xdrAccountId();
105200 }
105201
105202 var weightCheckFunction = function (value, name) {
105203 if (value >= 0 && value <= 255) {
105204 return true;
105205 } else {
105206 throw new Error("" + name + " value must be between 0 and 255");
105207 }
105208 };
105209
105210 attributes.clearFlags = this._checkUnsignedIntValue("clearFlags", opts.clearFlags);
105211 attributes.setFlags = this._checkUnsignedIntValue("setFlags", opts.setFlags);
105212 attributes.masterWeight = this._checkUnsignedIntValue("masterWeight", opts.masterWeight, weightCheckFunction);
105213 attributes.lowThreshold = this._checkUnsignedIntValue("lowThreshold", opts.lowThreshold, weightCheckFunction);
105214 attributes.medThreshold = this._checkUnsignedIntValue("medThreshold", opts.medThreshold, weightCheckFunction);
105215 attributes.highThreshold = this._checkUnsignedIntValue("highThreshold", opts.highThreshold, weightCheckFunction);
105216
105217 if (!isUndefined(opts.homeDomain) && !isString(opts.homeDomain)) {
105218 throw new TypeError("homeDomain argument must be of type String");
105219 }
105220 attributes.homeDomain = opts.homeDomain;
105221
105222 if (opts.signer) {
105223 var weight = this._checkUnsignedIntValue("signer.weight", opts.signer.weight, weightCheckFunction);
105224 var key = undefined;
105225
105226 var setValues = 0;
105227
105228 if (opts.signer.ed25519PublicKey) {
105229 if (!StrKey.isValidEd25519PublicKey(opts.signer.ed25519PublicKey)) {
105230 throw new Error("signer.ed25519PublicKey is invalid.");
105231 }
105232 var rawKey = StrKey.decodeEd25519PublicKey(opts.signer.ed25519PublicKey);
105233 key = new xdr.SignerKey.signerKeyTypeEd25519(rawKey);
105234 setValues++;
105235 }
105236
105237 if (opts.signer.preAuthTx) {
105238 if (isString(opts.signer.preAuthTx)) {
105239 opts.signer.preAuthTx = Buffer.from(opts.signer.preAuthTx, "hex");
105240 }
105241
105242 if (!(Buffer.isBuffer(opts.signer.preAuthTx) && opts.signer.preAuthTx.length == 32)) {
105243 throw new Error("signer.preAuthTx must be 32 bytes Buffer.");
105244 }
105245 key = new xdr.SignerKey.signerKeyTypePreAuthTx(opts.signer.preAuthTx);
105246 setValues++;
105247 }
105248
105249 if (opts.signer.sha256Hash) {
105250 if (isString(opts.signer.sha256Hash)) {
105251 opts.signer.sha256Hash = Buffer.from(opts.signer.sha256Hash, "hex");
105252 }
105253
105254 if (!(Buffer.isBuffer(opts.signer.sha256Hash) && opts.signer.sha256Hash.length == 32)) {
105255 throw new Error("signer.sha256Hash must be 32 bytes Buffer.");
105256 }
105257 key = new xdr.SignerKey.signerKeyTypeHashX(opts.signer.sha256Hash);
105258 setValues++;
105259 }
105260
105261 if (setValues != 1) {
105262 throw new Error("Signer object must contain exactly one of signer.ed25519PublicKey, signer.sha256Hash, signer.preAuthTx.");
105263 }
105264
105265 attributes.signer = new xdr.Signer({ key: key, weight: weight });
105266 }
105267
105268 var setOptionsOp = new xdr.SetOptionsOp(attributes);
105269
105270 var opAttributes = {};
105271 opAttributes.body = xdr.OperationBody.setOption(setOptionsOp);
105272 this.setSourceAccount(opAttributes, opts);
105273
105274 return new xdr.Operation(opAttributes);
105275};
105276exports.setOptions = setOptions;
105277}).call(this,require("buffer").Buffer)
105278},{"../generated/stellar-xdr_generated":780,"../keypair":783,"../strkey":801,"buffer":146,"lodash/isString":618,"lodash/isUndefined":621}],800:[function(require,module,exports){
105279(function (Buffer){
105280"use strict";
105281
105282exports.sign = sign;
105283exports.verify = verify;
105284Object.defineProperty(exports, "__esModule", {
105285 value: true
105286});
105287// This module provides the signing functionality used by the stellar network
105288// The code below may look a little strange... this is because we try to provide
105289// the most efficient signing method possible. First, we try to load the
105290// native ed25519 package for node.js environments, and if that fails we
105291// fallback to tweetnacl.js
105292
105293var actualMethods = {};
105294
105295/**
105296 * Use this flag to check if fast signing (provided by `ed25519` package) is available.
105297 * If your app is signing a large number of transaction or verifying a large number
105298 * of signatures make sure `ed25519` package is installed.
105299 */
105300var FastSigning = checkFastSigning();
105301
105302exports.FastSigning = FastSigning;
105303
105304function sign(data, secretKey) {
105305 return actualMethods.sign(data, secretKey);
105306}
105307
105308function verify(data, signature, publicKey) {
105309 return actualMethods.verify(data, signature, publicKey);
105310}
105311
105312function checkFastSigning() {
105313 return typeof window === "undefined" ? checkFastSigningNode() : checkFastSigningBrowser();
105314}
105315
105316function checkFastSigningNode() {
105317 // NOTE: we use commonjs style require here because es6 imports
105318 // can only occur at the top level. thanks, obama.
105319 var ed25519 = undefined;
105320 try {
105321 ed25519 = require("ed25519");
105322 } catch (err) {
105323 return checkFastSigningBrowser();
105324 }
105325
105326 actualMethods.sign = function (data, secretKey) {
105327 return ed25519.Sign(Buffer.from(data), secretKey);
105328 };
105329
105330 actualMethods.verify = function (data, signature, publicKey) {
105331 data = Buffer.from(data);
105332 try {
105333 return ed25519.Verify(data, signature, publicKey);
105334 } catch (e) {
105335 return false;
105336 }
105337 };
105338
105339 return true;
105340}
105341
105342function checkFastSigningBrowser() {
105343 // fallback to tweetnacl.js if we're in the browser or
105344 // if there was a failure installing ed25519
105345 var nacl = require("tweetnacl");
105346
105347 actualMethods.sign = function (data, secretKey) {
105348 data = Buffer.from(data);
105349 data = new Uint8Array(data.toJSON().data);
105350 secretKey = new Uint8Array(secretKey.toJSON().data);
105351
105352 var signature = nacl.sign.detached(data, secretKey);
105353
105354 return Buffer.from(signature);
105355 };
105356
105357 actualMethods.verify = function (data, signature, publicKey) {
105358 data = Buffer.from(data);
105359 data = new Uint8Array(data.toJSON().data);
105360 signature = new Uint8Array(signature.toJSON().data);
105361 publicKey = new Uint8Array(publicKey.toJSON().data);
105362
105363 return nacl.sign.detached.verify(data, signature, publicKey);
105364 };
105365
105366 return false;
105367}
105368}).call(this,require("buffer").Buffer)
105369},{"buffer":146,"ed25519":110,"tweetnacl":813}],801:[function(require,module,exports){
105370(function (Buffer){
105371"use strict";
105372
105373var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
105374
105375var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
105376
105377var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
105378
105379exports.decodeCheck = decodeCheck;
105380exports.encodeCheck = encodeCheck;
105381Object.defineProperty(exports, "__esModule", {
105382 value: true
105383});
105384
105385var base32 = _interopRequire(require("base32.js"));
105386
105387var crc = _interopRequire(require("crc"));
105388
105389var isUndefined = _interopRequire(require("lodash/isUndefined"));
105390
105391var isNull = _interopRequire(require("lodash/isNull"));
105392
105393var isString = _interopRequire(require("lodash/isString"));
105394
105395var verifyChecksum = require("./util/checksum").verifyChecksum;
105396
105397var versionBytes = {
105398 ed25519PublicKey: 6 << 3, // G
105399 ed25519SecretSeed: 18 << 3, // S
105400 preAuthTx: 19 << 3, // T
105401 sha256Hash: 23 << 3 // X
105402};
105403
105404/**
105405 * StrKey is a helper class that allows encoding and decoding strkey.
105406 */
105407
105408var StrKey = exports.StrKey = (function () {
105409 function StrKey() {
105410 _classCallCheck(this, StrKey);
105411 }
105412
105413 _createClass(StrKey, null, {
105414 encodeEd25519PublicKey: {
105415 /**
105416 * Encodes data to strkey ed25519 public key.
105417 * @param {Buffer} data data to encode
105418 * @returns {string}
105419 */
105420
105421 value: function encodeEd25519PublicKey(data) {
105422 return encodeCheck("ed25519PublicKey", data);
105423 }
105424 },
105425 decodeEd25519PublicKey: {
105426
105427 /**
105428 * Decodes strkey ed25519 public key to raw data.
105429 * @param {string} data data to decode
105430 * @returns {Buffer}
105431 */
105432
105433 value: function decodeEd25519PublicKey(data) {
105434 return decodeCheck("ed25519PublicKey", data);
105435 }
105436 },
105437 isValidEd25519PublicKey: {
105438
105439 /**
105440 * Returns true if the given Stellar public key is a valid ed25519 public key.
105441 * @param {string} publicKey public key to check
105442 * @returns {boolean}
105443 */
105444
105445 value: function isValidEd25519PublicKey(publicKey) {
105446 return isValid("ed25519PublicKey", publicKey);
105447 }
105448 },
105449 encodeEd25519SecretSeed: {
105450
105451 /**
105452 * Encodes data to strkey ed25519 seed.
105453 * @param {Buffer} data data to encode
105454 * @returns {string}
105455 */
105456
105457 value: function encodeEd25519SecretSeed(data) {
105458 return encodeCheck("ed25519SecretSeed", data);
105459 }
105460 },
105461 decodeEd25519SecretSeed: {
105462
105463 /**
105464 * Decodes strkey ed25519 seed to raw data.
105465 * @param {string} data data to decode
105466 * @returns {Buffer}
105467 */
105468
105469 value: function decodeEd25519SecretSeed(data) {
105470 return decodeCheck("ed25519SecretSeed", data);
105471 }
105472 },
105473 isValidEd25519SecretSeed: {
105474
105475 /**
105476 * Returns true if the given Stellar secret key is a valid ed25519 secret seed.
105477 * @param {string} seed seed to check
105478 * @returns {boolean}
105479 */
105480
105481 value: function isValidEd25519SecretSeed(seed) {
105482 return isValid("ed25519SecretSeed", seed);
105483 }
105484 },
105485 encodePreAuthTx: {
105486
105487 /**
105488 * Encodes data to strkey preAuthTx.
105489 * @param {Buffer} data data to encode
105490 * @returns {string}
105491 */
105492
105493 value: function encodePreAuthTx(data) {
105494 return encodeCheck("preAuthTx", data);
105495 }
105496 },
105497 decodePreAuthTx: {
105498
105499 /**
105500 * Decodes strkey PreAuthTx to raw data.
105501 * @param {string} data data to decode
105502 * @returns {Buffer}
105503 */
105504
105505 value: function decodePreAuthTx(data) {
105506 return decodeCheck("preAuthTx", data);
105507 }
105508 },
105509 encodeSha256Hash: {
105510
105511 /**
105512 * Encodes data to strkey sha256 hash.
105513 * @param {Buffer} data data to encode
105514 * @returns {string}
105515 */
105516
105517 value: function encodeSha256Hash(data) {
105518 return encodeCheck("sha256Hash", data);
105519 }
105520 },
105521 decodeSha256Hash: {
105522
105523 /**
105524 * Decodes strkey sha256 hash to raw data.
105525 * @param {string} data data to decode
105526 * @returns {Buffer}
105527 */
105528
105529 value: function decodeSha256Hash(data) {
105530 return decodeCheck("sha256Hash", data);
105531 }
105532 }
105533 });
105534
105535 return StrKey;
105536})();
105537
105538function isValid(versionByteName, encoded) {
105539 if (encoded && encoded.length != 56) {
105540 return false;
105541 }
105542
105543 try {
105544 var decoded = decodeCheck(versionByteName, encoded);
105545 if (decoded.length !== 32) {
105546 return false;
105547 }
105548 } catch (err) {
105549 return false;
105550 }
105551 return true;
105552}
105553
105554function decodeCheck(versionByteName, encoded) {
105555 if (!isString(encoded)) {
105556 throw new TypeError("encoded argument must be of type String");
105557 }
105558
105559 var decoded = base32.decode(encoded);
105560 var versionByte = decoded[0];
105561 var payload = decoded.slice(0, -2);
105562 var data = payload.slice(1);
105563 var checksum = decoded.slice(-2);
105564
105565 if (encoded != base32.encode(decoded)) {
105566 throw new Error("invalid encoded string");
105567 }
105568
105569 var expectedVersion = versionBytes[versionByteName];
105570
105571 if (isUndefined(expectedVersion)) {
105572 throw new Error("" + versionByteName + " is not a valid version byte name. expected one of \"accountId\" or \"seed\"");
105573 }
105574
105575 if (versionByte !== expectedVersion) {
105576 throw new Error("invalid version byte. expected " + expectedVersion + ", got " + versionByte);
105577 }
105578
105579 var expectedChecksum = calculateChecksum(payload);
105580
105581 if (!verifyChecksum(expectedChecksum, checksum)) {
105582 throw new Error("invalid checksum");
105583 }
105584
105585 return Buffer.from(data);
105586}
105587
105588function encodeCheck(versionByteName, data) {
105589 if (isNull(data) || isUndefined(data)) {
105590 throw new Error("cannot encode null data");
105591 }
105592
105593 var versionByte = versionBytes[versionByteName];
105594
105595 if (isUndefined(versionByte)) {
105596 throw new Error("" + versionByteName + " is not a valid version byte name. expected one of \"ed25519PublicKey\", \"ed25519SecretSeed\", \"preAuthTx\", \"sha256Hash\"");
105597 }
105598
105599 data = Buffer.from(data);
105600 var versionBuffer = Buffer.from([versionByte]);
105601 var payload = Buffer.concat([versionBuffer, data]);
105602 var checksum = calculateChecksum(payload);
105603 var unencoded = Buffer.concat([payload, checksum]);
105604
105605 return base32.encode(unencoded);
105606}
105607
105608function calculateChecksum(payload) {
105609 // This code calculates CRC16-XModem checksum of payload
105610 // and returns it as Buffer in little-endian order.
105611 var checksum = Buffer.alloc(2);
105612 checksum.writeUInt16LE(crc.crc16xmodem(payload), 0);
105613 return checksum;
105614}
105615}).call(this,require("buffer").Buffer)
105616},{"./util/checksum":804,"base32.js":55,"buffer":146,"crc":237,"lodash/isNull":613,"lodash/isString":618,"lodash/isUndefined":621}],802:[function(require,module,exports){
105617(function (Buffer){
105618"use strict";
105619
105620var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
105621
105622var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
105623
105624var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
105625
105626Object.defineProperty(exports, "__esModule", {
105627 value: true
105628});
105629
105630var _index = require("./index");
105631
105632var xdr = _index.xdr;
105633var hash = _index.hash;
105634
105635var StrKey = require("./strkey").StrKey;
105636
105637var Operation = require("./operation").Operation;
105638
105639var Network = require("./network").Network;
105640
105641var Memo = require("./memo").Memo;
105642
105643var map = _interopRequire(require("lodash/map"));
105644
105645var each = _interopRequire(require("lodash/each"));
105646
105647var isString = _interopRequire(require("lodash/isString"));
105648
105649var crypto = _interopRequire(require("crypto"));
105650
105651/**
105652 * A new Transaction object is created from a transaction envelope or via {@link TransactionBuilder}.
105653 * Once a Transaction has been created from an envelope, its attributes and operations
105654 * should not be changed. You should only add signers (using {@link Transaction#sign}) to a Transaction object before
105655 * submitting to the network or forwarding on to additional signers.
105656 * @constructor
105657 * @param {string|xdr.TransactionEnvelope} envelope - The transaction envelope object or base64 encoded string.
105658 */
105659
105660var Transaction = exports.Transaction = (function () {
105661 function Transaction(envelope) {
105662 _classCallCheck(this, Transaction);
105663
105664 if (typeof envelope === "string") {
105665 var buffer = Buffer.from(envelope, "base64");
105666 envelope = xdr.TransactionEnvelope.fromXDR(buffer);
105667 }
105668 // since this transaction is immutable, save the tx
105669 this.tx = envelope.tx();
105670 this.source = StrKey.encodeEd25519PublicKey(envelope.tx().sourceAccount().ed25519());
105671 this.fee = this.tx.fee();
105672 this._memo = this.tx.memo();
105673 this.sequence = this.tx.seqNum().toString();
105674
105675 var timeBounds = this.tx.timeBounds();
105676 if (timeBounds) {
105677 this.timeBounds = {
105678 minTime: timeBounds.minTime().toString(),
105679 maxTime: timeBounds.maxTime().toString()
105680 };
105681 }
105682
105683 var operations = this.tx.operations() || [];
105684 this.operations = map(operations, function (op) {
105685 return Operation.fromXDRObject(op);
105686 });
105687
105688 var signatures = envelope.signatures() || [];
105689 this.signatures = map(signatures, function (s) {
105690 return s;
105691 });
105692 }
105693
105694 _createClass(Transaction, {
105695 memo: {
105696 get: function () {
105697 return Memo.fromXDRObject(this._memo);
105698 },
105699 set: function (value) {
105700 throw new Error("Transaction is immutable");
105701 }
105702 },
105703 sign: {
105704
105705 /**
105706 * Signs the transaction with the given {@link Keypair}.
105707 * @param {...Keypair} keypairs Keypairs of signers
105708 * @returns {void}
105709 */
105710
105711 value: function sign() {
105712 var _this = this;
105713
105714 for (var _len = arguments.length, keypairs = Array(_len), _key = 0; _key < _len; _key++) {
105715 keypairs[_key] = arguments[_key];
105716 }
105717
105718 var txHash = this.hash();
105719 var newSigs = each(keypairs, function (kp) {
105720 var sig = kp.signDecorated(txHash);
105721 _this.signatures.push(sig);
105722 });
105723 }
105724 },
105725 signHashX: {
105726
105727 /**
105728 * Add `hashX` signer preimage as signature.
105729 * @param {Buffer|String} preimage Preimage of hash used as signer
105730 * @returns {void}
105731 */
105732
105733 value: function signHashX(preimage) {
105734 if (isString(preimage)) {
105735 preimage = Buffer.from(preimage, "hex");
105736 }
105737
105738 if (preimage.length > 64) {
105739 throw new Error("preimage cannnot be longer than 64 bytes");
105740 }
105741
105742 var signature = preimage;
105743 var hash = crypto.createHash("sha256").update(preimage).digest();
105744 var hint = hash.slice(hash.length - 4);
105745 this.signatures.push(new xdr.DecoratedSignature({ hint: hint, signature: signature }));
105746 }
105747 },
105748 hash: {
105749
105750 /**
105751 * Returns a hash for this transaction, suitable for signing.
105752 * @returns {Buffer}
105753 */
105754
105755 value: (function (_hash) {
105756 var _hashWrapper = function hash() {
105757 return _hash.apply(this, arguments);
105758 };
105759
105760 _hashWrapper.toString = function () {
105761 return _hash.toString();
105762 };
105763
105764 return _hashWrapper;
105765 })(function () {
105766 return hash(this.signatureBase());
105767 })
105768 },
105769 signatureBase: {
105770
105771 /**
105772 * Returns the "signature base" of this transaction, which is the value
105773 * that, when hashed, should be signed to create a signature that
105774 * validators on the Stellar Network will accept.
105775 *
105776 * It is composed of a 4 prefix bytes followed by the xdr-encoded form
105777 * of this transaction.
105778 * @returns {Buffer}
105779 */
105780
105781 value: function signatureBase() {
105782 if (Network.current() === null) {
105783 throw new Error("No network selected. Use `Network.use`, `Network.usePublicNetwork` or `Network.useTestNetwork` helper methods to select network.");
105784 }
105785
105786 return Buffer.concat([Network.current().networkId(), xdr.EnvelopeType.envelopeTypeTx().toXDR(), this.tx.toXDR()]);
105787 }
105788 },
105789 toEnvelope: {
105790
105791 /**
105792 * To envelope returns a xdr.TransactionEnvelope which can be submitted to the network.
105793 * @returns {xdr.TransactionEnvelope}
105794 */
105795
105796 value: function toEnvelope() {
105797 var tx = this.tx;
105798 var signatures = this.signatures;
105799 var envelope = new xdr.TransactionEnvelope({ tx: tx, signatures: signatures });
105800
105801 return envelope;
105802 }
105803 }
105804 });
105805
105806 return Transaction;
105807})();
105808}).call(this,require("buffer").Buffer)
105809},{"./index":782,"./memo":784,"./network":785,"./operation":786,"./strkey":801,"buffer":146,"crypto":243,"lodash/each":595,"lodash/isString":618,"lodash/map":624}],803:[function(require,module,exports){
105810"use strict";
105811
105812var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
105813
105814var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
105815
105816var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
105817
105818Object.defineProperty(exports, "__esModule", {
105819 value: true
105820});
105821
105822var xdr = _interopRequire(require("./generated/stellar-xdr_generated"));
105823
105824var UnsignedHyper = require("js-xdr").UnsignedHyper;
105825
105826var hash = require("./hashing").hash;
105827
105828var Keypair = require("./keypair").Keypair;
105829
105830var Account = require("./account").Account;
105831
105832var Operation = require("./operation").Operation;
105833
105834var Transaction = require("./transaction").Transaction;
105835
105836var Memo = require("./memo").Memo;
105837
105838var BigNumber = _interopRequire(require("bignumber.js"));
105839
105840var clone = _interopRequire(require("lodash/clone"));
105841
105842var map = _interopRequire(require("lodash/map"));
105843
105844var isUndefined = _interopRequire(require("lodash/isUndefined"));
105845
105846var BASE_FEE = 100; // Stroops
105847
105848/**
105849 * @constant
105850 * @see {@link TransactionBuilder#setTimeout}
105851 * @see [Timeout](https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html#timeout)
105852 */
105853var TimeoutInfinite = 0;
105854
105855exports.TimeoutInfinite = TimeoutInfinite;
105856/**
105857 * <p>Transaction builder helps constructs a new `{@link Transaction}` using the given {@link Account}
105858 * as the transaction's "source account". The transaction will use the current sequence
105859 * number of the given account as its sequence number and increment the given account's
105860 * sequence number by one. The given source account must include a private key for signing
105861 * the transaction or an error will be thrown.</p>
105862 *
105863 * <p>Operations can be added to the transaction via their corresponding builder methods, and
105864 * each returns the TransactionBuilder object so they can be chained together. After adding
105865 * the desired operations, call the `build()` method on the `TransactionBuilder` to return a fully
105866 * constructed `{@link Transaction}` that can be signed. The returned transaction will contain the
105867 * sequence number of the source account and include the signature from the source account.</p>
105868 *
105869 * <p>The following code example creates a new transaction with {@link Operation.createAccount} and
105870 * {@link Operation.payment} operations.
105871 * The Transaction's source account first funds `destinationA`, then sends
105872 * a payment to `destinationB`. The built transaction is then signed by `sourceKeypair`.</p>
105873 *
105874 * ```
105875 * var transaction = new TransactionBuilder(source)
105876 * .addOperation(Operation.createAccount({
105877 destination: destinationA,
105878 startingBalance: "20"
105879 }) // <- funds and creates destinationA
105880 .addOperation(Operation.payment({
105881 destination: destinationB,
105882 amount: "100"
105883 asset: Asset.native()
105884 }) // <- sends 100 XLM to destinationB
105885 * .setTimeout(30)
105886 * .build();
105887 *
105888 * transaction.sign(sourceKeypair);
105889 * ```
105890 * @constructor
105891 * @param {Account} sourceAccount - The source account for this transaction.
105892 * @param {object} [opts]
105893 * @param {number} [opts.fee] - The max fee willing to pay per operation in this transaction (**in stroops**).
105894 * @param {object} [opts.timebounds] - The timebounds for the validity of this transaction.
105895 * @param {number|string} [opts.timebounds.minTime] - 64 bit unix timestamp
105896 * @param {number|string} [opts.timebounds.maxTime] - 64 bit unix timestamp
105897 * @param {Memo} [opts.memo] - The memo for the transaction
105898 */
105899
105900var TransactionBuilder = exports.TransactionBuilder = (function () {
105901 function TransactionBuilder(sourceAccount) {
105902 var opts = arguments[1] === undefined ? {} : arguments[1];
105903
105904 _classCallCheck(this, TransactionBuilder);
105905
105906 if (!sourceAccount) {
105907 throw new Error("must specify source account for the transaction");
105908 }
105909 this.source = sourceAccount;
105910 this.operations = [];
105911 this.baseFee = isUndefined(opts.fee) ? BASE_FEE : opts.fee;
105912 this.timebounds = clone(opts.timebounds);
105913 this.memo = opts.memo || Memo.none();
105914 this.timeoutSet = false;
105915 }
105916
105917 _createClass(TransactionBuilder, {
105918 addOperation: {
105919
105920 /**
105921 * Adds an operation to the transaction.
105922 * @param {xdr.Operation} operation The xdr operation object, use {@link Operation} static methods.
105923 * @returns {TransactionBuilder}
105924 */
105925
105926 value: function addOperation(operation) {
105927 this.operations.push(operation);
105928 return this;
105929 }
105930 },
105931 addMemo: {
105932
105933 /**
105934 * Adds a memo to the transaction.
105935 * @param {Memo} memo {@link Memo} object
105936 * @returns {TransactionBuilder}
105937 */
105938
105939 value: function addMemo(memo) {
105940 this.memo = memo;
105941 return this;
105942 }
105943 },
105944 setTimeout: {
105945
105946 /**
105947 * Because of the distributed nature of the Stellar network it is possible that the status of your transaction
105948 * will be determined after a long time if the network is highly congested.
105949 * If you want to be sure to receive the status of the transaction within a given period you should set the
105950 * {@link TimeBounds} with <code>maxTime</code> on the transaction (this is what <code>setTimeout</code> does
105951 * internally; if there's <code>minTime</code> set but no <code>maxTime</code> it will be added).
105952 * Call to <code>TransactionBuilder.setTimeout</code> is required if Transaction does not have <code>max_time</code> set.
105953 * If you don't want to set timeout, use <code>{@link TimeoutInfinite}</code>. In general you should set
105954 * <code>{@link TimeoutInfinite}</code> only in smart contracts.
105955 *
105956 * Please note that Horizon may still return <code>504 Gateway Timeout</code> error, even for short timeouts.
105957 * In such case you need to resubmit the same transaction again without making any changes to receive a status.
105958 * This method is using the machine system time (UTC), make sure it is set correctly.
105959 * @param {timeout} Timeout in seconds.
105960 * @return {TransactionBuilder}
105961 * @see TimeoutInfinite
105962 */
105963
105964 value: function setTimeout(timeout) {
105965 if (this.timebounds != null && this.timebounds.maxTime > 0) {
105966 throw new Error("TimeBounds.max_time has been already set - setting timeout would overwrite it.");
105967 }
105968
105969 if (timeout < 0) {
105970 throw new Error("timeout cannot be negative");
105971 }
105972
105973 this.timeoutSet = true;
105974 if (timeout > 0) {
105975 var timeoutTimestamp = Math.floor(Date.now() / 1000) + timeout;
105976 if (this.timebounds == null) {
105977 this.timebounds = { minTime: 0, maxTime: timeoutTimestamp };
105978 } else {
105979 this.timebounds = { minTime: this.timebounds.minTime, maxTime: timeoutTimestamp };
105980 }
105981 }
105982
105983 return this;
105984 }
105985 },
105986 build: {
105987
105988 /**
105989 * This will build the transaction.
105990 * It will also increment the source account's sequence number by 1.
105991 * @returns {Transaction} This method will return the built {@link Transaction}.
105992 */
105993
105994 value: function build() {
105995 // Ensure setTimeout called or maxTime is set
105996 if ((this.timebounds == null || this.timebounds != null && this.timebounds.maxTime == 0) && !this.timeoutSet) {
105997 throw new Error("TimeBounds has to be set or you must call setTimeout(TimeoutInfinite).");
105998 }
105999
106000 var sequenceNumber = new BigNumber(this.source.sequenceNumber()).add(1);
106001
106002 var attrs = {
106003 sourceAccount: Keypair.fromPublicKey(this.source.accountId()).xdrAccountId(),
106004 fee: this.baseFee * this.operations.length,
106005 seqNum: xdr.SequenceNumber.fromString(sequenceNumber.toString()),
106006 memo: this.memo ? this.memo.toXDRObject() : null,
106007 ext: new xdr.TransactionExt(0)
106008 };
106009
106010 if (this.timebounds) {
106011 this.timebounds.minTime = UnsignedHyper.fromString(this.timebounds.minTime.toString());
106012 this.timebounds.maxTime = UnsignedHyper.fromString(this.timebounds.maxTime.toString());
106013 attrs.timeBounds = new xdr.TimeBounds(this.timebounds);
106014 }
106015
106016 var xtx = new xdr.Transaction(attrs);
106017 xtx.operations(this.operations);
106018
106019 var xenv = new xdr.TransactionEnvelope({ tx: xtx });
106020 var tx = new Transaction(xenv);
106021
106022 this.source.incrementSequenceNumber();
106023
106024 return tx;
106025 }
106026 }
106027 });
106028
106029 return TransactionBuilder;
106030})();
106031},{"./account":777,"./generated/stellar-xdr_generated":780,"./hashing":781,"./keypair":783,"./memo":784,"./operation":786,"./transaction":802,"bignumber.js":807,"js-xdr":410,"lodash/clone":593,"lodash/isUndefined":621,"lodash/map":624}],804:[function(require,module,exports){
106032"use strict";
106033
106034exports.verifyChecksum = verifyChecksum;
106035Object.defineProperty(exports, "__esModule", {
106036 value: true
106037});
106038
106039function verifyChecksum(expected, actual) {
106040 if (expected.length !== actual.length) {
106041 return false;
106042 }
106043
106044 if (expected.length === 0) {
106045 return true;
106046 }
106047
106048 for (var i = 0; i < expected.length; i++) {
106049 if (expected[i] !== actual[i]) {
106050 return false;
106051 }
106052 }
106053
106054 return true;
106055}
106056},{}],805:[function(require,module,exports){
106057"use strict";
106058
106059var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
106060
106061var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } };
106062
106063/**
106064 * Calculates and returns the best rational approximation of the given real number.
106065 * @private
106066 * @param {string|number|BigNumber} number
106067 * @throws Error Throws `Error` when the best rational approximation cannot be found.
106068 * @returns {array} first element is n (numerator), second element is d (denominator)
106069 */
106070exports.best_r = best_r;
106071Object.defineProperty(exports, "__esModule", {
106072 value: true
106073});
106074
106075var BigNumber = _interopRequire(require("bignumber.js"));
106076
106077var MAX_INT = (1 << 31 >>> 0) - 1;
106078function best_r(number) {
106079 number = new BigNumber(number);
106080 var a;
106081 var f;
106082 var fractions = [[new BigNumber(0), new BigNumber(1)], [new BigNumber(1), new BigNumber(0)]];
106083 var i = 2;
106084 while (true) {
106085 if (number.gt(MAX_INT)) {
106086 break;
106087 }
106088 a = number.floor();
106089 f = number.sub(a);
106090 var h = a.mul(fractions[i - 1][0]).add(fractions[i - 2][0]);
106091 var k = a.mul(fractions[i - 1][1]).add(fractions[i - 2][1]);
106092 if (h.gt(MAX_INT) || k.gt(MAX_INT)) {
106093 break;
106094 }
106095 fractions.push([h, k]);
106096 if (f.eq(0)) {
106097 break;
106098 }
106099 number = new BigNumber(1).div(f);
106100 i++;
106101 }
106102
106103 var _fractions = _slicedToArray(fractions[fractions.length - 1], 2);
106104
106105 var n = _fractions[0];
106106 var d = _fractions[1];
106107
106108 if (n.isZero() || d.isZero()) {
106109 throw new Error("Couldn't find approximation");
106110 }
106111
106112 return [n.toNumber(), d.toNumber()];
106113}
106114},{"bignumber.js":807}],806:[function(require,module,exports){
106115// vendored from http://cryptocoinjs.com/modules/misc/bs58/
106116
106117// Base58 encoding/decoding
106118// Originally written by Mike Hearn for BitcoinJ
106119// Copyright (c) 2011 Google Inc
106120// Ported to JavaScript by Stefan Thomas
106121// Merged Buffer refactorings from base58-native by Stephen Pair
106122// Copyright (c) 2013 BitPay Inc
106123
106124"use strict";
106125
106126var ALPHABET = "gsphnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCr65jkm8oFqi1tuvAxyz";
106127var ALPHABET_MAP = {};
106128for (var i = 0; i < ALPHABET.length; ++i) {
106129 ALPHABET_MAP[ALPHABET.charAt(i)] = i;
106130}
106131var BASE = 58;
106132
106133function decode(string) {
106134 if (string.length === 0) {
106135 return [];
106136 }var i,
106137 j,
106138 bytes = [0];
106139 for (i = 0; i < string.length; ++i) {
106140 var c = string[i];
106141 if (!(c in ALPHABET_MAP)) throw new Error("Non-base58 character");
106142
106143 for (j = 0; j < bytes.length; ++j) bytes[j] *= BASE;
106144 bytes[0] += ALPHABET_MAP[c];
106145
106146 var carry = 0;
106147 for (j = 0; j < bytes.length; ++j) {
106148 bytes[j] += carry;
106149
106150 carry = bytes[j] >> 8;
106151 bytes[j] &= 255;
106152 }
106153
106154 while (carry) {
106155 bytes.push(carry & 255);
106156
106157 carry >>= 8;
106158 }
106159 }
106160
106161 // deal with leading zeros
106162 for (i = 0; string[i] === "g" && i < string.length - 1; ++i) bytes.push(0);
106163
106164 return bytes.reverse();
106165}
106166
106167module.exports = { decode: decode };
106168},{}],807:[function(require,module,exports){
106169/*! bignumber.js v4.1.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\r
106170\r
106171;(function (globalObj) {\r
106172 'use strict';\r
106173\r
106174 /*\r
106175 bignumber.js v4.1.0\r
106176 A JavaScript library for arbitrary-precision arithmetic.\r
106177 https://github.com/MikeMcl/bignumber.js\r
106178 Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>\r
106179 MIT Expat Licence\r
106180 */\r
106181\r
106182\r
106183 var BigNumber,\r
106184 isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,\r
106185 mathceil = Math.ceil,\r
106186 mathfloor = Math.floor,\r
106187 notBool = ' not a boolean or binary digit',\r
106188 roundingMode = 'rounding mode',\r
106189 tooManyDigits = 'number type has more than 15 significant digits',\r
106190 ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',\r
106191 BASE = 1e14,\r
106192 LOG_BASE = 14,\r
106193 MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\r
106194 // MAX_INT32 = 0x7fffffff, // 2^31 - 1\r
106195 POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\r
106196 SQRT_BASE = 1e7,\r
106197\r
106198 /*\r
106199 * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\r
106200 * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an\r
106201 * exception is thrown (if ERRORS is true).\r
106202 */\r
106203 MAX = 1E9; // 0 to MAX_INT32\r
106204\r
106205\r
106206 /*\r
106207 * Create and return a BigNumber constructor.\r
106208 */\r
106209 function constructorFactory(config) {\r
106210 var div, parseNumeric,\r
106211\r
106212 // id tracks the caller function, so its name can be included in error messages.\r
106213 id = 0,\r
106214 P = BigNumber.prototype,\r
106215 ONE = new BigNumber(1),\r
106216\r
106217\r
106218 /********************************* EDITABLE DEFAULTS **********************************/\r
106219\r
106220\r
106221 /*\r
106222 * The default values below must be integers within the inclusive ranges stated.\r
106223 * The values can also be changed at run-time using BigNumber.config.\r
106224 */\r
106225\r
106226 // The maximum number of decimal places for operations involving division.\r
106227 DECIMAL_PLACES = 20, // 0 to MAX\r
106228\r
106229 /*\r
106230 * The rounding mode used when rounding to the above decimal places, and when using\r
106231 * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r
106232 * UP 0 Away from zero.\r
106233 * DOWN 1 Towards zero.\r
106234 * CEIL 2 Towards +Infinity.\r
106235 * FLOOR 3 Towards -Infinity.\r
106236 * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r
106237 * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r
106238 * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r
106239 * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r
106240 * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r
106241 */\r
106242 ROUNDING_MODE = 4, // 0 to 8\r
106243\r
106244 // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r
106245\r
106246 // The exponent value at and beneath which toString returns exponential notation.\r
106247 // Number type: -7\r
106248 TO_EXP_NEG = -7, // 0 to -MAX\r
106249\r
106250 // The exponent value at and above which toString returns exponential notation.\r
106251 // Number type: 21\r
106252 TO_EXP_POS = 21, // 0 to MAX\r
106253\r
106254 // RANGE : [MIN_EXP, MAX_EXP]\r
106255\r
106256 // The minimum exponent value, beneath which underflow to zero occurs.\r
106257 // Number type: -324 (5e-324)\r
106258 MIN_EXP = -1e7, // -1 to -MAX\r
106259\r
106260 // The maximum exponent value, above which overflow to Infinity occurs.\r
106261 // Number type: 308 (1.7976931348623157e+308)\r
106262 // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r
106263 MAX_EXP = 1e7, // 1 to MAX\r
106264\r
106265 // Whether BigNumber Errors are ever thrown.\r
106266 ERRORS = true, // true or false\r
106267\r
106268 // Change to intValidatorNoErrors if ERRORS is false.\r
106269 isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r
106270\r
106271 // Whether to use cryptographically-secure random number generation, if available.\r
106272 CRYPTO = false, // true or false\r
106273\r
106274 /*\r
106275 * The modulo mode used when calculating the modulus: a mod n.\r
106276 * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r
106277 * The remainder (r) is calculated as: r = a - n * q.\r
106278 *\r
106279 * UP 0 The remainder is positive if the dividend is negative, else is negative.\r
106280 * DOWN 1 The remainder has the same sign as the dividend.\r
106281 * This modulo mode is commonly known as 'truncated division' and is\r
106282 * equivalent to (a % n) in JavaScript.\r
106283 * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r
106284 * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r
106285 * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r
106286 * The remainder is always positive.\r
106287 *\r
106288 * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r
106289 * modes are commonly used for the modulus operation.\r
106290 * Although the other rounding modes can also be used, they may not give useful results.\r
106291 */\r
106292 MODULO_MODE = 1, // 0 to 9\r
106293\r
106294 // The maximum number of significant digits of the result of the toPower operation.\r
106295 // If POW_PRECISION is 0, there will be unlimited significant digits.\r
106296 POW_PRECISION = 0, // 0 to MAX\r
106297\r
106298 // The format specification used by the BigNumber.prototype.toFormat method.\r
106299 FORMAT = {\r
106300 decimalSeparator: '.',\r
106301 groupSeparator: ',',\r
106302 groupSize: 3,\r
106303 secondaryGroupSize: 0,\r
106304 fractionGroupSeparator: '\xA0', // non-breaking space\r
106305 fractionGroupSize: 0\r
106306 };\r
106307\r
106308\r
106309 /******************************************************************************************/\r
106310\r
106311\r
106312 // CONSTRUCTOR\r
106313\r
106314\r
106315 /*\r
106316 * The BigNumber constructor and exported function.\r
106317 * Create and return a new instance of a BigNumber object.\r
106318 *\r
106319 * n {number|string|BigNumber} A numeric value.\r
106320 * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r
106321 */\r
106322 function BigNumber( n, b ) {\r
106323 var c, e, i, num, len, str,\r
106324 x = this;\r
106325\r
106326 // Enable constructor usage without new.\r
106327 if ( !( x instanceof BigNumber ) ) {\r
106328\r
106329 // 'BigNumber() constructor call without new: {n}'\r
106330 if (ERRORS) raise( 26, 'constructor call without new', n );\r
106331 return new BigNumber( n, b );\r
106332 }\r
106333\r
106334 // 'new BigNumber() base not an integer: {b}'\r
106335 // 'new BigNumber() base out of range: {b}'\r
106336 if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r
106337\r
106338 // Duplicate.\r
106339 if ( n instanceof BigNumber ) {\r
106340 x.s = n.s;\r
106341 x.e = n.e;\r
106342 x.c = ( n = n.c ) ? n.slice() : n;\r
106343 id = 0;\r
106344 return;\r
106345 }\r
106346\r
106347 if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r
106348 x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r
106349\r
106350 // Fast path for integers.\r
106351 if ( n === ~~n ) {\r
106352 for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r
106353 x.e = e;\r
106354 x.c = [n];\r
106355 id = 0;\r
106356 return;\r
106357 }\r
106358\r
106359 str = n + '';\r
106360 } else {\r
106361 if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r
106362 x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r
106363 }\r
106364 } else {\r
106365 b = b | 0;\r
106366 str = n + '';\r
106367\r
106368 // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r
106369 // Allow exponential notation to be used with base 10 argument.\r
106370 if ( b == 10 ) {\r
106371 x = new BigNumber( n instanceof BigNumber ? n : str );\r
106372 return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r
106373 }\r
106374\r
106375 // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r
106376 // Any number in exponential form will fail due to the [Ee][+-].\r
106377 if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r
106378 !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r
106379 '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r
106380 return parseNumeric( x, str, num, b );\r
106381 }\r
106382\r
106383 if (num) {\r
106384 x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r
106385\r
106386 if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) {\r
106387\r
106388 // 'new BigNumber() number type has more than 15 significant digits: {n}'\r
106389 raise( id, tooManyDigits, n );\r
106390 }\r
106391\r
106392 // Prevent later check for length on converted number.\r
106393 num = false;\r
106394 } else {\r
106395 x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r
106396 }\r
106397\r
106398 str = convertBase( str, 10, b, x.s );\r
106399 }\r
106400\r
106401 // Decimal point?\r
106402 if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r
106403\r
106404 // Exponential form?\r
106405 if ( ( i = str.search( /e/i ) ) > 0 ) {\r
106406\r
106407 // Determine exponent.\r
106408 if ( e < 0 ) e = i;\r
106409 e += +str.slice( i + 1 );\r
106410 str = str.substring( 0, i );\r
106411 } else if ( e < 0 ) {\r
106412\r
106413 // Integer.\r
106414 e = str.length;\r
106415 }\r
106416\r
106417 // Determine leading zeros.\r
106418 for ( i = 0; str.charCodeAt(i) === 48; i++ );\r
106419\r
106420 // Determine trailing zeros.\r
106421 for ( len = str.length; str.charCodeAt(--len) === 48; );\r
106422 str = str.slice( i, len + 1 );\r
106423\r
106424 if (str) {\r
106425 len = str.length;\r
106426\r
106427 // Disallow numbers with over 15 significant digits if number type.\r
106428 // 'new BigNumber() number type has more than 15 significant digits: {n}'\r
106429 if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r
106430 raise( id, tooManyDigits, x.s * n );\r
106431 }\r
106432\r
106433 e = e - i - 1;\r
106434\r
106435 // Overflow?\r
106436 if ( e > MAX_EXP ) {\r
106437\r
106438 // Infinity.\r
106439 x.c = x.e = null;\r
106440\r
106441 // Underflow?\r
106442 } else if ( e < MIN_EXP ) {\r
106443\r
106444 // Zero.\r
106445 x.c = [ x.e = 0 ];\r
106446 } else {\r
106447 x.e = e;\r
106448 x.c = [];\r
106449\r
106450 // Transform base\r
106451\r
106452 // e is the base 10 exponent.\r
106453 // i is where to slice str to get the first element of the coefficient array.\r
106454 i = ( e + 1 ) % LOG_BASE;\r
106455 if ( e < 0 ) i += LOG_BASE;\r
106456\r
106457 if ( i < len ) {\r
106458 if (i) x.c.push( +str.slice( 0, i ) );\r
106459\r
106460 for ( len -= LOG_BASE; i < len; ) {\r
106461 x.c.push( +str.slice( i, i += LOG_BASE ) );\r
106462 }\r
106463\r
106464 str = str.slice(i);\r
106465 i = LOG_BASE - str.length;\r
106466 } else {\r
106467 i -= len;\r
106468 }\r
106469\r
106470 for ( ; i--; str += '0' );\r
106471 x.c.push( +str );\r
106472 }\r
106473 } else {\r
106474\r
106475 // Zero.\r
106476 x.c = [ x.e = 0 ];\r
106477 }\r
106478\r
106479 id = 0;\r
106480 }\r
106481\r
106482\r
106483 // CONSTRUCTOR PROPERTIES\r
106484\r
106485\r
106486 BigNumber.another = constructorFactory;\r
106487\r
106488 BigNumber.ROUND_UP = 0;\r
106489 BigNumber.ROUND_DOWN = 1;\r
106490 BigNumber.ROUND_CEIL = 2;\r
106491 BigNumber.ROUND_FLOOR = 3;\r
106492 BigNumber.ROUND_HALF_UP = 4;\r
106493 BigNumber.ROUND_HALF_DOWN = 5;\r
106494 BigNumber.ROUND_HALF_EVEN = 6;\r
106495 BigNumber.ROUND_HALF_CEIL = 7;\r
106496 BigNumber.ROUND_HALF_FLOOR = 8;\r
106497 BigNumber.EUCLID = 9;\r
106498\r
106499\r
106500 /*\r
106501 * Configure infrequently-changing library-wide settings.\r
106502 *\r
106503 * Accept an object or an argument list, with one or many of the following properties or\r
106504 * parameters respectively:\r
106505 *\r
106506 * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r
106507 * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r
106508 * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r
106509 * [integer -MAX to 0 incl., 0 to MAX incl.]\r
106510 * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r
106511 * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r
106512 * ERRORS {boolean|number} true, false, 1 or 0\r
106513 * CRYPTO {boolean|number} true, false, 1 or 0\r
106514 * MODULO_MODE {number} 0 to 9 inclusive\r
106515 * POW_PRECISION {number} 0 to MAX inclusive\r
106516 * FORMAT {object} See BigNumber.prototype.toFormat\r
106517 * decimalSeparator {string}\r
106518 * groupSeparator {string}\r
106519 * groupSize {number}\r
106520 * secondaryGroupSize {number}\r
106521 * fractionGroupSeparator {string}\r
106522 * fractionGroupSize {number}\r
106523 *\r
106524 * (The values assigned to the above FORMAT object properties are not checked for validity.)\r
106525 *\r
106526 * E.g.\r
106527 * BigNumber.config(20, 4) is equivalent to\r
106528 * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r
106529 *\r
106530 * Ignore properties/parameters set to null or undefined.\r
106531 * Return an object with the properties current values.\r
106532 */\r
106533 BigNumber.config = BigNumber.set = function () {\r
106534 var v, p,\r
106535 i = 0,\r
106536 r = {},\r
106537 a = arguments,\r
106538 o = a[0],\r
106539 has = o && typeof o == 'object'\r
106540 ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r
106541 : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r
106542\r
106543 // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r
106544 // 'config() DECIMAL_PLACES not an integer: {v}'\r
106545 // 'config() DECIMAL_PLACES out of range: {v}'\r
106546 if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r
106547 DECIMAL_PLACES = v | 0;\r
106548 }\r
106549 r[p] = DECIMAL_PLACES;\r
106550\r
106551 // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r
106552 // 'config() ROUNDING_MODE not an integer: {v}'\r
106553 // 'config() ROUNDING_MODE out of range: {v}'\r
106554 if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r
106555 ROUNDING_MODE = v | 0;\r
106556 }\r
106557 r[p] = ROUNDING_MODE;\r
106558\r
106559 // EXPONENTIAL_AT {number|number[]}\r
106560 // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r
106561 // 'config() EXPONENTIAL_AT not an integer: {v}'\r
106562 // 'config() EXPONENTIAL_AT out of range: {v}'\r
106563 if ( has( p = 'EXPONENTIAL_AT' ) ) {\r
106564\r
106565 if ( isArray(v) ) {\r
106566 if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r
106567 TO_EXP_NEG = v[0] | 0;\r
106568 TO_EXP_POS = v[1] | 0;\r
106569 }\r
106570 } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r
106571 TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r
106572 }\r
106573 }\r
106574 r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r
106575\r
106576 // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r
106577 // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r
106578 // 'config() RANGE not an integer: {v}'\r
106579 // 'config() RANGE cannot be zero: {v}'\r
106580 // 'config() RANGE out of range: {v}'\r
106581 if ( has( p = 'RANGE' ) ) {\r
106582\r
106583 if ( isArray(v) ) {\r
106584 if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r
106585 MIN_EXP = v[0] | 0;\r
106586 MAX_EXP = v[1] | 0;\r
106587 }\r
106588 } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r
106589 if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r
106590 else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r
106591 }\r
106592 }\r
106593 r[p] = [ MIN_EXP, MAX_EXP ];\r
106594\r
106595 // ERRORS {boolean|number} true, false, 1 or 0.\r
106596 // 'config() ERRORS not a boolean or binary digit: {v}'\r
106597 if ( has( p = 'ERRORS' ) ) {\r
106598\r
106599 if ( v === !!v || v === 1 || v === 0 ) {\r
106600 id = 0;\r
106601 isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r
106602 } else if (ERRORS) {\r
106603 raise( 2, p + notBool, v );\r
106604 }\r
106605 }\r
106606 r[p] = ERRORS;\r
106607\r
106608 // CRYPTO {boolean|number} true, false, 1 or 0.\r
106609 // 'config() CRYPTO not a boolean or binary digit: {v}'\r
106610 // 'config() crypto unavailable: {crypto}'\r
106611 if ( has( p = 'CRYPTO' ) ) {\r
106612\r
106613 if ( v === true || v === false || v === 1 || v === 0 ) {\r
106614 if (v) {\r
106615 v = typeof crypto == 'undefined';\r
106616 if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r
106617 CRYPTO = true;\r
106618 } else if (ERRORS) {\r
106619 raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r
106620 } else {\r
106621 CRYPTO = false;\r
106622 }\r
106623 } else {\r
106624 CRYPTO = false;\r
106625 }\r
106626 } else if (ERRORS) {\r
106627 raise( 2, p + notBool, v );\r
106628 }\r
106629 }\r
106630 r[p] = CRYPTO;\r
106631\r
106632 // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r
106633 // 'config() MODULO_MODE not an integer: {v}'\r
106634 // 'config() MODULO_MODE out of range: {v}'\r
106635 if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r
106636 MODULO_MODE = v | 0;\r
106637 }\r
106638 r[p] = MODULO_MODE;\r
106639\r
106640 // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r
106641 // 'config() POW_PRECISION not an integer: {v}'\r
106642 // 'config() POW_PRECISION out of range: {v}'\r
106643 if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r
106644 POW_PRECISION = v | 0;\r
106645 }\r
106646 r[p] = POW_PRECISION;\r
106647\r
106648 // FORMAT {object}\r
106649 // 'config() FORMAT not an object: {v}'\r
106650 if ( has( p = 'FORMAT' ) ) {\r
106651\r
106652 if ( typeof v == 'object' ) {\r
106653 FORMAT = v;\r
106654 } else if (ERRORS) {\r
106655 raise( 2, p + ' not an object', v );\r
106656 }\r
106657 }\r
106658 r[p] = FORMAT;\r
106659\r
106660 return r;\r
106661 };\r
106662\r
106663\r
106664 /*\r
106665 * Return a new BigNumber whose value is the maximum of the arguments.\r
106666 *\r
106667 * arguments {number|string|BigNumber}\r
106668 */\r
106669 BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r
106670\r
106671\r
106672 /*\r
106673 * Return a new BigNumber whose value is the minimum of the arguments.\r
106674 *\r
106675 * arguments {number|string|BigNumber}\r
106676 */\r
106677 BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r
106678\r
106679\r
106680 /*\r
106681 * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r
106682 * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r
106683 * zeros are produced).\r
106684 *\r
106685 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
106686 *\r
106687 * 'random() decimal places not an integer: {dp}'\r
106688 * 'random() decimal places out of range: {dp}'\r
106689 * 'random() crypto unavailable: {crypto}'\r
106690 */\r
106691 BigNumber.random = (function () {\r
106692 var pow2_53 = 0x20000000000000;\r
106693\r
106694 // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r
106695 // Check if Math.random() produces more than 32 bits of randomness.\r
106696 // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r
106697 // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r
106698 var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r
106699 ? function () { return mathfloor( Math.random() * pow2_53 ); }\r
106700 : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r
106701 (Math.random() * 0x800000 | 0); };\r
106702\r
106703 return function (dp) {\r
106704 var a, b, e, k, v,\r
106705 i = 0,\r
106706 c = [],\r
106707 rand = new BigNumber(ONE);\r
106708\r
106709 dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r
106710 k = mathceil( dp / LOG_BASE );\r
106711\r
106712 if (CRYPTO) {\r
106713\r
106714 // Browsers supporting crypto.getRandomValues.\r
106715 if (crypto.getRandomValues) {\r
106716\r
106717 a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r
106718\r
106719 for ( ; i < k; ) {\r
106720\r
106721 // 53 bits:\r
106722 // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r
106723 // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r
106724 // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r
106725 // 11111 11111111 11111111\r
106726 // 0x20000 is 2^21.\r
106727 v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r
106728\r
106729 // Rejection sampling:\r
106730 // 0 <= v < 9007199254740992\r
106731 // Probability that v >= 9e15, is\r
106732 // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r
106733 if ( v >= 9e15 ) {\r
106734 b = crypto.getRandomValues( new Uint32Array(2) );\r
106735 a[i] = b[0];\r
106736 a[i + 1] = b[1];\r
106737 } else {\r
106738\r
106739 // 0 <= v <= 8999999999999999\r
106740 // 0 <= (v % 1e14) <= 99999999999999\r
106741 c.push( v % 1e14 );\r
106742 i += 2;\r
106743 }\r
106744 }\r
106745 i = k / 2;\r
106746\r
106747 // Node.js supporting crypto.randomBytes.\r
106748 } else if (crypto.randomBytes) {\r
106749\r
106750 // buffer\r
106751 a = crypto.randomBytes( k *= 7 );\r
106752\r
106753 for ( ; i < k; ) {\r
106754\r
106755 // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r
106756 // 0x100000000 is 2^32, 0x1000000 is 2^24\r
106757 // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r
106758 // 0 <= v < 9007199254740992\r
106759 v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r
106760 ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r
106761 ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r
106762\r
106763 if ( v >= 9e15 ) {\r
106764 crypto.randomBytes(7).copy( a, i );\r
106765 } else {\r
106766\r
106767 // 0 <= (v % 1e14) <= 99999999999999\r
106768 c.push( v % 1e14 );\r
106769 i += 7;\r
106770 }\r
106771 }\r
106772 i = k / 7;\r
106773 } else {\r
106774 CRYPTO = false;\r
106775 if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r
106776 }\r
106777 }\r
106778\r
106779 // Use Math.random.\r
106780 if (!CRYPTO) {\r
106781\r
106782 for ( ; i < k; ) {\r
106783 v = random53bitInt();\r
106784 if ( v < 9e15 ) c[i++] = v % 1e14;\r
106785 }\r
106786 }\r
106787\r
106788 k = c[--i];\r
106789 dp %= LOG_BASE;\r
106790\r
106791 // Convert trailing digits to zeros according to dp.\r
106792 if ( k && dp ) {\r
106793 v = POWS_TEN[LOG_BASE - dp];\r
106794 c[i] = mathfloor( k / v ) * v;\r
106795 }\r
106796\r
106797 // Remove trailing elements which are zero.\r
106798 for ( ; c[i] === 0; c.pop(), i-- );\r
106799\r
106800 // Zero?\r
106801 if ( i < 0 ) {\r
106802 c = [ e = 0 ];\r
106803 } else {\r
106804\r
106805 // Remove leading elements which are zero and adjust exponent accordingly.\r
106806 for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r
106807\r
106808 // Count the digits of the first element of c to determine leading zeros, and...\r
106809 for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r
106810\r
106811 // adjust the exponent accordingly.\r
106812 if ( i < LOG_BASE ) e -= LOG_BASE - i;\r
106813 }\r
106814\r
106815 rand.e = e;\r
106816 rand.c = c;\r
106817 return rand;\r
106818 };\r
106819 })();\r
106820\r
106821\r
106822 // PRIVATE FUNCTIONS\r
106823\r
106824\r
106825 // Convert a numeric string of baseIn to a numeric string of baseOut.\r
106826 function convertBase( str, baseOut, baseIn, sign ) {\r
106827 var d, e, k, r, x, xc, y,\r
106828 i = str.indexOf( '.' ),\r
106829 dp = DECIMAL_PLACES,\r
106830 rm = ROUNDING_MODE;\r
106831\r
106832 if ( baseIn < 37 ) str = str.toLowerCase();\r
106833\r
106834 // Non-integer.\r
106835 if ( i >= 0 ) {\r
106836 k = POW_PRECISION;\r
106837\r
106838 // Unlimited precision.\r
106839 POW_PRECISION = 0;\r
106840 str = str.replace( '.', '' );\r
106841 y = new BigNumber(baseIn);\r
106842 x = y.pow( str.length - i );\r
106843 POW_PRECISION = k;\r
106844\r
106845 // Convert str as if an integer, then restore the fraction part by dividing the\r
106846 // result by its base raised to a power.\r
106847 y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r
106848 y.e = y.c.length;\r
106849 }\r
106850\r
106851 // Convert the number as integer.\r
106852 xc = toBaseOut( str, baseIn, baseOut );\r
106853 e = k = xc.length;\r
106854\r
106855 // Remove trailing zeros.\r
106856 for ( ; xc[--k] == 0; xc.pop() );\r
106857 if ( !xc[0] ) return '0';\r
106858\r
106859 if ( i < 0 ) {\r
106860 --e;\r
106861 } else {\r
106862 x.c = xc;\r
106863 x.e = e;\r
106864\r
106865 // sign is needed for correct rounding.\r
106866 x.s = sign;\r
106867 x = div( x, y, dp, rm, baseOut );\r
106868 xc = x.c;\r
106869 r = x.r;\r
106870 e = x.e;\r
106871 }\r
106872\r
106873 d = e + dp + 1;\r
106874\r
106875 // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r
106876 i = xc[d];\r
106877 k = baseOut / 2;\r
106878 r = r || d < 0 || xc[d + 1] != null;\r
106879\r
106880 r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r
106881 : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r
106882 rm == ( x.s < 0 ? 8 : 7 ) );\r
106883\r
106884 if ( d < 1 || !xc[0] ) {\r
106885\r
106886 // 1^-dp or 0.\r
106887 str = r ? toFixedPoint( '1', -dp ) : '0';\r
106888 } else {\r
106889 xc.length = d;\r
106890\r
106891 if (r) {\r
106892\r
106893 // Rounding up may mean the previous digit has to be rounded up and so on.\r
106894 for ( --baseOut; ++xc[--d] > baseOut; ) {\r
106895 xc[d] = 0;\r
106896\r
106897 if ( !d ) {\r
106898 ++e;\r
106899 xc = [1].concat(xc);\r
106900 }\r
106901 }\r
106902 }\r
106903\r
106904 // Determine trailing zeros.\r
106905 for ( k = xc.length; !xc[--k]; );\r
106906\r
106907 // E.g. [4, 11, 15] becomes 4bf.\r
106908 for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r
106909 str = toFixedPoint( str, e );\r
106910 }\r
106911\r
106912 // The caller will add the sign.\r
106913 return str;\r
106914 }\r
106915\r
106916\r
106917 // Perform division in the specified base. Called by div and convertBase.\r
106918 div = (function () {\r
106919\r
106920 // Assume non-zero x and k.\r
106921 function multiply( x, k, base ) {\r
106922 var m, temp, xlo, xhi,\r
106923 carry = 0,\r
106924 i = x.length,\r
106925 klo = k % SQRT_BASE,\r
106926 khi = k / SQRT_BASE | 0;\r
106927\r
106928 for ( x = x.slice(); i--; ) {\r
106929 xlo = x[i] % SQRT_BASE;\r
106930 xhi = x[i] / SQRT_BASE | 0;\r
106931 m = khi * xlo + xhi * klo;\r
106932 temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r
106933 carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r
106934 x[i] = temp % base;\r
106935 }\r
106936\r
106937 if (carry) x = [carry].concat(x);\r
106938\r
106939 return x;\r
106940 }\r
106941\r
106942 function compare( a, b, aL, bL ) {\r
106943 var i, cmp;\r
106944\r
106945 if ( aL != bL ) {\r
106946 cmp = aL > bL ? 1 : -1;\r
106947 } else {\r
106948\r
106949 for ( i = cmp = 0; i < aL; i++ ) {\r
106950\r
106951 if ( a[i] != b[i] ) {\r
106952 cmp = a[i] > b[i] ? 1 : -1;\r
106953 break;\r
106954 }\r
106955 }\r
106956 }\r
106957 return cmp;\r
106958 }\r
106959\r
106960 function subtract( a, b, aL, base ) {\r
106961 var i = 0;\r
106962\r
106963 // Subtract b from a.\r
106964 for ( ; aL--; ) {\r
106965 a[aL] -= i;\r
106966 i = a[aL] < b[aL] ? 1 : 0;\r
106967 a[aL] = i * base + a[aL] - b[aL];\r
106968 }\r
106969\r
106970 // Remove leading zeros.\r
106971 for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r
106972 }\r
106973\r
106974 // x: dividend, y: divisor.\r
106975 return function ( x, y, dp, rm, base ) {\r
106976 var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r
106977 yL, yz,\r
106978 s = x.s == y.s ? 1 : -1,\r
106979 xc = x.c,\r
106980 yc = y.c;\r
106981\r
106982 // Either NaN, Infinity or 0?\r
106983 if ( !xc || !xc[0] || !yc || !yc[0] ) {\r
106984\r
106985 return new BigNumber(\r
106986\r
106987 // Return NaN if either NaN, or both Infinity or 0.\r
106988 !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r
106989\r
106990 // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r
106991 xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r
106992 );\r
106993 }\r
106994\r
106995 q = new BigNumber(s);\r
106996 qc = q.c = [];\r
106997 e = x.e - y.e;\r
106998 s = dp + e + 1;\r
106999\r
107000 if ( !base ) {\r
107001 base = BASE;\r
107002 e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r
107003 s = s / LOG_BASE | 0;\r
107004 }\r
107005\r
107006 // Result exponent may be one less then the current value of e.\r
107007 // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r
107008 for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r
107009 if ( yc[i] > ( xc[i] || 0 ) ) e--;\r
107010\r
107011 if ( s < 0 ) {\r
107012 qc.push(1);\r
107013 more = true;\r
107014 } else {\r
107015 xL = xc.length;\r
107016 yL = yc.length;\r
107017 i = 0;\r
107018 s += 2;\r
107019\r
107020 // Normalise xc and yc so highest order digit of yc is >= base / 2.\r
107021\r
107022 n = mathfloor( base / ( yc[0] + 1 ) );\r
107023\r
107024 // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r
107025 // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r
107026 if ( n > 1 ) {\r
107027 yc = multiply( yc, n, base );\r
107028 xc = multiply( xc, n, base );\r
107029 yL = yc.length;\r
107030 xL = xc.length;\r
107031 }\r
107032\r
107033 xi = yL;\r
107034 rem = xc.slice( 0, yL );\r
107035 remL = rem.length;\r
107036\r
107037 // Add zeros to make remainder as long as divisor.\r
107038 for ( ; remL < yL; rem[remL++] = 0 );\r
107039 yz = yc.slice();\r
107040 yz = [0].concat(yz);\r
107041 yc0 = yc[0];\r
107042 if ( yc[1] >= base / 2 ) yc0++;\r
107043 // Not necessary, but to prevent trial digit n > base, when using base 3.\r
107044 // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r
107045\r
107046 do {\r
107047 n = 0;\r
107048\r
107049 // Compare divisor and remainder.\r
107050 cmp = compare( yc, rem, yL, remL );\r
107051\r
107052 // If divisor < remainder.\r
107053 if ( cmp < 0 ) {\r
107054\r
107055 // Calculate trial digit, n.\r
107056\r
107057 rem0 = rem[0];\r
107058 if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r
107059\r
107060 // n is how many times the divisor goes into the current remainder.\r
107061 n = mathfloor( rem0 / yc0 );\r
107062\r
107063 // Algorithm:\r
107064 // 1. product = divisor * trial digit (n)\r
107065 // 2. if product > remainder: product -= divisor, n--\r
107066 // 3. remainder -= product\r
107067 // 4. if product was < remainder at 2:\r
107068 // 5. compare new remainder and divisor\r
107069 // 6. If remainder > divisor: remainder -= divisor, n++\r
107070\r
107071 if ( n > 1 ) {\r
107072\r
107073 // n may be > base only when base is 3.\r
107074 if (n >= base) n = base - 1;\r
107075\r
107076 // product = divisor * trial digit.\r
107077 prod = multiply( yc, n, base );\r
107078 prodL = prod.length;\r
107079 remL = rem.length;\r
107080\r
107081 // Compare product and remainder.\r
107082 // If product > remainder.\r
107083 // Trial digit n too high.\r
107084 // n is 1 too high about 5% of the time, and is not known to have\r
107085 // ever been more than 1 too high.\r
107086 while ( compare( prod, rem, prodL, remL ) == 1 ) {\r
107087 n--;\r
107088\r
107089 // Subtract divisor from product.\r
107090 subtract( prod, yL < prodL ? yz : yc, prodL, base );\r
107091 prodL = prod.length;\r
107092 cmp = 1;\r
107093 }\r
107094 } else {\r
107095\r
107096 // n is 0 or 1, cmp is -1.\r
107097 // If n is 0, there is no need to compare yc and rem again below,\r
107098 // so change cmp to 1 to avoid it.\r
107099 // If n is 1, leave cmp as -1, so yc and rem are compared again.\r
107100 if ( n == 0 ) {\r
107101\r
107102 // divisor < remainder, so n must be at least 1.\r
107103 cmp = n = 1;\r
107104 }\r
107105\r
107106 // product = divisor\r
107107 prod = yc.slice();\r
107108 prodL = prod.length;\r
107109 }\r
107110\r
107111 if ( prodL < remL ) prod = [0].concat(prod);\r
107112\r
107113 // Subtract product from remainder.\r
107114 subtract( rem, prod, remL, base );\r
107115 remL = rem.length;\r
107116\r
107117 // If product was < remainder.\r
107118 if ( cmp == -1 ) {\r
107119\r
107120 // Compare divisor and new remainder.\r
107121 // If divisor < new remainder, subtract divisor from remainder.\r
107122 // Trial digit n too low.\r
107123 // n is 1 too low about 5% of the time, and very rarely 2 too low.\r
107124 while ( compare( yc, rem, yL, remL ) < 1 ) {\r
107125 n++;\r
107126\r
107127 // Subtract divisor from remainder.\r
107128 subtract( rem, yL < remL ? yz : yc, remL, base );\r
107129 remL = rem.length;\r
107130 }\r
107131 }\r
107132 } else if ( cmp === 0 ) {\r
107133 n++;\r
107134 rem = [0];\r
107135 } // else cmp === 1 and n will be 0\r
107136\r
107137 // Add the next digit, n, to the result array.\r
107138 qc[i++] = n;\r
107139\r
107140 // Update the remainder.\r
107141 if ( rem[0] ) {\r
107142 rem[remL++] = xc[xi] || 0;\r
107143 } else {\r
107144 rem = [ xc[xi] ];\r
107145 remL = 1;\r
107146 }\r
107147 } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r
107148\r
107149 more = rem[0] != null;\r
107150\r
107151 // Leading zero?\r
107152 if ( !qc[0] ) qc.splice(0, 1);\r
107153 }\r
107154\r
107155 if ( base == BASE ) {\r
107156\r
107157 // To calculate q.e, first get the number of digits of qc[0].\r
107158 for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r
107159 round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r
107160\r
107161 // Caller is convertBase.\r
107162 } else {\r
107163 q.e = e;\r
107164 q.r = +more;\r
107165 }\r
107166\r
107167 return q;\r
107168 };\r
107169 })();\r
107170\r
107171\r
107172 /*\r
107173 * Return a string representing the value of BigNumber n in fixed-point or exponential\r
107174 * notation rounded to the specified decimal places or significant digits.\r
107175 *\r
107176 * n is a BigNumber.\r
107177 * i is the index of the last digit required (i.e. the digit that may be rounded up).\r
107178 * rm is the rounding mode.\r
107179 * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r
107180 */\r
107181 function format( n, i, rm, caller ) {\r
107182 var c0, e, ne, len, str;\r
107183\r
107184 rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r
107185 ? rm | 0 : ROUNDING_MODE;\r
107186\r
107187 if ( !n.c ) return n.toString();\r
107188 c0 = n.c[0];\r
107189 ne = n.e;\r
107190\r
107191 if ( i == null ) {\r
107192 str = coeffToString( n.c );\r
107193 str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r
107194 ? toExponential( str, ne )\r
107195 : toFixedPoint( str, ne );\r
107196 } else {\r
107197 n = round( new BigNumber(n), i, rm );\r
107198\r
107199 // n.e may have changed if the value was rounded up.\r
107200 e = n.e;\r
107201\r
107202 str = coeffToString( n.c );\r
107203 len = str.length;\r
107204\r
107205 // toPrecision returns exponential notation if the number of significant digits\r
107206 // specified is less than the number of digits necessary to represent the integer\r
107207 // part of the value in fixed-point notation.\r
107208\r
107209 // Exponential notation.\r
107210 if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r
107211\r
107212 // Append zeros?\r
107213 for ( ; len < i; str += '0', len++ );\r
107214 str = toExponential( str, e );\r
107215\r
107216 // Fixed-point notation.\r
107217 } else {\r
107218 i -= ne;\r
107219 str = toFixedPoint( str, e );\r
107220\r
107221 // Append zeros?\r
107222 if ( e + 1 > len ) {\r
107223 if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r
107224 } else {\r
107225 i += e - len;\r
107226 if ( i > 0 ) {\r
107227 if ( e + 1 == len ) str += '.';\r
107228 for ( ; i--; str += '0' );\r
107229 }\r
107230 }\r
107231 }\r
107232 }\r
107233\r
107234 return n.s < 0 && c0 ? '-' + str : str;\r
107235 }\r
107236\r
107237\r
107238 // Handle BigNumber.max and BigNumber.min.\r
107239 function maxOrMin( args, method ) {\r
107240 var m, n,\r
107241 i = 0;\r
107242\r
107243 if ( isArray( args[0] ) ) args = args[0];\r
107244 m = new BigNumber( args[0] );\r
107245\r
107246 for ( ; ++i < args.length; ) {\r
107247 n = new BigNumber( args[i] );\r
107248\r
107249 // If any number is NaN, return NaN.\r
107250 if ( !n.s ) {\r
107251 m = n;\r
107252 break;\r
107253 } else if ( method.call( m, n ) ) {\r
107254 m = n;\r
107255 }\r
107256 }\r
107257\r
107258 return m;\r
107259 }\r
107260\r
107261\r
107262 /*\r
107263 * Return true if n is an integer in range, otherwise throw.\r
107264 * Use for argument validation when ERRORS is true.\r
107265 */\r
107266 function intValidatorWithErrors( n, min, max, caller, name ) {\r
107267 if ( n < min || n > max || n != truncate(n) ) {\r
107268 raise( caller, ( name || 'decimal places' ) +\r
107269 ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r
107270 }\r
107271\r
107272 return true;\r
107273 }\r
107274\r
107275\r
107276 /*\r
107277 * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r
107278 * Called by minus, plus and times.\r
107279 */\r
107280 function normalise( n, c, e ) {\r
107281 var i = 1,\r
107282 j = c.length;\r
107283\r
107284 // Remove trailing zeros.\r
107285 for ( ; !c[--j]; c.pop() );\r
107286\r
107287 // Calculate the base 10 exponent. First get the number of digits of c[0].\r
107288 for ( j = c[0]; j >= 10; j /= 10, i++ );\r
107289\r
107290 // Overflow?\r
107291 if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r
107292\r
107293 // Infinity.\r
107294 n.c = n.e = null;\r
107295\r
107296 // Underflow?\r
107297 } else if ( e < MIN_EXP ) {\r
107298\r
107299 // Zero.\r
107300 n.c = [ n.e = 0 ];\r
107301 } else {\r
107302 n.e = e;\r
107303 n.c = c;\r
107304 }\r
107305\r
107306 return n;\r
107307 }\r
107308\r
107309\r
107310 // Handle values that fail the validity test in BigNumber.\r
107311 parseNumeric = (function () {\r
107312 var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,\r
107313 dotAfter = /^([^.]+)\.$/,\r
107314 dotBefore = /^\.([^.]+)$/,\r
107315 isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r
107316 whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;\r
107317\r
107318 return function ( x, str, num, b ) {\r
107319 var base,\r
107320 s = num ? str : str.replace( whitespaceOrPlus, '' );\r
107321\r
107322 // No exception on ±Infinity or NaN.\r
107323 if ( isInfinityOrNaN.test(s) ) {\r
107324 x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r
107325 } else {\r
107326 if ( !num ) {\r
107327\r
107328 // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i\r
107329 s = s.replace( basePrefix, function ( m, p1, p2 ) {\r
107330 base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r
107331 return !b || b == base ? p1 : m;\r
107332 });\r
107333\r
107334 if (b) {\r
107335 base = b;\r
107336\r
107337 // E.g. '1.' to '1', '.1' to '0.1'\r
107338 s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r
107339 }\r
107340\r
107341 if ( str != s ) return new BigNumber( s, base );\r
107342 }\r
107343\r
107344 // 'new BigNumber() not a number: {n}'\r
107345 // 'new BigNumber() not a base {b} number: {n}'\r
107346 if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r
107347 x.s = null;\r
107348 }\r
107349\r
107350 x.c = x.e = null;\r
107351 id = 0;\r
107352 }\r
107353 })();\r
107354\r
107355\r
107356 // Throw a BigNumber Error.\r
107357 function raise( caller, msg, val ) {\r
107358 var error = new Error( [\r
107359 'new BigNumber', // 0\r
107360 'cmp', // 1\r
107361 'config', // 2\r
107362 'div', // 3\r
107363 'divToInt', // 4\r
107364 'eq', // 5\r
107365 'gt', // 6\r
107366 'gte', // 7\r
107367 'lt', // 8\r
107368 'lte', // 9\r
107369 'minus', // 10\r
107370 'mod', // 11\r
107371 'plus', // 12\r
107372 'precision', // 13\r
107373 'random', // 14\r
107374 'round', // 15\r
107375 'shift', // 16\r
107376 'times', // 17\r
107377 'toDigits', // 18\r
107378 'toExponential', // 19\r
107379 'toFixed', // 20\r
107380 'toFormat', // 21\r
107381 'toFraction', // 22\r
107382 'pow', // 23\r
107383 'toPrecision', // 24\r
107384 'toString', // 25\r
107385 'BigNumber' // 26\r
107386 ][caller] + '() ' + msg + ': ' + val );\r
107387\r
107388 error.name = 'BigNumber Error';\r
107389 id = 0;\r
107390 throw error;\r
107391 }\r
107392\r
107393\r
107394 /*\r
107395 * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r
107396 * If r is truthy, it is known that there are more digits after the rounding digit.\r
107397 */\r
107398 function round( x, sd, rm, r ) {\r
107399 var d, i, j, k, n, ni, rd,\r
107400 xc = x.c,\r
107401 pows10 = POWS_TEN;\r
107402\r
107403 // if x is not Infinity or NaN...\r
107404 if (xc) {\r
107405\r
107406 // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r
107407 // n is a base 1e14 number, the value of the element of array x.c containing rd.\r
107408 // ni is the index of n within x.c.\r
107409 // d is the number of digits of n.\r
107410 // i is the index of rd within n including leading zeros.\r
107411 // j is the actual index of rd within n (if < 0, rd is a leading zero).\r
107412 out: {\r
107413\r
107414 // Get the number of digits of the first element of xc.\r
107415 for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r
107416 i = sd - d;\r
107417\r
107418 // If the rounding digit is in the first element of xc...\r
107419 if ( i < 0 ) {\r
107420 i += LOG_BASE;\r
107421 j = sd;\r
107422 n = xc[ ni = 0 ];\r
107423\r
107424 // Get the rounding digit at index j of n.\r
107425 rd = n / pows10[ d - j - 1 ] % 10 | 0;\r
107426 } else {\r
107427 ni = mathceil( ( i + 1 ) / LOG_BASE );\r
107428\r
107429 if ( ni >= xc.length ) {\r
107430\r
107431 if (r) {\r
107432\r
107433 // Needed by sqrt.\r
107434 for ( ; xc.length <= ni; xc.push(0) );\r
107435 n = rd = 0;\r
107436 d = 1;\r
107437 i %= LOG_BASE;\r
107438 j = i - LOG_BASE + 1;\r
107439 } else {\r
107440 break out;\r
107441 }\r
107442 } else {\r
107443 n = k = xc[ni];\r
107444\r
107445 // Get the number of digits of n.\r
107446 for ( d = 1; k >= 10; k /= 10, d++ );\r
107447\r
107448 // Get the index of rd within n.\r
107449 i %= LOG_BASE;\r
107450\r
107451 // Get the index of rd within n, adjusted for leading zeros.\r
107452 // The number of leading zeros of n is given by LOG_BASE - d.\r
107453 j = i - LOG_BASE + d;\r
107454\r
107455 // Get the rounding digit at index j of n.\r
107456 rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r
107457 }\r
107458 }\r
107459\r
107460 r = r || sd < 0 ||\r
107461\r
107462 // Are there any non-zero digits after the rounding digit?\r
107463 // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r
107464 // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r
107465 xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r
107466\r
107467 r = rm < 4\r
107468 ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r
107469 : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r
107470\r
107471 // Check whether the digit to the left of the rounding digit is odd.\r
107472 ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r
107473 rm == ( x.s < 0 ? 8 : 7 ) );\r
107474\r
107475 if ( sd < 1 || !xc[0] ) {\r
107476 xc.length = 0;\r
107477\r
107478 if (r) {\r
107479\r
107480 // Convert sd to decimal places.\r
107481 sd -= x.e + 1;\r
107482\r
107483 // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r
107484 xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r
107485 x.e = -sd || 0;\r
107486 } else {\r
107487\r
107488 // Zero.\r
107489 xc[0] = x.e = 0;\r
107490 }\r
107491\r
107492 return x;\r
107493 }\r
107494\r
107495 // Remove excess digits.\r
107496 if ( i == 0 ) {\r
107497 xc.length = ni;\r
107498 k = 1;\r
107499 ni--;\r
107500 } else {\r
107501 xc.length = ni + 1;\r
107502 k = pows10[ LOG_BASE - i ];\r
107503\r
107504 // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r
107505 // j > 0 means i > number of leading zeros of n.\r
107506 xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r
107507 }\r
107508\r
107509 // Round up?\r
107510 if (r) {\r
107511\r
107512 for ( ; ; ) {\r
107513\r
107514 // If the digit to be rounded up is in the first element of xc...\r
107515 if ( ni == 0 ) {\r
107516\r
107517 // i will be the length of xc[0] before k is added.\r
107518 for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r
107519 j = xc[0] += k;\r
107520 for ( k = 1; j >= 10; j /= 10, k++ );\r
107521\r
107522 // if i != k the length has increased.\r
107523 if ( i != k ) {\r
107524 x.e++;\r
107525 if ( xc[0] == BASE ) xc[0] = 1;\r
107526 }\r
107527\r
107528 break;\r
107529 } else {\r
107530 xc[ni] += k;\r
107531 if ( xc[ni] != BASE ) break;\r
107532 xc[ni--] = 0;\r
107533 k = 1;\r
107534 }\r
107535 }\r
107536 }\r
107537\r
107538 // Remove trailing zeros.\r
107539 for ( i = xc.length; xc[--i] === 0; xc.pop() );\r
107540 }\r
107541\r
107542 // Overflow? Infinity.\r
107543 if ( x.e > MAX_EXP ) {\r
107544 x.c = x.e = null;\r
107545\r
107546 // Underflow? Zero.\r
107547 } else if ( x.e < MIN_EXP ) {\r
107548 x.c = [ x.e = 0 ];\r
107549 }\r
107550 }\r
107551\r
107552 return x;\r
107553 }\r
107554\r
107555\r
107556 // PROTOTYPE/INSTANCE METHODS\r
107557\r
107558\r
107559 /*\r
107560 * Return a new BigNumber whose value is the absolute value of this BigNumber.\r
107561 */\r
107562 P.absoluteValue = P.abs = function () {\r
107563 var x = new BigNumber(this);\r
107564 if ( x.s < 0 ) x.s = 1;\r
107565 return x;\r
107566 };\r
107567\r
107568\r
107569 /*\r
107570 * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r
107571 * number in the direction of Infinity.\r
107572 */\r
107573 P.ceil = function () {\r
107574 return round( new BigNumber(this), this.e + 1, 2 );\r
107575 };\r
107576\r
107577\r
107578 /*\r
107579 * Return\r
107580 * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r
107581 * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r
107582 * 0 if they have the same value,\r
107583 * or null if the value of either is NaN.\r
107584 */\r
107585 P.comparedTo = P.cmp = function ( y, b ) {\r
107586 id = 1;\r
107587 return compare( this, new BigNumber( y, b ) );\r
107588 };\r
107589\r
107590\r
107591 /*\r
107592 * Return the number of decimal places of the value of this BigNumber, or null if the value\r
107593 * of this BigNumber is ±Infinity or NaN.\r
107594 */\r
107595 P.decimalPlaces = P.dp = function () {\r
107596 var n, v,\r
107597 c = this.c;\r
107598\r
107599 if ( !c ) return null;\r
107600 n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r
107601\r
107602 // Subtract the number of trailing zeros of the last number.\r
107603 if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r
107604 if ( n < 0 ) n = 0;\r
107605\r
107606 return n;\r
107607 };\r
107608\r
107609\r
107610 /*\r
107611 * n / 0 = I\r
107612 * n / N = N\r
107613 * n / I = 0\r
107614 * 0 / n = 0\r
107615 * 0 / 0 = N\r
107616 * 0 / N = N\r
107617 * 0 / I = 0\r
107618 * N / n = N\r
107619 * N / 0 = N\r
107620 * N / N = N\r
107621 * N / I = N\r
107622 * I / n = I\r
107623 * I / 0 = I\r
107624 * I / N = N\r
107625 * I / I = N\r
107626 *\r
107627 * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r
107628 * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r
107629 */\r
107630 P.dividedBy = P.div = function ( y, b ) {\r
107631 id = 3;\r
107632 return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r
107633 };\r
107634\r
107635\r
107636 /*\r
107637 * Return a new BigNumber whose value is the integer part of dividing the value of this\r
107638 * BigNumber by the value of BigNumber(y, b).\r
107639 */\r
107640 P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r
107641 id = 4;\r
107642 return div( this, new BigNumber( y, b ), 0, 1 );\r
107643 };\r
107644\r
107645\r
107646 /*\r
107647 * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r
107648 * otherwise returns false.\r
107649 */\r
107650 P.equals = P.eq = function ( y, b ) {\r
107651 id = 5;\r
107652 return compare( this, new BigNumber( y, b ) ) === 0;\r
107653 };\r
107654\r
107655\r
107656 /*\r
107657 * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r
107658 * number in the direction of -Infinity.\r
107659 */\r
107660 P.floor = function () {\r
107661 return round( new BigNumber(this), this.e + 1, 3 );\r
107662 };\r
107663\r
107664\r
107665 /*\r
107666 * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r
107667 * otherwise returns false.\r
107668 */\r
107669 P.greaterThan = P.gt = function ( y, b ) {\r
107670 id = 6;\r
107671 return compare( this, new BigNumber( y, b ) ) > 0;\r
107672 };\r
107673\r
107674\r
107675 /*\r
107676 * Return true if the value of this BigNumber is greater than or equal to the value of\r
107677 * BigNumber(y, b), otherwise returns false.\r
107678 */\r
107679 P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r
107680 id = 7;\r
107681 return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r
107682\r
107683 };\r
107684\r
107685\r
107686 /*\r
107687 * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r
107688 */\r
107689 P.isFinite = function () {\r
107690 return !!this.c;\r
107691 };\r
107692\r
107693\r
107694 /*\r
107695 * Return true if the value of this BigNumber is an integer, otherwise return false.\r
107696 */\r
107697 P.isInteger = P.isInt = function () {\r
107698 return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r
107699 };\r
107700\r
107701\r
107702 /*\r
107703 * Return true if the value of this BigNumber is NaN, otherwise returns false.\r
107704 */\r
107705 P.isNaN = function () {\r
107706 return !this.s;\r
107707 };\r
107708\r
107709\r
107710 /*\r
107711 * Return true if the value of this BigNumber is negative, otherwise returns false.\r
107712 */\r
107713 P.isNegative = P.isNeg = function () {\r
107714 return this.s < 0;\r
107715 };\r
107716\r
107717\r
107718 /*\r
107719 * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r
107720 */\r
107721 P.isZero = function () {\r
107722 return !!this.c && this.c[0] == 0;\r
107723 };\r
107724\r
107725\r
107726 /*\r
107727 * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r
107728 * otherwise returns false.\r
107729 */\r
107730 P.lessThan = P.lt = function ( y, b ) {\r
107731 id = 8;\r
107732 return compare( this, new BigNumber( y, b ) ) < 0;\r
107733 };\r
107734\r
107735\r
107736 /*\r
107737 * Return true if the value of this BigNumber is less than or equal to the value of\r
107738 * BigNumber(y, b), otherwise returns false.\r
107739 */\r
107740 P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r
107741 id = 9;\r
107742 return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r
107743 };\r
107744\r
107745\r
107746 /*\r
107747 * n - 0 = n\r
107748 * n - N = N\r
107749 * n - I = -I\r
107750 * 0 - n = -n\r
107751 * 0 - 0 = 0\r
107752 * 0 - N = N\r
107753 * 0 - I = -I\r
107754 * N - n = N\r
107755 * N - 0 = N\r
107756 * N - N = N\r
107757 * N - I = N\r
107758 * I - n = I\r
107759 * I - 0 = I\r
107760 * I - N = N\r
107761 * I - I = N\r
107762 *\r
107763 * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r
107764 * BigNumber(y, b).\r
107765 */\r
107766 P.minus = P.sub = function ( y, b ) {\r
107767 var i, j, t, xLTy,\r
107768 x = this,\r
107769 a = x.s;\r
107770\r
107771 id = 10;\r
107772 y = new BigNumber( y, b );\r
107773 b = y.s;\r
107774\r
107775 // Either NaN?\r
107776 if ( !a || !b ) return new BigNumber(NaN);\r
107777\r
107778 // Signs differ?\r
107779 if ( a != b ) {\r
107780 y.s = -b;\r
107781 return x.plus(y);\r
107782 }\r
107783\r
107784 var xe = x.e / LOG_BASE,\r
107785 ye = y.e / LOG_BASE,\r
107786 xc = x.c,\r
107787 yc = y.c;\r
107788\r
107789 if ( !xe || !ye ) {\r
107790\r
107791 // Either Infinity?\r
107792 if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r
107793\r
107794 // Either zero?\r
107795 if ( !xc[0] || !yc[0] ) {\r
107796\r
107797 // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r
107798 return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r
107799\r
107800 // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r
107801 ROUNDING_MODE == 3 ? -0 : 0 );\r
107802 }\r
107803 }\r
107804\r
107805 xe = bitFloor(xe);\r
107806 ye = bitFloor(ye);\r
107807 xc = xc.slice();\r
107808\r
107809 // Determine which is the bigger number.\r
107810 if ( a = xe - ye ) {\r
107811\r
107812 if ( xLTy = a < 0 ) {\r
107813 a = -a;\r
107814 t = xc;\r
107815 } else {\r
107816 ye = xe;\r
107817 t = yc;\r
107818 }\r
107819\r
107820 t.reverse();\r
107821\r
107822 // Prepend zeros to equalise exponents.\r
107823 for ( b = a; b--; t.push(0) );\r
107824 t.reverse();\r
107825 } else {\r
107826\r
107827 // Exponents equal. Check digit by digit.\r
107828 j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r
107829\r
107830 for ( a = b = 0; b < j; b++ ) {\r
107831\r
107832 if ( xc[b] != yc[b] ) {\r
107833 xLTy = xc[b] < yc[b];\r
107834 break;\r
107835 }\r
107836 }\r
107837 }\r
107838\r
107839 // x < y? Point xc to the array of the bigger number.\r
107840 if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r
107841\r
107842 b = ( j = yc.length ) - ( i = xc.length );\r
107843\r
107844 // Append zeros to xc if shorter.\r
107845 // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r
107846 if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r
107847 b = BASE - 1;\r
107848\r
107849 // Subtract yc from xc.\r
107850 for ( ; j > a; ) {\r
107851\r
107852 if ( xc[--j] < yc[j] ) {\r
107853 for ( i = j; i && !xc[--i]; xc[i] = b );\r
107854 --xc[i];\r
107855 xc[j] += BASE;\r
107856 }\r
107857\r
107858 xc[j] -= yc[j];\r
107859 }\r
107860\r
107861 // Remove leading zeros and adjust exponent accordingly.\r
107862 for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r
107863\r
107864 // Zero?\r
107865 if ( !xc[0] ) {\r
107866\r
107867 // Following IEEE 754 (2008) 6.3,\r
107868 // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r
107869 y.s = ROUNDING_MODE == 3 ? -1 : 1;\r
107870 y.c = [ y.e = 0 ];\r
107871 return y;\r
107872 }\r
107873\r
107874 // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r
107875 // for finite x and y.\r
107876 return normalise( y, xc, ye );\r
107877 };\r
107878\r
107879\r
107880 /*\r
107881 * n % 0 = N\r
107882 * n % N = N\r
107883 * n % I = n\r
107884 * 0 % n = 0\r
107885 * -0 % n = -0\r
107886 * 0 % 0 = N\r
107887 * 0 % N = N\r
107888 * 0 % I = 0\r
107889 * N % n = N\r
107890 * N % 0 = N\r
107891 * N % N = N\r
107892 * N % I = N\r
107893 * I % n = N\r
107894 * I % 0 = N\r
107895 * I % N = N\r
107896 * I % I = N\r
107897 *\r
107898 * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r
107899 * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r
107900 */\r
107901 P.modulo = P.mod = function ( y, b ) {\r
107902 var q, s,\r
107903 x = this;\r
107904\r
107905 id = 11;\r
107906 y = new BigNumber( y, b );\r
107907\r
107908 // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r
107909 if ( !x.c || !y.s || y.c && !y.c[0] ) {\r
107910 return new BigNumber(NaN);\r
107911\r
107912 // Return x if y is Infinity or x is zero.\r
107913 } else if ( !y.c || x.c && !x.c[0] ) {\r
107914 return new BigNumber(x);\r
107915 }\r
107916\r
107917 if ( MODULO_MODE == 9 ) {\r
107918\r
107919 // Euclidian division: q = sign(y) * floor(x / abs(y))\r
107920 // r = x - qy where 0 <= r < abs(y)\r
107921 s = y.s;\r
107922 y.s = 1;\r
107923 q = div( x, y, 0, 3 );\r
107924 y.s = s;\r
107925 q.s *= s;\r
107926 } else {\r
107927 q = div( x, y, 0, MODULO_MODE );\r
107928 }\r
107929\r
107930 return x.minus( q.times(y) );\r
107931 };\r
107932\r
107933\r
107934 /*\r
107935 * Return a new BigNumber whose value is the value of this BigNumber negated,\r
107936 * i.e. multiplied by -1.\r
107937 */\r
107938 P.negated = P.neg = function () {\r
107939 var x = new BigNumber(this);\r
107940 x.s = -x.s || null;\r
107941 return x;\r
107942 };\r
107943\r
107944\r
107945 /*\r
107946 * n + 0 = n\r
107947 * n + N = N\r
107948 * n + I = I\r
107949 * 0 + n = n\r
107950 * 0 + 0 = 0\r
107951 * 0 + N = N\r
107952 * 0 + I = I\r
107953 * N + n = N\r
107954 * N + 0 = N\r
107955 * N + N = N\r
107956 * N + I = N\r
107957 * I + n = I\r
107958 * I + 0 = I\r
107959 * I + N = N\r
107960 * I + I = I\r
107961 *\r
107962 * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r
107963 * BigNumber(y, b).\r
107964 */\r
107965 P.plus = P.add = function ( y, b ) {\r
107966 var t,\r
107967 x = this,\r
107968 a = x.s;\r
107969\r
107970 id = 12;\r
107971 y = new BigNumber( y, b );\r
107972 b = y.s;\r
107973\r
107974 // Either NaN?\r
107975 if ( !a || !b ) return new BigNumber(NaN);\r
107976\r
107977 // Signs differ?\r
107978 if ( a != b ) {\r
107979 y.s = -b;\r
107980 return x.minus(y);\r
107981 }\r
107982\r
107983 var xe = x.e / LOG_BASE,\r
107984 ye = y.e / LOG_BASE,\r
107985 xc = x.c,\r
107986 yc = y.c;\r
107987\r
107988 if ( !xe || !ye ) {\r
107989\r
107990 // Return ±Infinity if either ±Infinity.\r
107991 if ( !xc || !yc ) return new BigNumber( a / 0 );\r
107992\r
107993 // Either zero?\r
107994 // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r
107995 if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r
107996 }\r
107997\r
107998 xe = bitFloor(xe);\r
107999 ye = bitFloor(ye);\r
108000 xc = xc.slice();\r
108001\r
108002 // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r
108003 if ( a = xe - ye ) {\r
108004 if ( a > 0 ) {\r
108005 ye = xe;\r
108006 t = yc;\r
108007 } else {\r
108008 a = -a;\r
108009 t = xc;\r
108010 }\r
108011\r
108012 t.reverse();\r
108013 for ( ; a--; t.push(0) );\r
108014 t.reverse();\r
108015 }\r
108016\r
108017 a = xc.length;\r
108018 b = yc.length;\r
108019\r
108020 // Point xc to the longer array, and b to the shorter length.\r
108021 if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r
108022\r
108023 // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r
108024 for ( a = 0; b; ) {\r
108025 a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r
108026 xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r
108027 }\r
108028\r
108029 if (a) {\r
108030 xc = [a].concat(xc);\r
108031 ++ye;\r
108032 }\r
108033\r
108034 // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r
108035 // ye = MAX_EXP + 1 possible\r
108036 return normalise( y, xc, ye );\r
108037 };\r
108038\r
108039\r
108040 /*\r
108041 * Return the number of significant digits of the value of this BigNumber.\r
108042 *\r
108043 * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r
108044 */\r
108045 P.precision = P.sd = function (z) {\r
108046 var n, v,\r
108047 x = this,\r
108048 c = x.c;\r
108049\r
108050 // 'precision() argument not a boolean or binary digit: {z}'\r
108051 if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r
108052 if (ERRORS) raise( 13, 'argument' + notBool, z );\r
108053 if ( z != !!z ) z = null;\r
108054 }\r
108055\r
108056 if ( !c ) return null;\r
108057 v = c.length - 1;\r
108058 n = v * LOG_BASE + 1;\r
108059\r
108060 if ( v = c[v] ) {\r
108061\r
108062 // Subtract the number of trailing zeros of the last element.\r
108063 for ( ; v % 10 == 0; v /= 10, n-- );\r
108064\r
108065 // Add the number of digits of the first element.\r
108066 for ( v = c[0]; v >= 10; v /= 10, n++ );\r
108067 }\r
108068\r
108069 if ( z && x.e + 1 > n ) n = x.e + 1;\r
108070\r
108071 return n;\r
108072 };\r
108073\r
108074\r
108075 /*\r
108076 * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r
108077 * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r
108078 * omitted.\r
108079 *\r
108080 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
108081 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
108082 *\r
108083 * 'round() decimal places out of range: {dp}'\r
108084 * 'round() decimal places not an integer: {dp}'\r
108085 * 'round() rounding mode not an integer: {rm}'\r
108086 * 'round() rounding mode out of range: {rm}'\r
108087 */\r
108088 P.round = function ( dp, rm ) {\r
108089 var n = new BigNumber(this);\r
108090\r
108091 if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r
108092 round( n, ~~dp + this.e + 1, rm == null ||\r
108093 !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r
108094 }\r
108095\r
108096 return n;\r
108097 };\r
108098\r
108099\r
108100 /*\r
108101 * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r
108102 * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r
108103 *\r
108104 * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r
108105 *\r
108106 * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r
108107 * otherwise.\r
108108 *\r
108109 * 'shift() argument not an integer: {k}'\r
108110 * 'shift() argument out of range: {k}'\r
108111 */\r
108112 P.shift = function (k) {\r
108113 var n = this;\r
108114 return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r
108115\r
108116 // k < 1e+21, or truncate(k) will produce exponential notation.\r
108117 ? n.times( '1e' + truncate(k) )\r
108118 : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r
108119 ? n.s * ( k < 0 ? 0 : 1 / 0 )\r
108120 : n );\r
108121 };\r
108122\r
108123\r
108124 /*\r
108125 * sqrt(-n) = N\r
108126 * sqrt( N) = N\r
108127 * sqrt(-I) = N\r
108128 * sqrt( I) = I\r
108129 * sqrt( 0) = 0\r
108130 * sqrt(-0) = -0\r
108131 *\r
108132 * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r
108133 * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r
108134 */\r
108135 P.squareRoot = P.sqrt = function () {\r
108136 var m, n, r, rep, t,\r
108137 x = this,\r
108138 c = x.c,\r
108139 s = x.s,\r
108140 e = x.e,\r
108141 dp = DECIMAL_PLACES + 4,\r
108142 half = new BigNumber('0.5');\r
108143\r
108144 // Negative/NaN/Infinity/zero?\r
108145 if ( s !== 1 || !c || !c[0] ) {\r
108146 return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r
108147 }\r
108148\r
108149 // Initial estimate.\r
108150 s = Math.sqrt( +x );\r
108151\r
108152 // Math.sqrt underflow/overflow?\r
108153 // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r
108154 if ( s == 0 || s == 1 / 0 ) {\r
108155 n = coeffToString(c);\r
108156 if ( ( n.length + e ) % 2 == 0 ) n += '0';\r
108157 s = Math.sqrt(n);\r
108158 e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r
108159\r
108160 if ( s == 1 / 0 ) {\r
108161 n = '1e' + e;\r
108162 } else {\r
108163 n = s.toExponential();\r
108164 n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r
108165 }\r
108166\r
108167 r = new BigNumber(n);\r
108168 } else {\r
108169 r = new BigNumber( s + '' );\r
108170 }\r
108171\r
108172 // Check for zero.\r
108173 // r could be zero if MIN_EXP is changed after the this value was created.\r
108174 // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r
108175 // coeffToString to throw.\r
108176 if ( r.c[0] ) {\r
108177 e = r.e;\r
108178 s = e + dp;\r
108179 if ( s < 3 ) s = 0;\r
108180\r
108181 // Newton-Raphson iteration.\r
108182 for ( ; ; ) {\r
108183 t = r;\r
108184 r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r
108185\r
108186 if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r
108187 coeffToString( r.c ) ).slice( 0, s ) ) {\r
108188\r
108189 // The exponent of r may here be one less than the final result exponent,\r
108190 // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r
108191 // are indexed correctly.\r
108192 if ( r.e < e ) --s;\r
108193 n = n.slice( s - 3, s + 1 );\r
108194\r
108195 // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r
108196 // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r
108197 // iteration.\r
108198 if ( n == '9999' || !rep && n == '4999' ) {\r
108199\r
108200 // On the first iteration only, check to see if rounding up gives the\r
108201 // exact result as the nines may infinitely repeat.\r
108202 if ( !rep ) {\r
108203 round( t, t.e + DECIMAL_PLACES + 2, 0 );\r
108204\r
108205 if ( t.times(t).eq(x) ) {\r
108206 r = t;\r
108207 break;\r
108208 }\r
108209 }\r
108210\r
108211 dp += 4;\r
108212 s += 4;\r
108213 rep = 1;\r
108214 } else {\r
108215\r
108216 // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r
108217 // result. If not, then there are further digits and m will be truthy.\r
108218 if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r
108219\r
108220 // Truncate to the first rounding digit.\r
108221 round( r, r.e + DECIMAL_PLACES + 2, 1 );\r
108222 m = !r.times(r).eq(x);\r
108223 }\r
108224\r
108225 break;\r
108226 }\r
108227 }\r
108228 }\r
108229 }\r
108230\r
108231 return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r
108232 };\r
108233\r
108234\r
108235 /*\r
108236 * n * 0 = 0\r
108237 * n * N = N\r
108238 * n * I = I\r
108239 * 0 * n = 0\r
108240 * 0 * 0 = 0\r
108241 * 0 * N = N\r
108242 * 0 * I = N\r
108243 * N * n = N\r
108244 * N * 0 = N\r
108245 * N * N = N\r
108246 * N * I = N\r
108247 * I * n = I\r
108248 * I * 0 = N\r
108249 * I * N = N\r
108250 * I * I = I\r
108251 *\r
108252 * Return a new BigNumber whose value is the value of this BigNumber times the value of\r
108253 * BigNumber(y, b).\r
108254 */\r
108255 P.times = P.mul = function ( y, b ) {\r
108256 var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r
108257 base, sqrtBase,\r
108258 x = this,\r
108259 xc = x.c,\r
108260 yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r
108261\r
108262 // Either NaN, ±Infinity or ±0?\r
108263 if ( !xc || !yc || !xc[0] || !yc[0] ) {\r
108264\r
108265 // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r
108266 if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r
108267 y.c = y.e = y.s = null;\r
108268 } else {\r
108269 y.s *= x.s;\r
108270\r
108271 // Return ±Infinity if either is ±Infinity.\r
108272 if ( !xc || !yc ) {\r
108273 y.c = y.e = null;\r
108274\r
108275 // Return ±0 if either is ±0.\r
108276 } else {\r
108277 y.c = [0];\r
108278 y.e = 0;\r
108279 }\r
108280 }\r
108281\r
108282 return y;\r
108283 }\r
108284\r
108285 e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r
108286 y.s *= x.s;\r
108287 xcL = xc.length;\r
108288 ycL = yc.length;\r
108289\r
108290 // Ensure xc points to longer array and xcL to its length.\r
108291 if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r
108292\r
108293 // Initialise the result array with zeros.\r
108294 for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r
108295\r
108296 base = BASE;\r
108297 sqrtBase = SQRT_BASE;\r
108298\r
108299 for ( i = ycL; --i >= 0; ) {\r
108300 c = 0;\r
108301 ylo = yc[i] % sqrtBase;\r
108302 yhi = yc[i] / sqrtBase | 0;\r
108303\r
108304 for ( k = xcL, j = i + k; j > i; ) {\r
108305 xlo = xc[--k] % sqrtBase;\r
108306 xhi = xc[k] / sqrtBase | 0;\r
108307 m = yhi * xlo + xhi * ylo;\r
108308 xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r
108309 c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r
108310 zc[j--] = xlo % base;\r
108311 }\r
108312\r
108313 zc[j] = c;\r
108314 }\r
108315\r
108316 if (c) {\r
108317 ++e;\r
108318 } else {\r
108319 zc.splice(0, 1);\r
108320 }\r
108321\r
108322 return normalise( y, zc, e );\r
108323 };\r
108324\r
108325\r
108326 /*\r
108327 * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r
108328 * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r
108329 *\r
108330 * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r
108331 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
108332 *\r
108333 * 'toDigits() precision out of range: {sd}'\r
108334 * 'toDigits() precision not an integer: {sd}'\r
108335 * 'toDigits() rounding mode not an integer: {rm}'\r
108336 * 'toDigits() rounding mode out of range: {rm}'\r
108337 */\r
108338 P.toDigits = function ( sd, rm ) {\r
108339 var n = new BigNumber(this);\r
108340 sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r
108341 rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r
108342 return sd ? round( n, sd, rm ) : n;\r
108343 };\r
108344\r
108345\r
108346 /*\r
108347 * Return a string representing the value of this BigNumber in exponential notation and\r
108348 * rounded using ROUNDING_MODE to dp fixed decimal places.\r
108349 *\r
108350 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
108351 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
108352 *\r
108353 * 'toExponential() decimal places not an integer: {dp}'\r
108354 * 'toExponential() decimal places out of range: {dp}'\r
108355 * 'toExponential() rounding mode not an integer: {rm}'\r
108356 * 'toExponential() rounding mode out of range: {rm}'\r
108357 */\r
108358 P.toExponential = function ( dp, rm ) {\r
108359 return format( this,\r
108360 dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r
108361 };\r
108362\r
108363\r
108364 /*\r
108365 * Return a string representing the value of this BigNumber in fixed-point notation rounding\r
108366 * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r
108367 *\r
108368 * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r
108369 * but e.g. (-0.00001).toFixed(0) is '-0'.\r
108370 *\r
108371 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
108372 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
108373 *\r
108374 * 'toFixed() decimal places not an integer: {dp}'\r
108375 * 'toFixed() decimal places out of range: {dp}'\r
108376 * 'toFixed() rounding mode not an integer: {rm}'\r
108377 * 'toFixed() rounding mode out of range: {rm}'\r
108378 */\r
108379 P.toFixed = function ( dp, rm ) {\r
108380 return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r
108381 ? ~~dp + this.e + 1 : null, rm, 20 );\r
108382 };\r
108383\r
108384\r
108385 /*\r
108386 * Return a string representing the value of this BigNumber in fixed-point notation rounded\r
108387 * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r
108388 * of the FORMAT object (see BigNumber.config).\r
108389 *\r
108390 * FORMAT = {\r
108391 * decimalSeparator : '.',\r
108392 * groupSeparator : ',',\r
108393 * groupSize : 3,\r
108394 * secondaryGroupSize : 0,\r
108395 * fractionGroupSeparator : '\xA0', // non-breaking space\r
108396 * fractionGroupSize : 0\r
108397 * };\r
108398 *\r
108399 * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r
108400 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
108401 *\r
108402 * 'toFormat() decimal places not an integer: {dp}'\r
108403 * 'toFormat() decimal places out of range: {dp}'\r
108404 * 'toFormat() rounding mode not an integer: {rm}'\r
108405 * 'toFormat() rounding mode out of range: {rm}'\r
108406 */\r
108407 P.toFormat = function ( dp, rm ) {\r
108408 var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r
108409 ? ~~dp + this.e + 1 : null, rm, 21 );\r
108410\r
108411 if ( this.c ) {\r
108412 var i,\r
108413 arr = str.split('.'),\r
108414 g1 = +FORMAT.groupSize,\r
108415 g2 = +FORMAT.secondaryGroupSize,\r
108416 groupSeparator = FORMAT.groupSeparator,\r
108417 intPart = arr[0],\r
108418 fractionPart = arr[1],\r
108419 isNeg = this.s < 0,\r
108420 intDigits = isNeg ? intPart.slice(1) : intPart,\r
108421 len = intDigits.length;\r
108422\r
108423 if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r
108424\r
108425 if ( g1 > 0 && len > 0 ) {\r
108426 i = len % g1 || g1;\r
108427 intPart = intDigits.substr( 0, i );\r
108428\r
108429 for ( ; i < len; i += g1 ) {\r
108430 intPart += groupSeparator + intDigits.substr( i, g1 );\r
108431 }\r
108432\r
108433 if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r
108434 if (isNeg) intPart = '-' + intPart;\r
108435 }\r
108436\r
108437 str = fractionPart\r
108438 ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r
108439 ? fractionPart.replace( new RegExp( '\\d{' + g2 + '}\\B', 'g' ),\r
108440 '$&' + FORMAT.fractionGroupSeparator )\r
108441 : fractionPart )\r
108442 : intPart;\r
108443 }\r
108444\r
108445 return str;\r
108446 };\r
108447\r
108448\r
108449 /*\r
108450 * Return a string array representing the value of this BigNumber as a simple fraction with\r
108451 * an integer numerator and an integer denominator. The denominator will be a positive\r
108452 * non-zero value less than or equal to the specified maximum denominator. If a maximum\r
108453 * denominator is not specified, the denominator will be the lowest value necessary to\r
108454 * represent the number exactly.\r
108455 *\r
108456 * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r
108457 *\r
108458 * 'toFraction() max denominator not an integer: {md}'\r
108459 * 'toFraction() max denominator out of range: {md}'\r
108460 */\r
108461 P.toFraction = function (md) {\r
108462 var arr, d0, d2, e, exp, n, n0, q, s,\r
108463 k = ERRORS,\r
108464 x = this,\r
108465 xc = x.c,\r
108466 d = new BigNumber(ONE),\r
108467 n1 = d0 = new BigNumber(ONE),\r
108468 d1 = n0 = new BigNumber(ONE);\r
108469\r
108470 if ( md != null ) {\r
108471 ERRORS = false;\r
108472 n = new BigNumber(md);\r
108473 ERRORS = k;\r
108474\r
108475 if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r
108476\r
108477 if (ERRORS) {\r
108478 raise( 22,\r
108479 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r
108480 }\r
108481\r
108482 // ERRORS is false:\r
108483 // If md is a finite non-integer >= 1, round it to an integer and use it.\r
108484 md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r
108485 }\r
108486 }\r
108487\r
108488 if ( !xc ) return x.toString();\r
108489 s = coeffToString(xc);\r
108490\r
108491 // Determine initial denominator.\r
108492 // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r
108493 e = d.e = s.length - x.e - 1;\r
108494 d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r
108495 md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r
108496\r
108497 exp = MAX_EXP;\r
108498 MAX_EXP = 1 / 0;\r
108499 n = new BigNumber(s);\r
108500\r
108501 // n0 = d1 = 0\r
108502 n0.c[0] = 0;\r
108503\r
108504 for ( ; ; ) {\r
108505 q = div( n, d, 0, 1 );\r
108506 d2 = d0.plus( q.times(d1) );\r
108507 if ( d2.cmp(md) == 1 ) break;\r
108508 d0 = d1;\r
108509 d1 = d2;\r
108510 n1 = n0.plus( q.times( d2 = n1 ) );\r
108511 n0 = d2;\r
108512 d = n.minus( q.times( d2 = d ) );\r
108513 n = d2;\r
108514 }\r
108515\r
108516 d2 = div( md.minus(d0), d1, 0, 1 );\r
108517 n0 = n0.plus( d2.times(n1) );\r
108518 d0 = d0.plus( d2.times(d1) );\r
108519 n0.s = n1.s = x.s;\r
108520 e *= 2;\r
108521\r
108522 // Determine which fraction is closer to x, n0/d0 or n1/d1\r
108523 arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r
108524 div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r
108525 ? [ n1.toString(), d1.toString() ]\r
108526 : [ n0.toString(), d0.toString() ];\r
108527\r
108528 MAX_EXP = exp;\r
108529 return arr;\r
108530 };\r
108531\r
108532\r
108533 /*\r
108534 * Return the value of this BigNumber converted to a number primitive.\r
108535 */\r
108536 P.toNumber = function () {\r
108537 return +this;\r
108538 };\r
108539\r
108540\r
108541 /*\r
108542 * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r
108543 * If m is present, return the result modulo m.\r
108544 * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r
108545 * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r
108546 * ROUNDING_MODE.\r
108547 *\r
108548 * The modular power operation works efficiently when x, n, and m are positive integers,\r
108549 * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r
108550 *\r
108551 * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r
108552 * [m] {number|string|BigNumber} The modulus.\r
108553 *\r
108554 * 'pow() exponent not an integer: {n}'\r
108555 * 'pow() exponent out of range: {n}'\r
108556 *\r
108557 * Performs 54 loop iterations for n of 9007199254740991.\r
108558 */\r
108559 P.toPower = P.pow = function ( n, m ) {\r
108560 var k, y, z,\r
108561 i = mathfloor( n < 0 ? -n : +n ),\r
108562 x = this;\r
108563\r
108564 if ( m != null ) {\r
108565 id = 23;\r
108566 m = new BigNumber(m);\r
108567 }\r
108568\r
108569 // Pass ±Infinity to Math.pow if exponent is out of range.\r
108570 if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r
108571 ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r
108572 parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r
108573 k = Math.pow( +x, n );\r
108574 return new BigNumber( m ? k % m : k );\r
108575 }\r
108576\r
108577 if (m) {\r
108578 if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r
108579 x = x.mod(m);\r
108580 } else {\r
108581 z = m;\r
108582\r
108583 // Nullify m so only a single mod operation is performed at the end.\r
108584 m = null;\r
108585 }\r
108586 } else if (POW_PRECISION) {\r
108587\r
108588 // Truncating each coefficient array to a length of k after each multiplication\r
108589 // equates to truncating significant digits to POW_PRECISION + [28, 41],\r
108590 // i.e. there will be a minimum of 28 guard digits retained.\r
108591 // (Using + 1.5 would give [9, 21] guard digits.)\r
108592 k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r
108593 }\r
108594\r
108595 y = new BigNumber(ONE);\r
108596\r
108597 for ( ; ; ) {\r
108598 if ( i % 2 ) {\r
108599 y = y.times(x);\r
108600 if ( !y.c ) break;\r
108601 if (k) {\r
108602 if ( y.c.length > k ) y.c.length = k;\r
108603 } else if (m) {\r
108604 y = y.mod(m);\r
108605 }\r
108606 }\r
108607\r
108608 i = mathfloor( i / 2 );\r
108609 if ( !i ) break;\r
108610 x = x.times(x);\r
108611 if (k) {\r
108612 if ( x.c && x.c.length > k ) x.c.length = k;\r
108613 } else if (m) {\r
108614 x = x.mod(m);\r
108615 }\r
108616 }\r
108617\r
108618 if (m) return y;\r
108619 if ( n < 0 ) y = ONE.div(y);\r
108620\r
108621 return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r
108622 };\r
108623\r
108624\r
108625 /*\r
108626 * Return a string representing the value of this BigNumber rounded to sd significant digits\r
108627 * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r
108628 * necessary to represent the integer part of the value in fixed-point notation, then use\r
108629 * exponential notation.\r
108630 *\r
108631 * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r
108632 * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r
108633 *\r
108634 * 'toPrecision() precision not an integer: {sd}'\r
108635 * 'toPrecision() precision out of range: {sd}'\r
108636 * 'toPrecision() rounding mode not an integer: {rm}'\r
108637 * 'toPrecision() rounding mode out of range: {rm}'\r
108638 */\r
108639 P.toPrecision = function ( sd, rm ) {\r
108640 return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r
108641 ? sd | 0 : null, rm, 24 );\r
108642 };\r
108643\r
108644\r
108645 /*\r
108646 * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r
108647 * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r
108648 * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r
108649 * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r
108650 * TO_EXP_NEG, return exponential notation.\r
108651 *\r
108652 * [b] {number} Integer, 2 to 64 inclusive.\r
108653 *\r
108654 * 'toString() base not an integer: {b}'\r
108655 * 'toString() base out of range: {b}'\r
108656 */\r
108657 P.toString = function (b) {\r
108658 var str,\r
108659 n = this,\r
108660 s = n.s,\r
108661 e = n.e;\r
108662\r
108663 // Infinity or NaN?\r
108664 if ( e === null ) {\r
108665\r
108666 if (s) {\r
108667 str = 'Infinity';\r
108668 if ( s < 0 ) str = '-' + str;\r
108669 } else {\r
108670 str = 'NaN';\r
108671 }\r
108672 } else {\r
108673 str = coeffToString( n.c );\r
108674\r
108675 if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r
108676 str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r
108677 ? toExponential( str, e )\r
108678 : toFixedPoint( str, e );\r
108679 } else {\r
108680 str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r
108681 }\r
108682\r
108683 if ( s < 0 && n.c[0] ) str = '-' + str;\r
108684 }\r
108685\r
108686 return str;\r
108687 };\r
108688\r
108689\r
108690 /*\r
108691 * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r
108692 * number.\r
108693 */\r
108694 P.truncated = P.trunc = function () {\r
108695 return round( new BigNumber(this), this.e + 1, 1 );\r
108696 };\r
108697\r
108698\r
108699 /*\r
108700 * Return as toString, but do not accept a base argument, and include the minus sign for\r
108701 * negative zero.\r
108702 */\r
108703 P.valueOf = P.toJSON = function () {\r
108704 var str,\r
108705 n = this,\r
108706 e = n.e;\r
108707\r
108708 if ( e === null ) return n.toString();\r
108709\r
108710 str = coeffToString( n.c );\r
108711\r
108712 str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r
108713 ? toExponential( str, e )\r
108714 : toFixedPoint( str, e );\r
108715\r
108716 return n.s < 0 ? '-' + str : str;\r
108717 };\r
108718\r
108719\r
108720 P.isBigNumber = true;\r
108721\r
108722 if ( config != null ) BigNumber.config(config);\r
108723\r
108724 return BigNumber;\r
108725 }\r
108726\r
108727\r
108728 // PRIVATE HELPER FUNCTIONS\r
108729\r
108730\r
108731 function bitFloor(n) {\r
108732 var i = n | 0;\r
108733 return n > 0 || n === i ? i : i - 1;\r
108734 }\r
108735\r
108736\r
108737 // Return a coefficient array as a string of base 10 digits.\r
108738 function coeffToString(a) {\r
108739 var s, z,\r
108740 i = 1,\r
108741 j = a.length,\r
108742 r = a[0] + '';\r
108743\r
108744 for ( ; i < j; ) {\r
108745 s = a[i++] + '';\r
108746 z = LOG_BASE - s.length;\r
108747 for ( ; z--; s = '0' + s );\r
108748 r += s;\r
108749 }\r
108750\r
108751 // Determine trailing zeros.\r
108752 for ( j = r.length; r.charCodeAt(--j) === 48; );\r
108753 return r.slice( 0, j + 1 || 1 );\r
108754 }\r
108755\r
108756\r
108757 // Compare the value of BigNumbers x and y.\r
108758 function compare( x, y ) {\r
108759 var a, b,\r
108760 xc = x.c,\r
108761 yc = y.c,\r
108762 i = x.s,\r
108763 j = y.s,\r
108764 k = x.e,\r
108765 l = y.e;\r
108766\r
108767 // Either NaN?\r
108768 if ( !i || !j ) return null;\r
108769\r
108770 a = xc && !xc[0];\r
108771 b = yc && !yc[0];\r
108772\r
108773 // Either zero?\r
108774 if ( a || b ) return a ? b ? 0 : -j : i;\r
108775\r
108776 // Signs differ?\r
108777 if ( i != j ) return i;\r
108778\r
108779 a = i < 0;\r
108780 b = k == l;\r
108781\r
108782 // Either Infinity?\r
108783 if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1;\r
108784\r
108785 // Compare exponents.\r
108786 if ( !b ) return k > l ^ a ? 1 : -1;\r
108787\r
108788 j = ( k = xc.length ) < ( l = yc.length ) ? k : l;\r
108789\r
108790 // Compare digit by digit.\r
108791 for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1;\r
108792\r
108793 // Compare lengths.\r
108794 return k == l ? 0 : k > l ^ a ? 1 : -1;\r
108795 }\r
108796\r
108797\r
108798 /*\r
108799 * Return true if n is a valid number in range, otherwise false.\r
108800 * Use for argument validation when ERRORS is false.\r
108801 * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10.\r
108802 */\r
108803 function intValidatorNoErrors( n, min, max ) {\r
108804 return ( n = truncate(n) ) >= min && n <= max;\r
108805 }\r
108806\r
108807\r
108808 function isArray(obj) {\r
108809 return Object.prototype.toString.call(obj) == '[object Array]';\r
108810 }\r
108811\r
108812\r
108813 /*\r
108814 * Convert string of baseIn to an array of numbers of baseOut.\r
108815 * Eg. convertBase('255', 10, 16) returns [15, 15].\r
108816 * Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\r
108817 */\r
108818 function toBaseOut( str, baseIn, baseOut ) {\r
108819 var j,\r
108820 arr = [0],\r
108821 arrL,\r
108822 i = 0,\r
108823 len = str.length;\r
108824\r
108825 for ( ; i < len; ) {\r
108826 for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r
108827 arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r
108828\r
108829 for ( ; j < arr.length; j++ ) {\r
108830\r
108831 if ( arr[j] > baseOut - 1 ) {\r
108832 if ( arr[j + 1] == null ) arr[j + 1] = 0;\r
108833 arr[j + 1] += arr[j] / baseOut | 0;\r
108834 arr[j] %= baseOut;\r
108835 }\r
108836 }\r
108837 }\r
108838\r
108839 return arr.reverse();\r
108840 }\r
108841\r
108842\r
108843 function toExponential( str, e ) {\r
108844 return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) +\r
108845 ( e < 0 ? 'e' : 'e+' ) + e;\r
108846 }\r
108847\r
108848\r
108849 function toFixedPoint( str, e ) {\r
108850 var len, z;\r
108851\r
108852 // Negative exponent?\r
108853 if ( e < 0 ) {\r
108854\r
108855 // Prepend zeros.\r
108856 for ( z = '0.'; ++e; z += '0' );\r
108857 str = z + str;\r
108858\r
108859 // Positive exponent\r
108860 } else {\r
108861 len = str.length;\r
108862\r
108863 // Append zeros.\r
108864 if ( ++e > len ) {\r
108865 for ( z = '0', e -= len; --e; z += '0' );\r
108866 str += z;\r
108867 } else if ( e < len ) {\r
108868 str = str.slice( 0, e ) + '.' + str.slice(e);\r
108869 }\r
108870 }\r
108871\r
108872 return str;\r
108873 }\r
108874\r
108875\r
108876 function truncate(n) {\r
108877 n = parseFloat(n);\r
108878 return n < 0 ? mathceil(n) : mathfloor(n);\r
108879 }\r
108880\r
108881\r
108882 // EXPORT\r
108883\r
108884\r
108885 BigNumber = constructorFactory();\r
108886 BigNumber['default'] = BigNumber.BigNumber = BigNumber;\r
108887\r
108888\r
108889 // AMD.\r
108890 if ( typeof define == 'function' && define.amd ) {\r
108891 define( function () { return BigNumber; } );\r
108892\r
108893 // Node.js and other environments that support module.exports.\r
108894 } else if ( typeof module != 'undefined' && module.exports ) {\r
108895 module.exports = BigNumber;\r
108896\r
108897 // Browser.\r
108898 } else {\r
108899 if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')();\r
108900 globalObj.BigNumber = BigNumber;\r
108901 }\r
108902})(this);\r
108903
108904},{}],808:[function(require,module,exports){
108905// Copyright Joyent, Inc. and other Node contributors.
108906//
108907// Permission is hereby granted, free of charge, to any person obtaining a
108908// copy of this software and associated documentation files (the
108909// "Software"), to deal in the Software without restriction, including
108910// without limitation the rights to use, copy, modify, merge, publish,
108911// distribute, sublicense, and/or sell copies of the Software, and to permit
108912// persons to whom the Software is furnished to do so, subject to the
108913// following conditions:
108914//
108915// The above copyright notice and this permission notice shall be included
108916// in all copies or substantial portions of the Software.
108917//
108918// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
108919// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
108920// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
108921// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
108922// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
108923// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
108924// USE OR OTHER DEALINGS IN THE SOFTWARE.
108925
108926module.exports = Stream;
108927
108928var EE = require('events').EventEmitter;
108929var inherits = require('inherits');
108930
108931inherits(Stream, EE);
108932Stream.Readable = require('readable-stream/readable.js');
108933Stream.Writable = require('readable-stream/writable.js');
108934Stream.Duplex = require('readable-stream/duplex.js');
108935Stream.Transform = require('readable-stream/transform.js');
108936Stream.PassThrough = require('readable-stream/passthrough.js');
108937
108938// Backwards-compat with node 0.4.x
108939Stream.Stream = Stream;
108940
108941
108942
108943// old-style streams. Note that the pipe method (the only relevant
108944// part of this class) is overridden in the Readable class.
108945
108946function Stream() {
108947 EE.call(this);
108948}
108949
108950Stream.prototype.pipe = function(dest, options) {
108951 var source = this;
108952
108953 function ondata(chunk) {
108954 if (dest.writable) {
108955 if (false === dest.write(chunk) && source.pause) {
108956 source.pause();
108957 }
108958 }
108959 }
108960
108961 source.on('data', ondata);
108962
108963 function ondrain() {
108964 if (source.readable && source.resume) {
108965 source.resume();
108966 }
108967 }
108968
108969 dest.on('drain', ondrain);
108970
108971 // If the 'end' option is not supplied, dest.end() will be called when
108972 // source gets the 'end' or 'close' events. Only dest.end() once.
108973 if (!dest._isStdio && (!options || options.end !== false)) {
108974 source.on('end', onend);
108975 source.on('close', onclose);
108976 }
108977
108978 var didOnEnd = false;
108979 function onend() {
108980 if (didOnEnd) return;
108981 didOnEnd = true;
108982
108983 dest.end();
108984 }
108985
108986
108987 function onclose() {
108988 if (didOnEnd) return;
108989 didOnEnd = true;
108990
108991 if (typeof dest.destroy === 'function') dest.destroy();
108992 }
108993
108994 // don't leave dangling pipes when there are errors.
108995 function onerror(er) {
108996 cleanup();
108997 if (EE.listenerCount(this, 'error') === 0) {
108998 throw er; // Unhandled stream error in pipe.
108999 }
109000 }
109001
109002 source.on('error', onerror);
109003 dest.on('error', onerror);
109004
109005 // remove all the event listeners that were added.
109006 function cleanup() {
109007 source.removeListener('data', ondata);
109008 dest.removeListener('drain', ondrain);
109009
109010 source.removeListener('end', onend);
109011 source.removeListener('close', onclose);
109012
109013 source.removeListener('error', onerror);
109014 dest.removeListener('error', onerror);
109015
109016 source.removeListener('end', cleanup);
109017 source.removeListener('close', cleanup);
109018
109019 dest.removeListener('close', cleanup);
109020 }
109021
109022 source.on('end', cleanup);
109023 source.on('close', cleanup);
109024
109025 dest.on('close', cleanup);
109026
109027 dest.emit('pipe', source);
109028
109029 // Allow for unix-like usage: A.pipe(B).pipe(C)
109030 return dest;
109031};
109032
109033},{"events":335,"inherits":396,"readable-stream/duplex.js":726,"readable-stream/passthrough.js":736,"readable-stream/readable.js":737,"readable-stream/transform.js":738,"readable-stream/writable.js":739}],809:[function(require,module,exports){
109034// Copyright Joyent, Inc. and other Node contributors.
109035//
109036// Permission is hereby granted, free of charge, to any person obtaining a
109037// copy of this software and associated documentation files (the
109038// "Software"), to deal in the Software without restriction, including
109039// without limitation the rights to use, copy, modify, merge, publish,
109040// distribute, sublicense, and/or sell copies of the Software, and to permit
109041// persons to whom the Software is furnished to do so, subject to the
109042// following conditions:
109043//
109044// The above copyright notice and this permission notice shall be included
109045// in all copies or substantial portions of the Software.
109046//
109047// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
109048// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
109049// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
109050// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
109051// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
109052// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
109053// USE OR OTHER DEALINGS IN THE SOFTWARE.
109054
109055'use strict';
109056
109057/*<replacement>*/
109058
109059var Buffer = require('safe-buffer').Buffer;
109060/*</replacement>*/
109061
109062var isEncoding = Buffer.isEncoding || function (encoding) {
109063 encoding = '' + encoding;
109064 switch (encoding && encoding.toLowerCase()) {
109065 case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
109066 return true;
109067 default:
109068 return false;
109069 }
109070};
109071
109072function _normalizeEncoding(enc) {
109073 if (!enc) return 'utf8';
109074 var retried;
109075 while (true) {
109076 switch (enc) {
109077 case 'utf8':
109078 case 'utf-8':
109079 return 'utf8';
109080 case 'ucs2':
109081 case 'ucs-2':
109082 case 'utf16le':
109083 case 'utf-16le':
109084 return 'utf16le';
109085 case 'latin1':
109086 case 'binary':
109087 return 'latin1';
109088 case 'base64':
109089 case 'ascii':
109090 case 'hex':
109091 return enc;
109092 default:
109093 if (retried) return; // undefined
109094 enc = ('' + enc).toLowerCase();
109095 retried = true;
109096 }
109097 }
109098};
109099
109100// Do not cache `Buffer.isEncoding` when checking encoding names as some
109101// modules monkey-patch it to support additional encodings
109102function normalizeEncoding(enc) {
109103 var nenc = _normalizeEncoding(enc);
109104 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
109105 return nenc || enc;
109106}
109107
109108// StringDecoder provides an interface for efficiently splitting a series of
109109// buffers into a series of JS strings without breaking apart multi-byte
109110// characters.
109111exports.StringDecoder = StringDecoder;
109112function StringDecoder(encoding) {
109113 this.encoding = normalizeEncoding(encoding);
109114 var nb;
109115 switch (this.encoding) {
109116 case 'utf16le':
109117 this.text = utf16Text;
109118 this.end = utf16End;
109119 nb = 4;
109120 break;
109121 case 'utf8':
109122 this.fillLast = utf8FillLast;
109123 nb = 4;
109124 break;
109125 case 'base64':
109126 this.text = base64Text;
109127 this.end = base64End;
109128 nb = 3;
109129 break;
109130 default:
109131 this.write = simpleWrite;
109132 this.end = simpleEnd;
109133 return;
109134 }
109135 this.lastNeed = 0;
109136 this.lastTotal = 0;
109137 this.lastChar = Buffer.allocUnsafe(nb);
109138}
109139
109140StringDecoder.prototype.write = function (buf) {
109141 if (buf.length === 0) return '';
109142 var r;
109143 var i;
109144 if (this.lastNeed) {
109145 r = this.fillLast(buf);
109146 if (r === undefined) return '';
109147 i = this.lastNeed;
109148 this.lastNeed = 0;
109149 } else {
109150 i = 0;
109151 }
109152 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
109153 return r || '';
109154};
109155
109156StringDecoder.prototype.end = utf8End;
109157
109158// Returns only complete characters in a Buffer
109159StringDecoder.prototype.text = utf8Text;
109160
109161// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
109162StringDecoder.prototype.fillLast = function (buf) {
109163 if (this.lastNeed <= buf.length) {
109164 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
109165 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
109166 }
109167 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
109168 this.lastNeed -= buf.length;
109169};
109170
109171// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
109172// continuation byte. If an invalid byte is detected, -2 is returned.
109173function utf8CheckByte(byte) {
109174 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
109175 return byte >> 6 === 0x02 ? -1 : -2;
109176}
109177
109178// Checks at most 3 bytes at the end of a Buffer in order to detect an
109179// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
109180// needed to complete the UTF-8 character (if applicable) are returned.
109181function utf8CheckIncomplete(self, buf, i) {
109182 var j = buf.length - 1;
109183 if (j < i) return 0;
109184 var nb = utf8CheckByte(buf[j]);
109185 if (nb >= 0) {
109186 if (nb > 0) self.lastNeed = nb - 1;
109187 return nb;
109188 }
109189 if (--j < i || nb === -2) return 0;
109190 nb = utf8CheckByte(buf[j]);
109191 if (nb >= 0) {
109192 if (nb > 0) self.lastNeed = nb - 2;
109193 return nb;
109194 }
109195 if (--j < i || nb === -2) return 0;
109196 nb = utf8CheckByte(buf[j]);
109197 if (nb >= 0) {
109198 if (nb > 0) {
109199 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
109200 }
109201 return nb;
109202 }
109203 return 0;
109204}
109205
109206// Validates as many continuation bytes for a multi-byte UTF-8 character as
109207// needed or are available. If we see a non-continuation byte where we expect
109208// one, we "replace" the validated continuation bytes we've seen so far with
109209// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
109210// behavior. The continuation byte check is included three times in the case
109211// where all of the continuation bytes for a character exist in the same buffer.
109212// It is also done this way as a slight performance increase instead of using a
109213// loop.
109214function utf8CheckExtraBytes(self, buf, p) {
109215 if ((buf[0] & 0xC0) !== 0x80) {
109216 self.lastNeed = 0;
109217 return '\ufffd';
109218 }
109219 if (self.lastNeed > 1 && buf.length > 1) {
109220 if ((buf[1] & 0xC0) !== 0x80) {
109221 self.lastNeed = 1;
109222 return '\ufffd';
109223 }
109224 if (self.lastNeed > 2 && buf.length > 2) {
109225 if ((buf[2] & 0xC0) !== 0x80) {
109226 self.lastNeed = 2;
109227 return '\ufffd';
109228 }
109229 }
109230 }
109231}
109232
109233// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
109234function utf8FillLast(buf) {
109235 var p = this.lastTotal - this.lastNeed;
109236 var r = utf8CheckExtraBytes(this, buf, p);
109237 if (r !== undefined) return r;
109238 if (this.lastNeed <= buf.length) {
109239 buf.copy(this.lastChar, p, 0, this.lastNeed);
109240 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
109241 }
109242 buf.copy(this.lastChar, p, 0, buf.length);
109243 this.lastNeed -= buf.length;
109244}
109245
109246// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
109247// partial character, the character's bytes are buffered until the required
109248// number of bytes are available.
109249function utf8Text(buf, i) {
109250 var total = utf8CheckIncomplete(this, buf, i);
109251 if (!this.lastNeed) return buf.toString('utf8', i);
109252 this.lastTotal = total;
109253 var end = buf.length - (total - this.lastNeed);
109254 buf.copy(this.lastChar, 0, end);
109255 return buf.toString('utf8', i, end);
109256}
109257
109258// For UTF-8, a replacement character is added when ending on a partial
109259// character.
109260function utf8End(buf) {
109261 var r = buf && buf.length ? this.write(buf) : '';
109262 if (this.lastNeed) return r + '\ufffd';
109263 return r;
109264}
109265
109266// UTF-16LE typically needs two bytes per character, but even if we have an even
109267// number of bytes available, we need to check if we end on a leading/high
109268// surrogate. In that case, we need to wait for the next two bytes in order to
109269// decode the last character properly.
109270function utf16Text(buf, i) {
109271 if ((buf.length - i) % 2 === 0) {
109272 var r = buf.toString('utf16le', i);
109273 if (r) {
109274 var c = r.charCodeAt(r.length - 1);
109275 if (c >= 0xD800 && c <= 0xDBFF) {
109276 this.lastNeed = 2;
109277 this.lastTotal = 4;
109278 this.lastChar[0] = buf[buf.length - 2];
109279 this.lastChar[1] = buf[buf.length - 1];
109280 return r.slice(0, -1);
109281 }
109282 }
109283 return r;
109284 }
109285 this.lastNeed = 1;
109286 this.lastTotal = 2;
109287 this.lastChar[0] = buf[buf.length - 1];
109288 return buf.toString('utf16le', i, buf.length - 1);
109289}
109290
109291// For UTF-16LE we do not explicitly append special replacement characters if we
109292// end on a partial character, we simply let v8 handle that.
109293function utf16End(buf) {
109294 var r = buf && buf.length ? this.write(buf) : '';
109295 if (this.lastNeed) {
109296 var end = this.lastTotal - this.lastNeed;
109297 return r + this.lastChar.toString('utf16le', 0, end);
109298 }
109299 return r;
109300}
109301
109302function base64Text(buf, i) {
109303 var n = (buf.length - i) % 3;
109304 if (n === 0) return buf.toString('base64', i);
109305 this.lastNeed = 3 - n;
109306 this.lastTotal = 3;
109307 if (n === 1) {
109308 this.lastChar[0] = buf[buf.length - 1];
109309 } else {
109310 this.lastChar[0] = buf[buf.length - 2];
109311 this.lastChar[1] = buf[buf.length - 1];
109312 }
109313 return buf.toString('base64', i, buf.length - n);
109314}
109315
109316function base64End(buf) {
109317 var r = buf && buf.length ? this.write(buf) : '';
109318 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
109319 return r;
109320}
109321
109322// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
109323function simpleWrite(buf) {
109324 return buf.toString(this.encoding);
109325}
109326
109327function simpleEnd(buf) {
109328 return buf && buf.length ? this.write(buf) : '';
109329}
109330},{"safe-buffer":810}],810:[function(require,module,exports){
109331arguments[4][735][0].apply(exports,arguments)
109332},{"buffer":146,"dup":735}],811:[function(require,module,exports){
109333var isHexPrefixed = require('is-hex-prefixed');
109334
109335/**
109336 * Removes '0x' from a given `String` is present
109337 * @param {String} str the string value
109338 * @return {String|Optional} a string by pass if necessary
109339 */
109340module.exports = function stripHexPrefix(str) {
109341 if (typeof str !== 'string') {
109342 return str;
109343 }
109344
109345 return isHexPrefixed(str) ? str.slice(2) : str;
109346}
109347
109348},{"is-hex-prefixed":399}],812:[function(require,module,exports){
109349(function (setImmediate,clearImmediate){
109350var nextTick = require('process/browser.js').nextTick;
109351var apply = Function.prototype.apply;
109352var slice = Array.prototype.slice;
109353var immediateIds = {};
109354var nextImmediateId = 0;
109355
109356// DOM APIs, for completeness
109357
109358exports.setTimeout = function() {
109359 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
109360};
109361exports.setInterval = function() {
109362 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
109363};
109364exports.clearTimeout =
109365exports.clearInterval = function(timeout) { timeout.close(); };
109366
109367function Timeout(id, clearFn) {
109368 this._id = id;
109369 this._clearFn = clearFn;
109370}
109371Timeout.prototype.unref = Timeout.prototype.ref = function() {};
109372Timeout.prototype.close = function() {
109373 this._clearFn.call(window, this._id);
109374};
109375
109376// Does not start the time, just sets up the members needed.
109377exports.enroll = function(item, msecs) {
109378 clearTimeout(item._idleTimeoutId);
109379 item._idleTimeout = msecs;
109380};
109381
109382exports.unenroll = function(item) {
109383 clearTimeout(item._idleTimeoutId);
109384 item._idleTimeout = -1;
109385};
109386
109387exports._unrefActive = exports.active = function(item) {
109388 clearTimeout(item._idleTimeoutId);
109389
109390 var msecs = item._idleTimeout;
109391 if (msecs >= 0) {
109392 item._idleTimeoutId = setTimeout(function onTimeout() {
109393 if (item._onTimeout)
109394 item._onTimeout();
109395 }, msecs);
109396 }
109397};
109398
109399// That's not how node.js implements it but the exposed api is the same.
109400exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
109401 var id = nextImmediateId++;
109402 var args = arguments.length < 2 ? false : slice.call(arguments, 1);
109403
109404 immediateIds[id] = true;
109405
109406 nextTick(function onNextTick() {
109407 if (immediateIds[id]) {
109408 // fn.call() is faster so we optimize for the common use-case
109409 // @see http://jsperf.com/call-apply-segu
109410 if (args) {
109411 fn.apply(null, args);
109412 } else {
109413 fn.call(null);
109414 }
109415 // Prevent ids from leaking
109416 exports.clearImmediate(id);
109417 }
109418 });
109419
109420 return id;
109421};
109422
109423exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
109424 delete immediateIds[id];
109425};
109426}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
109427},{"process/browser.js":678,"timers":812}],813:[function(require,module,exports){
109428(function(nacl) {
109429'use strict';
109430
109431// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
109432// Public domain.
109433//
109434// Implementation derived from TweetNaCl version 20140427.
109435// See for details: http://tweetnacl.cr.yp.to/
109436
109437var gf = function(init) {
109438 var i, r = new Float64Array(16);
109439 if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
109440 return r;
109441};
109442
109443// Pluggable, initialized in high-level API below.
109444var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
109445
109446var _0 = new Uint8Array(16);
109447var _9 = new Uint8Array(32); _9[0] = 9;
109448
109449var gf0 = gf(),
109450 gf1 = gf([1]),
109451 _121665 = gf([0xdb41, 1]),
109452 D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
109453 D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
109454 X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
109455 Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
109456 I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
109457
109458function ts64(x, i, h, l) {
109459 x[i] = (h >> 24) & 0xff;
109460 x[i+1] = (h >> 16) & 0xff;
109461 x[i+2] = (h >> 8) & 0xff;
109462 x[i+3] = h & 0xff;
109463 x[i+4] = (l >> 24) & 0xff;
109464 x[i+5] = (l >> 16) & 0xff;
109465 x[i+6] = (l >> 8) & 0xff;
109466 x[i+7] = l & 0xff;
109467}
109468
109469function vn(x, xi, y, yi, n) {
109470 var i,d = 0;
109471 for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
109472 return (1 & ((d - 1) >>> 8)) - 1;
109473}
109474
109475function crypto_verify_16(x, xi, y, yi) {
109476 return vn(x,xi,y,yi,16);
109477}
109478
109479function crypto_verify_32(x, xi, y, yi) {
109480 return vn(x,xi,y,yi,32);
109481}
109482
109483function core_salsa20(o, p, k, c) {
109484 var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
109485 j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
109486 j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
109487 j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
109488 j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
109489 j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
109490 j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
109491 j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
109492 j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
109493 j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
109494 j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
109495 j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
109496 j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
109497 j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
109498 j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
109499 j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
109500
109501 var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
109502 x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
109503 x15 = j15, u;
109504
109505 for (var i = 0; i < 20; i += 2) {
109506 u = x0 + x12 | 0;
109507 x4 ^= u<<7 | u>>>(32-7);
109508 u = x4 + x0 | 0;
109509 x8 ^= u<<9 | u>>>(32-9);
109510 u = x8 + x4 | 0;
109511 x12 ^= u<<13 | u>>>(32-13);
109512 u = x12 + x8 | 0;
109513 x0 ^= u<<18 | u>>>(32-18);
109514
109515 u = x5 + x1 | 0;
109516 x9 ^= u<<7 | u>>>(32-7);
109517 u = x9 + x5 | 0;
109518 x13 ^= u<<9 | u>>>(32-9);
109519 u = x13 + x9 | 0;
109520 x1 ^= u<<13 | u>>>(32-13);
109521 u = x1 + x13 | 0;
109522 x5 ^= u<<18 | u>>>(32-18);
109523
109524 u = x10 + x6 | 0;
109525 x14 ^= u<<7 | u>>>(32-7);
109526 u = x14 + x10 | 0;
109527 x2 ^= u<<9 | u>>>(32-9);
109528 u = x2 + x14 | 0;
109529 x6 ^= u<<13 | u>>>(32-13);
109530 u = x6 + x2 | 0;
109531 x10 ^= u<<18 | u>>>(32-18);
109532
109533 u = x15 + x11 | 0;
109534 x3 ^= u<<7 | u>>>(32-7);
109535 u = x3 + x15 | 0;
109536 x7 ^= u<<9 | u>>>(32-9);
109537 u = x7 + x3 | 0;
109538 x11 ^= u<<13 | u>>>(32-13);
109539 u = x11 + x7 | 0;
109540 x15 ^= u<<18 | u>>>(32-18);
109541
109542 u = x0 + x3 | 0;
109543 x1 ^= u<<7 | u>>>(32-7);
109544 u = x1 + x0 | 0;
109545 x2 ^= u<<9 | u>>>(32-9);
109546 u = x2 + x1 | 0;
109547 x3 ^= u<<13 | u>>>(32-13);
109548 u = x3 + x2 | 0;
109549 x0 ^= u<<18 | u>>>(32-18);
109550
109551 u = x5 + x4 | 0;
109552 x6 ^= u<<7 | u>>>(32-7);
109553 u = x6 + x5 | 0;
109554 x7 ^= u<<9 | u>>>(32-9);
109555 u = x7 + x6 | 0;
109556 x4 ^= u<<13 | u>>>(32-13);
109557 u = x4 + x7 | 0;
109558 x5 ^= u<<18 | u>>>(32-18);
109559
109560 u = x10 + x9 | 0;
109561 x11 ^= u<<7 | u>>>(32-7);
109562 u = x11 + x10 | 0;
109563 x8 ^= u<<9 | u>>>(32-9);
109564 u = x8 + x11 | 0;
109565 x9 ^= u<<13 | u>>>(32-13);
109566 u = x9 + x8 | 0;
109567 x10 ^= u<<18 | u>>>(32-18);
109568
109569 u = x15 + x14 | 0;
109570 x12 ^= u<<7 | u>>>(32-7);
109571 u = x12 + x15 | 0;
109572 x13 ^= u<<9 | u>>>(32-9);
109573 u = x13 + x12 | 0;
109574 x14 ^= u<<13 | u>>>(32-13);
109575 u = x14 + x13 | 0;
109576 x15 ^= u<<18 | u>>>(32-18);
109577 }
109578 x0 = x0 + j0 | 0;
109579 x1 = x1 + j1 | 0;
109580 x2 = x2 + j2 | 0;
109581 x3 = x3 + j3 | 0;
109582 x4 = x4 + j4 | 0;
109583 x5 = x5 + j5 | 0;
109584 x6 = x6 + j6 | 0;
109585 x7 = x7 + j7 | 0;
109586 x8 = x8 + j8 | 0;
109587 x9 = x9 + j9 | 0;
109588 x10 = x10 + j10 | 0;
109589 x11 = x11 + j11 | 0;
109590 x12 = x12 + j12 | 0;
109591 x13 = x13 + j13 | 0;
109592 x14 = x14 + j14 | 0;
109593 x15 = x15 + j15 | 0;
109594
109595 o[ 0] = x0 >>> 0 & 0xff;
109596 o[ 1] = x0 >>> 8 & 0xff;
109597 o[ 2] = x0 >>> 16 & 0xff;
109598 o[ 3] = x0 >>> 24 & 0xff;
109599
109600 o[ 4] = x1 >>> 0 & 0xff;
109601 o[ 5] = x1 >>> 8 & 0xff;
109602 o[ 6] = x1 >>> 16 & 0xff;
109603 o[ 7] = x1 >>> 24 & 0xff;
109604
109605 o[ 8] = x2 >>> 0 & 0xff;
109606 o[ 9] = x2 >>> 8 & 0xff;
109607 o[10] = x2 >>> 16 & 0xff;
109608 o[11] = x2 >>> 24 & 0xff;
109609
109610 o[12] = x3 >>> 0 & 0xff;
109611 o[13] = x3 >>> 8 & 0xff;
109612 o[14] = x3 >>> 16 & 0xff;
109613 o[15] = x3 >>> 24 & 0xff;
109614
109615 o[16] = x4 >>> 0 & 0xff;
109616 o[17] = x4 >>> 8 & 0xff;
109617 o[18] = x4 >>> 16 & 0xff;
109618 o[19] = x4 >>> 24 & 0xff;
109619
109620 o[20] = x5 >>> 0 & 0xff;
109621 o[21] = x5 >>> 8 & 0xff;
109622 o[22] = x5 >>> 16 & 0xff;
109623 o[23] = x5 >>> 24 & 0xff;
109624
109625 o[24] = x6 >>> 0 & 0xff;
109626 o[25] = x6 >>> 8 & 0xff;
109627 o[26] = x6 >>> 16 & 0xff;
109628 o[27] = x6 >>> 24 & 0xff;
109629
109630 o[28] = x7 >>> 0 & 0xff;
109631 o[29] = x7 >>> 8 & 0xff;
109632 o[30] = x7 >>> 16 & 0xff;
109633 o[31] = x7 >>> 24 & 0xff;
109634
109635 o[32] = x8 >>> 0 & 0xff;
109636 o[33] = x8 >>> 8 & 0xff;
109637 o[34] = x8 >>> 16 & 0xff;
109638 o[35] = x8 >>> 24 & 0xff;
109639
109640 o[36] = x9 >>> 0 & 0xff;
109641 o[37] = x9 >>> 8 & 0xff;
109642 o[38] = x9 >>> 16 & 0xff;
109643 o[39] = x9 >>> 24 & 0xff;
109644
109645 o[40] = x10 >>> 0 & 0xff;
109646 o[41] = x10 >>> 8 & 0xff;
109647 o[42] = x10 >>> 16 & 0xff;
109648 o[43] = x10 >>> 24 & 0xff;
109649
109650 o[44] = x11 >>> 0 & 0xff;
109651 o[45] = x11 >>> 8 & 0xff;
109652 o[46] = x11 >>> 16 & 0xff;
109653 o[47] = x11 >>> 24 & 0xff;
109654
109655 o[48] = x12 >>> 0 & 0xff;
109656 o[49] = x12 >>> 8 & 0xff;
109657 o[50] = x12 >>> 16 & 0xff;
109658 o[51] = x12 >>> 24 & 0xff;
109659
109660 o[52] = x13 >>> 0 & 0xff;
109661 o[53] = x13 >>> 8 & 0xff;
109662 o[54] = x13 >>> 16 & 0xff;
109663 o[55] = x13 >>> 24 & 0xff;
109664
109665 o[56] = x14 >>> 0 & 0xff;
109666 o[57] = x14 >>> 8 & 0xff;
109667 o[58] = x14 >>> 16 & 0xff;
109668 o[59] = x14 >>> 24 & 0xff;
109669
109670 o[60] = x15 >>> 0 & 0xff;
109671 o[61] = x15 >>> 8 & 0xff;
109672 o[62] = x15 >>> 16 & 0xff;
109673 o[63] = x15 >>> 24 & 0xff;
109674}
109675
109676function core_hsalsa20(o,p,k,c) {
109677 var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
109678 j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
109679 j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
109680 j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
109681 j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
109682 j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
109683 j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
109684 j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
109685 j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
109686 j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
109687 j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
109688 j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
109689 j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
109690 j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
109691 j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
109692 j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
109693
109694 var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
109695 x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
109696 x15 = j15, u;
109697
109698 for (var i = 0; i < 20; i += 2) {
109699 u = x0 + x12 | 0;
109700 x4 ^= u<<7 | u>>>(32-7);
109701 u = x4 + x0 | 0;
109702 x8 ^= u<<9 | u>>>(32-9);
109703 u = x8 + x4 | 0;
109704 x12 ^= u<<13 | u>>>(32-13);
109705 u = x12 + x8 | 0;
109706 x0 ^= u<<18 | u>>>(32-18);
109707
109708 u = x5 + x1 | 0;
109709 x9 ^= u<<7 | u>>>(32-7);
109710 u = x9 + x5 | 0;
109711 x13 ^= u<<9 | u>>>(32-9);
109712 u = x13 + x9 | 0;
109713 x1 ^= u<<13 | u>>>(32-13);
109714 u = x1 + x13 | 0;
109715 x5 ^= u<<18 | u>>>(32-18);
109716
109717 u = x10 + x6 | 0;
109718 x14 ^= u<<7 | u>>>(32-7);
109719 u = x14 + x10 | 0;
109720 x2 ^= u<<9 | u>>>(32-9);
109721 u = x2 + x14 | 0;
109722 x6 ^= u<<13 | u>>>(32-13);
109723 u = x6 + x2 | 0;
109724 x10 ^= u<<18 | u>>>(32-18);
109725
109726 u = x15 + x11 | 0;
109727 x3 ^= u<<7 | u>>>(32-7);
109728 u = x3 + x15 | 0;
109729 x7 ^= u<<9 | u>>>(32-9);
109730 u = x7 + x3 | 0;
109731 x11 ^= u<<13 | u>>>(32-13);
109732 u = x11 + x7 | 0;
109733 x15 ^= u<<18 | u>>>(32-18);
109734
109735 u = x0 + x3 | 0;
109736 x1 ^= u<<7 | u>>>(32-7);
109737 u = x1 + x0 | 0;
109738 x2 ^= u<<9 | u>>>(32-9);
109739 u = x2 + x1 | 0;
109740 x3 ^= u<<13 | u>>>(32-13);
109741 u = x3 + x2 | 0;
109742 x0 ^= u<<18 | u>>>(32-18);
109743
109744 u = x5 + x4 | 0;
109745 x6 ^= u<<7 | u>>>(32-7);
109746 u = x6 + x5 | 0;
109747 x7 ^= u<<9 | u>>>(32-9);
109748 u = x7 + x6 | 0;
109749 x4 ^= u<<13 | u>>>(32-13);
109750 u = x4 + x7 | 0;
109751 x5 ^= u<<18 | u>>>(32-18);
109752
109753 u = x10 + x9 | 0;
109754 x11 ^= u<<7 | u>>>(32-7);
109755 u = x11 + x10 | 0;
109756 x8 ^= u<<9 | u>>>(32-9);
109757 u = x8 + x11 | 0;
109758 x9 ^= u<<13 | u>>>(32-13);
109759 u = x9 + x8 | 0;
109760 x10 ^= u<<18 | u>>>(32-18);
109761
109762 u = x15 + x14 | 0;
109763 x12 ^= u<<7 | u>>>(32-7);
109764 u = x12 + x15 | 0;
109765 x13 ^= u<<9 | u>>>(32-9);
109766 u = x13 + x12 | 0;
109767 x14 ^= u<<13 | u>>>(32-13);
109768 u = x14 + x13 | 0;
109769 x15 ^= u<<18 | u>>>(32-18);
109770 }
109771
109772 o[ 0] = x0 >>> 0 & 0xff;
109773 o[ 1] = x0 >>> 8 & 0xff;
109774 o[ 2] = x0 >>> 16 & 0xff;
109775 o[ 3] = x0 >>> 24 & 0xff;
109776
109777 o[ 4] = x5 >>> 0 & 0xff;
109778 o[ 5] = x5 >>> 8 & 0xff;
109779 o[ 6] = x5 >>> 16 & 0xff;
109780 o[ 7] = x5 >>> 24 & 0xff;
109781
109782 o[ 8] = x10 >>> 0 & 0xff;
109783 o[ 9] = x10 >>> 8 & 0xff;
109784 o[10] = x10 >>> 16 & 0xff;
109785 o[11] = x10 >>> 24 & 0xff;
109786
109787 o[12] = x15 >>> 0 & 0xff;
109788 o[13] = x15 >>> 8 & 0xff;
109789 o[14] = x15 >>> 16 & 0xff;
109790 o[15] = x15 >>> 24 & 0xff;
109791
109792 o[16] = x6 >>> 0 & 0xff;
109793 o[17] = x6 >>> 8 & 0xff;
109794 o[18] = x6 >>> 16 & 0xff;
109795 o[19] = x6 >>> 24 & 0xff;
109796
109797 o[20] = x7 >>> 0 & 0xff;
109798 o[21] = x7 >>> 8 & 0xff;
109799 o[22] = x7 >>> 16 & 0xff;
109800 o[23] = x7 >>> 24 & 0xff;
109801
109802 o[24] = x8 >>> 0 & 0xff;
109803 o[25] = x8 >>> 8 & 0xff;
109804 o[26] = x8 >>> 16 & 0xff;
109805 o[27] = x8 >>> 24 & 0xff;
109806
109807 o[28] = x9 >>> 0 & 0xff;
109808 o[29] = x9 >>> 8 & 0xff;
109809 o[30] = x9 >>> 16 & 0xff;
109810 o[31] = x9 >>> 24 & 0xff;
109811}
109812
109813function crypto_core_salsa20(out,inp,k,c) {
109814 core_salsa20(out,inp,k,c);
109815}
109816
109817function crypto_core_hsalsa20(out,inp,k,c) {
109818 core_hsalsa20(out,inp,k,c);
109819}
109820
109821var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
109822 // "expand 32-byte k"
109823
109824function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
109825 var z = new Uint8Array(16), x = new Uint8Array(64);
109826 var u, i;
109827 for (i = 0; i < 16; i++) z[i] = 0;
109828 for (i = 0; i < 8; i++) z[i] = n[i];
109829 while (b >= 64) {
109830 crypto_core_salsa20(x,z,k,sigma);
109831 for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
109832 u = 1;
109833 for (i = 8; i < 16; i++) {
109834 u = u + (z[i] & 0xff) | 0;
109835 z[i] = u & 0xff;
109836 u >>>= 8;
109837 }
109838 b -= 64;
109839 cpos += 64;
109840 mpos += 64;
109841 }
109842 if (b > 0) {
109843 crypto_core_salsa20(x,z,k,sigma);
109844 for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
109845 }
109846 return 0;
109847}
109848
109849function crypto_stream_salsa20(c,cpos,b,n,k) {
109850 var z = new Uint8Array(16), x = new Uint8Array(64);
109851 var u, i;
109852 for (i = 0; i < 16; i++) z[i] = 0;
109853 for (i = 0; i < 8; i++) z[i] = n[i];
109854 while (b >= 64) {
109855 crypto_core_salsa20(x,z,k,sigma);
109856 for (i = 0; i < 64; i++) c[cpos+i] = x[i];
109857 u = 1;
109858 for (i = 8; i < 16; i++) {
109859 u = u + (z[i] & 0xff) | 0;
109860 z[i] = u & 0xff;
109861 u >>>= 8;
109862 }
109863 b -= 64;
109864 cpos += 64;
109865 }
109866 if (b > 0) {
109867 crypto_core_salsa20(x,z,k,sigma);
109868 for (i = 0; i < b; i++) c[cpos+i] = x[i];
109869 }
109870 return 0;
109871}
109872
109873function crypto_stream(c,cpos,d,n,k) {
109874 var s = new Uint8Array(32);
109875 crypto_core_hsalsa20(s,n,k,sigma);
109876 var sn = new Uint8Array(8);
109877 for (var i = 0; i < 8; i++) sn[i] = n[i+16];
109878 return crypto_stream_salsa20(c,cpos,d,sn,s);
109879}
109880
109881function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
109882 var s = new Uint8Array(32);
109883 crypto_core_hsalsa20(s,n,k,sigma);
109884 var sn = new Uint8Array(8);
109885 for (var i = 0; i < 8; i++) sn[i] = n[i+16];
109886 return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
109887}
109888
109889/*
109890* Port of Andrew Moon's Poly1305-donna-16. Public domain.
109891* https://github.com/floodyberry/poly1305-donna
109892*/
109893
109894var poly1305 = function(key) {
109895 this.buffer = new Uint8Array(16);
109896 this.r = new Uint16Array(10);
109897 this.h = new Uint16Array(10);
109898 this.pad = new Uint16Array(8);
109899 this.leftover = 0;
109900 this.fin = 0;
109901
109902 var t0, t1, t2, t3, t4, t5, t6, t7;
109903
109904 t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
109905 t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
109906 t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
109907 t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
109908 t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
109909 this.r[5] = ((t4 >>> 1)) & 0x1ffe;
109910 t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
109911 t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
109912 t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
109913 this.r[9] = ((t7 >>> 5)) & 0x007f;
109914
109915 this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
109916 this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
109917 this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
109918 this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
109919 this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
109920 this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
109921 this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
109922 this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
109923};
109924
109925poly1305.prototype.blocks = function(m, mpos, bytes) {
109926 var hibit = this.fin ? 0 : (1 << 11);
109927 var t0, t1, t2, t3, t4, t5, t6, t7, c;
109928 var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
109929
109930 var h0 = this.h[0],
109931 h1 = this.h[1],
109932 h2 = this.h[2],
109933 h3 = this.h[3],
109934 h4 = this.h[4],
109935 h5 = this.h[5],
109936 h6 = this.h[6],
109937 h7 = this.h[7],
109938 h8 = this.h[8],
109939 h9 = this.h[9];
109940
109941 var r0 = this.r[0],
109942 r1 = this.r[1],
109943 r2 = this.r[2],
109944 r3 = this.r[3],
109945 r4 = this.r[4],
109946 r5 = this.r[5],
109947 r6 = this.r[6],
109948 r7 = this.r[7],
109949 r8 = this.r[8],
109950 r9 = this.r[9];
109951
109952 while (bytes >= 16) {
109953 t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
109954 t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
109955 t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
109956 t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
109957 t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
109958 h5 += ((t4 >>> 1)) & 0x1fff;
109959 t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
109960 t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
109961 t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
109962 h9 += ((t7 >>> 5)) | hibit;
109963
109964 c = 0;
109965
109966 d0 = c;
109967 d0 += h0 * r0;
109968 d0 += h1 * (5 * r9);
109969 d0 += h2 * (5 * r8);
109970 d0 += h3 * (5 * r7);
109971 d0 += h4 * (5 * r6);
109972 c = (d0 >>> 13); d0 &= 0x1fff;
109973 d0 += h5 * (5 * r5);
109974 d0 += h6 * (5 * r4);
109975 d0 += h7 * (5 * r3);
109976 d0 += h8 * (5 * r2);
109977 d0 += h9 * (5 * r1);
109978 c += (d0 >>> 13); d0 &= 0x1fff;
109979
109980 d1 = c;
109981 d1 += h0 * r1;
109982 d1 += h1 * r0;
109983 d1 += h2 * (5 * r9);
109984 d1 += h3 * (5 * r8);
109985 d1 += h4 * (5 * r7);
109986 c = (d1 >>> 13); d1 &= 0x1fff;
109987 d1 += h5 * (5 * r6);
109988 d1 += h6 * (5 * r5);
109989 d1 += h7 * (5 * r4);
109990 d1 += h8 * (5 * r3);
109991 d1 += h9 * (5 * r2);
109992 c += (d1 >>> 13); d1 &= 0x1fff;
109993
109994 d2 = c;
109995 d2 += h0 * r2;
109996 d2 += h1 * r1;
109997 d2 += h2 * r0;
109998 d2 += h3 * (5 * r9);
109999 d2 += h4 * (5 * r8);
110000 c = (d2 >>> 13); d2 &= 0x1fff;
110001 d2 += h5 * (5 * r7);
110002 d2 += h6 * (5 * r6);
110003 d2 += h7 * (5 * r5);
110004 d2 += h8 * (5 * r4);
110005 d2 += h9 * (5 * r3);
110006 c += (d2 >>> 13); d2 &= 0x1fff;
110007
110008 d3 = c;
110009 d3 += h0 * r3;
110010 d3 += h1 * r2;
110011 d3 += h2 * r1;
110012 d3 += h3 * r0;
110013 d3 += h4 * (5 * r9);
110014 c = (d3 >>> 13); d3 &= 0x1fff;
110015 d3 += h5 * (5 * r8);
110016 d3 += h6 * (5 * r7);
110017 d3 += h7 * (5 * r6);
110018 d3 += h8 * (5 * r5);
110019 d3 += h9 * (5 * r4);
110020 c += (d3 >>> 13); d3 &= 0x1fff;
110021
110022 d4 = c;
110023 d4 += h0 * r4;
110024 d4 += h1 * r3;
110025 d4 += h2 * r2;
110026 d4 += h3 * r1;
110027 d4 += h4 * r0;
110028 c = (d4 >>> 13); d4 &= 0x1fff;
110029 d4 += h5 * (5 * r9);
110030 d4 += h6 * (5 * r8);
110031 d4 += h7 * (5 * r7);
110032 d4 += h8 * (5 * r6);
110033 d4 += h9 * (5 * r5);
110034 c += (d4 >>> 13); d4 &= 0x1fff;
110035
110036 d5 = c;
110037 d5 += h0 * r5;
110038 d5 += h1 * r4;
110039 d5 += h2 * r3;
110040 d5 += h3 * r2;
110041 d5 += h4 * r1;
110042 c = (d5 >>> 13); d5 &= 0x1fff;
110043 d5 += h5 * r0;
110044 d5 += h6 * (5 * r9);
110045 d5 += h7 * (5 * r8);
110046 d5 += h8 * (5 * r7);
110047 d5 += h9 * (5 * r6);
110048 c += (d5 >>> 13); d5 &= 0x1fff;
110049
110050 d6 = c;
110051 d6 += h0 * r6;
110052 d6 += h1 * r5;
110053 d6 += h2 * r4;
110054 d6 += h3 * r3;
110055 d6 += h4 * r2;
110056 c = (d6 >>> 13); d6 &= 0x1fff;
110057 d6 += h5 * r1;
110058 d6 += h6 * r0;
110059 d6 += h7 * (5 * r9);
110060 d6 += h8 * (5 * r8);
110061 d6 += h9 * (5 * r7);
110062 c += (d6 >>> 13); d6 &= 0x1fff;
110063
110064 d7 = c;
110065 d7 += h0 * r7;
110066 d7 += h1 * r6;
110067 d7 += h2 * r5;
110068 d7 += h3 * r4;
110069 d7 += h4 * r3;
110070 c = (d7 >>> 13); d7 &= 0x1fff;
110071 d7 += h5 * r2;
110072 d7 += h6 * r1;
110073 d7 += h7 * r0;
110074 d7 += h8 * (5 * r9);
110075 d7 += h9 * (5 * r8);
110076 c += (d7 >>> 13); d7 &= 0x1fff;
110077
110078 d8 = c;
110079 d8 += h0 * r8;
110080 d8 += h1 * r7;
110081 d8 += h2 * r6;
110082 d8 += h3 * r5;
110083 d8 += h4 * r4;
110084 c = (d8 >>> 13); d8 &= 0x1fff;
110085 d8 += h5 * r3;
110086 d8 += h6 * r2;
110087 d8 += h7 * r1;
110088 d8 += h8 * r0;
110089 d8 += h9 * (5 * r9);
110090 c += (d8 >>> 13); d8 &= 0x1fff;
110091
110092 d9 = c;
110093 d9 += h0 * r9;
110094 d9 += h1 * r8;
110095 d9 += h2 * r7;
110096 d9 += h3 * r6;
110097 d9 += h4 * r5;
110098 c = (d9 >>> 13); d9 &= 0x1fff;
110099 d9 += h5 * r4;
110100 d9 += h6 * r3;
110101 d9 += h7 * r2;
110102 d9 += h8 * r1;
110103 d9 += h9 * r0;
110104 c += (d9 >>> 13); d9 &= 0x1fff;
110105
110106 c = (((c << 2) + c)) | 0;
110107 c = (c + d0) | 0;
110108 d0 = c & 0x1fff;
110109 c = (c >>> 13);
110110 d1 += c;
110111
110112 h0 = d0;
110113 h1 = d1;
110114 h2 = d2;
110115 h3 = d3;
110116 h4 = d4;
110117 h5 = d5;
110118 h6 = d6;
110119 h7 = d7;
110120 h8 = d8;
110121 h9 = d9;
110122
110123 mpos += 16;
110124 bytes -= 16;
110125 }
110126 this.h[0] = h0;
110127 this.h[1] = h1;
110128 this.h[2] = h2;
110129 this.h[3] = h3;
110130 this.h[4] = h4;
110131 this.h[5] = h5;
110132 this.h[6] = h6;
110133 this.h[7] = h7;
110134 this.h[8] = h8;
110135 this.h[9] = h9;
110136};
110137
110138poly1305.prototype.finish = function(mac, macpos) {
110139 var g = new Uint16Array(10);
110140 var c, mask, f, i;
110141
110142 if (this.leftover) {
110143 i = this.leftover;
110144 this.buffer[i++] = 1;
110145 for (; i < 16; i++) this.buffer[i] = 0;
110146 this.fin = 1;
110147 this.blocks(this.buffer, 0, 16);
110148 }
110149
110150 c = this.h[1] >>> 13;
110151 this.h[1] &= 0x1fff;
110152 for (i = 2; i < 10; i++) {
110153 this.h[i] += c;
110154 c = this.h[i] >>> 13;
110155 this.h[i] &= 0x1fff;
110156 }
110157 this.h[0] += (c * 5);
110158 c = this.h[0] >>> 13;
110159 this.h[0] &= 0x1fff;
110160 this.h[1] += c;
110161 c = this.h[1] >>> 13;
110162 this.h[1] &= 0x1fff;
110163 this.h[2] += c;
110164
110165 g[0] = this.h[0] + 5;
110166 c = g[0] >>> 13;
110167 g[0] &= 0x1fff;
110168 for (i = 1; i < 10; i++) {
110169 g[i] = this.h[i] + c;
110170 c = g[i] >>> 13;
110171 g[i] &= 0x1fff;
110172 }
110173 g[9] -= (1 << 13);
110174
110175 mask = (c ^ 1) - 1;
110176 for (i = 0; i < 10; i++) g[i] &= mask;
110177 mask = ~mask;
110178 for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
110179
110180 this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
110181 this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
110182 this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
110183 this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
110184 this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
110185 this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
110186 this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
110187 this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
110188
110189 f = this.h[0] + this.pad[0];
110190 this.h[0] = f & 0xffff;
110191 for (i = 1; i < 8; i++) {
110192 f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
110193 this.h[i] = f & 0xffff;
110194 }
110195
110196 mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
110197 mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
110198 mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
110199 mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
110200 mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
110201 mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
110202 mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
110203 mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
110204 mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
110205 mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
110206 mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
110207 mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
110208 mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
110209 mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
110210 mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
110211 mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
110212};
110213
110214poly1305.prototype.update = function(m, mpos, bytes) {
110215 var i, want;
110216
110217 if (this.leftover) {
110218 want = (16 - this.leftover);
110219 if (want > bytes)
110220 want = bytes;
110221 for (i = 0; i < want; i++)
110222 this.buffer[this.leftover + i] = m[mpos+i];
110223 bytes -= want;
110224 mpos += want;
110225 this.leftover += want;
110226 if (this.leftover < 16)
110227 return;
110228 this.blocks(this.buffer, 0, 16);
110229 this.leftover = 0;
110230 }
110231
110232 if (bytes >= 16) {
110233 want = bytes - (bytes % 16);
110234 this.blocks(m, mpos, want);
110235 mpos += want;
110236 bytes -= want;
110237 }
110238
110239 if (bytes) {
110240 for (i = 0; i < bytes; i++)
110241 this.buffer[this.leftover + i] = m[mpos+i];
110242 this.leftover += bytes;
110243 }
110244};
110245
110246function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
110247 var s = new poly1305(k);
110248 s.update(m, mpos, n);
110249 s.finish(out, outpos);
110250 return 0;
110251}
110252
110253function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
110254 var x = new Uint8Array(16);
110255 crypto_onetimeauth(x,0,m,mpos,n,k);
110256 return crypto_verify_16(h,hpos,x,0);
110257}
110258
110259function crypto_secretbox(c,m,d,n,k) {
110260 var i;
110261 if (d < 32) return -1;
110262 crypto_stream_xor(c,0,m,0,d,n,k);
110263 crypto_onetimeauth(c, 16, c, 32, d - 32, c);
110264 for (i = 0; i < 16; i++) c[i] = 0;
110265 return 0;
110266}
110267
110268function crypto_secretbox_open(m,c,d,n,k) {
110269 var i;
110270 var x = new Uint8Array(32);
110271 if (d < 32) return -1;
110272 crypto_stream(x,0,32,n,k);
110273 if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
110274 crypto_stream_xor(m,0,c,0,d,n,k);
110275 for (i = 0; i < 32; i++) m[i] = 0;
110276 return 0;
110277}
110278
110279function set25519(r, a) {
110280 var i;
110281 for (i = 0; i < 16; i++) r[i] = a[i]|0;
110282}
110283
110284function car25519(o) {
110285 var i, v, c = 1;
110286 for (i = 0; i < 16; i++) {
110287 v = o[i] + c + 65535;
110288 c = Math.floor(v / 65536);
110289 o[i] = v - c * 65536;
110290 }
110291 o[0] += c-1 + 37 * (c-1);
110292}
110293
110294function sel25519(p, q, b) {
110295 var t, c = ~(b-1);
110296 for (var i = 0; i < 16; i++) {
110297 t = c & (p[i] ^ q[i]);
110298 p[i] ^= t;
110299 q[i] ^= t;
110300 }
110301}
110302
110303function pack25519(o, n) {
110304 var i, j, b;
110305 var m = gf(), t = gf();
110306 for (i = 0; i < 16; i++) t[i] = n[i];
110307 car25519(t);
110308 car25519(t);
110309 car25519(t);
110310 for (j = 0; j < 2; j++) {
110311 m[0] = t[0] - 0xffed;
110312 for (i = 1; i < 15; i++) {
110313 m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
110314 m[i-1] &= 0xffff;
110315 }
110316 m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
110317 b = (m[15]>>16) & 1;
110318 m[14] &= 0xffff;
110319 sel25519(t, m, 1-b);
110320 }
110321 for (i = 0; i < 16; i++) {
110322 o[2*i] = t[i] & 0xff;
110323 o[2*i+1] = t[i]>>8;
110324 }
110325}
110326
110327function neq25519(a, b) {
110328 var c = new Uint8Array(32), d = new Uint8Array(32);
110329 pack25519(c, a);
110330 pack25519(d, b);
110331 return crypto_verify_32(c, 0, d, 0);
110332}
110333
110334function par25519(a) {
110335 var d = new Uint8Array(32);
110336 pack25519(d, a);
110337 return d[0] & 1;
110338}
110339
110340function unpack25519(o, n) {
110341 var i;
110342 for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
110343 o[15] &= 0x7fff;
110344}
110345
110346function A(o, a, b) {
110347 for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
110348}
110349
110350function Z(o, a, b) {
110351 for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
110352}
110353
110354function M(o, a, b) {
110355 var v, c,
110356 t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
110357 t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
110358 t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
110359 t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
110360 b0 = b[0],
110361 b1 = b[1],
110362 b2 = b[2],
110363 b3 = b[3],
110364 b4 = b[4],
110365 b5 = b[5],
110366 b6 = b[6],
110367 b7 = b[7],
110368 b8 = b[8],
110369 b9 = b[9],
110370 b10 = b[10],
110371 b11 = b[11],
110372 b12 = b[12],
110373 b13 = b[13],
110374 b14 = b[14],
110375 b15 = b[15];
110376
110377 v = a[0];
110378 t0 += v * b0;
110379 t1 += v * b1;
110380 t2 += v * b2;
110381 t3 += v * b3;
110382 t4 += v * b4;
110383 t5 += v * b5;
110384 t6 += v * b6;
110385 t7 += v * b7;
110386 t8 += v * b8;
110387 t9 += v * b9;
110388 t10 += v * b10;
110389 t11 += v * b11;
110390 t12 += v * b12;
110391 t13 += v * b13;
110392 t14 += v * b14;
110393 t15 += v * b15;
110394 v = a[1];
110395 t1 += v * b0;
110396 t2 += v * b1;
110397 t3 += v * b2;
110398 t4 += v * b3;
110399 t5 += v * b4;
110400 t6 += v * b5;
110401 t7 += v * b6;
110402 t8 += v * b7;
110403 t9 += v * b8;
110404 t10 += v * b9;
110405 t11 += v * b10;
110406 t12 += v * b11;
110407 t13 += v * b12;
110408 t14 += v * b13;
110409 t15 += v * b14;
110410 t16 += v * b15;
110411 v = a[2];
110412 t2 += v * b0;
110413 t3 += v * b1;
110414 t4 += v * b2;
110415 t5 += v * b3;
110416 t6 += v * b4;
110417 t7 += v * b5;
110418 t8 += v * b6;
110419 t9 += v * b7;
110420 t10 += v * b8;
110421 t11 += v * b9;
110422 t12 += v * b10;
110423 t13 += v * b11;
110424 t14 += v * b12;
110425 t15 += v * b13;
110426 t16 += v * b14;
110427 t17 += v * b15;
110428 v = a[3];
110429 t3 += v * b0;
110430 t4 += v * b1;
110431 t5 += v * b2;
110432 t6 += v * b3;
110433 t7 += v * b4;
110434 t8 += v * b5;
110435 t9 += v * b6;
110436 t10 += v * b7;
110437 t11 += v * b8;
110438 t12 += v * b9;
110439 t13 += v * b10;
110440 t14 += v * b11;
110441 t15 += v * b12;
110442 t16 += v * b13;
110443 t17 += v * b14;
110444 t18 += v * b15;
110445 v = a[4];
110446 t4 += v * b0;
110447 t5 += v * b1;
110448 t6 += v * b2;
110449 t7 += v * b3;
110450 t8 += v * b4;
110451 t9 += v * b5;
110452 t10 += v * b6;
110453 t11 += v * b7;
110454 t12 += v * b8;
110455 t13 += v * b9;
110456 t14 += v * b10;
110457 t15 += v * b11;
110458 t16 += v * b12;
110459 t17 += v * b13;
110460 t18 += v * b14;
110461 t19 += v * b15;
110462 v = a[5];
110463 t5 += v * b0;
110464 t6 += v * b1;
110465 t7 += v * b2;
110466 t8 += v * b3;
110467 t9 += v * b4;
110468 t10 += v * b5;
110469 t11 += v * b6;
110470 t12 += v * b7;
110471 t13 += v * b8;
110472 t14 += v * b9;
110473 t15 += v * b10;
110474 t16 += v * b11;
110475 t17 += v * b12;
110476 t18 += v * b13;
110477 t19 += v * b14;
110478 t20 += v * b15;
110479 v = a[6];
110480 t6 += v * b0;
110481 t7 += v * b1;
110482 t8 += v * b2;
110483 t9 += v * b3;
110484 t10 += v * b4;
110485 t11 += v * b5;
110486 t12 += v * b6;
110487 t13 += v * b7;
110488 t14 += v * b8;
110489 t15 += v * b9;
110490 t16 += v * b10;
110491 t17 += v * b11;
110492 t18 += v * b12;
110493 t19 += v * b13;
110494 t20 += v * b14;
110495 t21 += v * b15;
110496 v = a[7];
110497 t7 += v * b0;
110498 t8 += v * b1;
110499 t9 += v * b2;
110500 t10 += v * b3;
110501 t11 += v * b4;
110502 t12 += v * b5;
110503 t13 += v * b6;
110504 t14 += v * b7;
110505 t15 += v * b8;
110506 t16 += v * b9;
110507 t17 += v * b10;
110508 t18 += v * b11;
110509 t19 += v * b12;
110510 t20 += v * b13;
110511 t21 += v * b14;
110512 t22 += v * b15;
110513 v = a[8];
110514 t8 += v * b0;
110515 t9 += v * b1;
110516 t10 += v * b2;
110517 t11 += v * b3;
110518 t12 += v * b4;
110519 t13 += v * b5;
110520 t14 += v * b6;
110521 t15 += v * b7;
110522 t16 += v * b8;
110523 t17 += v * b9;
110524 t18 += v * b10;
110525 t19 += v * b11;
110526 t20 += v * b12;
110527 t21 += v * b13;
110528 t22 += v * b14;
110529 t23 += v * b15;
110530 v = a[9];
110531 t9 += v * b0;
110532 t10 += v * b1;
110533 t11 += v * b2;
110534 t12 += v * b3;
110535 t13 += v * b4;
110536 t14 += v * b5;
110537 t15 += v * b6;
110538 t16 += v * b7;
110539 t17 += v * b8;
110540 t18 += v * b9;
110541 t19 += v * b10;
110542 t20 += v * b11;
110543 t21 += v * b12;
110544 t22 += v * b13;
110545 t23 += v * b14;
110546 t24 += v * b15;
110547 v = a[10];
110548 t10 += v * b0;
110549 t11 += v * b1;
110550 t12 += v * b2;
110551 t13 += v * b3;
110552 t14 += v * b4;
110553 t15 += v * b5;
110554 t16 += v * b6;
110555 t17 += v * b7;
110556 t18 += v * b8;
110557 t19 += v * b9;
110558 t20 += v * b10;
110559 t21 += v * b11;
110560 t22 += v * b12;
110561 t23 += v * b13;
110562 t24 += v * b14;
110563 t25 += v * b15;
110564 v = a[11];
110565 t11 += v * b0;
110566 t12 += v * b1;
110567 t13 += v * b2;
110568 t14 += v * b3;
110569 t15 += v * b4;
110570 t16 += v * b5;
110571 t17 += v * b6;
110572 t18 += v * b7;
110573 t19 += v * b8;
110574 t20 += v * b9;
110575 t21 += v * b10;
110576 t22 += v * b11;
110577 t23 += v * b12;
110578 t24 += v * b13;
110579 t25 += v * b14;
110580 t26 += v * b15;
110581 v = a[12];
110582 t12 += v * b0;
110583 t13 += v * b1;
110584 t14 += v * b2;
110585 t15 += v * b3;
110586 t16 += v * b4;
110587 t17 += v * b5;
110588 t18 += v * b6;
110589 t19 += v * b7;
110590 t20 += v * b8;
110591 t21 += v * b9;
110592 t22 += v * b10;
110593 t23 += v * b11;
110594 t24 += v * b12;
110595 t25 += v * b13;
110596 t26 += v * b14;
110597 t27 += v * b15;
110598 v = a[13];
110599 t13 += v * b0;
110600 t14 += v * b1;
110601 t15 += v * b2;
110602 t16 += v * b3;
110603 t17 += v * b4;
110604 t18 += v * b5;
110605 t19 += v * b6;
110606 t20 += v * b7;
110607 t21 += v * b8;
110608 t22 += v * b9;
110609 t23 += v * b10;
110610 t24 += v * b11;
110611 t25 += v * b12;
110612 t26 += v * b13;
110613 t27 += v * b14;
110614 t28 += v * b15;
110615 v = a[14];
110616 t14 += v * b0;
110617 t15 += v * b1;
110618 t16 += v * b2;
110619 t17 += v * b3;
110620 t18 += v * b4;
110621 t19 += v * b5;
110622 t20 += v * b6;
110623 t21 += v * b7;
110624 t22 += v * b8;
110625 t23 += v * b9;
110626 t24 += v * b10;
110627 t25 += v * b11;
110628 t26 += v * b12;
110629 t27 += v * b13;
110630 t28 += v * b14;
110631 t29 += v * b15;
110632 v = a[15];
110633 t15 += v * b0;
110634 t16 += v * b1;
110635 t17 += v * b2;
110636 t18 += v * b3;
110637 t19 += v * b4;
110638 t20 += v * b5;
110639 t21 += v * b6;
110640 t22 += v * b7;
110641 t23 += v * b8;
110642 t24 += v * b9;
110643 t25 += v * b10;
110644 t26 += v * b11;
110645 t27 += v * b12;
110646 t28 += v * b13;
110647 t29 += v * b14;
110648 t30 += v * b15;
110649
110650 t0 += 38 * t16;
110651 t1 += 38 * t17;
110652 t2 += 38 * t18;
110653 t3 += 38 * t19;
110654 t4 += 38 * t20;
110655 t5 += 38 * t21;
110656 t6 += 38 * t22;
110657 t7 += 38 * t23;
110658 t8 += 38 * t24;
110659 t9 += 38 * t25;
110660 t10 += 38 * t26;
110661 t11 += 38 * t27;
110662 t12 += 38 * t28;
110663 t13 += 38 * t29;
110664 t14 += 38 * t30;
110665 // t15 left as is
110666
110667 // first car
110668 c = 1;
110669 v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
110670 v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
110671 v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
110672 v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
110673 v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
110674 v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
110675 v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
110676 v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
110677 v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
110678 v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
110679 v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
110680 v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
110681 v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
110682 v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
110683 v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
110684 v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
110685 t0 += c-1 + 37 * (c-1);
110686
110687 // second car
110688 c = 1;
110689 v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
110690 v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
110691 v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
110692 v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
110693 v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
110694 v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
110695 v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
110696 v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
110697 v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
110698 v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
110699 v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
110700 v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
110701 v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
110702 v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
110703 v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
110704 v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
110705 t0 += c-1 + 37 * (c-1);
110706
110707 o[ 0] = t0;
110708 o[ 1] = t1;
110709 o[ 2] = t2;
110710 o[ 3] = t3;
110711 o[ 4] = t4;
110712 o[ 5] = t5;
110713 o[ 6] = t6;
110714 o[ 7] = t7;
110715 o[ 8] = t8;
110716 o[ 9] = t9;
110717 o[10] = t10;
110718 o[11] = t11;
110719 o[12] = t12;
110720 o[13] = t13;
110721 o[14] = t14;
110722 o[15] = t15;
110723}
110724
110725function S(o, a) {
110726 M(o, a, a);
110727}
110728
110729function inv25519(o, i) {
110730 var c = gf();
110731 var a;
110732 for (a = 0; a < 16; a++) c[a] = i[a];
110733 for (a = 253; a >= 0; a--) {
110734 S(c, c);
110735 if(a !== 2 && a !== 4) M(c, c, i);
110736 }
110737 for (a = 0; a < 16; a++) o[a] = c[a];
110738}
110739
110740function pow2523(o, i) {
110741 var c = gf();
110742 var a;
110743 for (a = 0; a < 16; a++) c[a] = i[a];
110744 for (a = 250; a >= 0; a--) {
110745 S(c, c);
110746 if(a !== 1) M(c, c, i);
110747 }
110748 for (a = 0; a < 16; a++) o[a] = c[a];
110749}
110750
110751function crypto_scalarmult(q, n, p) {
110752 var z = new Uint8Array(32);
110753 var x = new Float64Array(80), r, i;
110754 var a = gf(), b = gf(), c = gf(),
110755 d = gf(), e = gf(), f = gf();
110756 for (i = 0; i < 31; i++) z[i] = n[i];
110757 z[31]=(n[31]&127)|64;
110758 z[0]&=248;
110759 unpack25519(x,p);
110760 for (i = 0; i < 16; i++) {
110761 b[i]=x[i];
110762 d[i]=a[i]=c[i]=0;
110763 }
110764 a[0]=d[0]=1;
110765 for (i=254; i>=0; --i) {
110766 r=(z[i>>>3]>>>(i&7))&1;
110767 sel25519(a,b,r);
110768 sel25519(c,d,r);
110769 A(e,a,c);
110770 Z(a,a,c);
110771 A(c,b,d);
110772 Z(b,b,d);
110773 S(d,e);
110774 S(f,a);
110775 M(a,c,a);
110776 M(c,b,e);
110777 A(e,a,c);
110778 Z(a,a,c);
110779 S(b,a);
110780 Z(c,d,f);
110781 M(a,c,_121665);
110782 A(a,a,d);
110783 M(c,c,a);
110784 M(a,d,f);
110785 M(d,b,x);
110786 S(b,e);
110787 sel25519(a,b,r);
110788 sel25519(c,d,r);
110789 }
110790 for (i = 0; i < 16; i++) {
110791 x[i+16]=a[i];
110792 x[i+32]=c[i];
110793 x[i+48]=b[i];
110794 x[i+64]=d[i];
110795 }
110796 var x32 = x.subarray(32);
110797 var x16 = x.subarray(16);
110798 inv25519(x32,x32);
110799 M(x16,x16,x32);
110800 pack25519(q,x16);
110801 return 0;
110802}
110803
110804function crypto_scalarmult_base(q, n) {
110805 return crypto_scalarmult(q, n, _9);
110806}
110807
110808function crypto_box_keypair(y, x) {
110809 randombytes(x, 32);
110810 return crypto_scalarmult_base(y, x);
110811}
110812
110813function crypto_box_beforenm(k, y, x) {
110814 var s = new Uint8Array(32);
110815 crypto_scalarmult(s, x, y);
110816 return crypto_core_hsalsa20(k, _0, s, sigma);
110817}
110818
110819var crypto_box_afternm = crypto_secretbox;
110820var crypto_box_open_afternm = crypto_secretbox_open;
110821
110822function crypto_box(c, m, d, n, y, x) {
110823 var k = new Uint8Array(32);
110824 crypto_box_beforenm(k, y, x);
110825 return crypto_box_afternm(c, m, d, n, k);
110826}
110827
110828function crypto_box_open(m, c, d, n, y, x) {
110829 var k = new Uint8Array(32);
110830 crypto_box_beforenm(k, y, x);
110831 return crypto_box_open_afternm(m, c, d, n, k);
110832}
110833
110834var K = [
110835 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
110836 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
110837 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
110838 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
110839 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
110840 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
110841 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
110842 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
110843 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
110844 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
110845 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
110846 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
110847 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
110848 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
110849 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
110850 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
110851 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
110852 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
110853 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
110854 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
110855 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
110856 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
110857 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
110858 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
110859 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
110860 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
110861 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
110862 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
110863 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
110864 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
110865 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
110866 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
110867 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
110868 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
110869 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
110870 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
110871 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
110872 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
110873 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
110874 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
110875];
110876
110877function crypto_hashblocks_hl(hh, hl, m, n) {
110878 var wh = new Int32Array(16), wl = new Int32Array(16),
110879 bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
110880 bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
110881 th, tl, i, j, h, l, a, b, c, d;
110882
110883 var ah0 = hh[0],
110884 ah1 = hh[1],
110885 ah2 = hh[2],
110886 ah3 = hh[3],
110887 ah4 = hh[4],
110888 ah5 = hh[5],
110889 ah6 = hh[6],
110890 ah7 = hh[7],
110891
110892 al0 = hl[0],
110893 al1 = hl[1],
110894 al2 = hl[2],
110895 al3 = hl[3],
110896 al4 = hl[4],
110897 al5 = hl[5],
110898 al6 = hl[6],
110899 al7 = hl[7];
110900
110901 var pos = 0;
110902 while (n >= 128) {
110903 for (i = 0; i < 16; i++) {
110904 j = 8 * i + pos;
110905 wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
110906 wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
110907 }
110908 for (i = 0; i < 80; i++) {
110909 bh0 = ah0;
110910 bh1 = ah1;
110911 bh2 = ah2;
110912 bh3 = ah3;
110913 bh4 = ah4;
110914 bh5 = ah5;
110915 bh6 = ah6;
110916 bh7 = ah7;
110917
110918 bl0 = al0;
110919 bl1 = al1;
110920 bl2 = al2;
110921 bl3 = al3;
110922 bl4 = al4;
110923 bl5 = al5;
110924 bl6 = al6;
110925 bl7 = al7;
110926
110927 // add
110928 h = ah7;
110929 l = al7;
110930
110931 a = l & 0xffff; b = l >>> 16;
110932 c = h & 0xffff; d = h >>> 16;
110933
110934 // Sigma1
110935 h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
110936 l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
110937
110938 a += l & 0xffff; b += l >>> 16;
110939 c += h & 0xffff; d += h >>> 16;
110940
110941 // Ch
110942 h = (ah4 & ah5) ^ (~ah4 & ah6);
110943 l = (al4 & al5) ^ (~al4 & al6);
110944
110945 a += l & 0xffff; b += l >>> 16;
110946 c += h & 0xffff; d += h >>> 16;
110947
110948 // K
110949 h = K[i*2];
110950 l = K[i*2+1];
110951
110952 a += l & 0xffff; b += l >>> 16;
110953 c += h & 0xffff; d += h >>> 16;
110954
110955 // w
110956 h = wh[i%16];
110957 l = wl[i%16];
110958
110959 a += l & 0xffff; b += l >>> 16;
110960 c += h & 0xffff; d += h >>> 16;
110961
110962 b += a >>> 16;
110963 c += b >>> 16;
110964 d += c >>> 16;
110965
110966 th = c & 0xffff | d << 16;
110967 tl = a & 0xffff | b << 16;
110968
110969 // add
110970 h = th;
110971 l = tl;
110972
110973 a = l & 0xffff; b = l >>> 16;
110974 c = h & 0xffff; d = h >>> 16;
110975
110976 // Sigma0
110977 h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
110978 l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
110979
110980 a += l & 0xffff; b += l >>> 16;
110981 c += h & 0xffff; d += h >>> 16;
110982
110983 // Maj
110984 h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
110985 l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
110986
110987 a += l & 0xffff; b += l >>> 16;
110988 c += h & 0xffff; d += h >>> 16;
110989
110990 b += a >>> 16;
110991 c += b >>> 16;
110992 d += c >>> 16;
110993
110994 bh7 = (c & 0xffff) | (d << 16);
110995 bl7 = (a & 0xffff) | (b << 16);
110996
110997 // add
110998 h = bh3;
110999 l = bl3;
111000
111001 a = l & 0xffff; b = l >>> 16;
111002 c = h & 0xffff; d = h >>> 16;
111003
111004 h = th;
111005 l = tl;
111006
111007 a += l & 0xffff; b += l >>> 16;
111008 c += h & 0xffff; d += h >>> 16;
111009
111010 b += a >>> 16;
111011 c += b >>> 16;
111012 d += c >>> 16;
111013
111014 bh3 = (c & 0xffff) | (d << 16);
111015 bl3 = (a & 0xffff) | (b << 16);
111016
111017 ah1 = bh0;
111018 ah2 = bh1;
111019 ah3 = bh2;
111020 ah4 = bh3;
111021 ah5 = bh4;
111022 ah6 = bh5;
111023 ah7 = bh6;
111024 ah0 = bh7;
111025
111026 al1 = bl0;
111027 al2 = bl1;
111028 al3 = bl2;
111029 al4 = bl3;
111030 al5 = bl4;
111031 al6 = bl5;
111032 al7 = bl6;
111033 al0 = bl7;
111034
111035 if (i%16 === 15) {
111036 for (j = 0; j < 16; j++) {
111037 // add
111038 h = wh[j];
111039 l = wl[j];
111040
111041 a = l & 0xffff; b = l >>> 16;
111042 c = h & 0xffff; d = h >>> 16;
111043
111044 h = wh[(j+9)%16];
111045 l = wl[(j+9)%16];
111046
111047 a += l & 0xffff; b += l >>> 16;
111048 c += h & 0xffff; d += h >>> 16;
111049
111050 // sigma0
111051 th = wh[(j+1)%16];
111052 tl = wl[(j+1)%16];
111053 h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
111054 l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
111055
111056 a += l & 0xffff; b += l >>> 16;
111057 c += h & 0xffff; d += h >>> 16;
111058
111059 // sigma1
111060 th = wh[(j+14)%16];
111061 tl = wl[(j+14)%16];
111062 h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
111063 l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
111064
111065 a += l & 0xffff; b += l >>> 16;
111066 c += h & 0xffff; d += h >>> 16;
111067
111068 b += a >>> 16;
111069 c += b >>> 16;
111070 d += c >>> 16;
111071
111072 wh[j] = (c & 0xffff) | (d << 16);
111073 wl[j] = (a & 0xffff) | (b << 16);
111074 }
111075 }
111076 }
111077
111078 // add
111079 h = ah0;
111080 l = al0;
111081
111082 a = l & 0xffff; b = l >>> 16;
111083 c = h & 0xffff; d = h >>> 16;
111084
111085 h = hh[0];
111086 l = hl[0];
111087
111088 a += l & 0xffff; b += l >>> 16;
111089 c += h & 0xffff; d += h >>> 16;
111090
111091 b += a >>> 16;
111092 c += b >>> 16;
111093 d += c >>> 16;
111094
111095 hh[0] = ah0 = (c & 0xffff) | (d << 16);
111096 hl[0] = al0 = (a & 0xffff) | (b << 16);
111097
111098 h = ah1;
111099 l = al1;
111100
111101 a = l & 0xffff; b = l >>> 16;
111102 c = h & 0xffff; d = h >>> 16;
111103
111104 h = hh[1];
111105 l = hl[1];
111106
111107 a += l & 0xffff; b += l >>> 16;
111108 c += h & 0xffff; d += h >>> 16;
111109
111110 b += a >>> 16;
111111 c += b >>> 16;
111112 d += c >>> 16;
111113
111114 hh[1] = ah1 = (c & 0xffff) | (d << 16);
111115 hl[1] = al1 = (a & 0xffff) | (b << 16);
111116
111117 h = ah2;
111118 l = al2;
111119
111120 a = l & 0xffff; b = l >>> 16;
111121 c = h & 0xffff; d = h >>> 16;
111122
111123 h = hh[2];
111124 l = hl[2];
111125
111126 a += l & 0xffff; b += l >>> 16;
111127 c += h & 0xffff; d += h >>> 16;
111128
111129 b += a >>> 16;
111130 c += b >>> 16;
111131 d += c >>> 16;
111132
111133 hh[2] = ah2 = (c & 0xffff) | (d << 16);
111134 hl[2] = al2 = (a & 0xffff) | (b << 16);
111135
111136 h = ah3;
111137 l = al3;
111138
111139 a = l & 0xffff; b = l >>> 16;
111140 c = h & 0xffff; d = h >>> 16;
111141
111142 h = hh[3];
111143 l = hl[3];
111144
111145 a += l & 0xffff; b += l >>> 16;
111146 c += h & 0xffff; d += h >>> 16;
111147
111148 b += a >>> 16;
111149 c += b >>> 16;
111150 d += c >>> 16;
111151
111152 hh[3] = ah3 = (c & 0xffff) | (d << 16);
111153 hl[3] = al3 = (a & 0xffff) | (b << 16);
111154
111155 h = ah4;
111156 l = al4;
111157
111158 a = l & 0xffff; b = l >>> 16;
111159 c = h & 0xffff; d = h >>> 16;
111160
111161 h = hh[4];
111162 l = hl[4];
111163
111164 a += l & 0xffff; b += l >>> 16;
111165 c += h & 0xffff; d += h >>> 16;
111166
111167 b += a >>> 16;
111168 c += b >>> 16;
111169 d += c >>> 16;
111170
111171 hh[4] = ah4 = (c & 0xffff) | (d << 16);
111172 hl[4] = al4 = (a & 0xffff) | (b << 16);
111173
111174 h = ah5;
111175 l = al5;
111176
111177 a = l & 0xffff; b = l >>> 16;
111178 c = h & 0xffff; d = h >>> 16;
111179
111180 h = hh[5];
111181 l = hl[5];
111182
111183 a += l & 0xffff; b += l >>> 16;
111184 c += h & 0xffff; d += h >>> 16;
111185
111186 b += a >>> 16;
111187 c += b >>> 16;
111188 d += c >>> 16;
111189
111190 hh[5] = ah5 = (c & 0xffff) | (d << 16);
111191 hl[5] = al5 = (a & 0xffff) | (b << 16);
111192
111193 h = ah6;
111194 l = al6;
111195
111196 a = l & 0xffff; b = l >>> 16;
111197 c = h & 0xffff; d = h >>> 16;
111198
111199 h = hh[6];
111200 l = hl[6];
111201
111202 a += l & 0xffff; b += l >>> 16;
111203 c += h & 0xffff; d += h >>> 16;
111204
111205 b += a >>> 16;
111206 c += b >>> 16;
111207 d += c >>> 16;
111208
111209 hh[6] = ah6 = (c & 0xffff) | (d << 16);
111210 hl[6] = al6 = (a & 0xffff) | (b << 16);
111211
111212 h = ah7;
111213 l = al7;
111214
111215 a = l & 0xffff; b = l >>> 16;
111216 c = h & 0xffff; d = h >>> 16;
111217
111218 h = hh[7];
111219 l = hl[7];
111220
111221 a += l & 0xffff; b += l >>> 16;
111222 c += h & 0xffff; d += h >>> 16;
111223
111224 b += a >>> 16;
111225 c += b >>> 16;
111226 d += c >>> 16;
111227
111228 hh[7] = ah7 = (c & 0xffff) | (d << 16);
111229 hl[7] = al7 = (a & 0xffff) | (b << 16);
111230
111231 pos += 128;
111232 n -= 128;
111233 }
111234
111235 return n;
111236}
111237
111238function crypto_hash(out, m, n) {
111239 var hh = new Int32Array(8),
111240 hl = new Int32Array(8),
111241 x = new Uint8Array(256),
111242 i, b = n;
111243
111244 hh[0] = 0x6a09e667;
111245 hh[1] = 0xbb67ae85;
111246 hh[2] = 0x3c6ef372;
111247 hh[3] = 0xa54ff53a;
111248 hh[4] = 0x510e527f;
111249 hh[5] = 0x9b05688c;
111250 hh[6] = 0x1f83d9ab;
111251 hh[7] = 0x5be0cd19;
111252
111253 hl[0] = 0xf3bcc908;
111254 hl[1] = 0x84caa73b;
111255 hl[2] = 0xfe94f82b;
111256 hl[3] = 0x5f1d36f1;
111257 hl[4] = 0xade682d1;
111258 hl[5] = 0x2b3e6c1f;
111259 hl[6] = 0xfb41bd6b;
111260 hl[7] = 0x137e2179;
111261
111262 crypto_hashblocks_hl(hh, hl, m, n);
111263 n %= 128;
111264
111265 for (i = 0; i < n; i++) x[i] = m[b-n+i];
111266 x[n] = 128;
111267
111268 n = 256-128*(n<112?1:0);
111269 x[n-9] = 0;
111270 ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
111271 crypto_hashblocks_hl(hh, hl, x, n);
111272
111273 for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
111274
111275 return 0;
111276}
111277
111278function add(p, q) {
111279 var a = gf(), b = gf(), c = gf(),
111280 d = gf(), e = gf(), f = gf(),
111281 g = gf(), h = gf(), t = gf();
111282
111283 Z(a, p[1], p[0]);
111284 Z(t, q[1], q[0]);
111285 M(a, a, t);
111286 A(b, p[0], p[1]);
111287 A(t, q[0], q[1]);
111288 M(b, b, t);
111289 M(c, p[3], q[3]);
111290 M(c, c, D2);
111291 M(d, p[2], q[2]);
111292 A(d, d, d);
111293 Z(e, b, a);
111294 Z(f, d, c);
111295 A(g, d, c);
111296 A(h, b, a);
111297
111298 M(p[0], e, f);
111299 M(p[1], h, g);
111300 M(p[2], g, f);
111301 M(p[3], e, h);
111302}
111303
111304function cswap(p, q, b) {
111305 var i;
111306 for (i = 0; i < 4; i++) {
111307 sel25519(p[i], q[i], b);
111308 }
111309}
111310
111311function pack(r, p) {
111312 var tx = gf(), ty = gf(), zi = gf();
111313 inv25519(zi, p[2]);
111314 M(tx, p[0], zi);
111315 M(ty, p[1], zi);
111316 pack25519(r, ty);
111317 r[31] ^= par25519(tx) << 7;
111318}
111319
111320function scalarmult(p, q, s) {
111321 var b, i;
111322 set25519(p[0], gf0);
111323 set25519(p[1], gf1);
111324 set25519(p[2], gf1);
111325 set25519(p[3], gf0);
111326 for (i = 255; i >= 0; --i) {
111327 b = (s[(i/8)|0] >> (i&7)) & 1;
111328 cswap(p, q, b);
111329 add(q, p);
111330 add(p, p);
111331 cswap(p, q, b);
111332 }
111333}
111334
111335function scalarbase(p, s) {
111336 var q = [gf(), gf(), gf(), gf()];
111337 set25519(q[0], X);
111338 set25519(q[1], Y);
111339 set25519(q[2], gf1);
111340 M(q[3], X, Y);
111341 scalarmult(p, q, s);
111342}
111343
111344function crypto_sign_keypair(pk, sk, seeded) {
111345 var d = new Uint8Array(64);
111346 var p = [gf(), gf(), gf(), gf()];
111347 var i;
111348
111349 if (!seeded) randombytes(sk, 32);
111350 crypto_hash(d, sk, 32);
111351 d[0] &= 248;
111352 d[31] &= 127;
111353 d[31] |= 64;
111354
111355 scalarbase(p, d);
111356 pack(pk, p);
111357
111358 for (i = 0; i < 32; i++) sk[i+32] = pk[i];
111359 return 0;
111360}
111361
111362var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
111363
111364function modL(r, x) {
111365 var carry, i, j, k;
111366 for (i = 63; i >= 32; --i) {
111367 carry = 0;
111368 for (j = i - 32, k = i - 12; j < k; ++j) {
111369 x[j] += carry - 16 * x[i] * L[j - (i - 32)];
111370 carry = (x[j] + 128) >> 8;
111371 x[j] -= carry * 256;
111372 }
111373 x[j] += carry;
111374 x[i] = 0;
111375 }
111376 carry = 0;
111377 for (j = 0; j < 32; j++) {
111378 x[j] += carry - (x[31] >> 4) * L[j];
111379 carry = x[j] >> 8;
111380 x[j] &= 255;
111381 }
111382 for (j = 0; j < 32; j++) x[j] -= carry * L[j];
111383 for (i = 0; i < 32; i++) {
111384 x[i+1] += x[i] >> 8;
111385 r[i] = x[i] & 255;
111386 }
111387}
111388
111389function reduce(r) {
111390 var x = new Float64Array(64), i;
111391 for (i = 0; i < 64; i++) x[i] = r[i];
111392 for (i = 0; i < 64; i++) r[i] = 0;
111393 modL(r, x);
111394}
111395
111396// Note: difference from C - smlen returned, not passed as argument.
111397function crypto_sign(sm, m, n, sk) {
111398 var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
111399 var i, j, x = new Float64Array(64);
111400 var p = [gf(), gf(), gf(), gf()];
111401
111402 crypto_hash(d, sk, 32);
111403 d[0] &= 248;
111404 d[31] &= 127;
111405 d[31] |= 64;
111406
111407 var smlen = n + 64;
111408 for (i = 0; i < n; i++) sm[64 + i] = m[i];
111409 for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
111410
111411 crypto_hash(r, sm.subarray(32), n+32);
111412 reduce(r);
111413 scalarbase(p, r);
111414 pack(sm, p);
111415
111416 for (i = 32; i < 64; i++) sm[i] = sk[i];
111417 crypto_hash(h, sm, n + 64);
111418 reduce(h);
111419
111420 for (i = 0; i < 64; i++) x[i] = 0;
111421 for (i = 0; i < 32; i++) x[i] = r[i];
111422 for (i = 0; i < 32; i++) {
111423 for (j = 0; j < 32; j++) {
111424 x[i+j] += h[i] * d[j];
111425 }
111426 }
111427
111428 modL(sm.subarray(32), x);
111429 return smlen;
111430}
111431
111432function unpackneg(r, p) {
111433 var t = gf(), chk = gf(), num = gf(),
111434 den = gf(), den2 = gf(), den4 = gf(),
111435 den6 = gf();
111436
111437 set25519(r[2], gf1);
111438 unpack25519(r[1], p);
111439 S(num, r[1]);
111440 M(den, num, D);
111441 Z(num, num, r[2]);
111442 A(den, r[2], den);
111443
111444 S(den2, den);
111445 S(den4, den2);
111446 M(den6, den4, den2);
111447 M(t, den6, num);
111448 M(t, t, den);
111449
111450 pow2523(t, t);
111451 M(t, t, num);
111452 M(t, t, den);
111453 M(t, t, den);
111454 M(r[0], t, den);
111455
111456 S(chk, r[0]);
111457 M(chk, chk, den);
111458 if (neq25519(chk, num)) M(r[0], r[0], I);
111459
111460 S(chk, r[0]);
111461 M(chk, chk, den);
111462 if (neq25519(chk, num)) return -1;
111463
111464 if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
111465
111466 M(r[3], r[0], r[1]);
111467 return 0;
111468}
111469
111470function crypto_sign_open(m, sm, n, pk) {
111471 var i, mlen;
111472 var t = new Uint8Array(32), h = new Uint8Array(64);
111473 var p = [gf(), gf(), gf(), gf()],
111474 q = [gf(), gf(), gf(), gf()];
111475
111476 mlen = -1;
111477 if (n < 64) return -1;
111478
111479 if (unpackneg(q, pk)) return -1;
111480
111481 for (i = 0; i < n; i++) m[i] = sm[i];
111482 for (i = 0; i < 32; i++) m[i+32] = pk[i];
111483 crypto_hash(h, m, n);
111484 reduce(h);
111485 scalarmult(p, q, h);
111486
111487 scalarbase(q, sm.subarray(32));
111488 add(p, q);
111489 pack(t, p);
111490
111491 n -= 64;
111492 if (crypto_verify_32(sm, 0, t, 0)) {
111493 for (i = 0; i < n; i++) m[i] = 0;
111494 return -1;
111495 }
111496
111497 for (i = 0; i < n; i++) m[i] = sm[i + 64];
111498 mlen = n;
111499 return mlen;
111500}
111501
111502var crypto_secretbox_KEYBYTES = 32,
111503 crypto_secretbox_NONCEBYTES = 24,
111504 crypto_secretbox_ZEROBYTES = 32,
111505 crypto_secretbox_BOXZEROBYTES = 16,
111506 crypto_scalarmult_BYTES = 32,
111507 crypto_scalarmult_SCALARBYTES = 32,
111508 crypto_box_PUBLICKEYBYTES = 32,
111509 crypto_box_SECRETKEYBYTES = 32,
111510 crypto_box_BEFORENMBYTES = 32,
111511 crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
111512 crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
111513 crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
111514 crypto_sign_BYTES = 64,
111515 crypto_sign_PUBLICKEYBYTES = 32,
111516 crypto_sign_SECRETKEYBYTES = 64,
111517 crypto_sign_SEEDBYTES = 32,
111518 crypto_hash_BYTES = 64;
111519
111520nacl.lowlevel = {
111521 crypto_core_hsalsa20: crypto_core_hsalsa20,
111522 crypto_stream_xor: crypto_stream_xor,
111523 crypto_stream: crypto_stream,
111524 crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
111525 crypto_stream_salsa20: crypto_stream_salsa20,
111526 crypto_onetimeauth: crypto_onetimeauth,
111527 crypto_onetimeauth_verify: crypto_onetimeauth_verify,
111528 crypto_verify_16: crypto_verify_16,
111529 crypto_verify_32: crypto_verify_32,
111530 crypto_secretbox: crypto_secretbox,
111531 crypto_secretbox_open: crypto_secretbox_open,
111532 crypto_scalarmult: crypto_scalarmult,
111533 crypto_scalarmult_base: crypto_scalarmult_base,
111534 crypto_box_beforenm: crypto_box_beforenm,
111535 crypto_box_afternm: crypto_box_afternm,
111536 crypto_box: crypto_box,
111537 crypto_box_open: crypto_box_open,
111538 crypto_box_keypair: crypto_box_keypair,
111539 crypto_hash: crypto_hash,
111540 crypto_sign: crypto_sign,
111541 crypto_sign_keypair: crypto_sign_keypair,
111542 crypto_sign_open: crypto_sign_open,
111543
111544 crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
111545 crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
111546 crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
111547 crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
111548 crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
111549 crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
111550 crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
111551 crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
111552 crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
111553 crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
111554 crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
111555 crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
111556 crypto_sign_BYTES: crypto_sign_BYTES,
111557 crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
111558 crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
111559 crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
111560 crypto_hash_BYTES: crypto_hash_BYTES
111561};
111562
111563/* High-level API */
111564
111565function checkLengths(k, n) {
111566 if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
111567 if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
111568}
111569
111570function checkBoxLengths(pk, sk) {
111571 if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
111572 if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
111573}
111574
111575function checkArrayTypes() {
111576 for (var i = 0; i < arguments.length; i++) {
111577 if (!(arguments[i] instanceof Uint8Array))
111578 throw new TypeError('unexpected type, use Uint8Array');
111579 }
111580}
111581
111582function cleanup(arr) {
111583 for (var i = 0; i < arr.length; i++) arr[i] = 0;
111584}
111585
111586nacl.randomBytes = function(n) {
111587 var b = new Uint8Array(n);
111588 randombytes(b, n);
111589 return b;
111590};
111591
111592nacl.secretbox = function(msg, nonce, key) {
111593 checkArrayTypes(msg, nonce, key);
111594 checkLengths(key, nonce);
111595 var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
111596 var c = new Uint8Array(m.length);
111597 for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
111598 crypto_secretbox(c, m, m.length, nonce, key);
111599 return c.subarray(crypto_secretbox_BOXZEROBYTES);
111600};
111601
111602nacl.secretbox.open = function(box, nonce, key) {
111603 checkArrayTypes(box, nonce, key);
111604 checkLengths(key, nonce);
111605 var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
111606 var m = new Uint8Array(c.length);
111607 for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
111608 if (c.length < 32) return null;
111609 if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
111610 return m.subarray(crypto_secretbox_ZEROBYTES);
111611};
111612
111613nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
111614nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
111615nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
111616
111617nacl.scalarMult = function(n, p) {
111618 checkArrayTypes(n, p);
111619 if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
111620 if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
111621 var q = new Uint8Array(crypto_scalarmult_BYTES);
111622 crypto_scalarmult(q, n, p);
111623 return q;
111624};
111625
111626nacl.scalarMult.base = function(n) {
111627 checkArrayTypes(n);
111628 if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
111629 var q = new Uint8Array(crypto_scalarmult_BYTES);
111630 crypto_scalarmult_base(q, n);
111631 return q;
111632};
111633
111634nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
111635nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
111636
111637nacl.box = function(msg, nonce, publicKey, secretKey) {
111638 var k = nacl.box.before(publicKey, secretKey);
111639 return nacl.secretbox(msg, nonce, k);
111640};
111641
111642nacl.box.before = function(publicKey, secretKey) {
111643 checkArrayTypes(publicKey, secretKey);
111644 checkBoxLengths(publicKey, secretKey);
111645 var k = new Uint8Array(crypto_box_BEFORENMBYTES);
111646 crypto_box_beforenm(k, publicKey, secretKey);
111647 return k;
111648};
111649
111650nacl.box.after = nacl.secretbox;
111651
111652nacl.box.open = function(msg, nonce, publicKey, secretKey) {
111653 var k = nacl.box.before(publicKey, secretKey);
111654 return nacl.secretbox.open(msg, nonce, k);
111655};
111656
111657nacl.box.open.after = nacl.secretbox.open;
111658
111659nacl.box.keyPair = function() {
111660 var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
111661 var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
111662 crypto_box_keypair(pk, sk);
111663 return {publicKey: pk, secretKey: sk};
111664};
111665
111666nacl.box.keyPair.fromSecretKey = function(secretKey) {
111667 checkArrayTypes(secretKey);
111668 if (secretKey.length !== crypto_box_SECRETKEYBYTES)
111669 throw new Error('bad secret key size');
111670 var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
111671 crypto_scalarmult_base(pk, secretKey);
111672 return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
111673};
111674
111675nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
111676nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
111677nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
111678nacl.box.nonceLength = crypto_box_NONCEBYTES;
111679nacl.box.overheadLength = nacl.secretbox.overheadLength;
111680
111681nacl.sign = function(msg, secretKey) {
111682 checkArrayTypes(msg, secretKey);
111683 if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
111684 throw new Error('bad secret key size');
111685 var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
111686 crypto_sign(signedMsg, msg, msg.length, secretKey);
111687 return signedMsg;
111688};
111689
111690nacl.sign.open = function(signedMsg, publicKey) {
111691 checkArrayTypes(signedMsg, publicKey);
111692 if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
111693 throw new Error('bad public key size');
111694 var tmp = new Uint8Array(signedMsg.length);
111695 var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
111696 if (mlen < 0) return null;
111697 var m = new Uint8Array(mlen);
111698 for (var i = 0; i < m.length; i++) m[i] = tmp[i];
111699 return m;
111700};
111701
111702nacl.sign.detached = function(msg, secretKey) {
111703 var signedMsg = nacl.sign(msg, secretKey);
111704 var sig = new Uint8Array(crypto_sign_BYTES);
111705 for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
111706 return sig;
111707};
111708
111709nacl.sign.detached.verify = function(msg, sig, publicKey) {
111710 checkArrayTypes(msg, sig, publicKey);
111711 if (sig.length !== crypto_sign_BYTES)
111712 throw new Error('bad signature size');
111713 if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
111714 throw new Error('bad public key size');
111715 var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
111716 var m = new Uint8Array(crypto_sign_BYTES + msg.length);
111717 var i;
111718 for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
111719 for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
111720 return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
111721};
111722
111723nacl.sign.keyPair = function() {
111724 var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
111725 var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
111726 crypto_sign_keypair(pk, sk);
111727 return {publicKey: pk, secretKey: sk};
111728};
111729
111730nacl.sign.keyPair.fromSecretKey = function(secretKey) {
111731 checkArrayTypes(secretKey);
111732 if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
111733 throw new Error('bad secret key size');
111734 var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
111735 for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
111736 return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
111737};
111738
111739nacl.sign.keyPair.fromSeed = function(seed) {
111740 checkArrayTypes(seed);
111741 if (seed.length !== crypto_sign_SEEDBYTES)
111742 throw new Error('bad seed size');
111743 var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
111744 var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
111745 for (var i = 0; i < 32; i++) sk[i] = seed[i];
111746 crypto_sign_keypair(pk, sk, true);
111747 return {publicKey: pk, secretKey: sk};
111748};
111749
111750nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
111751nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
111752nacl.sign.seedLength = crypto_sign_SEEDBYTES;
111753nacl.sign.signatureLength = crypto_sign_BYTES;
111754
111755nacl.hash = function(msg) {
111756 checkArrayTypes(msg);
111757 var h = new Uint8Array(crypto_hash_BYTES);
111758 crypto_hash(h, msg, msg.length);
111759 return h;
111760};
111761
111762nacl.hash.hashLength = crypto_hash_BYTES;
111763
111764nacl.verify = function(x, y) {
111765 checkArrayTypes(x, y);
111766 // Zero length arguments are considered not equal.
111767 if (x.length === 0 || y.length === 0) return false;
111768 if (x.length !== y.length) return false;
111769 return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
111770};
111771
111772nacl.setPRNG = function(fn) {
111773 randombytes = fn;
111774};
111775
111776(function() {
111777 // Initialize PRNG if environment provides CSPRNG.
111778 // If not, methods calling randombytes will throw.
111779 var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
111780 if (crypto && crypto.getRandomValues) {
111781 // Browsers.
111782 var QUOTA = 65536;
111783 nacl.setPRNG(function(x, n) {
111784 var i, v = new Uint8Array(n);
111785 for (i = 0; i < n; i += QUOTA) {
111786 crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
111787 }
111788 for (i = 0; i < n; i++) x[i] = v[i];
111789 cleanup(v);
111790 });
111791 } else if (typeof require !== 'undefined') {
111792 // Node.js.
111793 crypto = require('crypto');
111794 if (crypto && crypto.randomBytes) {
111795 nacl.setPRNG(function(x, n) {
111796 var i, v = crypto.randomBytes(n);
111797 for (i = 0; i < n; i++) x[i] = v[i];
111798 cleanup(v);
111799 });
111800 }
111801 }
111802})();
111803
111804})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {}));
111805
111806},{"crypto":110}],814:[function(require,module,exports){
111807var native = require('./native')
111808
111809function getTypeName (fn) {
111810 return fn.name || fn.toString().match(/function (.*?)\s*\(/)[1]
111811}
111812
111813function getValueTypeName (value) {
111814 return native.Nil(value) ? '' : getTypeName(value.constructor)
111815}
111816
111817function getValue (value) {
111818 if (native.Function(value)) return ''
111819 if (native.String(value)) return JSON.stringify(value)
111820 if (value && native.Object(value)) return ''
111821 return value
111822}
111823
111824function captureStackTrace (e, t) {
111825 if (Error.captureStackTrace) {
111826 Error.captureStackTrace(e, t)
111827 }
111828}
111829
111830function tfJSON (type) {
111831 if (native.Function(type)) return type.toJSON ? type.toJSON() : getTypeName(type)
111832 if (native.Array(type)) return 'Array'
111833 if (type && native.Object(type)) return 'Object'
111834
111835 return type !== undefined ? type : ''
111836}
111837
111838function tfErrorString (type, value, valueTypeName) {
111839 var valueJson = getValue(value)
111840
111841 return 'Expected ' + tfJSON(type) + ', got' +
111842 (valueTypeName !== '' ? ' ' + valueTypeName : '') +
111843 (valueJson !== '' ? ' ' + valueJson : '')
111844}
111845
111846function TfTypeError (type, value, valueTypeName) {
111847 valueTypeName = valueTypeName || getValueTypeName(value)
111848 this.message = tfErrorString(type, value, valueTypeName)
111849
111850 captureStackTrace(this, TfTypeError)
111851 this.__type = type
111852 this.__value = value
111853 this.__valueTypeName = valueTypeName
111854}
111855
111856TfTypeError.prototype = Object.create(Error.prototype)
111857TfTypeError.prototype.constructor = TfTypeError
111858
111859function tfPropertyErrorString (type, label, name, value, valueTypeName) {
111860 var description = '" of type '
111861 if (label === 'key') description = '" with key type '
111862
111863 return tfErrorString('property "' + tfJSON(name) + description + tfJSON(type), value, valueTypeName)
111864}
111865
111866function TfPropertyTypeError (type, property, label, value, valueTypeName) {
111867 if (type) {
111868 valueTypeName = valueTypeName || getValueTypeName(value)
111869 this.message = tfPropertyErrorString(type, label, property, value, valueTypeName)
111870 } else {
111871 this.message = 'Unexpected property "' + property + '"'
111872 }
111873
111874 captureStackTrace(this, TfTypeError)
111875 this.__label = label
111876 this.__property = property
111877 this.__type = type
111878 this.__value = value
111879 this.__valueTypeName = valueTypeName
111880}
111881
111882TfPropertyTypeError.prototype = Object.create(Error.prototype)
111883TfPropertyTypeError.prototype.constructor = TfTypeError
111884
111885function tfCustomError (expected, actual) {
111886 return new TfTypeError(expected, {}, actual)
111887}
111888
111889function tfSubError (e, property, label) {
111890 // sub child?
111891 if (e instanceof TfPropertyTypeError) {
111892 property = property + '.' + e.__property
111893
111894 e = new TfPropertyTypeError(
111895 e.__type, property, e.__label, e.__value, e.__valueTypeName
111896 )
111897
111898 // child?
111899 } else if (e instanceof TfTypeError) {
111900 e = new TfPropertyTypeError(
111901 e.__type, property, label, e.__value, e.__valueTypeName
111902 )
111903 }
111904
111905 captureStackTrace(e)
111906 return e
111907}
111908
111909module.exports = {
111910 TfTypeError: TfTypeError,
111911 TfPropertyTypeError: TfPropertyTypeError,
111912 tfCustomError: tfCustomError,
111913 tfSubError: tfSubError,
111914 tfJSON: tfJSON,
111915 getValueTypeName: getValueTypeName
111916}
111917
111918},{"./native":817}],815:[function(require,module,exports){
111919(function (Buffer){
111920var NATIVE = require('./native')
111921var ERRORS = require('./errors')
111922
111923function _Buffer (value) {
111924 return Buffer.isBuffer(value)
111925}
111926
111927function Hex (value) {
111928 return typeof value === 'string' && /^([0-9a-f]{2})+$/i.test(value)
111929}
111930
111931function _LengthN (type, length) {
111932 var name = type.toJSON()
111933
111934 function Length (value) {
111935 if (!type(value)) return false
111936 if (value.length === length) return true
111937
111938 throw ERRORS.tfCustomError(name + '(Length: ' + length + ')', name + '(Length: ' + value.length + ')')
111939 }
111940 Length.toJSON = function () { return name }
111941
111942 return Length
111943}
111944
111945var _ArrayN = _LengthN.bind(null, NATIVE.Array)
111946var _BufferN = _LengthN.bind(null, _Buffer)
111947var _HexN = _LengthN.bind(null, Hex)
111948var _StringN = _LengthN.bind(null, NATIVE.String)
111949
111950function Range (a, b, f) {
111951 f = f || NATIVE.Number
111952 function _range (value, strict) {
111953 return f(value, strict) && (value > a) && (value < b)
111954 }
111955 _range.toJSON = function () {
111956 return `${f.toJSON()} between [${a}, ${b}]`
111957 }
111958 return _range
111959}
111960
111961var INT53_MAX = Math.pow(2, 53) - 1
111962
111963function Finite (value) {
111964 return typeof value === 'number' && isFinite(value)
111965}
111966function Int8 (value) { return ((value << 24) >> 24) === value }
111967function Int16 (value) { return ((value << 16) >> 16) === value }
111968function Int32 (value) { return (value | 0) === value }
111969function Int53 (value) {
111970 return typeof value === 'number' &&
111971 value >= -INT53_MAX &&
111972 value <= INT53_MAX &&
111973 Math.floor(value) === value
111974}
111975function UInt8 (value) { return (value & 0xff) === value }
111976function UInt16 (value) { return (value & 0xffff) === value }
111977function UInt32 (value) { return (value >>> 0) === value }
111978function UInt53 (value) {
111979 return typeof value === 'number' &&
111980 value >= 0 &&
111981 value <= INT53_MAX &&
111982 Math.floor(value) === value
111983}
111984
111985var types = {
111986 ArrayN: _ArrayN,
111987 Buffer: _Buffer,
111988 BufferN: _BufferN,
111989 Finite: Finite,
111990 Hex: Hex,
111991 HexN: _HexN,
111992 Int8: Int8,
111993 Int16: Int16,
111994 Int32: Int32,
111995 Int53: Int53,
111996 Range: Range,
111997 StringN: _StringN,
111998 UInt8: UInt8,
111999 UInt16: UInt16,
112000 UInt32: UInt32,
112001 UInt53: UInt53
112002}
112003
112004for (var typeName in types) {
112005 types[typeName].toJSON = function (t) {
112006 return t
112007 }.bind(null, typeName)
112008}
112009
112010module.exports = types
112011
112012}).call(this,{"isBuffer":require("../insert-module-globals/node_modules/is-buffer/index.js")})
112013},{"../insert-module-globals/node_modules/is-buffer/index.js":397,"./errors":814,"./native":817}],816:[function(require,module,exports){
112014var ERRORS = require('./errors')
112015var NATIVE = require('./native')
112016
112017// short-hand
112018var tfJSON = ERRORS.tfJSON
112019var TfTypeError = ERRORS.TfTypeError
112020var TfPropertyTypeError = ERRORS.TfPropertyTypeError
112021var tfSubError = ERRORS.tfSubError
112022var getValueTypeName = ERRORS.getValueTypeName
112023
112024var TYPES = {
112025 arrayOf: function arrayOf (type, options) {
112026 type = compile(type)
112027 options = options || {}
112028
112029 function _arrayOf (array, strict) {
112030 if (!NATIVE.Array(array)) return false
112031 if (NATIVE.Nil(array)) return false
112032 if (options.minLength !== undefined && array.length < options.minLength) return false
112033 if (options.maxLength !== undefined && array.length > options.maxLength) return false
112034 if (options.length !== undefined && array.length !== options.length) return false
112035
112036 return array.every(function (value, i) {
112037 try {
112038 return typeforce(type, value, strict)
112039 } catch (e) {
112040 throw tfSubError(e, i)
112041 }
112042 })
112043 }
112044 _arrayOf.toJSON = function () {
112045 var str = '[' + tfJSON(type) + ']'
112046 if (options.length !== undefined) {
112047 str += '{' + options.length + '}'
112048 } else if (options.minLength !== undefined || options.maxLength !== undefined) {
112049 str += '{' +
112050 (options.minLength === undefined ? 0 : options.minLength) + ',' +
112051 (options.maxLength === undefined ? Infinity : options.maxLength) + '}'
112052 }
112053 return str
112054 }
112055
112056 return _arrayOf
112057 },
112058
112059 maybe: function maybe (type) {
112060 type = compile(type)
112061
112062 function _maybe (value, strict) {
112063 return NATIVE.Nil(value) || type(value, strict, maybe)
112064 }
112065 _maybe.toJSON = function () { return '?' + tfJSON(type) }
112066
112067 return _maybe
112068 },
112069
112070 map: function map (propertyType, propertyKeyType) {
112071 propertyType = compile(propertyType)
112072 if (propertyKeyType) propertyKeyType = compile(propertyKeyType)
112073
112074 function _map (value, strict) {
112075 if (!NATIVE.Object(value)) return false
112076 if (NATIVE.Nil(value)) return false
112077
112078 for (var propertyName in value) {
112079 try {
112080 if (propertyKeyType) {
112081 typeforce(propertyKeyType, propertyName, strict)
112082 }
112083 } catch (e) {
112084 throw tfSubError(e, propertyName, 'key')
112085 }
112086
112087 try {
112088 var propertyValue = value[propertyName]
112089 typeforce(propertyType, propertyValue, strict)
112090 } catch (e) {
112091 throw tfSubError(e, propertyName)
112092 }
112093 }
112094
112095 return true
112096 }
112097
112098 if (propertyKeyType) {
112099 _map.toJSON = function () {
112100 return '{' + tfJSON(propertyKeyType) + ': ' + tfJSON(propertyType) + '}'
112101 }
112102 } else {
112103 _map.toJSON = function () { return '{' + tfJSON(propertyType) + '}' }
112104 }
112105
112106 return _map
112107 },
112108
112109 object: function object (uncompiled) {
112110 var type = {}
112111
112112 for (var typePropertyName in uncompiled) {
112113 type[typePropertyName] = compile(uncompiled[typePropertyName])
112114 }
112115
112116 function _object (value, strict) {
112117 if (!NATIVE.Object(value)) return false
112118 if (NATIVE.Nil(value)) return false
112119
112120 var propertyName
112121
112122 try {
112123 for (propertyName in type) {
112124 var propertyType = type[propertyName]
112125 var propertyValue = value[propertyName]
112126
112127 typeforce(propertyType, propertyValue, strict)
112128 }
112129 } catch (e) {
112130 throw tfSubError(e, propertyName)
112131 }
112132
112133 if (strict) {
112134 for (propertyName in value) {
112135 if (type[propertyName]) continue
112136
112137 throw new TfPropertyTypeError(undefined, propertyName)
112138 }
112139 }
112140
112141 return true
112142 }
112143 _object.toJSON = function () { return tfJSON(type) }
112144
112145 return _object
112146 },
112147
112148 anyOf: function anyOf () {
112149 var types = [].slice.call(arguments).map(compile)
112150
112151 function _anyOf (value, strict) {
112152 return types.some(function (type) {
112153 try {
112154 return typeforce(type, value, strict)
112155 } catch (e) {
112156 return false
112157 }
112158 })
112159 }
112160 _anyOf.toJSON = function () { return types.map(tfJSON).join('|') }
112161
112162 return _anyOf
112163 },
112164
112165 allOf: function allOf () {
112166 var types = [].slice.call(arguments).map(compile)
112167
112168 function _allOf (value, strict) {
112169 return types.every(function (type) {
112170 try {
112171 return typeforce(type, value, strict)
112172 } catch (e) {
112173 return false
112174 }
112175 })
112176 }
112177 _allOf.toJSON = function () { return types.map(tfJSON).join(' & ') }
112178
112179 return _allOf
112180 },
112181
112182 quacksLike: function quacksLike (type) {
112183 function _quacksLike (value) {
112184 return type === getValueTypeName(value)
112185 }
112186 _quacksLike.toJSON = function () { return type }
112187
112188 return _quacksLike
112189 },
112190
112191 tuple: function tuple () {
112192 var types = [].slice.call(arguments).map(compile)
112193
112194 function _tuple (values, strict) {
112195 if (NATIVE.Nil(values)) return false
112196 if (NATIVE.Nil(values.length)) return false
112197 if (strict && (values.length !== types.length)) return false
112198
112199 return types.every(function (type, i) {
112200 try {
112201 return typeforce(type, values[i], strict)
112202 } catch (e) {
112203 throw tfSubError(e, i)
112204 }
112205 })
112206 }
112207 _tuple.toJSON = function () { return '(' + types.map(tfJSON).join(', ') + ')' }
112208
112209 return _tuple
112210 },
112211
112212 value: function value (expected) {
112213 function _value (actual) {
112214 return actual === expected
112215 }
112216 _value.toJSON = function () { return expected }
112217
112218 return _value
112219 }
112220}
112221
112222// TODO: deprecate
112223TYPES.oneOf = TYPES.anyOf
112224
112225function compile (type) {
112226 if (NATIVE.String(type)) {
112227 if (type[0] === '?') return TYPES.maybe(type.slice(1))
112228
112229 return NATIVE[type] || TYPES.quacksLike(type)
112230 } else if (type && NATIVE.Object(type)) {
112231 if (NATIVE.Array(type)) {
112232 if (type.length !== 1) throw new TypeError('Expected compile() parameter of type Array of length 1')
112233 return TYPES.arrayOf(type[0])
112234 }
112235
112236 return TYPES.object(type)
112237 } else if (NATIVE.Function(type)) {
112238 return type
112239 }
112240
112241 return TYPES.value(type)
112242}
112243
112244function typeforce (type, value, strict, surrogate) {
112245 if (NATIVE.Function(type)) {
112246 if (type(value, strict)) return true
112247
112248 throw new TfTypeError(surrogate || type, value)
112249 }
112250
112251 // JIT
112252 return typeforce(compile(type), value, strict)
112253}
112254
112255// assign types to typeforce function
112256for (var typeName in NATIVE) {
112257 typeforce[typeName] = NATIVE[typeName]
112258}
112259
112260for (typeName in TYPES) {
112261 typeforce[typeName] = TYPES[typeName]
112262}
112263
112264var EXTRA = require('./extra')
112265for (typeName in EXTRA) {
112266 typeforce[typeName] = EXTRA[typeName]
112267}
112268
112269typeforce.compile = compile
112270typeforce.TfTypeError = TfTypeError
112271typeforce.TfPropertyTypeError = TfPropertyTypeError
112272
112273module.exports = typeforce
112274
112275},{"./errors":814,"./extra":815,"./native":817}],817:[function(require,module,exports){
112276var types = {
112277 Array: function (value) { return value !== null && value !== undefined && value.constructor === Array },
112278 Boolean: function (value) { return typeof value === 'boolean' },
112279 Function: function (value) { return typeof value === 'function' },
112280 Nil: function (value) { return value === undefined || value === null },
112281 Number: function (value) { return typeof value === 'number' },
112282 Object: function (value) { return typeof value === 'object' },
112283 String: function (value) { return typeof value === 'string' },
112284 '': function () { return true }
112285}
112286
112287// TODO: deprecate
112288types.Null = types.Nil
112289
112290for (var typeName in types) {
112291 types[typeName].toJSON = function (t) {
112292 return t
112293 }.bind(null, typeName)
112294}
112295
112296module.exports = types
112297
112298},{}],818:[function(require,module,exports){
112299(function (root) {
112300 "use strict";
112301
112302/***** unorm.js *****/
112303
112304/*
112305 * UnicodeNormalizer 1.0.0
112306 * Copyright (c) 2008 Matsuza
112307 * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
112308 * $Date: 2008-06-05 16:44:17 +0200 (Thu, 05 Jun 2008) $
112309 * $Rev: 13309 $
112310 */
112311
112312 var DEFAULT_FEATURE = [null, 0, {}];
112313 var CACHE_THRESHOLD = 10;
112314 var SBase = 0xAC00, LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7, LCount = 19, VCount = 21, TCount = 28;
112315 var NCount = VCount * TCount; // 588
112316 var SCount = LCount * NCount; // 11172
112317
112318 var UChar = function(cp, feature){
112319 this.codepoint = cp;
112320 this.feature = feature;
112321 };
112322
112323 // Strategies
112324 var cache = {};
112325 var cacheCounter = [];
112326 for (var i = 0; i <= 0xFF; ++i){
112327 cacheCounter[i] = 0;
112328 }
112329
112330 function fromCache(next, cp, needFeature){
112331 var ret = cache[cp];
112332 if(!ret){
112333 ret = next(cp, needFeature);
112334 if(!!ret.feature && ++cacheCounter[(cp >> 8) & 0xFF] > CACHE_THRESHOLD){
112335 cache[cp] = ret;
112336 }
112337 }
112338 return ret;
112339 }
112340
112341 function fromData(next, cp, needFeature){
112342 var hash = cp & 0xFF00;
112343 var dunit = UChar.udata[hash] || {};
112344 var f = dunit[cp];
112345 return f ? new UChar(cp, f) : new UChar(cp, DEFAULT_FEATURE);
112346 }
112347 function fromCpOnly(next, cp, needFeature){
112348 return !!needFeature ? next(cp, needFeature) : new UChar(cp, null);
112349 }
112350 function fromRuleBasedJamo(next, cp, needFeature){
112351 var j;
112352 if(cp < LBase || (LBase + LCount <= cp && cp < SBase) || (SBase + SCount < cp)){
112353 return next(cp, needFeature);
112354 }
112355 if(LBase <= cp && cp < LBase + LCount){
112356 var c = {};
112357 var base = (cp - LBase) * VCount;
112358 for (j = 0; j < VCount; ++j){
112359 c[VBase + j] = SBase + TCount * (j + base);
112360 }
112361 return new UChar(cp, [,,c]);
112362 }
112363
112364 var SIndex = cp - SBase;
112365 var TIndex = SIndex % TCount;
112366 var feature = [];
112367 if(TIndex !== 0){
112368 feature[0] = [SBase + SIndex - TIndex, TBase + TIndex];
112369 } else {
112370 feature[0] = [LBase + Math.floor(SIndex / NCount), VBase + Math.floor((SIndex % NCount) / TCount)];
112371 feature[2] = {};
112372 for (j = 1; j < TCount; ++j){
112373 feature[2][TBase + j] = cp + j;
112374 }
112375 }
112376 return new UChar(cp, feature);
112377 }
112378 function fromCpFilter(next, cp, needFeature){
112379 return cp < 60 || 13311 < cp && cp < 42607 ? new UChar(cp, DEFAULT_FEATURE) : next(cp, needFeature);
112380 }
112381
112382 var strategies = [fromCpFilter, fromCache, fromCpOnly, fromRuleBasedJamo, fromData];
112383
112384 UChar.fromCharCode = strategies.reduceRight(function (next, strategy) {
112385 return function (cp, needFeature) {
112386 return strategy(next, cp, needFeature);
112387 };
112388 }, null);
112389
112390 UChar.isHighSurrogate = function(cp){
112391 return cp >= 0xD800 && cp <= 0xDBFF;
112392 };
112393 UChar.isLowSurrogate = function(cp){
112394 return cp >= 0xDC00 && cp <= 0xDFFF;
112395 };
112396
112397 UChar.prototype.prepFeature = function(){
112398 if(!this.feature){
112399 this.feature = UChar.fromCharCode(this.codepoint, true).feature;
112400 }
112401 };
112402
112403 UChar.prototype.toString = function(){
112404 if(this.codepoint < 0x10000){
112405 return String.fromCharCode(this.codepoint);
112406 } else {
112407 var x = this.codepoint - 0x10000;
112408 return String.fromCharCode(Math.floor(x / 0x400) + 0xD800, x % 0x400 + 0xDC00);
112409 }
112410 };
112411
112412 UChar.prototype.getDecomp = function(){
112413 this.prepFeature();
112414 return this.feature[0] || null;
112415 };
112416
112417 UChar.prototype.isCompatibility = function(){
112418 this.prepFeature();
112419 return !!this.feature[1] && (this.feature[1] & (1 << 8));
112420 };
112421 UChar.prototype.isExclude = function(){
112422 this.prepFeature();
112423 return !!this.feature[1] && (this.feature[1] & (1 << 9));
112424 };
112425 UChar.prototype.getCanonicalClass = function(){
112426 this.prepFeature();
112427 return !!this.feature[1] ? (this.feature[1] & 0xff) : 0;
112428 };
112429 UChar.prototype.getComposite = function(following){
112430 this.prepFeature();
112431 if(!this.feature[2]){
112432 return null;
112433 }
112434 var cp = this.feature[2][following.codepoint];
112435 return cp ? UChar.fromCharCode(cp) : null;
112436 };
112437
112438 var UCharIterator = function(str){
112439 this.str = str;
112440 this.cursor = 0;
112441 };
112442 UCharIterator.prototype.next = function(){
112443 if(!!this.str && this.cursor < this.str.length){
112444 var cp = this.str.charCodeAt(this.cursor++);
112445 var d;
112446 if(UChar.isHighSurrogate(cp) && this.cursor < this.str.length && UChar.isLowSurrogate((d = this.str.charCodeAt(this.cursor)))){
112447 cp = (cp - 0xD800) * 0x400 + (d -0xDC00) + 0x10000;
112448 ++this.cursor;
112449 }
112450 return UChar.fromCharCode(cp);
112451 } else {
112452 this.str = null;
112453 return null;
112454 }
112455 };
112456
112457 var RecursDecompIterator = function(it, cano){
112458 this.it = it;
112459 this.canonical = cano;
112460 this.resBuf = [];
112461 };
112462
112463 RecursDecompIterator.prototype.next = function(){
112464 function recursiveDecomp(cano, uchar){
112465 var decomp = uchar.getDecomp();
112466 if(!!decomp && !(cano && uchar.isCompatibility())){
112467 var ret = [];
112468 for(var i = 0; i < decomp.length; ++i){
112469 var a = recursiveDecomp(cano, UChar.fromCharCode(decomp[i]));
112470 ret = ret.concat(a);
112471 }
112472 return ret;
112473 } else {
112474 return [uchar];
112475 }
112476 }
112477 if(this.resBuf.length === 0){
112478 var uchar = this.it.next();
112479 if(!uchar){
112480 return null;
112481 }
112482 this.resBuf = recursiveDecomp(this.canonical, uchar);
112483 }
112484 return this.resBuf.shift();
112485 };
112486
112487 var DecompIterator = function(it){
112488 this.it = it;
112489 this.resBuf = [];
112490 };
112491
112492 DecompIterator.prototype.next = function(){
112493 var cc;
112494 if(this.resBuf.length === 0){
112495 do{
112496 var uchar = this.it.next();
112497 if(!uchar){
112498 break;
112499 }
112500 cc = uchar.getCanonicalClass();
112501 var inspt = this.resBuf.length;
112502 if(cc !== 0){
112503 for(; inspt > 0; --inspt){
112504 var uchar2 = this.resBuf[inspt - 1];
112505 var cc2 = uchar2.getCanonicalClass();
112506 if(cc2 <= cc){
112507 break;
112508 }
112509 }
112510 }
112511 this.resBuf.splice(inspt, 0, uchar);
112512 } while(cc !== 0);
112513 }
112514 return this.resBuf.shift();
112515 };
112516
112517 var CompIterator = function(it){
112518 this.it = it;
112519 this.procBuf = [];
112520 this.resBuf = [];
112521 this.lastClass = null;
112522 };
112523
112524 CompIterator.prototype.next = function(){
112525 while(this.resBuf.length === 0){
112526 var uchar = this.it.next();
112527 if(!uchar){
112528 this.resBuf = this.procBuf;
112529 this.procBuf = [];
112530 break;
112531 }
112532 if(this.procBuf.length === 0){
112533 this.lastClass = uchar.getCanonicalClass();
112534 this.procBuf.push(uchar);
112535 } else {
112536 var starter = this.procBuf[0];
112537 var composite = starter.getComposite(uchar);
112538 var cc = uchar.getCanonicalClass();
112539 if(!!composite && (this.lastClass < cc || this.lastClass === 0)){
112540 this.procBuf[0] = composite;
112541 } else {
112542 if(cc === 0){
112543 this.resBuf = this.procBuf;
112544 this.procBuf = [];
112545 }
112546 this.lastClass = cc;
112547 this.procBuf.push(uchar);
112548 }
112549 }
112550 }
112551 return this.resBuf.shift();
112552 };
112553
112554 var createIterator = function(mode, str){
112555 switch(mode){
112556 case "NFD":
112557 return new DecompIterator(new RecursDecompIterator(new UCharIterator(str), true));
112558 case "NFKD":
112559 return new DecompIterator(new RecursDecompIterator(new UCharIterator(str), false));
112560 case "NFC":
112561 return new CompIterator(new DecompIterator(new RecursDecompIterator(new UCharIterator(str), true)));
112562 case "NFKC":
112563 return new CompIterator(new DecompIterator(new RecursDecompIterator(new UCharIterator(str), false)));
112564 }
112565 throw mode + " is invalid";
112566 };
112567 var normalize = function(mode, str){
112568 var it = createIterator(mode, str);
112569 var ret = "";
112570 var uchar;
112571 while(!!(uchar = it.next())){
112572 ret += uchar.toString();
112573 }
112574 return ret;
112575 };
112576
112577 /* API functions */
112578 function nfd(str){
112579 return normalize("NFD", str);
112580 }
112581
112582 function nfkd(str){
112583 return normalize("NFKD", str);
112584 }
112585
112586 function nfc(str){
112587 return normalize("NFC", str);
112588 }
112589
112590 function nfkc(str){
112591 return normalize("NFKC", str);
112592 }
112593
112594/* Unicode data */
112595UChar.udata={
1125960:{60:[,,{824:8814}],61:[,,{824:8800}],62:[,,{824:8815}],65:[,,{768:192,769:193,770:194,771:195,772:256,774:258,775:550,776:196,777:7842,778:197,780:461,783:512,785:514,803:7840,805:7680,808:260}],66:[,,{775:7682,803:7684,817:7686}],67:[,,{769:262,770:264,775:266,780:268,807:199}],68:[,,{775:7690,780:270,803:7692,807:7696,813:7698,817:7694}],69:[,,{768:200,769:201,770:202,771:7868,772:274,774:276,775:278,776:203,777:7866,780:282,783:516,785:518,803:7864,807:552,808:280,813:7704,816:7706}],70:[,,{775:7710}],71:[,,{769:500,770:284,772:7712,774:286,775:288,780:486,807:290}],72:[,,{770:292,775:7714,776:7718,780:542,803:7716,807:7720,814:7722}],73:[,,{768:204,769:205,770:206,771:296,772:298,774:300,775:304,776:207,777:7880,780:463,783:520,785:522,803:7882,808:302,816:7724}],74:[,,{770:308}],75:[,,{769:7728,780:488,803:7730,807:310,817:7732}],76:[,,{769:313,780:317,803:7734,807:315,813:7740,817:7738}],77:[,,{769:7742,775:7744,803:7746}],78:[,,{768:504,769:323,771:209,775:7748,780:327,803:7750,807:325,813:7754,817:7752}],79:[,,{768:210,769:211,770:212,771:213,772:332,774:334,775:558,776:214,777:7886,779:336,780:465,783:524,785:526,795:416,803:7884,808:490}],80:[,,{769:7764,775:7766}],82:[,,{769:340,775:7768,780:344,783:528,785:530,803:7770,807:342,817:7774}],83:[,,{769:346,770:348,775:7776,780:352,803:7778,806:536,807:350}],84:[,,{775:7786,780:356,803:7788,806:538,807:354,813:7792,817:7790}],85:[,,{768:217,769:218,770:219,771:360,772:362,774:364,776:220,777:7910,778:366,779:368,780:467,783:532,785:534,795:431,803:7908,804:7794,808:370,813:7798,816:7796}],86:[,,{771:7804,803:7806}],87:[,,{768:7808,769:7810,770:372,775:7814,776:7812,803:7816}],88:[,,{775:7818,776:7820}],89:[,,{768:7922,769:221,770:374,771:7928,772:562,775:7822,776:376,777:7926,803:7924}],90:[,,{769:377,770:7824,775:379,780:381,803:7826,817:7828}],97:[,,{768:224,769:225,770:226,771:227,772:257,774:259,775:551,776:228,777:7843,778:229,780:462,783:513,785:515,803:7841,805:7681,808:261}],98:[,,{775:7683,803:7685,817:7687}],99:[,,{769:263,770:265,775:267,780:269,807:231}],100:[,,{775:7691,780:271,803:7693,807:7697,813:7699,817:7695}],101:[,,{768:232,769:233,770:234,771:7869,772:275,774:277,775:279,776:235,777:7867,780:283,783:517,785:519,803:7865,807:553,808:281,813:7705,816:7707}],102:[,,{775:7711}],103:[,,{769:501,770:285,772:7713,774:287,775:289,780:487,807:291}],104:[,,{770:293,775:7715,776:7719,780:543,803:7717,807:7721,814:7723,817:7830}],105:[,,{768:236,769:237,770:238,771:297,772:299,774:301,776:239,777:7881,780:464,783:521,785:523,803:7883,808:303,816:7725}],106:[,,{770:309,780:496}],107:[,,{769:7729,780:489,803:7731,807:311,817:7733}],108:[,,{769:314,780:318,803:7735,807:316,813:7741,817:7739}],109:[,,{769:7743,775:7745,803:7747}],110:[,,{768:505,769:324,771:241,775:7749,780:328,803:7751,807:326,813:7755,817:7753}],111:[,,{768:242,769:243,770:244,771:245,772:333,774:335,775:559,776:246,777:7887,779:337,780:466,783:525,785:527,795:417,803:7885,808:491}],112:[,,{769:7765,775:7767}],114:[,,{769:341,775:7769,780:345,783:529,785:531,803:7771,807:343,817:7775}],115:[,,{769:347,770:349,775:7777,780:353,803:7779,806:537,807:351}],116:[,,{775:7787,776:7831,780:357,803:7789,806:539,807:355,813:7793,817:7791}],117:[,,{768:249,769:250,770:251,771:361,772:363,774:365,776:252,777:7911,778:367,779:369,780:468,783:533,785:535,795:432,803:7909,804:7795,808:371,813:7799,816:7797}],118:[,,{771:7805,803:7807}],119:[,,{768:7809,769:7811,770:373,775:7815,776:7813,778:7832,803:7817}],120:[,,{775:7819,776:7821}],121:[,,{768:7923,769:253,770:375,771:7929,772:563,775:7823,776:255,777:7927,778:7833,803:7925}],122:[,,{769:378,770:7825,775:380,780:382,803:7827,817:7829}],160:[[32],256],168:[[32,776],256,{768:8173,769:901,834:8129}],170:[[97],256],175:[[32,772],256],178:[[50],256],179:[[51],256],180:[[32,769],256],181:[[956],256],184:[[32,807],256],185:[[49],256],186:[[111],256],188:[[49,8260,52],256],189:[[49,8260,50],256],190:[[51,8260,52],256],192:[[65,768]],193:[[65,769]],194:[[65,770],,{768:7846,769:7844,771:7850,777:7848}],195:[[65,771]],196:[[65,776],,{772:478}],197:[[65,778],,{769:506}],198:[,,{769:508,772:482}],199:[[67,807],,{769:7688}],200:[[69,768]],201:[[69,769]],202:[[69,770],,{768:7872,769:7870,771:7876,777:7874}],203:[[69,776]],204:[[73,768]],205:[[73,769]],206:[[73,770]],207:[[73,776],,{769:7726}],209:[[78,771]],210:[[79,768]],211:[[79,769]],212:[[79,770],,{768:7890,769:7888,771:7894,777:7892}],213:[[79,771],,{769:7756,772:556,776:7758}],214:[[79,776],,{772:554}],216:[,,{769:510}],217:[[85,768]],218:[[85,769]],219:[[85,770]],220:[[85,776],,{768:475,769:471,772:469,780:473}],221:[[89,769]],224:[[97,768]],225:[[97,769]],226:[[97,770],,{768:7847,769:7845,771:7851,777:7849}],227:[[97,771]],228:[[97,776],,{772:479}],229:[[97,778],,{769:507}],230:[,,{769:509,772:483}],231:[[99,807],,{769:7689}],232:[[101,768]],233:[[101,769]],234:[[101,770],,{768:7873,769:7871,771:7877,777:7875}],235:[[101,776]],236:[[105,768]],237:[[105,769]],238:[[105,770]],239:[[105,776],,{769:7727}],241:[[110,771]],242:[[111,768]],243:[[111,769]],244:[[111,770],,{768:7891,769:7889,771:7895,777:7893}],245:[[111,771],,{769:7757,772:557,776:7759}],246:[[111,776],,{772:555}],248:[,,{769:511}],249:[[117,768]],250:[[117,769]],251:[[117,770]],252:[[117,776],,{768:476,769:472,772:470,780:474}],253:[[121,769]],255:[[121,776]]},
112597256:{256:[[65,772]],257:[[97,772]],258:[[65,774],,{768:7856,769:7854,771:7860,777:7858}],259:[[97,774],,{768:7857,769:7855,771:7861,777:7859}],260:[[65,808]],261:[[97,808]],262:[[67,769]],263:[[99,769]],264:[[67,770]],265:[[99,770]],266:[[67,775]],267:[[99,775]],268:[[67,780]],269:[[99,780]],270:[[68,780]],271:[[100,780]],274:[[69,772],,{768:7700,769:7702}],275:[[101,772],,{768:7701,769:7703}],276:[[69,774]],277:[[101,774]],278:[[69,775]],279:[[101,775]],280:[[69,808]],281:[[101,808]],282:[[69,780]],283:[[101,780]],284:[[71,770]],285:[[103,770]],286:[[71,774]],287:[[103,774]],288:[[71,775]],289:[[103,775]],290:[[71,807]],291:[[103,807]],292:[[72,770]],293:[[104,770]],296:[[73,771]],297:[[105,771]],298:[[73,772]],299:[[105,772]],300:[[73,774]],301:[[105,774]],302:[[73,808]],303:[[105,808]],304:[[73,775]],306:[[73,74],256],307:[[105,106],256],308:[[74,770]],309:[[106,770]],310:[[75,807]],311:[[107,807]],313:[[76,769]],314:[[108,769]],315:[[76,807]],316:[[108,807]],317:[[76,780]],318:[[108,780]],319:[[76,183],256],320:[[108,183],256],323:[[78,769]],324:[[110,769]],325:[[78,807]],326:[[110,807]],327:[[78,780]],328:[[110,780]],329:[[700,110],256],332:[[79,772],,{768:7760,769:7762}],333:[[111,772],,{768:7761,769:7763}],334:[[79,774]],335:[[111,774]],336:[[79,779]],337:[[111,779]],340:[[82,769]],341:[[114,769]],342:[[82,807]],343:[[114,807]],344:[[82,780]],345:[[114,780]],346:[[83,769],,{775:7780}],347:[[115,769],,{775:7781}],348:[[83,770]],349:[[115,770]],350:[[83,807]],351:[[115,807]],352:[[83,780],,{775:7782}],353:[[115,780],,{775:7783}],354:[[84,807]],355:[[116,807]],356:[[84,780]],357:[[116,780]],360:[[85,771],,{769:7800}],361:[[117,771],,{769:7801}],362:[[85,772],,{776:7802}],363:[[117,772],,{776:7803}],364:[[85,774]],365:[[117,774]],366:[[85,778]],367:[[117,778]],368:[[85,779]],369:[[117,779]],370:[[85,808]],371:[[117,808]],372:[[87,770]],373:[[119,770]],374:[[89,770]],375:[[121,770]],376:[[89,776]],377:[[90,769]],378:[[122,769]],379:[[90,775]],380:[[122,775]],381:[[90,780]],382:[[122,780]],383:[[115],256,{775:7835}],416:[[79,795],,{768:7900,769:7898,771:7904,777:7902,803:7906}],417:[[111,795],,{768:7901,769:7899,771:7905,777:7903,803:7907}],431:[[85,795],,{768:7914,769:7912,771:7918,777:7916,803:7920}],432:[[117,795],,{768:7915,769:7913,771:7919,777:7917,803:7921}],439:[,,{780:494}],452:[[68,381],256],453:[[68,382],256],454:[[100,382],256],455:[[76,74],256],456:[[76,106],256],457:[[108,106],256],458:[[78,74],256],459:[[78,106],256],460:[[110,106],256],461:[[65,780]],462:[[97,780]],463:[[73,780]],464:[[105,780]],465:[[79,780]],466:[[111,780]],467:[[85,780]],468:[[117,780]],469:[[220,772]],470:[[252,772]],471:[[220,769]],472:[[252,769]],473:[[220,780]],474:[[252,780]],475:[[220,768]],476:[[252,768]],478:[[196,772]],479:[[228,772]],480:[[550,772]],481:[[551,772]],482:[[198,772]],483:[[230,772]],486:[[71,780]],487:[[103,780]],488:[[75,780]],489:[[107,780]],490:[[79,808],,{772:492}],491:[[111,808],,{772:493}],492:[[490,772]],493:[[491,772]],494:[[439,780]],495:[[658,780]],496:[[106,780]],497:[[68,90],256],498:[[68,122],256],499:[[100,122],256],500:[[71,769]],501:[[103,769]],504:[[78,768]],505:[[110,768]],506:[[197,769]],507:[[229,769]],508:[[198,769]],509:[[230,769]],510:[[216,769]],511:[[248,769]],66045:[,220]},
112598512:{512:[[65,783]],513:[[97,783]],514:[[65,785]],515:[[97,785]],516:[[69,783]],517:[[101,783]],518:[[69,785]],519:[[101,785]],520:[[73,783]],521:[[105,783]],522:[[73,785]],523:[[105,785]],524:[[79,783]],525:[[111,783]],526:[[79,785]],527:[[111,785]],528:[[82,783]],529:[[114,783]],530:[[82,785]],531:[[114,785]],532:[[85,783]],533:[[117,783]],534:[[85,785]],535:[[117,785]],536:[[83,806]],537:[[115,806]],538:[[84,806]],539:[[116,806]],542:[[72,780]],543:[[104,780]],550:[[65,775],,{772:480}],551:[[97,775],,{772:481}],552:[[69,807],,{774:7708}],553:[[101,807],,{774:7709}],554:[[214,772]],555:[[246,772]],556:[[213,772]],557:[[245,772]],558:[[79,775],,{772:560}],559:[[111,775],,{772:561}],560:[[558,772]],561:[[559,772]],562:[[89,772]],563:[[121,772]],658:[,,{780:495}],688:[[104],256],689:[[614],256],690:[[106],256],691:[[114],256],692:[[633],256],693:[[635],256],694:[[641],256],695:[[119],256],696:[[121],256],728:[[32,774],256],729:[[32,775],256],730:[[32,778],256],731:[[32,808],256],732:[[32,771],256],733:[[32,779],256],736:[[611],256],737:[[108],256],738:[[115],256],739:[[120],256],740:[[661],256],66272:[,220]},
112599768:{768:[,230],769:[,230],770:[,230],771:[,230],772:[,230],773:[,230],774:[,230],775:[,230],776:[,230,{769:836}],777:[,230],778:[,230],779:[,230],780:[,230],781:[,230],782:[,230],783:[,230],784:[,230],785:[,230],786:[,230],787:[,230],788:[,230],789:[,232],790:[,220],791:[,220],792:[,220],793:[,220],794:[,232],795:[,216],796:[,220],797:[,220],798:[,220],799:[,220],800:[,220],801:[,202],802:[,202],803:[,220],804:[,220],805:[,220],806:[,220],807:[,202],808:[,202],809:[,220],810:[,220],811:[,220],812:[,220],813:[,220],814:[,220],815:[,220],816:[,220],817:[,220],818:[,220],819:[,220],820:[,1],821:[,1],822:[,1],823:[,1],824:[,1],825:[,220],826:[,220],827:[,220],828:[,220],829:[,230],830:[,230],831:[,230],832:[[768],230],833:[[769],230],834:[,230],835:[[787],230],836:[[776,769],230],837:[,240],838:[,230],839:[,220],840:[,220],841:[,220],842:[,230],843:[,230],844:[,230],845:[,220],846:[,220],848:[,230],849:[,230],850:[,230],851:[,220],852:[,220],853:[,220],854:[,220],855:[,230],856:[,232],857:[,220],858:[,220],859:[,230],860:[,233],861:[,234],862:[,234],863:[,233],864:[,234],865:[,234],866:[,233],867:[,230],868:[,230],869:[,230],870:[,230],871:[,230],872:[,230],873:[,230],874:[,230],875:[,230],876:[,230],877:[,230],878:[,230],879:[,230],884:[[697]],890:[[32,837],256],894:[[59]],900:[[32,769],256],901:[[168,769]],902:[[913,769]],903:[[183]],904:[[917,769]],905:[[919,769]],906:[[921,769]],908:[[927,769]],910:[[933,769]],911:[[937,769]],912:[[970,769]],913:[,,{768:8122,769:902,772:8121,774:8120,787:7944,788:7945,837:8124}],917:[,,{768:8136,769:904,787:7960,788:7961}],919:[,,{768:8138,769:905,787:7976,788:7977,837:8140}],921:[,,{768:8154,769:906,772:8153,774:8152,776:938,787:7992,788:7993}],927:[,,{768:8184,769:908,787:8008,788:8009}],929:[,,{788:8172}],933:[,,{768:8170,769:910,772:8169,774:8168,776:939,788:8025}],937:[,,{768:8186,769:911,787:8040,788:8041,837:8188}],938:[[921,776]],939:[[933,776]],940:[[945,769],,{837:8116}],941:[[949,769]],942:[[951,769],,{837:8132}],943:[[953,769]],944:[[971,769]],945:[,,{768:8048,769:940,772:8113,774:8112,787:7936,788:7937,834:8118,837:8115}],949:[,,{768:8050,769:941,787:7952,788:7953}],951:[,,{768:8052,769:942,787:7968,788:7969,834:8134,837:8131}],953:[,,{768:8054,769:943,772:8145,774:8144,776:970,787:7984,788:7985,834:8150}],959:[,,{768:8056,769:972,787:8000,788:8001}],961:[,,{787:8164,788:8165}],965:[,,{768:8058,769:973,772:8161,774:8160,776:971,787:8016,788:8017,834:8166}],969:[,,{768:8060,769:974,787:8032,788:8033,834:8182,837:8179}],970:[[953,776],,{768:8146,769:912,834:8151}],971:[[965,776],,{768:8162,769:944,834:8167}],972:[[959,769]],973:[[965,769]],974:[[969,769],,{837:8180}],976:[[946],256],977:[[952],256],978:[[933],256,{769:979,776:980}],979:[[978,769]],980:[[978,776]],981:[[966],256],982:[[960],256],1008:[[954],256],1009:[[961],256],1010:[[962],256],1012:[[920],256],1013:[[949],256],1017:[[931],256],66422:[,230],66423:[,230],66424:[,230],66425:[,230],66426:[,230]},
1126001024:{1024:[[1045,768]],1025:[[1045,776]],1027:[[1043,769]],1030:[,,{776:1031}],1031:[[1030,776]],1036:[[1050,769]],1037:[[1048,768]],1038:[[1059,774]],1040:[,,{774:1232,776:1234}],1043:[,,{769:1027}],1045:[,,{768:1024,774:1238,776:1025}],1046:[,,{774:1217,776:1244}],1047:[,,{776:1246}],1048:[,,{768:1037,772:1250,774:1049,776:1252}],1049:[[1048,774]],1050:[,,{769:1036}],1054:[,,{776:1254}],1059:[,,{772:1262,774:1038,776:1264,779:1266}],1063:[,,{776:1268}],1067:[,,{776:1272}],1069:[,,{776:1260}],1072:[,,{774:1233,776:1235}],1075:[,,{769:1107}],1077:[,,{768:1104,774:1239,776:1105}],1078:[,,{774:1218,776:1245}],1079:[,,{776:1247}],1080:[,,{768:1117,772:1251,774:1081,776:1253}],1081:[[1080,774]],1082:[,,{769:1116}],1086:[,,{776:1255}],1091:[,,{772:1263,774:1118,776:1265,779:1267}],1095:[,,{776:1269}],1099:[,,{776:1273}],1101:[,,{776:1261}],1104:[[1077,768]],1105:[[1077,776]],1107:[[1075,769]],1110:[,,{776:1111}],1111:[[1110,776]],1116:[[1082,769]],1117:[[1080,768]],1118:[[1091,774]],1140:[,,{783:1142}],1141:[,,{783:1143}],1142:[[1140,783]],1143:[[1141,783]],1155:[,230],1156:[,230],1157:[,230],1158:[,230],1159:[,230],1217:[[1046,774]],1218:[[1078,774]],1232:[[1040,774]],1233:[[1072,774]],1234:[[1040,776]],1235:[[1072,776]],1238:[[1045,774]],1239:[[1077,774]],1240:[,,{776:1242}],1241:[,,{776:1243}],1242:[[1240,776]],1243:[[1241,776]],1244:[[1046,776]],1245:[[1078,776]],1246:[[1047,776]],1247:[[1079,776]],1250:[[1048,772]],1251:[[1080,772]],1252:[[1048,776]],1253:[[1080,776]],1254:[[1054,776]],1255:[[1086,776]],1256:[,,{776:1258}],1257:[,,{776:1259}],1258:[[1256,776]],1259:[[1257,776]],1260:[[1069,776]],1261:[[1101,776]],1262:[[1059,772]],1263:[[1091,772]],1264:[[1059,776]],1265:[[1091,776]],1266:[[1059,779]],1267:[[1091,779]],1268:[[1063,776]],1269:[[1095,776]],1272:[[1067,776]],1273:[[1099,776]]},
1126011280:{1415:[[1381,1410],256],1425:[,220],1426:[,230],1427:[,230],1428:[,230],1429:[,230],1430:[,220],1431:[,230],1432:[,230],1433:[,230],1434:[,222],1435:[,220],1436:[,230],1437:[,230],1438:[,230],1439:[,230],1440:[,230],1441:[,230],1442:[,220],1443:[,220],1444:[,220],1445:[,220],1446:[,220],1447:[,220],1448:[,230],1449:[,230],1450:[,220],1451:[,230],1452:[,230],1453:[,222],1454:[,228],1455:[,230],1456:[,10],1457:[,11],1458:[,12],1459:[,13],1460:[,14],1461:[,15],1462:[,16],1463:[,17],1464:[,18],1465:[,19],1466:[,19],1467:[,20],1468:[,21],1469:[,22],1471:[,23],1473:[,24],1474:[,25],1476:[,230],1477:[,220],1479:[,18]},
1126021536:{1552:[,230],1553:[,230],1554:[,230],1555:[,230],1556:[,230],1557:[,230],1558:[,230],1559:[,230],1560:[,30],1561:[,31],1562:[,32],1570:[[1575,1619]],1571:[[1575,1620]],1572:[[1608,1620]],1573:[[1575,1621]],1574:[[1610,1620]],1575:[,,{1619:1570,1620:1571,1621:1573}],1608:[,,{1620:1572}],1610:[,,{1620:1574}],1611:[,27],1612:[,28],1613:[,29],1614:[,30],1615:[,31],1616:[,32],1617:[,33],1618:[,34],1619:[,230],1620:[,230],1621:[,220],1622:[,220],1623:[,230],1624:[,230],1625:[,230],1626:[,230],1627:[,230],1628:[,220],1629:[,230],1630:[,230],1631:[,220],1648:[,35],1653:[[1575,1652],256],1654:[[1608,1652],256],1655:[[1735,1652],256],1656:[[1610,1652],256],1728:[[1749,1620]],1729:[,,{1620:1730}],1730:[[1729,1620]],1746:[,,{1620:1747}],1747:[[1746,1620]],1749:[,,{1620:1728}],1750:[,230],1751:[,230],1752:[,230],1753:[,230],1754:[,230],1755:[,230],1756:[,230],1759:[,230],1760:[,230],1761:[,230],1762:[,230],1763:[,220],1764:[,230],1767:[,230],1768:[,230],1770:[,220],1771:[,230],1772:[,230],1773:[,220]},
1126031792:{1809:[,36],1840:[,230],1841:[,220],1842:[,230],1843:[,230],1844:[,220],1845:[,230],1846:[,230],1847:[,220],1848:[,220],1849:[,220],1850:[,230],1851:[,220],1852:[,220],1853:[,230],1854:[,220],1855:[,230],1856:[,230],1857:[,230],1858:[,220],1859:[,230],1860:[,220],1861:[,230],1862:[,220],1863:[,230],1864:[,220],1865:[,230],1866:[,230],2027:[,230],2028:[,230],2029:[,230],2030:[,230],2031:[,230],2032:[,230],2033:[,230],2034:[,220],2035:[,230]},
1126042048:{2070:[,230],2071:[,230],2072:[,230],2073:[,230],2075:[,230],2076:[,230],2077:[,230],2078:[,230],2079:[,230],2080:[,230],2081:[,230],2082:[,230],2083:[,230],2085:[,230],2086:[,230],2087:[,230],2089:[,230],2090:[,230],2091:[,230],2092:[,230],2093:[,230],2137:[,220],2138:[,220],2139:[,220],2276:[,230],2277:[,230],2278:[,220],2279:[,230],2280:[,230],2281:[,220],2282:[,230],2283:[,230],2284:[,230],2285:[,220],2286:[,220],2287:[,220],2288:[,27],2289:[,28],2290:[,29],2291:[,230],2292:[,230],2293:[,230],2294:[,220],2295:[,230],2296:[,230],2297:[,220],2298:[,220],2299:[,230],2300:[,230],2301:[,230],2302:[,230],2303:[,230]},
1126052304:{2344:[,,{2364:2345}],2345:[[2344,2364]],2352:[,,{2364:2353}],2353:[[2352,2364]],2355:[,,{2364:2356}],2356:[[2355,2364]],2364:[,7],2381:[,9],2385:[,230],2386:[,220],2387:[,230],2388:[,230],2392:[[2325,2364],512],2393:[[2326,2364],512],2394:[[2327,2364],512],2395:[[2332,2364],512],2396:[[2337,2364],512],2397:[[2338,2364],512],2398:[[2347,2364],512],2399:[[2351,2364],512],2492:[,7],2503:[,,{2494:2507,2519:2508}],2507:[[2503,2494]],2508:[[2503,2519]],2509:[,9],2524:[[2465,2492],512],2525:[[2466,2492],512],2527:[[2479,2492],512]},
1126062560:{2611:[[2610,2620],512],2614:[[2616,2620],512],2620:[,7],2637:[,9],2649:[[2582,2620],512],2650:[[2583,2620],512],2651:[[2588,2620],512],2654:[[2603,2620],512],2748:[,7],2765:[,9],68109:[,220],68111:[,230],68152:[,230],68153:[,1],68154:[,220],68159:[,9],68325:[,230],68326:[,220]},
1126072816:{2876:[,7],2887:[,,{2878:2891,2902:2888,2903:2892}],2888:[[2887,2902]],2891:[[2887,2878]],2892:[[2887,2903]],2893:[,9],2908:[[2849,2876],512],2909:[[2850,2876],512],2962:[,,{3031:2964}],2964:[[2962,3031]],3014:[,,{3006:3018,3031:3020}],3015:[,,{3006:3019}],3018:[[3014,3006]],3019:[[3015,3006]],3020:[[3014,3031]],3021:[,9]},
1126083072:{3142:[,,{3158:3144}],3144:[[3142,3158]],3149:[,9],3157:[,84],3158:[,91],3260:[,7],3263:[,,{3285:3264}],3264:[[3263,3285]],3270:[,,{3266:3274,3285:3271,3286:3272}],3271:[[3270,3285]],3272:[[3270,3286]],3274:[[3270,3266],,{3285:3275}],3275:[[3274,3285]],3277:[,9]},
1126093328:{3398:[,,{3390:3402,3415:3404}],3399:[,,{3390:3403}],3402:[[3398,3390]],3403:[[3399,3390]],3404:[[3398,3415]],3405:[,9],3530:[,9],3545:[,,{3530:3546,3535:3548,3551:3550}],3546:[[3545,3530]],3548:[[3545,3535],,{3530:3549}],3549:[[3548,3530]],3550:[[3545,3551]]},
1126103584:{3635:[[3661,3634],256],3640:[,103],3641:[,103],3642:[,9],3656:[,107],3657:[,107],3658:[,107],3659:[,107],3763:[[3789,3762],256],3768:[,118],3769:[,118],3784:[,122],3785:[,122],3786:[,122],3787:[,122],3804:[[3755,3737],256],3805:[[3755,3745],256]},
1126113840:{3852:[[3851],256],3864:[,220],3865:[,220],3893:[,220],3895:[,220],3897:[,216],3907:[[3906,4023],512],3917:[[3916,4023],512],3922:[[3921,4023],512],3927:[[3926,4023],512],3932:[[3931,4023],512],3945:[[3904,4021],512],3953:[,129],3954:[,130],3955:[[3953,3954],512],3956:[,132],3957:[[3953,3956],512],3958:[[4018,3968],512],3959:[[4018,3969],256],3960:[[4019,3968],512],3961:[[4019,3969],256],3962:[,130],3963:[,130],3964:[,130],3965:[,130],3968:[,130],3969:[[3953,3968],512],3970:[,230],3971:[,230],3972:[,9],3974:[,230],3975:[,230],3987:[[3986,4023],512],3997:[[3996,4023],512],4002:[[4001,4023],512],4007:[[4006,4023],512],4012:[[4011,4023],512],4025:[[3984,4021],512],4038:[,220]},
1126124096:{4133:[,,{4142:4134}],4134:[[4133,4142]],4151:[,7],4153:[,9],4154:[,9],4237:[,220],4348:[[4316],256],69702:[,9],69759:[,9],69785:[,,{69818:69786}],69786:[[69785,69818]],69787:[,,{69818:69788}],69788:[[69787,69818]],69797:[,,{69818:69803}],69803:[[69797,69818]],69817:[,9],69818:[,7]},
1126134352:{69888:[,230],69889:[,230],69890:[,230],69934:[[69937,69927]],69935:[[69938,69927]],69937:[,,{69927:69934}],69938:[,,{69927:69935}],69939:[,9],69940:[,9],70003:[,7],70080:[,9]},
1126144608:{70197:[,9],70198:[,7],70377:[,7],70378:[,9]},
1126154864:{4957:[,230],4958:[,230],4959:[,230],70460:[,7],70471:[,,{70462:70475,70487:70476}],70475:[[70471,70462]],70476:[[70471,70487]],70477:[,9],70502:[,230],70503:[,230],70504:[,230],70505:[,230],70506:[,230],70507:[,230],70508:[,230],70512:[,230],70513:[,230],70514:[,230],70515:[,230],70516:[,230]},
1126165120:{70841:[,,{70832:70844,70842:70843,70845:70846}],70843:[[70841,70842]],70844:[[70841,70832]],70846:[[70841,70845]],70850:[,9],70851:[,7]},
1126175376:{71096:[,,{71087:71098}],71097:[,,{71087:71099}],71098:[[71096,71087]],71099:[[71097,71087]],71103:[,9],71104:[,7]},
1126185632:{71231:[,9],71350:[,9],71351:[,7]},
1126195888:{5908:[,9],5940:[,9],6098:[,9],6109:[,230]},
1126206144:{6313:[,228]},
1126216400:{6457:[,222],6458:[,230],6459:[,220]},
1126226656:{6679:[,230],6680:[,220],6752:[,9],6773:[,230],6774:[,230],6775:[,230],6776:[,230],6777:[,230],6778:[,230],6779:[,230],6780:[,230],6783:[,220],6832:[,230],6833:[,230],6834:[,230],6835:[,230],6836:[,230],6837:[,220],6838:[,220],6839:[,220],6840:[,220],6841:[,220],6842:[,220],6843:[,230],6844:[,230],6845:[,220]},
1126236912:{6917:[,,{6965:6918}],6918:[[6917,6965]],6919:[,,{6965:6920}],6920:[[6919,6965]],6921:[,,{6965:6922}],6922:[[6921,6965]],6923:[,,{6965:6924}],6924:[[6923,6965]],6925:[,,{6965:6926}],6926:[[6925,6965]],6929:[,,{6965:6930}],6930:[[6929,6965]],6964:[,7],6970:[,,{6965:6971}],6971:[[6970,6965]],6972:[,,{6965:6973}],6973:[[6972,6965]],6974:[,,{6965:6976}],6975:[,,{6965:6977}],6976:[[6974,6965]],6977:[[6975,6965]],6978:[,,{6965:6979}],6979:[[6978,6965]],6980:[,9],7019:[,230],7020:[,220],7021:[,230],7022:[,230],7023:[,230],7024:[,230],7025:[,230],7026:[,230],7027:[,230],7082:[,9],7083:[,9],7142:[,7],7154:[,9],7155:[,9]},
1126247168:{7223:[,7],7376:[,230],7377:[,230],7378:[,230],7380:[,1],7381:[,220],7382:[,220],7383:[,220],7384:[,220],7385:[,220],7386:[,230],7387:[,230],7388:[,220],7389:[,220],7390:[,220],7391:[,220],7392:[,230],7394:[,1],7395:[,1],7396:[,1],7397:[,1],7398:[,1],7399:[,1],7400:[,1],7405:[,220],7412:[,230],7416:[,230],7417:[,230]},
1126257424:{7468:[[65],256],7469:[[198],256],7470:[[66],256],7472:[[68],256],7473:[[69],256],7474:[[398],256],7475:[[71],256],7476:[[72],256],7477:[[73],256],7478:[[74],256],7479:[[75],256],7480:[[76],256],7481:[[77],256],7482:[[78],256],7484:[[79],256],7485:[[546],256],7486:[[80],256],7487:[[82],256],7488:[[84],256],7489:[[85],256],7490:[[87],256],7491:[[97],256],7492:[[592],256],7493:[[593],256],7494:[[7426],256],7495:[[98],256],7496:[[100],256],7497:[[101],256],7498:[[601],256],7499:[[603],256],7500:[[604],256],7501:[[103],256],7503:[[107],256],7504:[[109],256],7505:[[331],256],7506:[[111],256],7507:[[596],256],7508:[[7446],256],7509:[[7447],256],7510:[[112],256],7511:[[116],256],7512:[[117],256],7513:[[7453],256],7514:[[623],256],7515:[[118],256],7516:[[7461],256],7517:[[946],256],7518:[[947],256],7519:[[948],256],7520:[[966],256],7521:[[967],256],7522:[[105],256],7523:[[114],256],7524:[[117],256],7525:[[118],256],7526:[[946],256],7527:[[947],256],7528:[[961],256],7529:[[966],256],7530:[[967],256],7544:[[1085],256],7579:[[594],256],7580:[[99],256],7581:[[597],256],7582:[[240],256],7583:[[604],256],7584:[[102],256],7585:[[607],256],7586:[[609],256],7587:[[613],256],7588:[[616],256],7589:[[617],256],7590:[[618],256],7591:[[7547],256],7592:[[669],256],7593:[[621],256],7594:[[7557],256],7595:[[671],256],7596:[[625],256],7597:[[624],256],7598:[[626],256],7599:[[627],256],7600:[[628],256],7601:[[629],256],7602:[[632],256],7603:[[642],256],7604:[[643],256],7605:[[427],256],7606:[[649],256],7607:[[650],256],7608:[[7452],256],7609:[[651],256],7610:[[652],256],7611:[[122],256],7612:[[656],256],7613:[[657],256],7614:[[658],256],7615:[[952],256],7616:[,230],7617:[,230],7618:[,220],7619:[,230],7620:[,230],7621:[,230],7622:[,230],7623:[,230],7624:[,230],7625:[,230],7626:[,220],7627:[,230],7628:[,230],7629:[,234],7630:[,214],7631:[,220],7632:[,202],7633:[,230],7634:[,230],7635:[,230],7636:[,230],7637:[,230],7638:[,230],7639:[,230],7640:[,230],7641:[,230],7642:[,230],7643:[,230],7644:[,230],7645:[,230],7646:[,230],7647:[,230],7648:[,230],7649:[,230],7650:[,230],7651:[,230],7652:[,230],7653:[,230],7654:[,230],7655:[,230],7656:[,230],7657:[,230],7658:[,230],7659:[,230],7660:[,230],7661:[,230],7662:[,230],7663:[,230],7664:[,230],7665:[,230],7666:[,230],7667:[,230],7668:[,230],7669:[,230],7676:[,233],7677:[,220],7678:[,230],7679:[,220]},
1126267680:{7680:[[65,805]],7681:[[97,805]],7682:[[66,775]],7683:[[98,775]],7684:[[66,803]],7685:[[98,803]],7686:[[66,817]],7687:[[98,817]],7688:[[199,769]],7689:[[231,769]],7690:[[68,775]],7691:[[100,775]],7692:[[68,803]],7693:[[100,803]],7694:[[68,817]],7695:[[100,817]],7696:[[68,807]],7697:[[100,807]],7698:[[68,813]],7699:[[100,813]],7700:[[274,768]],7701:[[275,768]],7702:[[274,769]],7703:[[275,769]],7704:[[69,813]],7705:[[101,813]],7706:[[69,816]],7707:[[101,816]],7708:[[552,774]],7709:[[553,774]],7710:[[70,775]],7711:[[102,775]],7712:[[71,772]],7713:[[103,772]],7714:[[72,775]],7715:[[104,775]],7716:[[72,803]],7717:[[104,803]],7718:[[72,776]],7719:[[104,776]],7720:[[72,807]],7721:[[104,807]],7722:[[72,814]],7723:[[104,814]],7724:[[73,816]],7725:[[105,816]],7726:[[207,769]],7727:[[239,769]],7728:[[75,769]],7729:[[107,769]],7730:[[75,803]],7731:[[107,803]],7732:[[75,817]],7733:[[107,817]],7734:[[76,803],,{772:7736}],7735:[[108,803],,{772:7737}],7736:[[7734,772]],7737:[[7735,772]],7738:[[76,817]],7739:[[108,817]],7740:[[76,813]],7741:[[108,813]],7742:[[77,769]],7743:[[109,769]],7744:[[77,775]],7745:[[109,775]],7746:[[77,803]],7747:[[109,803]],7748:[[78,775]],7749:[[110,775]],7750:[[78,803]],7751:[[110,803]],7752:[[78,817]],7753:[[110,817]],7754:[[78,813]],7755:[[110,813]],7756:[[213,769]],7757:[[245,769]],7758:[[213,776]],7759:[[245,776]],7760:[[332,768]],7761:[[333,768]],7762:[[332,769]],7763:[[333,769]],7764:[[80,769]],7765:[[112,769]],7766:[[80,775]],7767:[[112,775]],7768:[[82,775]],7769:[[114,775]],7770:[[82,803],,{772:7772}],7771:[[114,803],,{772:7773}],7772:[[7770,772]],7773:[[7771,772]],7774:[[82,817]],7775:[[114,817]],7776:[[83,775]],7777:[[115,775]],7778:[[83,803],,{775:7784}],7779:[[115,803],,{775:7785}],7780:[[346,775]],7781:[[347,775]],7782:[[352,775]],7783:[[353,775]],7784:[[7778,775]],7785:[[7779,775]],7786:[[84,775]],7787:[[116,775]],7788:[[84,803]],7789:[[116,803]],7790:[[84,817]],7791:[[116,817]],7792:[[84,813]],7793:[[116,813]],7794:[[85,804]],7795:[[117,804]],7796:[[85,816]],7797:[[117,816]],7798:[[85,813]],7799:[[117,813]],7800:[[360,769]],7801:[[361,769]],7802:[[362,776]],7803:[[363,776]],7804:[[86,771]],7805:[[118,771]],7806:[[86,803]],7807:[[118,803]],7808:[[87,768]],7809:[[119,768]],7810:[[87,769]],7811:[[119,769]],7812:[[87,776]],7813:[[119,776]],7814:[[87,775]],7815:[[119,775]],7816:[[87,803]],7817:[[119,803]],7818:[[88,775]],7819:[[120,775]],7820:[[88,776]],7821:[[120,776]],7822:[[89,775]],7823:[[121,775]],7824:[[90,770]],7825:[[122,770]],7826:[[90,803]],7827:[[122,803]],7828:[[90,817]],7829:[[122,817]],7830:[[104,817]],7831:[[116,776]],7832:[[119,778]],7833:[[121,778]],7834:[[97,702],256],7835:[[383,775]],7840:[[65,803],,{770:7852,774:7862}],7841:[[97,803],,{770:7853,774:7863}],7842:[[65,777]],7843:[[97,777]],7844:[[194,769]],7845:[[226,769]],7846:[[194,768]],7847:[[226,768]],7848:[[194,777]],7849:[[226,777]],7850:[[194,771]],7851:[[226,771]],7852:[[7840,770]],7853:[[7841,770]],7854:[[258,769]],7855:[[259,769]],7856:[[258,768]],7857:[[259,768]],7858:[[258,777]],7859:[[259,777]],7860:[[258,771]],7861:[[259,771]],7862:[[7840,774]],7863:[[7841,774]],7864:[[69,803],,{770:7878}],7865:[[101,803],,{770:7879}],7866:[[69,777]],7867:[[101,777]],7868:[[69,771]],7869:[[101,771]],7870:[[202,769]],7871:[[234,769]],7872:[[202,768]],7873:[[234,768]],7874:[[202,777]],7875:[[234,777]],7876:[[202,771]],7877:[[234,771]],7878:[[7864,770]],7879:[[7865,770]],7880:[[73,777]],7881:[[105,777]],7882:[[73,803]],7883:[[105,803]],7884:[[79,803],,{770:7896}],7885:[[111,803],,{770:7897}],7886:[[79,777]],7887:[[111,777]],7888:[[212,769]],7889:[[244,769]],7890:[[212,768]],7891:[[244,768]],7892:[[212,777]],7893:[[244,777]],7894:[[212,771]],7895:[[244,771]],7896:[[7884,770]],7897:[[7885,770]],7898:[[416,769]],7899:[[417,769]],7900:[[416,768]],7901:[[417,768]],7902:[[416,777]],7903:[[417,777]],7904:[[416,771]],7905:[[417,771]],7906:[[416,803]],7907:[[417,803]],7908:[[85,803]],7909:[[117,803]],7910:[[85,777]],7911:[[117,777]],7912:[[431,769]],7913:[[432,769]],7914:[[431,768]],7915:[[432,768]],7916:[[431,777]],7917:[[432,777]],7918:[[431,771]],7919:[[432,771]],7920:[[431,803]],7921:[[432,803]],7922:[[89,768]],7923:[[121,768]],7924:[[89,803]],7925:[[121,803]],7926:[[89,777]],7927:[[121,777]],7928:[[89,771]],7929:[[121,771]]},
1126277936:{7936:[[945,787],,{768:7938,769:7940,834:7942,837:8064}],7937:[[945,788],,{768:7939,769:7941,834:7943,837:8065}],7938:[[7936,768],,{837:8066}],7939:[[7937,768],,{837:8067}],7940:[[7936,769],,{837:8068}],7941:[[7937,769],,{837:8069}],7942:[[7936,834],,{837:8070}],7943:[[7937,834],,{837:8071}],7944:[[913,787],,{768:7946,769:7948,834:7950,837:8072}],7945:[[913,788],,{768:7947,769:7949,834:7951,837:8073}],7946:[[7944,768],,{837:8074}],7947:[[7945,768],,{837:8075}],7948:[[7944,769],,{837:8076}],7949:[[7945,769],,{837:8077}],7950:[[7944,834],,{837:8078}],7951:[[7945,834],,{837:8079}],7952:[[949,787],,{768:7954,769:7956}],7953:[[949,788],,{768:7955,769:7957}],7954:[[7952,768]],7955:[[7953,768]],7956:[[7952,769]],7957:[[7953,769]],7960:[[917,787],,{768:7962,769:7964}],7961:[[917,788],,{768:7963,769:7965}],7962:[[7960,768]],7963:[[7961,768]],7964:[[7960,769]],7965:[[7961,769]],7968:[[951,787],,{768:7970,769:7972,834:7974,837:8080}],7969:[[951,788],,{768:7971,769:7973,834:7975,837:8081}],7970:[[7968,768],,{837:8082}],7971:[[7969,768],,{837:8083}],7972:[[7968,769],,{837:8084}],7973:[[7969,769],,{837:8085}],7974:[[7968,834],,{837:8086}],7975:[[7969,834],,{837:8087}],7976:[[919,787],,{768:7978,769:7980,834:7982,837:8088}],7977:[[919,788],,{768:7979,769:7981,834:7983,837:8089}],7978:[[7976,768],,{837:8090}],7979:[[7977,768],,{837:8091}],7980:[[7976,769],,{837:8092}],7981:[[7977,769],,{837:8093}],7982:[[7976,834],,{837:8094}],7983:[[7977,834],,{837:8095}],7984:[[953,787],,{768:7986,769:7988,834:7990}],7985:[[953,788],,{768:7987,769:7989,834:7991}],7986:[[7984,768]],7987:[[7985,768]],7988:[[7984,769]],7989:[[7985,769]],7990:[[7984,834]],7991:[[7985,834]],7992:[[921,787],,{768:7994,769:7996,834:7998}],7993:[[921,788],,{768:7995,769:7997,834:7999}],7994:[[7992,768]],7995:[[7993,768]],7996:[[7992,769]],7997:[[7993,769]],7998:[[7992,834]],7999:[[7993,834]],8000:[[959,787],,{768:8002,769:8004}],8001:[[959,788],,{768:8003,769:8005}],8002:[[8000,768]],8003:[[8001,768]],8004:[[8000,769]],8005:[[8001,769]],8008:[[927,787],,{768:8010,769:8012}],8009:[[927,788],,{768:8011,769:8013}],8010:[[8008,768]],8011:[[8009,768]],8012:[[8008,769]],8013:[[8009,769]],8016:[[965,787],,{768:8018,769:8020,834:8022}],8017:[[965,788],,{768:8019,769:8021,834:8023}],8018:[[8016,768]],8019:[[8017,768]],8020:[[8016,769]],8021:[[8017,769]],8022:[[8016,834]],8023:[[8017,834]],8025:[[933,788],,{768:8027,769:8029,834:8031}],8027:[[8025,768]],8029:[[8025,769]],8031:[[8025,834]],8032:[[969,787],,{768:8034,769:8036,834:8038,837:8096}],8033:[[969,788],,{768:8035,769:8037,834:8039,837:8097}],8034:[[8032,768],,{837:8098}],8035:[[8033,768],,{837:8099}],8036:[[8032,769],,{837:8100}],8037:[[8033,769],,{837:8101}],8038:[[8032,834],,{837:8102}],8039:[[8033,834],,{837:8103}],8040:[[937,787],,{768:8042,769:8044,834:8046,837:8104}],8041:[[937,788],,{768:8043,769:8045,834:8047,837:8105}],8042:[[8040,768],,{837:8106}],8043:[[8041,768],,{837:8107}],8044:[[8040,769],,{837:8108}],8045:[[8041,769],,{837:8109}],8046:[[8040,834],,{837:8110}],8047:[[8041,834],,{837:8111}],8048:[[945,768],,{837:8114}],8049:[[940]],8050:[[949,768]],8051:[[941]],8052:[[951,768],,{837:8130}],8053:[[942]],8054:[[953,768]],8055:[[943]],8056:[[959,768]],8057:[[972]],8058:[[965,768]],8059:[[973]],8060:[[969,768],,{837:8178}],8061:[[974]],8064:[[7936,837]],8065:[[7937,837]],8066:[[7938,837]],8067:[[7939,837]],8068:[[7940,837]],8069:[[7941,837]],8070:[[7942,837]],8071:[[7943,837]],8072:[[7944,837]],8073:[[7945,837]],8074:[[7946,837]],8075:[[7947,837]],8076:[[7948,837]],8077:[[7949,837]],8078:[[7950,837]],8079:[[7951,837]],8080:[[7968,837]],8081:[[7969,837]],8082:[[7970,837]],8083:[[7971,837]],8084:[[7972,837]],8085:[[7973,837]],8086:[[7974,837]],8087:[[7975,837]],8088:[[7976,837]],8089:[[7977,837]],8090:[[7978,837]],8091:[[7979,837]],8092:[[7980,837]],8093:[[7981,837]],8094:[[7982,837]],8095:[[7983,837]],8096:[[8032,837]],8097:[[8033,837]],8098:[[8034,837]],8099:[[8035,837]],8100:[[8036,837]],8101:[[8037,837]],8102:[[8038,837]],8103:[[8039,837]],8104:[[8040,837]],8105:[[8041,837]],8106:[[8042,837]],8107:[[8043,837]],8108:[[8044,837]],8109:[[8045,837]],8110:[[8046,837]],8111:[[8047,837]],8112:[[945,774]],8113:[[945,772]],8114:[[8048,837]],8115:[[945,837]],8116:[[940,837]],8118:[[945,834],,{837:8119}],8119:[[8118,837]],8120:[[913,774]],8121:[[913,772]],8122:[[913,768]],8123:[[902]],8124:[[913,837]],8125:[[32,787],256],8126:[[953]],8127:[[32,787],256,{768:8141,769:8142,834:8143}],8128:[[32,834],256],8129:[[168,834]],8130:[[8052,837]],8131:[[951,837]],8132:[[942,837]],8134:[[951,834],,{837:8135}],8135:[[8134,837]],8136:[[917,768]],8137:[[904]],8138:[[919,768]],8139:[[905]],8140:[[919,837]],8141:[[8127,768]],8142:[[8127,769]],8143:[[8127,834]],8144:[[953,774]],8145:[[953,772]],8146:[[970,768]],8147:[[912]],8150:[[953,834]],8151:[[970,834]],8152:[[921,774]],8153:[[921,772]],8154:[[921,768]],8155:[[906]],8157:[[8190,768]],8158:[[8190,769]],8159:[[8190,834]],8160:[[965,774]],8161:[[965,772]],8162:[[971,768]],8163:[[944]],8164:[[961,787]],8165:[[961,788]],8166:[[965,834]],8167:[[971,834]],8168:[[933,774]],8169:[[933,772]],8170:[[933,768]],8171:[[910]],8172:[[929,788]],8173:[[168,768]],8174:[[901]],8175:[[96]],8178:[[8060,837]],8179:[[969,837]],8180:[[974,837]],8182:[[969,834],,{837:8183}],8183:[[8182,837]],8184:[[927,768]],8185:[[908]],8186:[[937,768]],8187:[[911]],8188:[[937,837]],8189:[[180]],8190:[[32,788],256,{768:8157,769:8158,834:8159}]},
1126288192:{8192:[[8194]],8193:[[8195]],8194:[[32],256],8195:[[32],256],8196:[[32],256],8197:[[32],256],8198:[[32],256],8199:[[32],256],8200:[[32],256],8201:[[32],256],8202:[[32],256],8209:[[8208],256],8215:[[32,819],256],8228:[[46],256],8229:[[46,46],256],8230:[[46,46,46],256],8239:[[32],256],8243:[[8242,8242],256],8244:[[8242,8242,8242],256],8246:[[8245,8245],256],8247:[[8245,8245,8245],256],8252:[[33,33],256],8254:[[32,773],256],8263:[[63,63],256],8264:[[63,33],256],8265:[[33,63],256],8279:[[8242,8242,8242,8242],256],8287:[[32],256],8304:[[48],256],8305:[[105],256],8308:[[52],256],8309:[[53],256],8310:[[54],256],8311:[[55],256],8312:[[56],256],8313:[[57],256],8314:[[43],256],8315:[[8722],256],8316:[[61],256],8317:[[40],256],8318:[[41],256],8319:[[110],256],8320:[[48],256],8321:[[49],256],8322:[[50],256],8323:[[51],256],8324:[[52],256],8325:[[53],256],8326:[[54],256],8327:[[55],256],8328:[[56],256],8329:[[57],256],8330:[[43],256],8331:[[8722],256],8332:[[61],256],8333:[[40],256],8334:[[41],256],8336:[[97],256],8337:[[101],256],8338:[[111],256],8339:[[120],256],8340:[[601],256],8341:[[104],256],8342:[[107],256],8343:[[108],256],8344:[[109],256],8345:[[110],256],8346:[[112],256],8347:[[115],256],8348:[[116],256],8360:[[82,115],256],8400:[,230],8401:[,230],8402:[,1],8403:[,1],8404:[,230],8405:[,230],8406:[,230],8407:[,230],8408:[,1],8409:[,1],8410:[,1],8411:[,230],8412:[,230],8417:[,230],8421:[,1],8422:[,1],8423:[,230],8424:[,220],8425:[,230],8426:[,1],8427:[,1],8428:[,220],8429:[,220],8430:[,220],8431:[,220],8432:[,230]},
1126298448:{8448:[[97,47,99],256],8449:[[97,47,115],256],8450:[[67],256],8451:[[176,67],256],8453:[[99,47,111],256],8454:[[99,47,117],256],8455:[[400],256],8457:[[176,70],256],8458:[[103],256],8459:[[72],256],8460:[[72],256],8461:[[72],256],8462:[[104],256],8463:[[295],256],8464:[[73],256],8465:[[73],256],8466:[[76],256],8467:[[108],256],8469:[[78],256],8470:[[78,111],256],8473:[[80],256],8474:[[81],256],8475:[[82],256],8476:[[82],256],8477:[[82],256],8480:[[83,77],256],8481:[[84,69,76],256],8482:[[84,77],256],8484:[[90],256],8486:[[937]],8488:[[90],256],8490:[[75]],8491:[[197]],8492:[[66],256],8493:[[67],256],8495:[[101],256],8496:[[69],256],8497:[[70],256],8499:[[77],256],8500:[[111],256],8501:[[1488],256],8502:[[1489],256],8503:[[1490],256],8504:[[1491],256],8505:[[105],256],8507:[[70,65,88],256],8508:[[960],256],8509:[[947],256],8510:[[915],256],8511:[[928],256],8512:[[8721],256],8517:[[68],256],8518:[[100],256],8519:[[101],256],8520:[[105],256],8521:[[106],256],8528:[[49,8260,55],256],8529:[[49,8260,57],256],8530:[[49,8260,49,48],256],8531:[[49,8260,51],256],8532:[[50,8260,51],256],8533:[[49,8260,53],256],8534:[[50,8260,53],256],8535:[[51,8260,53],256],8536:[[52,8260,53],256],8537:[[49,8260,54],256],8538:[[53,8260,54],256],8539:[[49,8260,56],256],8540:[[51,8260,56],256],8541:[[53,8260,56],256],8542:[[55,8260,56],256],8543:[[49,8260],256],8544:[[73],256],8545:[[73,73],256],8546:[[73,73,73],256],8547:[[73,86],256],8548:[[86],256],8549:[[86,73],256],8550:[[86,73,73],256],8551:[[86,73,73,73],256],8552:[[73,88],256],8553:[[88],256],8554:[[88,73],256],8555:[[88,73,73],256],8556:[[76],256],8557:[[67],256],8558:[[68],256],8559:[[77],256],8560:[[105],256],8561:[[105,105],256],8562:[[105,105,105],256],8563:[[105,118],256],8564:[[118],256],8565:[[118,105],256],8566:[[118,105,105],256],8567:[[118,105,105,105],256],8568:[[105,120],256],8569:[[120],256],8570:[[120,105],256],8571:[[120,105,105],256],8572:[[108],256],8573:[[99],256],8574:[[100],256],8575:[[109],256],8585:[[48,8260,51],256],8592:[,,{824:8602}],8594:[,,{824:8603}],8596:[,,{824:8622}],8602:[[8592,824]],8603:[[8594,824]],8622:[[8596,824]],8653:[[8656,824]],8654:[[8660,824]],8655:[[8658,824]],8656:[,,{824:8653}],8658:[,,{824:8655}],8660:[,,{824:8654}]},
1126308704:{8707:[,,{824:8708}],8708:[[8707,824]],8712:[,,{824:8713}],8713:[[8712,824]],8715:[,,{824:8716}],8716:[[8715,824]],8739:[,,{824:8740}],8740:[[8739,824]],8741:[,,{824:8742}],8742:[[8741,824]],8748:[[8747,8747],256],8749:[[8747,8747,8747],256],8751:[[8750,8750],256],8752:[[8750,8750,8750],256],8764:[,,{824:8769}],8769:[[8764,824]],8771:[,,{824:8772}],8772:[[8771,824]],8773:[,,{824:8775}],8775:[[8773,824]],8776:[,,{824:8777}],8777:[[8776,824]],8781:[,,{824:8813}],8800:[[61,824]],8801:[,,{824:8802}],8802:[[8801,824]],8804:[,,{824:8816}],8805:[,,{824:8817}],8813:[[8781,824]],8814:[[60,824]],8815:[[62,824]],8816:[[8804,824]],8817:[[8805,824]],8818:[,,{824:8820}],8819:[,,{824:8821}],8820:[[8818,824]],8821:[[8819,824]],8822:[,,{824:8824}],8823:[,,{824:8825}],8824:[[8822,824]],8825:[[8823,824]],8826:[,,{824:8832}],8827:[,,{824:8833}],8828:[,,{824:8928}],8829:[,,{824:8929}],8832:[[8826,824]],8833:[[8827,824]],8834:[,,{824:8836}],8835:[,,{824:8837}],8836:[[8834,824]],8837:[[8835,824]],8838:[,,{824:8840}],8839:[,,{824:8841}],8840:[[8838,824]],8841:[[8839,824]],8849:[,,{824:8930}],8850:[,,{824:8931}],8866:[,,{824:8876}],8872:[,,{824:8877}],8873:[,,{824:8878}],8875:[,,{824:8879}],8876:[[8866,824]],8877:[[8872,824]],8878:[[8873,824]],8879:[[8875,824]],8882:[,,{824:8938}],8883:[,,{824:8939}],8884:[,,{824:8940}],8885:[,,{824:8941}],8928:[[8828,824]],8929:[[8829,824]],8930:[[8849,824]],8931:[[8850,824]],8938:[[8882,824]],8939:[[8883,824]],8940:[[8884,824]],8941:[[8885,824]]},
1126318960:{9001:[[12296]],9002:[[12297]]},
1126329216:{9312:[[49],256],9313:[[50],256],9314:[[51],256],9315:[[52],256],9316:[[53],256],9317:[[54],256],9318:[[55],256],9319:[[56],256],9320:[[57],256],9321:[[49,48],256],9322:[[49,49],256],9323:[[49,50],256],9324:[[49,51],256],9325:[[49,52],256],9326:[[49,53],256],9327:[[49,54],256],9328:[[49,55],256],9329:[[49,56],256],9330:[[49,57],256],9331:[[50,48],256],9332:[[40,49,41],256],9333:[[40,50,41],256],9334:[[40,51,41],256],9335:[[40,52,41],256],9336:[[40,53,41],256],9337:[[40,54,41],256],9338:[[40,55,41],256],9339:[[40,56,41],256],9340:[[40,57,41],256],9341:[[40,49,48,41],256],9342:[[40,49,49,41],256],9343:[[40,49,50,41],256],9344:[[40,49,51,41],256],9345:[[40,49,52,41],256],9346:[[40,49,53,41],256],9347:[[40,49,54,41],256],9348:[[40,49,55,41],256],9349:[[40,49,56,41],256],9350:[[40,49,57,41],256],9351:[[40,50,48,41],256],9352:[[49,46],256],9353:[[50,46],256],9354:[[51,46],256],9355:[[52,46],256],9356:[[53,46],256],9357:[[54,46],256],9358:[[55,46],256],9359:[[56,46],256],9360:[[57,46],256],9361:[[49,48,46],256],9362:[[49,49,46],256],9363:[[49,50,46],256],9364:[[49,51,46],256],9365:[[49,52,46],256],9366:[[49,53,46],256],9367:[[49,54,46],256],9368:[[49,55,46],256],9369:[[49,56,46],256],9370:[[49,57,46],256],9371:[[50,48,46],256],9372:[[40,97,41],256],9373:[[40,98,41],256],9374:[[40,99,41],256],9375:[[40,100,41],256],9376:[[40,101,41],256],9377:[[40,102,41],256],9378:[[40,103,41],256],9379:[[40,104,41],256],9380:[[40,105,41],256],9381:[[40,106,41],256],9382:[[40,107,41],256],9383:[[40,108,41],256],9384:[[40,109,41],256],9385:[[40,110,41],256],9386:[[40,111,41],256],9387:[[40,112,41],256],9388:[[40,113,41],256],9389:[[40,114,41],256],9390:[[40,115,41],256],9391:[[40,116,41],256],9392:[[40,117,41],256],9393:[[40,118,41],256],9394:[[40,119,41],256],9395:[[40,120,41],256],9396:[[40,121,41],256],9397:[[40,122,41],256],9398:[[65],256],9399:[[66],256],9400:[[67],256],9401:[[68],256],9402:[[69],256],9403:[[70],256],9404:[[71],256],9405:[[72],256],9406:[[73],256],9407:[[74],256],9408:[[75],256],9409:[[76],256],9410:[[77],256],9411:[[78],256],9412:[[79],256],9413:[[80],256],9414:[[81],256],9415:[[82],256],9416:[[83],256],9417:[[84],256],9418:[[85],256],9419:[[86],256],9420:[[87],256],9421:[[88],256],9422:[[89],256],9423:[[90],256],9424:[[97],256],9425:[[98],256],9426:[[99],256],9427:[[100],256],9428:[[101],256],9429:[[102],256],9430:[[103],256],9431:[[104],256],9432:[[105],256],9433:[[106],256],9434:[[107],256],9435:[[108],256],9436:[[109],256],9437:[[110],256],9438:[[111],256],9439:[[112],256],9440:[[113],256],9441:[[114],256],9442:[[115],256],9443:[[116],256],9444:[[117],256],9445:[[118],256],9446:[[119],256],9447:[[120],256],9448:[[121],256],9449:[[122],256],9450:[[48],256]},
11263310752:{10764:[[8747,8747,8747,8747],256],10868:[[58,58,61],256],10869:[[61,61],256],10870:[[61,61,61],256],10972:[[10973,824],512]},
11263411264:{11388:[[106],256],11389:[[86],256],11503:[,230],11504:[,230],11505:[,230]},
11263511520:{11631:[[11617],256],11647:[,9],11744:[,230],11745:[,230],11746:[,230],11747:[,230],11748:[,230],11749:[,230],11750:[,230],11751:[,230],11752:[,230],11753:[,230],11754:[,230],11755:[,230],11756:[,230],11757:[,230],11758:[,230],11759:[,230],11760:[,230],11761:[,230],11762:[,230],11763:[,230],11764:[,230],11765:[,230],11766:[,230],11767:[,230],11768:[,230],11769:[,230],11770:[,230],11771:[,230],11772:[,230],11773:[,230],11774:[,230],11775:[,230]},
11263611776:{11935:[[27597],256],12019:[[40863],256]},
11263712032:{12032:[[19968],256],12033:[[20008],256],12034:[[20022],256],12035:[[20031],256],12036:[[20057],256],12037:[[20101],256],12038:[[20108],256],12039:[[20128],256],12040:[[20154],256],12041:[[20799],256],12042:[[20837],256],12043:[[20843],256],12044:[[20866],256],12045:[[20886],256],12046:[[20907],256],12047:[[20960],256],12048:[[20981],256],12049:[[20992],256],12050:[[21147],256],12051:[[21241],256],12052:[[21269],256],12053:[[21274],256],12054:[[21304],256],12055:[[21313],256],12056:[[21340],256],12057:[[21353],256],12058:[[21378],256],12059:[[21430],256],12060:[[21448],256],12061:[[21475],256],12062:[[22231],256],12063:[[22303],256],12064:[[22763],256],12065:[[22786],256],12066:[[22794],256],12067:[[22805],256],12068:[[22823],256],12069:[[22899],256],12070:[[23376],256],12071:[[23424],256],12072:[[23544],256],12073:[[23567],256],12074:[[23586],256],12075:[[23608],256],12076:[[23662],256],12077:[[23665],256],12078:[[24027],256],12079:[[24037],256],12080:[[24049],256],12081:[[24062],256],12082:[[24178],256],12083:[[24186],256],12084:[[24191],256],12085:[[24308],256],12086:[[24318],256],12087:[[24331],256],12088:[[24339],256],12089:[[24400],256],12090:[[24417],256],12091:[[24435],256],12092:[[24515],256],12093:[[25096],256],12094:[[25142],256],12095:[[25163],256],12096:[[25903],256],12097:[[25908],256],12098:[[25991],256],12099:[[26007],256],12100:[[26020],256],12101:[[26041],256],12102:[[26080],256],12103:[[26085],256],12104:[[26352],256],12105:[[26376],256],12106:[[26408],256],12107:[[27424],256],12108:[[27490],256],12109:[[27513],256],12110:[[27571],256],12111:[[27595],256],12112:[[27604],256],12113:[[27611],256],12114:[[27663],256],12115:[[27668],256],12116:[[27700],256],12117:[[28779],256],12118:[[29226],256],12119:[[29238],256],12120:[[29243],256],12121:[[29247],256],12122:[[29255],256],12123:[[29273],256],12124:[[29275],256],12125:[[29356],256],12126:[[29572],256],12127:[[29577],256],12128:[[29916],256],12129:[[29926],256],12130:[[29976],256],12131:[[29983],256],12132:[[29992],256],12133:[[30000],256],12134:[[30091],256],12135:[[30098],256],12136:[[30326],256],12137:[[30333],256],12138:[[30382],256],12139:[[30399],256],12140:[[30446],256],12141:[[30683],256],12142:[[30690],256],12143:[[30707],256],12144:[[31034],256],12145:[[31160],256],12146:[[31166],256],12147:[[31348],256],12148:[[31435],256],12149:[[31481],256],12150:[[31859],256],12151:[[31992],256],12152:[[32566],256],12153:[[32593],256],12154:[[32650],256],12155:[[32701],256],12156:[[32769],256],12157:[[32780],256],12158:[[32786],256],12159:[[32819],256],12160:[[32895],256],12161:[[32905],256],12162:[[33251],256],12163:[[33258],256],12164:[[33267],256],12165:[[33276],256],12166:[[33292],256],12167:[[33307],256],12168:[[33311],256],12169:[[33390],256],12170:[[33394],256],12171:[[33400],256],12172:[[34381],256],12173:[[34411],256],12174:[[34880],256],12175:[[34892],256],12176:[[34915],256],12177:[[35198],256],12178:[[35211],256],12179:[[35282],256],12180:[[35328],256],12181:[[35895],256],12182:[[35910],256],12183:[[35925],256],12184:[[35960],256],12185:[[35997],256],12186:[[36196],256],12187:[[36208],256],12188:[[36275],256],12189:[[36523],256],12190:[[36554],256],12191:[[36763],256],12192:[[36784],256],12193:[[36789],256],12194:[[37009],256],12195:[[37193],256],12196:[[37318],256],12197:[[37324],256],12198:[[37329],256],12199:[[38263],256],12200:[[38272],256],12201:[[38428],256],12202:[[38582],256],12203:[[38585],256],12204:[[38632],256],12205:[[38737],256],12206:[[38750],256],12207:[[38754],256],12208:[[38761],256],12209:[[38859],256],12210:[[38893],256],12211:[[38899],256],12212:[[38913],256],12213:[[39080],256],12214:[[39131],256],12215:[[39135],256],12216:[[39318],256],12217:[[39321],256],12218:[[39340],256],12219:[[39592],256],12220:[[39640],256],12221:[[39647],256],12222:[[39717],256],12223:[[39727],256],12224:[[39730],256],12225:[[39740],256],12226:[[39770],256],12227:[[40165],256],12228:[[40565],256],12229:[[40575],256],12230:[[40613],256],12231:[[40635],256],12232:[[40643],256],12233:[[40653],256],12234:[[40657],256],12235:[[40697],256],12236:[[40701],256],12237:[[40718],256],12238:[[40723],256],12239:[[40736],256],12240:[[40763],256],12241:[[40778],256],12242:[[40786],256],12243:[[40845],256],12244:[[40860],256],12245:[[40864],256]},
11263812288:{12288:[[32],256],12330:[,218],12331:[,228],12332:[,232],12333:[,222],12334:[,224],12335:[,224],12342:[[12306],256],12344:[[21313],256],12345:[[21316],256],12346:[[21317],256],12358:[,,{12441:12436}],12363:[,,{12441:12364}],12364:[[12363,12441]],12365:[,,{12441:12366}],12366:[[12365,12441]],12367:[,,{12441:12368}],12368:[[12367,12441]],12369:[,,{12441:12370}],12370:[[12369,12441]],12371:[,,{12441:12372}],12372:[[12371,12441]],12373:[,,{12441:12374}],12374:[[12373,12441]],12375:[,,{12441:12376}],12376:[[12375,12441]],12377:[,,{12441:12378}],12378:[[12377,12441]],12379:[,,{12441:12380}],12380:[[12379,12441]],12381:[,,{12441:12382}],12382:[[12381,12441]],12383:[,,{12441:12384}],12384:[[12383,12441]],12385:[,,{12441:12386}],12386:[[12385,12441]],12388:[,,{12441:12389}],12389:[[12388,12441]],12390:[,,{12441:12391}],12391:[[12390,12441]],12392:[,,{12441:12393}],12393:[[12392,12441]],12399:[,,{12441:12400,12442:12401}],12400:[[12399,12441]],12401:[[12399,12442]],12402:[,,{12441:12403,12442:12404}],12403:[[12402,12441]],12404:[[12402,12442]],12405:[,,{12441:12406,12442:12407}],12406:[[12405,12441]],12407:[[12405,12442]],12408:[,,{12441:12409,12442:12410}],12409:[[12408,12441]],12410:[[12408,12442]],12411:[,,{12441:12412,12442:12413}],12412:[[12411,12441]],12413:[[12411,12442]],12436:[[12358,12441]],12441:[,8],12442:[,8],12443:[[32,12441],256],12444:[[32,12442],256],12445:[,,{12441:12446}],12446:[[12445,12441]],12447:[[12424,12426],256],12454:[,,{12441:12532}],12459:[,,{12441:12460}],12460:[[12459,12441]],12461:[,,{12441:12462}],12462:[[12461,12441]],12463:[,,{12441:12464}],12464:[[12463,12441]],12465:[,,{12441:12466}],12466:[[12465,12441]],12467:[,,{12441:12468}],12468:[[12467,12441]],12469:[,,{12441:12470}],12470:[[12469,12441]],12471:[,,{12441:12472}],12472:[[12471,12441]],12473:[,,{12441:12474}],12474:[[12473,12441]],12475:[,,{12441:12476}],12476:[[12475,12441]],12477:[,,{12441:12478}],12478:[[12477,12441]],12479:[,,{12441:12480}],12480:[[12479,12441]],12481:[,,{12441:12482}],12482:[[12481,12441]],12484:[,,{12441:12485}],12485:[[12484,12441]],12486:[,,{12441:12487}],12487:[[12486,12441]],12488:[,,{12441:12489}],12489:[[12488,12441]],12495:[,,{12441:12496,12442:12497}],12496:[[12495,12441]],12497:[[12495,12442]],12498:[,,{12441:12499,12442:12500}],12499:[[12498,12441]],12500:[[12498,12442]],12501:[,,{12441:12502,12442:12503}],12502:[[12501,12441]],12503:[[12501,12442]],12504:[,,{12441:12505,12442:12506}],12505:[[12504,12441]],12506:[[12504,12442]],12507:[,,{12441:12508,12442:12509}],12508:[[12507,12441]],12509:[[12507,12442]],12527:[,,{12441:12535}],12528:[,,{12441:12536}],12529:[,,{12441:12537}],12530:[,,{12441:12538}],12532:[[12454,12441]],12535:[[12527,12441]],12536:[[12528,12441]],12537:[[12529,12441]],12538:[[12530,12441]],12541:[,,{12441:12542}],12542:[[12541,12441]],12543:[[12467,12488],256]},
11263912544:{12593:[[4352],256],12594:[[4353],256],12595:[[4522],256],12596:[[4354],256],12597:[[4524],256],12598:[[4525],256],12599:[[4355],256],12600:[[4356],256],12601:[[4357],256],12602:[[4528],256],12603:[[4529],256],12604:[[4530],256],12605:[[4531],256],12606:[[4532],256],12607:[[4533],256],12608:[[4378],256],12609:[[4358],256],12610:[[4359],256],12611:[[4360],256],12612:[[4385],256],12613:[[4361],256],12614:[[4362],256],12615:[[4363],256],12616:[[4364],256],12617:[[4365],256],12618:[[4366],256],12619:[[4367],256],12620:[[4368],256],12621:[[4369],256],12622:[[4370],256],12623:[[4449],256],12624:[[4450],256],12625:[[4451],256],12626:[[4452],256],12627:[[4453],256],12628:[[4454],256],12629:[[4455],256],12630:[[4456],256],12631:[[4457],256],12632:[[4458],256],12633:[[4459],256],12634:[[4460],256],12635:[[4461],256],12636:[[4462],256],12637:[[4463],256],12638:[[4464],256],12639:[[4465],256],12640:[[4466],256],12641:[[4467],256],12642:[[4468],256],12643:[[4469],256],12644:[[4448],256],12645:[[4372],256],12646:[[4373],256],12647:[[4551],256],12648:[[4552],256],12649:[[4556],256],12650:[[4558],256],12651:[[4563],256],12652:[[4567],256],12653:[[4569],256],12654:[[4380],256],12655:[[4573],256],12656:[[4575],256],12657:[[4381],256],12658:[[4382],256],12659:[[4384],256],12660:[[4386],256],12661:[[4387],256],12662:[[4391],256],12663:[[4393],256],12664:[[4395],256],12665:[[4396],256],12666:[[4397],256],12667:[[4398],256],12668:[[4399],256],12669:[[4402],256],12670:[[4406],256],12671:[[4416],256],12672:[[4423],256],12673:[[4428],256],12674:[[4593],256],12675:[[4594],256],12676:[[4439],256],12677:[[4440],256],12678:[[4441],256],12679:[[4484],256],12680:[[4485],256],12681:[[4488],256],12682:[[4497],256],12683:[[4498],256],12684:[[4500],256],12685:[[4510],256],12686:[[4513],256],12690:[[19968],256],12691:[[20108],256],12692:[[19977],256],12693:[[22235],256],12694:[[19978],256],12695:[[20013],256],12696:[[19979],256],12697:[[30002],256],12698:[[20057],256],12699:[[19993],256],12700:[[19969],256],12701:[[22825],256],12702:[[22320],256],12703:[[20154],256]},
11264012800:{12800:[[40,4352,41],256],12801:[[40,4354,41],256],12802:[[40,4355,41],256],12803:[[40,4357,41],256],12804:[[40,4358,41],256],12805:[[40,4359,41],256],12806:[[40,4361,41],256],12807:[[40,4363,41],256],12808:[[40,4364,41],256],12809:[[40,4366,41],256],12810:[[40,4367,41],256],12811:[[40,4368,41],256],12812:[[40,4369,41],256],12813:[[40,4370,41],256],12814:[[40,4352,4449,41],256],12815:[[40,4354,4449,41],256],12816:[[40,4355,4449,41],256],12817:[[40,4357,4449,41],256],12818:[[40,4358,4449,41],256],12819:[[40,4359,4449,41],256],12820:[[40,4361,4449,41],256],12821:[[40,4363,4449,41],256],12822:[[40,4364,4449,41],256],12823:[[40,4366,4449,41],256],12824:[[40,4367,4449,41],256],12825:[[40,4368,4449,41],256],12826:[[40,4369,4449,41],256],12827:[[40,4370,4449,41],256],12828:[[40,4364,4462,41],256],12829:[[40,4363,4457,4364,4453,4523,41],256],12830:[[40,4363,4457,4370,4462,41],256],12832:[[40,19968,41],256],12833:[[40,20108,41],256],12834:[[40,19977,41],256],12835:[[40,22235,41],256],12836:[[40,20116,41],256],12837:[[40,20845,41],256],12838:[[40,19971,41],256],12839:[[40,20843,41],256],12840:[[40,20061,41],256],12841:[[40,21313,41],256],12842:[[40,26376,41],256],12843:[[40,28779,41],256],12844:[[40,27700,41],256],12845:[[40,26408,41],256],12846:[[40,37329,41],256],12847:[[40,22303,41],256],12848:[[40,26085,41],256],12849:[[40,26666,41],256],12850:[[40,26377,41],256],12851:[[40,31038,41],256],12852:[[40,21517,41],256],12853:[[40,29305,41],256],12854:[[40,36001,41],256],12855:[[40,31069,41],256],12856:[[40,21172,41],256],12857:[[40,20195,41],256],12858:[[40,21628,41],256],12859:[[40,23398,41],256],12860:[[40,30435,41],256],12861:[[40,20225,41],256],12862:[[40,36039,41],256],12863:[[40,21332,41],256],12864:[[40,31085,41],256],12865:[[40,20241,41],256],12866:[[40,33258,41],256],12867:[[40,33267,41],256],12868:[[21839],256],12869:[[24188],256],12870:[[25991],256],12871:[[31631],256],12880:[[80,84,69],256],12881:[[50,49],256],12882:[[50,50],256],12883:[[50,51],256],12884:[[50,52],256],12885:[[50,53],256],12886:[[50,54],256],12887:[[50,55],256],12888:[[50,56],256],12889:[[50,57],256],12890:[[51,48],256],12891:[[51,49],256],12892:[[51,50],256],12893:[[51,51],256],12894:[[51,52],256],12895:[[51,53],256],12896:[[4352],256],12897:[[4354],256],12898:[[4355],256],12899:[[4357],256],12900:[[4358],256],12901:[[4359],256],12902:[[4361],256],12903:[[4363],256],12904:[[4364],256],12905:[[4366],256],12906:[[4367],256],12907:[[4368],256],12908:[[4369],256],12909:[[4370],256],12910:[[4352,4449],256],12911:[[4354,4449],256],12912:[[4355,4449],256],12913:[[4357,4449],256],12914:[[4358,4449],256],12915:[[4359,4449],256],12916:[[4361,4449],256],12917:[[4363,4449],256],12918:[[4364,4449],256],12919:[[4366,4449],256],12920:[[4367,4449],256],12921:[[4368,4449],256],12922:[[4369,4449],256],12923:[[4370,4449],256],12924:[[4366,4449,4535,4352,4457],256],12925:[[4364,4462,4363,4468],256],12926:[[4363,4462],256],12928:[[19968],256],12929:[[20108],256],12930:[[19977],256],12931:[[22235],256],12932:[[20116],256],12933:[[20845],256],12934:[[19971],256],12935:[[20843],256],12936:[[20061],256],12937:[[21313],256],12938:[[26376],256],12939:[[28779],256],12940:[[27700],256],12941:[[26408],256],12942:[[37329],256],12943:[[22303],256],12944:[[26085],256],12945:[[26666],256],12946:[[26377],256],12947:[[31038],256],12948:[[21517],256],12949:[[29305],256],12950:[[36001],256],12951:[[31069],256],12952:[[21172],256],12953:[[31192],256],12954:[[30007],256],12955:[[22899],256],12956:[[36969],256],12957:[[20778],256],12958:[[21360],256],12959:[[27880],256],12960:[[38917],256],12961:[[20241],256],12962:[[20889],256],12963:[[27491],256],12964:[[19978],256],12965:[[20013],256],12966:[[19979],256],12967:[[24038],256],12968:[[21491],256],12969:[[21307],256],12970:[[23447],256],12971:[[23398],256],12972:[[30435],256],12973:[[20225],256],12974:[[36039],256],12975:[[21332],256],12976:[[22812],256],12977:[[51,54],256],12978:[[51,55],256],12979:[[51,56],256],12980:[[51,57],256],12981:[[52,48],256],12982:[[52,49],256],12983:[[52,50],256],12984:[[52,51],256],12985:[[52,52],256],12986:[[52,53],256],12987:[[52,54],256],12988:[[52,55],256],12989:[[52,56],256],12990:[[52,57],256],12991:[[53,48],256],12992:[[49,26376],256],12993:[[50,26376],256],12994:[[51,26376],256],12995:[[52,26376],256],12996:[[53,26376],256],12997:[[54,26376],256],12998:[[55,26376],256],12999:[[56,26376],256],13000:[[57,26376],256],13001:[[49,48,26376],256],13002:[[49,49,26376],256],13003:[[49,50,26376],256],13004:[[72,103],256],13005:[[101,114,103],256],13006:[[101,86],256],13007:[[76,84,68],256],13008:[[12450],256],13009:[[12452],256],13010:[[12454],256],13011:[[12456],256],13012:[[12458],256],13013:[[12459],256],13014:[[12461],256],13015:[[12463],256],13016:[[12465],256],13017:[[12467],256],13018:[[12469],256],13019:[[12471],256],13020:[[12473],256],13021:[[12475],256],13022:[[12477],256],13023:[[12479],256],13024:[[12481],256],13025:[[12484],256],13026:[[12486],256],13027:[[12488],256],13028:[[12490],256],13029:[[12491],256],13030:[[12492],256],13031:[[12493],256],13032:[[12494],256],13033:[[12495],256],13034:[[12498],256],13035:[[12501],256],13036:[[12504],256],13037:[[12507],256],13038:[[12510],256],13039:[[12511],256],13040:[[12512],256],13041:[[12513],256],13042:[[12514],256],13043:[[12516],256],13044:[[12518],256],13045:[[12520],256],13046:[[12521],256],13047:[[12522],256],13048:[[12523],256],13049:[[12524],256],13050:[[12525],256],13051:[[12527],256],13052:[[12528],256],13053:[[12529],256],13054:[[12530],256]},
11264113056:{13056:[[12450,12497,12540,12488],256],13057:[[12450,12523,12501,12449],256],13058:[[12450,12531,12506,12450],256],13059:[[12450,12540,12523],256],13060:[[12452,12491,12531,12464],256],13061:[[12452,12531,12481],256],13062:[[12454,12457,12531],256],13063:[[12456,12473,12463,12540,12489],256],13064:[[12456,12540,12459,12540],256],13065:[[12458,12531,12473],256],13066:[[12458,12540,12512],256],13067:[[12459,12452,12522],256],13068:[[12459,12521,12483,12488],256],13069:[[12459,12525,12522,12540],256],13070:[[12460,12525,12531],256],13071:[[12460,12531,12510],256],13072:[[12462,12460],256],13073:[[12462,12491,12540],256],13074:[[12461,12517,12522,12540],256],13075:[[12462,12523,12480,12540],256],13076:[[12461,12525],256],13077:[[12461,12525,12464,12521,12512],256],13078:[[12461,12525,12513,12540,12488,12523],256],13079:[[12461,12525,12527,12483,12488],256],13080:[[12464,12521,12512],256],13081:[[12464,12521,12512,12488,12531],256],13082:[[12463,12523,12476,12452,12525],256],13083:[[12463,12525,12540,12493],256],13084:[[12465,12540,12473],256],13085:[[12467,12523,12490],256],13086:[[12467,12540,12509],256],13087:[[12469,12452,12463,12523],256],13088:[[12469,12531,12481,12540,12512],256],13089:[[12471,12522,12531,12464],256],13090:[[12475,12531,12481],256],13091:[[12475,12531,12488],256],13092:[[12480,12540,12473],256],13093:[[12487,12471],256],13094:[[12489,12523],256],13095:[[12488,12531],256],13096:[[12490,12494],256],13097:[[12494,12483,12488],256],13098:[[12495,12452,12484],256],13099:[[12497,12540,12475,12531,12488],256],13100:[[12497,12540,12484],256],13101:[[12496,12540,12524,12523],256],13102:[[12500,12450,12473,12488,12523],256],13103:[[12500,12463,12523],256],13104:[[12500,12467],256],13105:[[12499,12523],256],13106:[[12501,12449,12521,12483,12489],256],13107:[[12501,12451,12540,12488],256],13108:[[12502,12483,12471,12455,12523],256],13109:[[12501,12521,12531],256],13110:[[12504,12463,12479,12540,12523],256],13111:[[12506,12477],256],13112:[[12506,12491,12498],256],13113:[[12504,12523,12484],256],13114:[[12506,12531,12473],256],13115:[[12506,12540,12472],256],13116:[[12505,12540,12479],256],13117:[[12509,12452,12531,12488],256],13118:[[12508,12523,12488],256],13119:[[12507,12531],256],13120:[[12509,12531,12489],256],13121:[[12507,12540,12523],256],13122:[[12507,12540,12531],256],13123:[[12510,12452,12463,12525],256],13124:[[12510,12452,12523],256],13125:[[12510,12483,12495],256],13126:[[12510,12523,12463],256],13127:[[12510,12531,12471,12519,12531],256],13128:[[12511,12463,12525,12531],256],13129:[[12511,12522],256],13130:[[12511,12522,12496,12540,12523],256],13131:[[12513,12460],256],13132:[[12513,12460,12488,12531],256],13133:[[12513,12540,12488,12523],256],13134:[[12516,12540,12489],256],13135:[[12516,12540,12523],256],13136:[[12518,12450,12531],256],13137:[[12522,12483,12488,12523],256],13138:[[12522,12521],256],13139:[[12523,12500,12540],256],13140:[[12523,12540,12502,12523],256],13141:[[12524,12512],256],13142:[[12524,12531,12488,12466,12531],256],13143:[[12527,12483,12488],256],13144:[[48,28857],256],13145:[[49,28857],256],13146:[[50,28857],256],13147:[[51,28857],256],13148:[[52,28857],256],13149:[[53,28857],256],13150:[[54,28857],256],13151:[[55,28857],256],13152:[[56,28857],256],13153:[[57,28857],256],13154:[[49,48,28857],256],13155:[[49,49,28857],256],13156:[[49,50,28857],256],13157:[[49,51,28857],256],13158:[[49,52,28857],256],13159:[[49,53,28857],256],13160:[[49,54,28857],256],13161:[[49,55,28857],256],13162:[[49,56,28857],256],13163:[[49,57,28857],256],13164:[[50,48,28857],256],13165:[[50,49,28857],256],13166:[[50,50,28857],256],13167:[[50,51,28857],256],13168:[[50,52,28857],256],13169:[[104,80,97],256],13170:[[100,97],256],13171:[[65,85],256],13172:[[98,97,114],256],13173:[[111,86],256],13174:[[112,99],256],13175:[[100,109],256],13176:[[100,109,178],256],13177:[[100,109,179],256],13178:[[73,85],256],13179:[[24179,25104],256],13180:[[26157,21644],256],13181:[[22823,27491],256],13182:[[26126,27835],256],13183:[[26666,24335,20250,31038],256],13184:[[112,65],256],13185:[[110,65],256],13186:[[956,65],256],13187:[[109,65],256],13188:[[107,65],256],13189:[[75,66],256],13190:[[77,66],256],13191:[[71,66],256],13192:[[99,97,108],256],13193:[[107,99,97,108],256],13194:[[112,70],256],13195:[[110,70],256],13196:[[956,70],256],13197:[[956,103],256],13198:[[109,103],256],13199:[[107,103],256],13200:[[72,122],256],13201:[[107,72,122],256],13202:[[77,72,122],256],13203:[[71,72,122],256],13204:[[84,72,122],256],13205:[[956,8467],256],13206:[[109,8467],256],13207:[[100,8467],256],13208:[[107,8467],256],13209:[[102,109],256],13210:[[110,109],256],13211:[[956,109],256],13212:[[109,109],256],13213:[[99,109],256],13214:[[107,109],256],13215:[[109,109,178],256],13216:[[99,109,178],256],13217:[[109,178],256],13218:[[107,109,178],256],13219:[[109,109,179],256],13220:[[99,109,179],256],13221:[[109,179],256],13222:[[107,109,179],256],13223:[[109,8725,115],256],13224:[[109,8725,115,178],256],13225:[[80,97],256],13226:[[107,80,97],256],13227:[[77,80,97],256],13228:[[71,80,97],256],13229:[[114,97,100],256],13230:[[114,97,100,8725,115],256],13231:[[114,97,100,8725,115,178],256],13232:[[112,115],256],13233:[[110,115],256],13234:[[956,115],256],13235:[[109,115],256],13236:[[112,86],256],13237:[[110,86],256],13238:[[956,86],256],13239:[[109,86],256],13240:[[107,86],256],13241:[[77,86],256],13242:[[112,87],256],13243:[[110,87],256],13244:[[956,87],256],13245:[[109,87],256],13246:[[107,87],256],13247:[[77,87],256],13248:[[107,937],256],13249:[[77,937],256],13250:[[97,46,109,46],256],13251:[[66,113],256],13252:[[99,99],256],13253:[[99,100],256],13254:[[67,8725,107,103],256],13255:[[67,111,46],256],13256:[[100,66],256],13257:[[71,121],256],13258:[[104,97],256],13259:[[72,80],256],13260:[[105,110],256],13261:[[75,75],256],13262:[[75,77],256],13263:[[107,116],256],13264:[[108,109],256],13265:[[108,110],256],13266:[[108,111,103],256],13267:[[108,120],256],13268:[[109,98],256],13269:[[109,105,108],256],13270:[[109,111,108],256],13271:[[80,72],256],13272:[[112,46,109,46],256],13273:[[80,80,77],256],13274:[[80,82],256],13275:[[115,114],256],13276:[[83,118],256],13277:[[87,98],256],13278:[[86,8725,109],256],13279:[[65,8725,109],256],13280:[[49,26085],256],13281:[[50,26085],256],13282:[[51,26085],256],13283:[[52,26085],256],13284:[[53,26085],256],13285:[[54,26085],256],13286:[[55,26085],256],13287:[[56,26085],256],13288:[[57,26085],256],13289:[[49,48,26085],256],13290:[[49,49,26085],256],13291:[[49,50,26085],256],13292:[[49,51,26085],256],13293:[[49,52,26085],256],13294:[[49,53,26085],256],13295:[[49,54,26085],256],13296:[[49,55,26085],256],13297:[[49,56,26085],256],13298:[[49,57,26085],256],13299:[[50,48,26085],256],13300:[[50,49,26085],256],13301:[[50,50,26085],256],13302:[[50,51,26085],256],13303:[[50,52,26085],256],13304:[[50,53,26085],256],13305:[[50,54,26085],256],13306:[[50,55,26085],256],13307:[[50,56,26085],256],13308:[[50,57,26085],256],13309:[[51,48,26085],256],13310:[[51,49,26085],256],13311:[[103,97,108],256]},
11264227136:{92912:[,1],92913:[,1],92914:[,1],92915:[,1],92916:[,1]},
11264327392:{92976:[,230],92977:[,230],92978:[,230],92979:[,230],92980:[,230],92981:[,230],92982:[,230]},
11264442496:{42607:[,230],42612:[,230],42613:[,230],42614:[,230],42615:[,230],42616:[,230],42617:[,230],42618:[,230],42619:[,230],42620:[,230],42621:[,230],42652:[[1098],256],42653:[[1100],256],42655:[,230],42736:[,230],42737:[,230]},
11264542752:{42864:[[42863],256],43000:[[294],256],43001:[[339],256]},
11264643008:{43014:[,9],43204:[,9],43232:[,230],43233:[,230],43234:[,230],43235:[,230],43236:[,230],43237:[,230],43238:[,230],43239:[,230],43240:[,230],43241:[,230],43242:[,230],43243:[,230],43244:[,230],43245:[,230],43246:[,230],43247:[,230],43248:[,230],43249:[,230]},
11264743264:{43307:[,220],43308:[,220],43309:[,220],43347:[,9],43443:[,7],43456:[,9]},
11264843520:{43696:[,230],43698:[,230],43699:[,230],43700:[,220],43703:[,230],43704:[,230],43710:[,230],43711:[,230],43713:[,230],43766:[,9]},
11264943776:{43868:[[42791],256],43869:[[43831],256],43870:[[619],256],43871:[[43858],256],44013:[,9]},
11265048128:{113822:[,1]},
11265153504:{119134:[[119127,119141],512],119135:[[119128,119141],512],119136:[[119135,119150],512],119137:[[119135,119151],512],119138:[[119135,119152],512],119139:[[119135,119153],512],119140:[[119135,119154],512],119141:[,216],119142:[,216],119143:[,1],119144:[,1],119145:[,1],119149:[,226],119150:[,216],119151:[,216],119152:[,216],119153:[,216],119154:[,216],119163:[,220],119164:[,220],119165:[,220],119166:[,220],119167:[,220],119168:[,220],119169:[,220],119170:[,220],119173:[,230],119174:[,230],119175:[,230],119176:[,230],119177:[,230],119178:[,220],119179:[,220],119210:[,230],119211:[,230],119212:[,230],119213:[,230],119227:[[119225,119141],512],119228:[[119226,119141],512],119229:[[119227,119150],512],119230:[[119228,119150],512],119231:[[119227,119151],512],119232:[[119228,119151],512]},
11265253760:{119362:[,230],119363:[,230],119364:[,230]},
11265354272:{119808:[[65],256],119809:[[66],256],119810:[[67],256],119811:[[68],256],119812:[[69],256],119813:[[70],256],119814:[[71],256],119815:[[72],256],119816:[[73],256],119817:[[74],256],119818:[[75],256],119819:[[76],256],119820:[[77],256],119821:[[78],256],119822:[[79],256],119823:[[80],256],119824:[[81],256],119825:[[82],256],119826:[[83],256],119827:[[84],256],119828:[[85],256],119829:[[86],256],119830:[[87],256],119831:[[88],256],119832:[[89],256],119833:[[90],256],119834:[[97],256],119835:[[98],256],119836:[[99],256],119837:[[100],256],119838:[[101],256],119839:[[102],256],119840:[[103],256],119841:[[104],256],119842:[[105],256],119843:[[106],256],119844:[[107],256],119845:[[108],256],119846:[[109],256],119847:[[110],256],119848:[[111],256],119849:[[112],256],119850:[[113],256],119851:[[114],256],119852:[[115],256],119853:[[116],256],119854:[[117],256],119855:[[118],256],119856:[[119],256],119857:[[120],256],119858:[[121],256],119859:[[122],256],119860:[[65],256],119861:[[66],256],119862:[[67],256],119863:[[68],256],119864:[[69],256],119865:[[70],256],119866:[[71],256],119867:[[72],256],119868:[[73],256],119869:[[74],256],119870:[[75],256],119871:[[76],256],119872:[[77],256],119873:[[78],256],119874:[[79],256],119875:[[80],256],119876:[[81],256],119877:[[82],256],119878:[[83],256],119879:[[84],256],119880:[[85],256],119881:[[86],256],119882:[[87],256],119883:[[88],256],119884:[[89],256],119885:[[90],256],119886:[[97],256],119887:[[98],256],119888:[[99],256],119889:[[100],256],119890:[[101],256],119891:[[102],256],119892:[[103],256],119894:[[105],256],119895:[[106],256],119896:[[107],256],119897:[[108],256],119898:[[109],256],119899:[[110],256],119900:[[111],256],119901:[[112],256],119902:[[113],256],119903:[[114],256],119904:[[115],256],119905:[[116],256],119906:[[117],256],119907:[[118],256],119908:[[119],256],119909:[[120],256],119910:[[121],256],119911:[[122],256],119912:[[65],256],119913:[[66],256],119914:[[67],256],119915:[[68],256],119916:[[69],256],119917:[[70],256],119918:[[71],256],119919:[[72],256],119920:[[73],256],119921:[[74],256],119922:[[75],256],119923:[[76],256],119924:[[77],256],119925:[[78],256],119926:[[79],256],119927:[[80],256],119928:[[81],256],119929:[[82],256],119930:[[83],256],119931:[[84],256],119932:[[85],256],119933:[[86],256],119934:[[87],256],119935:[[88],256],119936:[[89],256],119937:[[90],256],119938:[[97],256],119939:[[98],256],119940:[[99],256],119941:[[100],256],119942:[[101],256],119943:[[102],256],119944:[[103],256],119945:[[104],256],119946:[[105],256],119947:[[106],256],119948:[[107],256],119949:[[108],256],119950:[[109],256],119951:[[110],256],119952:[[111],256],119953:[[112],256],119954:[[113],256],119955:[[114],256],119956:[[115],256],119957:[[116],256],119958:[[117],256],119959:[[118],256],119960:[[119],256],119961:[[120],256],119962:[[121],256],119963:[[122],256],119964:[[65],256],119966:[[67],256],119967:[[68],256],119970:[[71],256],119973:[[74],256],119974:[[75],256],119977:[[78],256],119978:[[79],256],119979:[[80],256],119980:[[81],256],119982:[[83],256],119983:[[84],256],119984:[[85],256],119985:[[86],256],119986:[[87],256],119987:[[88],256],119988:[[89],256],119989:[[90],256],119990:[[97],256],119991:[[98],256],119992:[[99],256],119993:[[100],256],119995:[[102],256],119997:[[104],256],119998:[[105],256],119999:[[106],256],120000:[[107],256],120001:[[108],256],120002:[[109],256],120003:[[110],256],120005:[[112],256],120006:[[113],256],120007:[[114],256],120008:[[115],256],120009:[[116],256],120010:[[117],256],120011:[[118],256],120012:[[119],256],120013:[[120],256],120014:[[121],256],120015:[[122],256],120016:[[65],256],120017:[[66],256],120018:[[67],256],120019:[[68],256],120020:[[69],256],120021:[[70],256],120022:[[71],256],120023:[[72],256],120024:[[73],256],120025:[[74],256],120026:[[75],256],120027:[[76],256],120028:[[77],256],120029:[[78],256],120030:[[79],256],120031:[[80],256],120032:[[81],256],120033:[[82],256],120034:[[83],256],120035:[[84],256],120036:[[85],256],120037:[[86],256],120038:[[87],256],120039:[[88],256],120040:[[89],256],120041:[[90],256],120042:[[97],256],120043:[[98],256],120044:[[99],256],120045:[[100],256],120046:[[101],256],120047:[[102],256],120048:[[103],256],120049:[[104],256],120050:[[105],256],120051:[[106],256],120052:[[107],256],120053:[[108],256],120054:[[109],256],120055:[[110],256],120056:[[111],256],120057:[[112],256],120058:[[113],256],120059:[[114],256],120060:[[115],256],120061:[[116],256],120062:[[117],256],120063:[[118],256]},
11265454528:{120064:[[119],256],120065:[[120],256],120066:[[121],256],120067:[[122],256],120068:[[65],256],120069:[[66],256],120071:[[68],256],120072:[[69],256],120073:[[70],256],120074:[[71],256],120077:[[74],256],120078:[[75],256],120079:[[76],256],120080:[[77],256],120081:[[78],256],120082:[[79],256],120083:[[80],256],120084:[[81],256],120086:[[83],256],120087:[[84],256],120088:[[85],256],120089:[[86],256],120090:[[87],256],120091:[[88],256],120092:[[89],256],120094:[[97],256],120095:[[98],256],120096:[[99],256],120097:[[100],256],120098:[[101],256],120099:[[102],256],120100:[[103],256],120101:[[104],256],120102:[[105],256],120103:[[106],256],120104:[[107],256],120105:[[108],256],120106:[[109],256],120107:[[110],256],120108:[[111],256],120109:[[112],256],120110:[[113],256],120111:[[114],256],120112:[[115],256],120113:[[116],256],120114:[[117],256],120115:[[118],256],120116:[[119],256],120117:[[120],256],120118:[[121],256],120119:[[122],256],120120:[[65],256],120121:[[66],256],120123:[[68],256],120124:[[69],256],120125:[[70],256],120126:[[71],256],120128:[[73],256],120129:[[74],256],120130:[[75],256],120131:[[76],256],120132:[[77],256],120134:[[79],256],120138:[[83],256],120139:[[84],256],120140:[[85],256],120141:[[86],256],120142:[[87],256],120143:[[88],256],120144:[[89],256],120146:[[97],256],120147:[[98],256],120148:[[99],256],120149:[[100],256],120150:[[101],256],120151:[[102],256],120152:[[103],256],120153:[[104],256],120154:[[105],256],120155:[[106],256],120156:[[107],256],120157:[[108],256],120158:[[109],256],120159:[[110],256],120160:[[111],256],120161:[[112],256],120162:[[113],256],120163:[[114],256],120164:[[115],256],120165:[[116],256],120166:[[117],256],120167:[[118],256],120168:[[119],256],120169:[[120],256],120170:[[121],256],120171:[[122],256],120172:[[65],256],120173:[[66],256],120174:[[67],256],120175:[[68],256],120176:[[69],256],120177:[[70],256],120178:[[71],256],120179:[[72],256],120180:[[73],256],120181:[[74],256],120182:[[75],256],120183:[[76],256],120184:[[77],256],120185:[[78],256],120186:[[79],256],120187:[[80],256],120188:[[81],256],120189:[[82],256],120190:[[83],256],120191:[[84],256],120192:[[85],256],120193:[[86],256],120194:[[87],256],120195:[[88],256],120196:[[89],256],120197:[[90],256],120198:[[97],256],120199:[[98],256],120200:[[99],256],120201:[[100],256],120202:[[101],256],120203:[[102],256],120204:[[103],256],120205:[[104],256],120206:[[105],256],120207:[[106],256],120208:[[107],256],120209:[[108],256],120210:[[109],256],120211:[[110],256],120212:[[111],256],120213:[[112],256],120214:[[113],256],120215:[[114],256],120216:[[115],256],120217:[[116],256],120218:[[117],256],120219:[[118],256],120220:[[119],256],120221:[[120],256],120222:[[121],256],120223:[[122],256],120224:[[65],256],120225:[[66],256],120226:[[67],256],120227:[[68],256],120228:[[69],256],120229:[[70],256],120230:[[71],256],120231:[[72],256],120232:[[73],256],120233:[[74],256],120234:[[75],256],120235:[[76],256],120236:[[77],256],120237:[[78],256],120238:[[79],256],120239:[[80],256],120240:[[81],256],120241:[[82],256],120242:[[83],256],120243:[[84],256],120244:[[85],256],120245:[[86],256],120246:[[87],256],120247:[[88],256],120248:[[89],256],120249:[[90],256],120250:[[97],256],120251:[[98],256],120252:[[99],256],120253:[[100],256],120254:[[101],256],120255:[[102],256],120256:[[103],256],120257:[[104],256],120258:[[105],256],120259:[[106],256],120260:[[107],256],120261:[[108],256],120262:[[109],256],120263:[[110],256],120264:[[111],256],120265:[[112],256],120266:[[113],256],120267:[[114],256],120268:[[115],256],120269:[[116],256],120270:[[117],256],120271:[[118],256],120272:[[119],256],120273:[[120],256],120274:[[121],256],120275:[[122],256],120276:[[65],256],120277:[[66],256],120278:[[67],256],120279:[[68],256],120280:[[69],256],120281:[[70],256],120282:[[71],256],120283:[[72],256],120284:[[73],256],120285:[[74],256],120286:[[75],256],120287:[[76],256],120288:[[77],256],120289:[[78],256],120290:[[79],256],120291:[[80],256],120292:[[81],256],120293:[[82],256],120294:[[83],256],120295:[[84],256],120296:[[85],256],120297:[[86],256],120298:[[87],256],120299:[[88],256],120300:[[89],256],120301:[[90],256],120302:[[97],256],120303:[[98],256],120304:[[99],256],120305:[[100],256],120306:[[101],256],120307:[[102],256],120308:[[103],256],120309:[[104],256],120310:[[105],256],120311:[[106],256],120312:[[107],256],120313:[[108],256],120314:[[109],256],120315:[[110],256],120316:[[111],256],120317:[[112],256],120318:[[113],256],120319:[[114],256]},
11265554784:{120320:[[115],256],120321:[[116],256],120322:[[117],256],120323:[[118],256],120324:[[119],256],120325:[[120],256],120326:[[121],256],120327:[[122],256],120328:[[65],256],120329:[[66],256],120330:[[67],256],120331:[[68],256],120332:[[69],256],120333:[[70],256],120334:[[71],256],120335:[[72],256],120336:[[73],256],120337:[[74],256],120338:[[75],256],120339:[[76],256],120340:[[77],256],120341:[[78],256],120342:[[79],256],120343:[[80],256],120344:[[81],256],120345:[[82],256],120346:[[83],256],120347:[[84],256],120348:[[85],256],120349:[[86],256],120350:[[87],256],120351:[[88],256],120352:[[89],256],120353:[[90],256],120354:[[97],256],120355:[[98],256],120356:[[99],256],120357:[[100],256],120358:[[101],256],120359:[[102],256],120360:[[103],256],120361:[[104],256],120362:[[105],256],120363:[[106],256],120364:[[107],256],120365:[[108],256],120366:[[109],256],120367:[[110],256],120368:[[111],256],120369:[[112],256],120370:[[113],256],120371:[[114],256],120372:[[115],256],120373:[[116],256],120374:[[117],256],120375:[[118],256],120376:[[119],256],120377:[[120],256],120378:[[121],256],120379:[[122],256],120380:[[65],256],120381:[[66],256],120382:[[67],256],120383:[[68],256],120384:[[69],256],120385:[[70],256],120386:[[71],256],120387:[[72],256],120388:[[73],256],120389:[[74],256],120390:[[75],256],120391:[[76],256],120392:[[77],256],120393:[[78],256],120394:[[79],256],120395:[[80],256],120396:[[81],256],120397:[[82],256],120398:[[83],256],120399:[[84],256],120400:[[85],256],120401:[[86],256],120402:[[87],256],120403:[[88],256],120404:[[89],256],120405:[[90],256],120406:[[97],256],120407:[[98],256],120408:[[99],256],120409:[[100],256],120410:[[101],256],120411:[[102],256],120412:[[103],256],120413:[[104],256],120414:[[105],256],120415:[[106],256],120416:[[107],256],120417:[[108],256],120418:[[109],256],120419:[[110],256],120420:[[111],256],120421:[[112],256],120422:[[113],256],120423:[[114],256],120424:[[115],256],120425:[[116],256],120426:[[117],256],120427:[[118],256],120428:[[119],256],120429:[[120],256],120430:[[121],256],120431:[[122],256],120432:[[65],256],120433:[[66],256],120434:[[67],256],120435:[[68],256],120436:[[69],256],120437:[[70],256],120438:[[71],256],120439:[[72],256],120440:[[73],256],120441:[[74],256],120442:[[75],256],120443:[[76],256],120444:[[77],256],120445:[[78],256],120446:[[79],256],120447:[[80],256],120448:[[81],256],120449:[[82],256],120450:[[83],256],120451:[[84],256],120452:[[85],256],120453:[[86],256],120454:[[87],256],120455:[[88],256],120456:[[89],256],120457:[[90],256],120458:[[97],256],120459:[[98],256],120460:[[99],256],120461:[[100],256],120462:[[101],256],120463:[[102],256],120464:[[103],256],120465:[[104],256],120466:[[105],256],120467:[[106],256],120468:[[107],256],120469:[[108],256],120470:[[109],256],120471:[[110],256],120472:[[111],256],120473:[[112],256],120474:[[113],256],120475:[[114],256],120476:[[115],256],120477:[[116],256],120478:[[117],256],120479:[[118],256],120480:[[119],256],120481:[[120],256],120482:[[121],256],120483:[[122],256],120484:[[305],256],120485:[[567],256],120488:[[913],256],120489:[[914],256],120490:[[915],256],120491:[[916],256],120492:[[917],256],120493:[[918],256],120494:[[919],256],120495:[[920],256],120496:[[921],256],120497:[[922],256],120498:[[923],256],120499:[[924],256],120500:[[925],256],120501:[[926],256],120502:[[927],256],120503:[[928],256],120504:[[929],256],120505:[[1012],256],120506:[[931],256],120507:[[932],256],120508:[[933],256],120509:[[934],256],120510:[[935],256],120511:[[936],256],120512:[[937],256],120513:[[8711],256],120514:[[945],256],120515:[[946],256],120516:[[947],256],120517:[[948],256],120518:[[949],256],120519:[[950],256],120520:[[951],256],120521:[[952],256],120522:[[953],256],120523:[[954],256],120524:[[955],256],120525:[[956],256],120526:[[957],256],120527:[[958],256],120528:[[959],256],120529:[[960],256],120530:[[961],256],120531:[[962],256],120532:[[963],256],120533:[[964],256],120534:[[965],256],120535:[[966],256],120536:[[967],256],120537:[[968],256],120538:[[969],256],120539:[[8706],256],120540:[[1013],256],120541:[[977],256],120542:[[1008],256],120543:[[981],256],120544:[[1009],256],120545:[[982],256],120546:[[913],256],120547:[[914],256],120548:[[915],256],120549:[[916],256],120550:[[917],256],120551:[[918],256],120552:[[919],256],120553:[[920],256],120554:[[921],256],120555:[[922],256],120556:[[923],256],120557:[[924],256],120558:[[925],256],120559:[[926],256],120560:[[927],256],120561:[[928],256],120562:[[929],256],120563:[[1012],256],120564:[[931],256],120565:[[932],256],120566:[[933],256],120567:[[934],256],120568:[[935],256],120569:[[936],256],120570:[[937],256],120571:[[8711],256],120572:[[945],256],120573:[[946],256],120574:[[947],256],120575:[[948],256]},
11265655040:{120576:[[949],256],120577:[[950],256],120578:[[951],256],120579:[[952],256],120580:[[953],256],120581:[[954],256],120582:[[955],256],120583:[[956],256],120584:[[957],256],120585:[[958],256],120586:[[959],256],120587:[[960],256],120588:[[961],256],120589:[[962],256],120590:[[963],256],120591:[[964],256],120592:[[965],256],120593:[[966],256],120594:[[967],256],120595:[[968],256],120596:[[969],256],120597:[[8706],256],120598:[[1013],256],120599:[[977],256],120600:[[1008],256],120601:[[981],256],120602:[[1009],256],120603:[[982],256],120604:[[913],256],120605:[[914],256],120606:[[915],256],120607:[[916],256],120608:[[917],256],120609:[[918],256],120610:[[919],256],120611:[[920],256],120612:[[921],256],120613:[[922],256],120614:[[923],256],120615:[[924],256],120616:[[925],256],120617:[[926],256],120618:[[927],256],120619:[[928],256],120620:[[929],256],120621:[[1012],256],120622:[[931],256],120623:[[932],256],120624:[[933],256],120625:[[934],256],120626:[[935],256],120627:[[936],256],120628:[[937],256],120629:[[8711],256],120630:[[945],256],120631:[[946],256],120632:[[947],256],120633:[[948],256],120634:[[949],256],120635:[[950],256],120636:[[951],256],120637:[[952],256],120638:[[953],256],120639:[[954],256],120640:[[955],256],120641:[[956],256],120642:[[957],256],120643:[[958],256],120644:[[959],256],120645:[[960],256],120646:[[961],256],120647:[[962],256],120648:[[963],256],120649:[[964],256],120650:[[965],256],120651:[[966],256],120652:[[967],256],120653:[[968],256],120654:[[969],256],120655:[[8706],256],120656:[[1013],256],120657:[[977],256],120658:[[1008],256],120659:[[981],256],120660:[[1009],256],120661:[[982],256],120662:[[913],256],120663:[[914],256],120664:[[915],256],120665:[[916],256],120666:[[917],256],120667:[[918],256],120668:[[919],256],120669:[[920],256],120670:[[921],256],120671:[[922],256],120672:[[923],256],120673:[[924],256],120674:[[925],256],120675:[[926],256],120676:[[927],256],120677:[[928],256],120678:[[929],256],120679:[[1012],256],120680:[[931],256],120681:[[932],256],120682:[[933],256],120683:[[934],256],120684:[[935],256],120685:[[936],256],120686:[[937],256],120687:[[8711],256],120688:[[945],256],120689:[[946],256],120690:[[947],256],120691:[[948],256],120692:[[949],256],120693:[[950],256],120694:[[951],256],120695:[[952],256],120696:[[953],256],120697:[[954],256],120698:[[955],256],120699:[[956],256],120700:[[957],256],120701:[[958],256],120702:[[959],256],120703:[[960],256],120704:[[961],256],120705:[[962],256],120706:[[963],256],120707:[[964],256],120708:[[965],256],120709:[[966],256],120710:[[967],256],120711:[[968],256],120712:[[969],256],120713:[[8706],256],120714:[[1013],256],120715:[[977],256],120716:[[1008],256],120717:[[981],256],120718:[[1009],256],120719:[[982],256],120720:[[913],256],120721:[[914],256],120722:[[915],256],120723:[[916],256],120724:[[917],256],120725:[[918],256],120726:[[919],256],120727:[[920],256],120728:[[921],256],120729:[[922],256],120730:[[923],256],120731:[[924],256],120732:[[925],256],120733:[[926],256],120734:[[927],256],120735:[[928],256],120736:[[929],256],120737:[[1012],256],120738:[[931],256],120739:[[932],256],120740:[[933],256],120741:[[934],256],120742:[[935],256],120743:[[936],256],120744:[[937],256],120745:[[8711],256],120746:[[945],256],120747:[[946],256],120748:[[947],256],120749:[[948],256],120750:[[949],256],120751:[[950],256],120752:[[951],256],120753:[[952],256],120754:[[953],256],120755:[[954],256],120756:[[955],256],120757:[[956],256],120758:[[957],256],120759:[[958],256],120760:[[959],256],120761:[[960],256],120762:[[961],256],120763:[[962],256],120764:[[963],256],120765:[[964],256],120766:[[965],256],120767:[[966],256],120768:[[967],256],120769:[[968],256],120770:[[969],256],120771:[[8706],256],120772:[[1013],256],120773:[[977],256],120774:[[1008],256],120775:[[981],256],120776:[[1009],256],120777:[[982],256],120778:[[988],256],120779:[[989],256],120782:[[48],256],120783:[[49],256],120784:[[50],256],120785:[[51],256],120786:[[52],256],120787:[[53],256],120788:[[54],256],120789:[[55],256],120790:[[56],256],120791:[[57],256],120792:[[48],256],120793:[[49],256],120794:[[50],256],120795:[[51],256],120796:[[52],256],120797:[[53],256],120798:[[54],256],120799:[[55],256],120800:[[56],256],120801:[[57],256],120802:[[48],256],120803:[[49],256],120804:[[50],256],120805:[[51],256],120806:[[52],256],120807:[[53],256],120808:[[54],256],120809:[[55],256],120810:[[56],256],120811:[[57],256],120812:[[48],256],120813:[[49],256],120814:[[50],256],120815:[[51],256],120816:[[52],256],120817:[[53],256],120818:[[54],256],120819:[[55],256],120820:[[56],256],120821:[[57],256],120822:[[48],256],120823:[[49],256],120824:[[50],256],120825:[[51],256],120826:[[52],256],120827:[[53],256],120828:[[54],256],120829:[[55],256],120830:[[56],256],120831:[[57],256]},
11265759392:{125136:[,220],125137:[,220],125138:[,220],125139:[,220],125140:[,220],125141:[,220],125142:[,220]},
11265860928:{126464:[[1575],256],126465:[[1576],256],126466:[[1580],256],126467:[[1583],256],126469:[[1608],256],126470:[[1586],256],126471:[[1581],256],126472:[[1591],256],126473:[[1610],256],126474:[[1603],256],126475:[[1604],256],126476:[[1605],256],126477:[[1606],256],126478:[[1587],256],126479:[[1593],256],126480:[[1601],256],126481:[[1589],256],126482:[[1602],256],126483:[[1585],256],126484:[[1588],256],126485:[[1578],256],126486:[[1579],256],126487:[[1582],256],126488:[[1584],256],126489:[[1590],256],126490:[[1592],256],126491:[[1594],256],126492:[[1646],256],126493:[[1722],256],126494:[[1697],256],126495:[[1647],256],126497:[[1576],256],126498:[[1580],256],126500:[[1607],256],126503:[[1581],256],126505:[[1610],256],126506:[[1603],256],126507:[[1604],256],126508:[[1605],256],126509:[[1606],256],126510:[[1587],256],126511:[[1593],256],126512:[[1601],256],126513:[[1589],256],126514:[[1602],256],126516:[[1588],256],126517:[[1578],256],126518:[[1579],256],126519:[[1582],256],126521:[[1590],256],126523:[[1594],256],126530:[[1580],256],126535:[[1581],256],126537:[[1610],256],126539:[[1604],256],126541:[[1606],256],126542:[[1587],256],126543:[[1593],256],126545:[[1589],256],126546:[[1602],256],126548:[[1588],256],126551:[[1582],256],126553:[[1590],256],126555:[[1594],256],126557:[[1722],256],126559:[[1647],256],126561:[[1576],256],126562:[[1580],256],126564:[[1607],256],126567:[[1581],256],126568:[[1591],256],126569:[[1610],256],126570:[[1603],256],126572:[[1605],256],126573:[[1606],256],126574:[[1587],256],126575:[[1593],256],126576:[[1601],256],126577:[[1589],256],126578:[[1602],256],126580:[[1588],256],126581:[[1578],256],126582:[[1579],256],126583:[[1582],256],126585:[[1590],256],126586:[[1592],256],126587:[[1594],256],126588:[[1646],256],126590:[[1697],256],126592:[[1575],256],126593:[[1576],256],126594:[[1580],256],126595:[[1583],256],126596:[[1607],256],126597:[[1608],256],126598:[[1586],256],126599:[[1581],256],126600:[[1591],256],126601:[[1610],256],126603:[[1604],256],126604:[[1605],256],126605:[[1606],256],126606:[[1587],256],126607:[[1593],256],126608:[[1601],256],126609:[[1589],256],126610:[[1602],256],126611:[[1585],256],126612:[[1588],256],126613:[[1578],256],126614:[[1579],256],126615:[[1582],256],126616:[[1584],256],126617:[[1590],256],126618:[[1592],256],126619:[[1594],256],126625:[[1576],256],126626:[[1580],256],126627:[[1583],256],126629:[[1608],256],126630:[[1586],256],126631:[[1581],256],126632:[[1591],256],126633:[[1610],256],126635:[[1604],256],126636:[[1605],256],126637:[[1606],256],126638:[[1587],256],126639:[[1593],256],126640:[[1601],256],126641:[[1589],256],126642:[[1602],256],126643:[[1585],256],126644:[[1588],256],126645:[[1578],256],126646:[[1579],256],126647:[[1582],256],126648:[[1584],256],126649:[[1590],256],126650:[[1592],256],126651:[[1594],256]},
11265961696:{127232:[[48,46],256],127233:[[48,44],256],127234:[[49,44],256],127235:[[50,44],256],127236:[[51,44],256],127237:[[52,44],256],127238:[[53,44],256],127239:[[54,44],256],127240:[[55,44],256],127241:[[56,44],256],127242:[[57,44],256],127248:[[40,65,41],256],127249:[[40,66,41],256],127250:[[40,67,41],256],127251:[[40,68,41],256],127252:[[40,69,41],256],127253:[[40,70,41],256],127254:[[40,71,41],256],127255:[[40,72,41],256],127256:[[40,73,41],256],127257:[[40,74,41],256],127258:[[40,75,41],256],127259:[[40,76,41],256],127260:[[40,77,41],256],127261:[[40,78,41],256],127262:[[40,79,41],256],127263:[[40,80,41],256],127264:[[40,81,41],256],127265:[[40,82,41],256],127266:[[40,83,41],256],127267:[[40,84,41],256],127268:[[40,85,41],256],127269:[[40,86,41],256],127270:[[40,87,41],256],127271:[[40,88,41],256],127272:[[40,89,41],256],127273:[[40,90,41],256],127274:[[12308,83,12309],256],127275:[[67],256],127276:[[82],256],127277:[[67,68],256],127278:[[87,90],256],127280:[[65],256],127281:[[66],256],127282:[[67],256],127283:[[68],256],127284:[[69],256],127285:[[70],256],127286:[[71],256],127287:[[72],256],127288:[[73],256],127289:[[74],256],127290:[[75],256],127291:[[76],256],127292:[[77],256],127293:[[78],256],127294:[[79],256],127295:[[80],256],127296:[[81],256],127297:[[82],256],127298:[[83],256],127299:[[84],256],127300:[[85],256],127301:[[86],256],127302:[[87],256],127303:[[88],256],127304:[[89],256],127305:[[90],256],127306:[[72,86],256],127307:[[77,86],256],127308:[[83,68],256],127309:[[83,83],256],127310:[[80,80,86],256],127311:[[87,67],256],127338:[[77,67],256],127339:[[77,68],256],127376:[[68,74],256]},
11266061952:{127488:[[12411,12363],256],127489:[[12467,12467],256],127490:[[12469],256],127504:[[25163],256],127505:[[23383],256],127506:[[21452],256],127507:[[12487],256],127508:[[20108],256],127509:[[22810],256],127510:[[35299],256],127511:[[22825],256],127512:[[20132],256],127513:[[26144],256],127514:[[28961],256],127515:[[26009],256],127516:[[21069],256],127517:[[24460],256],127518:[[20877],256],127519:[[26032],256],127520:[[21021],256],127521:[[32066],256],127522:[[29983],256],127523:[[36009],256],127524:[[22768],256],127525:[[21561],256],127526:[[28436],256],127527:[[25237],256],127528:[[25429],256],127529:[[19968],256],127530:[[19977],256],127531:[[36938],256],127532:[[24038],256],127533:[[20013],256],127534:[[21491],256],127535:[[25351],256],127536:[[36208],256],127537:[[25171],256],127538:[[31105],256],127539:[[31354],256],127540:[[21512],256],127541:[[28288],256],127542:[[26377],256],127543:[[26376],256],127544:[[30003],256],127545:[[21106],256],127546:[[21942],256],127552:[[12308,26412,12309],256],127553:[[12308,19977,12309],256],127554:[[12308,20108,12309],256],127555:[[12308,23433,12309],256],127556:[[12308,28857,12309],256],127557:[[12308,25171,12309],256],127558:[[12308,30423,12309],256],127559:[[12308,21213,12309],256],127560:[[12308,25943,12309],256],127568:[[24471],256],127569:[[21487],256]},
11266163488:{194560:[[20029]],194561:[[20024]],194562:[[20033]],194563:[[131362]],194564:[[20320]],194565:[[20398]],194566:[[20411]],194567:[[20482]],194568:[[20602]],194569:[[20633]],194570:[[20711]],194571:[[20687]],194572:[[13470]],194573:[[132666]],194574:[[20813]],194575:[[20820]],194576:[[20836]],194577:[[20855]],194578:[[132380]],194579:[[13497]],194580:[[20839]],194581:[[20877]],194582:[[132427]],194583:[[20887]],194584:[[20900]],194585:[[20172]],194586:[[20908]],194587:[[20917]],194588:[[168415]],194589:[[20981]],194590:[[20995]],194591:[[13535]],194592:[[21051]],194593:[[21062]],194594:[[21106]],194595:[[21111]],194596:[[13589]],194597:[[21191]],194598:[[21193]],194599:[[21220]],194600:[[21242]],194601:[[21253]],194602:[[21254]],194603:[[21271]],194604:[[21321]],194605:[[21329]],194606:[[21338]],194607:[[21363]],194608:[[21373]],194609:[[21375]],194610:[[21375]],194611:[[21375]],194612:[[133676]],194613:[[28784]],194614:[[21450]],194615:[[21471]],194616:[[133987]],194617:[[21483]],194618:[[21489]],194619:[[21510]],194620:[[21662]],194621:[[21560]],194622:[[21576]],194623:[[21608]],194624:[[21666]],194625:[[21750]],194626:[[21776]],194627:[[21843]],194628:[[21859]],194629:[[21892]],194630:[[21892]],194631:[[21913]],194632:[[21931]],194633:[[21939]],194634:[[21954]],194635:[[22294]],194636:[[22022]],194637:[[22295]],194638:[[22097]],194639:[[22132]],194640:[[20999]],194641:[[22766]],194642:[[22478]],194643:[[22516]],194644:[[22541]],194645:[[22411]],194646:[[22578]],194647:[[22577]],194648:[[22700]],194649:[[136420]],194650:[[22770]],194651:[[22775]],194652:[[22790]],194653:[[22810]],194654:[[22818]],194655:[[22882]],194656:[[136872]],194657:[[136938]],194658:[[23020]],194659:[[23067]],194660:[[23079]],194661:[[23000]],194662:[[23142]],194663:[[14062]],194664:[[14076]],194665:[[23304]],194666:[[23358]],194667:[[23358]],194668:[[137672]],194669:[[23491]],194670:[[23512]],194671:[[23527]],194672:[[23539]],194673:[[138008]],194674:[[23551]],194675:[[23558]],194676:[[24403]],194677:[[23586]],194678:[[14209]],194679:[[23648]],194680:[[23662]],194681:[[23744]],194682:[[23693]],194683:[[138724]],194684:[[23875]],194685:[[138726]],194686:[[23918]],194687:[[23915]],194688:[[23932]],194689:[[24033]],194690:[[24034]],194691:[[14383]],194692:[[24061]],194693:[[24104]],194694:[[24125]],194695:[[24169]],194696:[[14434]],194697:[[139651]],194698:[[14460]],194699:[[24240]],194700:[[24243]],194701:[[24246]],194702:[[24266]],194703:[[172946]],194704:[[24318]],194705:[[140081]],194706:[[140081]],194707:[[33281]],194708:[[24354]],194709:[[24354]],194710:[[14535]],194711:[[144056]],194712:[[156122]],194713:[[24418]],194714:[[24427]],194715:[[14563]],194716:[[24474]],194717:[[24525]],194718:[[24535]],194719:[[24569]],194720:[[24705]],194721:[[14650]],194722:[[14620]],194723:[[24724]],194724:[[141012]],194725:[[24775]],194726:[[24904]],194727:[[24908]],194728:[[24910]],194729:[[24908]],194730:[[24954]],194731:[[24974]],194732:[[25010]],194733:[[24996]],194734:[[25007]],194735:[[25054]],194736:[[25074]],194737:[[25078]],194738:[[25104]],194739:[[25115]],194740:[[25181]],194741:[[25265]],194742:[[25300]],194743:[[25424]],194744:[[142092]],194745:[[25405]],194746:[[25340]],194747:[[25448]],194748:[[25475]],194749:[[25572]],194750:[[142321]],194751:[[25634]],194752:[[25541]],194753:[[25513]],194754:[[14894]],194755:[[25705]],194756:[[25726]],194757:[[25757]],194758:[[25719]],194759:[[14956]],194760:[[25935]],194761:[[25964]],194762:[[143370]],194763:[[26083]],194764:[[26360]],194765:[[26185]],194766:[[15129]],194767:[[26257]],194768:[[15112]],194769:[[15076]],194770:[[20882]],194771:[[20885]],194772:[[26368]],194773:[[26268]],194774:[[32941]],194775:[[17369]],194776:[[26391]],194777:[[26395]],194778:[[26401]],194779:[[26462]],194780:[[26451]],194781:[[144323]],194782:[[15177]],194783:[[26618]],194784:[[26501]],194785:[[26706]],194786:[[26757]],194787:[[144493]],194788:[[26766]],194789:[[26655]],194790:[[26900]],194791:[[15261]],194792:[[26946]],194793:[[27043]],194794:[[27114]],194795:[[27304]],194796:[[145059]],194797:[[27355]],194798:[[15384]],194799:[[27425]],194800:[[145575]],194801:[[27476]],194802:[[15438]],194803:[[27506]],194804:[[27551]],194805:[[27578]],194806:[[27579]],194807:[[146061]],194808:[[138507]],194809:[[146170]],194810:[[27726]],194811:[[146620]],194812:[[27839]],194813:[[27853]],194814:[[27751]],194815:[[27926]]},
11266263744:{63744:[[35912]],63745:[[26356]],63746:[[36554]],63747:[[36040]],63748:[[28369]],63749:[[20018]],63750:[[21477]],63751:[[40860]],63752:[[40860]],63753:[[22865]],63754:[[37329]],63755:[[21895]],63756:[[22856]],63757:[[25078]],63758:[[30313]],63759:[[32645]],63760:[[34367]],63761:[[34746]],63762:[[35064]],63763:[[37007]],63764:[[27138]],63765:[[27931]],63766:[[28889]],63767:[[29662]],63768:[[33853]],63769:[[37226]],63770:[[39409]],63771:[[20098]],63772:[[21365]],63773:[[27396]],63774:[[29211]],63775:[[34349]],63776:[[40478]],63777:[[23888]],63778:[[28651]],63779:[[34253]],63780:[[35172]],63781:[[25289]],63782:[[33240]],63783:[[34847]],63784:[[24266]],63785:[[26391]],63786:[[28010]],63787:[[29436]],63788:[[37070]],63789:[[20358]],63790:[[20919]],63791:[[21214]],63792:[[25796]],63793:[[27347]],63794:[[29200]],63795:[[30439]],63796:[[32769]],63797:[[34310]],63798:[[34396]],63799:[[36335]],63800:[[38706]],63801:[[39791]],63802:[[40442]],63803:[[30860]],63804:[[31103]],63805:[[32160]],63806:[[33737]],63807:[[37636]],63808:[[40575]],63809:[[35542]],63810:[[22751]],63811:[[24324]],63812:[[31840]],63813:[[32894]],63814:[[29282]],63815:[[30922]],63816:[[36034]],63817:[[38647]],63818:[[22744]],63819:[[23650]],63820:[[27155]],63821:[[28122]],63822:[[28431]],63823:[[32047]],63824:[[32311]],63825:[[38475]],63826:[[21202]],63827:[[32907]],63828:[[20956]],63829:[[20940]],63830:[[31260]],63831:[[32190]],63832:[[33777]],63833:[[38517]],63834:[[35712]],63835:[[25295]],63836:[[27138]],63837:[[35582]],63838:[[20025]],63839:[[23527]],63840:[[24594]],63841:[[29575]],63842:[[30064]],63843:[[21271]],63844:[[30971]],63845:[[20415]],63846:[[24489]],63847:[[19981]],63848:[[27852]],63849:[[25976]],63850:[[32034]],63851:[[21443]],63852:[[22622]],63853:[[30465]],63854:[[33865]],63855:[[35498]],63856:[[27578]],63857:[[36784]],63858:[[27784]],63859:[[25342]],63860:[[33509]],63861:[[25504]],63862:[[30053]],63863:[[20142]],63864:[[20841]],63865:[[20937]],63866:[[26753]],63867:[[31975]],63868:[[33391]],63869:[[35538]],63870:[[37327]],63871:[[21237]],63872:[[21570]],63873:[[22899]],63874:[[24300]],63875:[[26053]],63876:[[28670]],63877:[[31018]],63878:[[38317]],63879:[[39530]],63880:[[40599]],63881:[[40654]],63882:[[21147]],63883:[[26310]],63884:[[27511]],63885:[[36706]],63886:[[24180]],63887:[[24976]],63888:[[25088]],63889:[[25754]],63890:[[28451]],63891:[[29001]],63892:[[29833]],63893:[[31178]],63894:[[32244]],63895:[[32879]],63896:[[36646]],63897:[[34030]],63898:[[36899]],63899:[[37706]],63900:[[21015]],63901:[[21155]],63902:[[21693]],63903:[[28872]],63904:[[35010]],63905:[[35498]],63906:[[24265]],63907:[[24565]],63908:[[25467]],63909:[[27566]],63910:[[31806]],63911:[[29557]],63912:[[20196]],63913:[[22265]],63914:[[23527]],63915:[[23994]],63916:[[24604]],63917:[[29618]],63918:[[29801]],63919:[[32666]],63920:[[32838]],63921:[[37428]],63922:[[38646]],63923:[[38728]],63924:[[38936]],63925:[[20363]],63926:[[31150]],63927:[[37300]],63928:[[38584]],63929:[[24801]],63930:[[20102]],63931:[[20698]],63932:[[23534]],63933:[[23615]],63934:[[26009]],63935:[[27138]],63936:[[29134]],63937:[[30274]],63938:[[34044]],63939:[[36988]],63940:[[40845]],63941:[[26248]],63942:[[38446]],63943:[[21129]],63944:[[26491]],63945:[[26611]],63946:[[27969]],63947:[[28316]],63948:[[29705]],63949:[[30041]],63950:[[30827]],63951:[[32016]],63952:[[39006]],63953:[[20845]],63954:[[25134]],63955:[[38520]],63956:[[20523]],63957:[[23833]],63958:[[28138]],63959:[[36650]],63960:[[24459]],63961:[[24900]],63962:[[26647]],63963:[[29575]],63964:[[38534]],63965:[[21033]],63966:[[21519]],63967:[[23653]],63968:[[26131]],63969:[[26446]],63970:[[26792]],63971:[[27877]],63972:[[29702]],63973:[[30178]],63974:[[32633]],63975:[[35023]],63976:[[35041]],63977:[[37324]],63978:[[38626]],63979:[[21311]],63980:[[28346]],63981:[[21533]],63982:[[29136]],63983:[[29848]],63984:[[34298]],63985:[[38563]],63986:[[40023]],63987:[[40607]],63988:[[26519]],63989:[[28107]],63990:[[33256]],63991:[[31435]],63992:[[31520]],63993:[[31890]],63994:[[29376]],63995:[[28825]],63996:[[35672]],63997:[[20160]],63998:[[33590]],63999:[[21050]],194816:[[27966]],194817:[[28023]],194818:[[27969]],194819:[[28009]],194820:[[28024]],194821:[[28037]],194822:[[146718]],194823:[[27956]],194824:[[28207]],194825:[[28270]],194826:[[15667]],194827:[[28363]],194828:[[28359]],194829:[[147153]],194830:[[28153]],194831:[[28526]],194832:[[147294]],194833:[[147342]],194834:[[28614]],194835:[[28729]],194836:[[28702]],194837:[[28699]],194838:[[15766]],194839:[[28746]],194840:[[28797]],194841:[[28791]],194842:[[28845]],194843:[[132389]],194844:[[28997]],194845:[[148067]],194846:[[29084]],194847:[[148395]],194848:[[29224]],194849:[[29237]],194850:[[29264]],194851:[[149000]],194852:[[29312]],194853:[[29333]],194854:[[149301]],194855:[[149524]],194856:[[29562]],194857:[[29579]],194858:[[16044]],194859:[[29605]],194860:[[16056]],194861:[[16056]],194862:[[29767]],194863:[[29788]],194864:[[29809]],194865:[[29829]],194866:[[29898]],194867:[[16155]],194868:[[29988]],194869:[[150582]],194870:[[30014]],194871:[[150674]],194872:[[30064]],194873:[[139679]],194874:[[30224]],194875:[[151457]],194876:[[151480]],194877:[[151620]],194878:[[16380]],194879:[[16392]],194880:[[30452]],194881:[[151795]],194882:[[151794]],194883:[[151833]],194884:[[151859]],194885:[[30494]],194886:[[30495]],194887:[[30495]],194888:[[30538]],194889:[[16441]],194890:[[30603]],194891:[[16454]],194892:[[16534]],194893:[[152605]],194894:[[30798]],194895:[[30860]],194896:[[30924]],194897:[[16611]],194898:[[153126]],194899:[[31062]],194900:[[153242]],194901:[[153285]],194902:[[31119]],194903:[[31211]],194904:[[16687]],194905:[[31296]],194906:[[31306]],194907:[[31311]],194908:[[153980]],194909:[[154279]],194910:[[154279]],194911:[[31470]],194912:[[16898]],194913:[[154539]],194914:[[31686]],194915:[[31689]],194916:[[16935]],194917:[[154752]],194918:[[31954]],194919:[[17056]],194920:[[31976]],194921:[[31971]],194922:[[32000]],194923:[[155526]],194924:[[32099]],194925:[[17153]],194926:[[32199]],194927:[[32258]],194928:[[32325]],194929:[[17204]],194930:[[156200]],194931:[[156231]],194932:[[17241]],194933:[[156377]],194934:[[32634]],194935:[[156478]],194936:[[32661]],194937:[[32762]],194938:[[32773]],194939:[[156890]],194940:[[156963]],194941:[[32864]],194942:[[157096]],194943:[[32880]],194944:[[144223]],194945:[[17365]],194946:[[32946]],194947:[[33027]],194948:[[17419]],194949:[[33086]],194950:[[23221]],194951:[[157607]],194952:[[157621]],194953:[[144275]],194954:[[144284]],194955:[[33281]],194956:[[33284]],194957:[[36766]],194958:[[17515]],194959:[[33425]],194960:[[33419]],194961:[[33437]],194962:[[21171]],194963:[[33457]],194964:[[33459]],194965:[[33469]],194966:[[33510]],194967:[[158524]],194968:[[33509]],194969:[[33565]],194970:[[33635]],194971:[[33709]],194972:[[33571]],194973:[[33725]],194974:[[33767]],194975:[[33879]],194976:[[33619]],194977:[[33738]],194978:[[33740]],194979:[[33756]],194980:[[158774]],194981:[[159083]],194982:[[158933]],194983:[[17707]],194984:[[34033]],194985:[[34035]],194986:[[34070]],194987:[[160714]],194988:[[34148]],194989:[[159532]],194990:[[17757]],194991:[[17761]],194992:[[159665]],194993:[[159954]],194994:[[17771]],194995:[[34384]],194996:[[34396]],194997:[[34407]],194998:[[34409]],194999:[[34473]],195000:[[34440]],195001:[[34574]],195002:[[34530]],195003:[[34681]],195004:[[34600]],195005:[[34667]],195006:[[34694]],195007:[[17879]],195008:[[34785]],195009:[[34817]],195010:[[17913]],195011:[[34912]],195012:[[34915]],195013:[[161383]],195014:[[35031]],195015:[[35038]],195016:[[17973]],195017:[[35066]],195018:[[13499]],195019:[[161966]],195020:[[162150]],195021:[[18110]],195022:[[18119]],195023:[[35488]],195024:[[35565]],195025:[[35722]],195026:[[35925]],195027:[[162984]],195028:[[36011]],195029:[[36033]],195030:[[36123]],195031:[[36215]],195032:[[163631]],195033:[[133124]],195034:[[36299]],195035:[[36284]],195036:[[36336]],195037:[[133342]],195038:[[36564]],195039:[[36664]],195040:[[165330]],195041:[[165357]],195042:[[37012]],195043:[[37105]],195044:[[37137]],195045:[[165678]],195046:[[37147]],195047:[[37432]],195048:[[37591]],195049:[[37592]],195050:[[37500]],195051:[[37881]],195052:[[37909]],195053:[[166906]],195054:[[38283]],195055:[[18837]],195056:[[38327]],195057:[[167287]],195058:[[18918]],195059:[[38595]],195060:[[23986]],195061:[[38691]],195062:[[168261]],195063:[[168474]],195064:[[19054]],195065:[[19062]],195066:[[38880]],195067:[[168970]],195068:[[19122]],195069:[[169110]],195070:[[38923]],195071:[[38923]]},
11266364000:{64000:[[20999]],64001:[[24230]],64002:[[25299]],64003:[[31958]],64004:[[23429]],64005:[[27934]],64006:[[26292]],64007:[[36667]],64008:[[34892]],64009:[[38477]],64010:[[35211]],64011:[[24275]],64012:[[20800]],64013:[[21952]],64016:[[22618]],64018:[[26228]],64021:[[20958]],64022:[[29482]],64023:[[30410]],64024:[[31036]],64025:[[31070]],64026:[[31077]],64027:[[31119]],64028:[[38742]],64029:[[31934]],64030:[[32701]],64032:[[34322]],64034:[[35576]],64037:[[36920]],64038:[[37117]],64042:[[39151]],64043:[[39164]],64044:[[39208]],64045:[[40372]],64046:[[37086]],64047:[[38583]],64048:[[20398]],64049:[[20711]],64050:[[20813]],64051:[[21193]],64052:[[21220]],64053:[[21329]],64054:[[21917]],64055:[[22022]],64056:[[22120]],64057:[[22592]],64058:[[22696]],64059:[[23652]],64060:[[23662]],64061:[[24724]],64062:[[24936]],64063:[[24974]],64064:[[25074]],64065:[[25935]],64066:[[26082]],64067:[[26257]],64068:[[26757]],64069:[[28023]],64070:[[28186]],64071:[[28450]],64072:[[29038]],64073:[[29227]],64074:[[29730]],64075:[[30865]],64076:[[31038]],64077:[[31049]],64078:[[31048]],64079:[[31056]],64080:[[31062]],64081:[[31069]],64082:[[31117]],64083:[[31118]],64084:[[31296]],64085:[[31361]],64086:[[31680]],64087:[[32244]],64088:[[32265]],64089:[[32321]],64090:[[32626]],64091:[[32773]],64092:[[33261]],64093:[[33401]],64094:[[33401]],64095:[[33879]],64096:[[35088]],64097:[[35222]],64098:[[35585]],64099:[[35641]],64100:[[36051]],64101:[[36104]],64102:[[36790]],64103:[[36920]],64104:[[38627]],64105:[[38911]],64106:[[38971]],64107:[[24693]],64108:[[148206]],64109:[[33304]],64112:[[20006]],64113:[[20917]],64114:[[20840]],64115:[[20352]],64116:[[20805]],64117:[[20864]],64118:[[21191]],64119:[[21242]],64120:[[21917]],64121:[[21845]],64122:[[21913]],64123:[[21986]],64124:[[22618]],64125:[[22707]],64126:[[22852]],64127:[[22868]],64128:[[23138]],64129:[[23336]],64130:[[24274]],64131:[[24281]],64132:[[24425]],64133:[[24493]],64134:[[24792]],64135:[[24910]],64136:[[24840]],64137:[[24974]],64138:[[24928]],64139:[[25074]],64140:[[25140]],64141:[[25540]],64142:[[25628]],64143:[[25682]],64144:[[25942]],64145:[[26228]],64146:[[26391]],64147:[[26395]],64148:[[26454]],64149:[[27513]],64150:[[27578]],64151:[[27969]],64152:[[28379]],64153:[[28363]],64154:[[28450]],64155:[[28702]],64156:[[29038]],64157:[[30631]],64158:[[29237]],64159:[[29359]],64160:[[29482]],64161:[[29809]],64162:[[29958]],64163:[[30011]],64164:[[30237]],64165:[[30239]],64166:[[30410]],64167:[[30427]],64168:[[30452]],64169:[[30538]],64170:[[30528]],64171:[[30924]],64172:[[31409]],64173:[[31680]],64174:[[31867]],64175:[[32091]],64176:[[32244]],64177:[[32574]],64178:[[32773]],64179:[[33618]],64180:[[33775]],64181:[[34681]],64182:[[35137]],64183:[[35206]],64184:[[35222]],64185:[[35519]],64186:[[35576]],64187:[[35531]],64188:[[35585]],64189:[[35582]],64190:[[35565]],64191:[[35641]],64192:[[35722]],64193:[[36104]],64194:[[36664]],64195:[[36978]],64196:[[37273]],64197:[[37494]],64198:[[38524]],64199:[[38627]],64200:[[38742]],64201:[[38875]],64202:[[38911]],64203:[[38923]],64204:[[38971]],64205:[[39698]],64206:[[40860]],64207:[[141386]],64208:[[141380]],64209:[[144341]],64210:[[15261]],64211:[[16408]],64212:[[16441]],64213:[[152137]],64214:[[154832]],64215:[[163539]],64216:[[40771]],64217:[[40846]],195072:[[38953]],195073:[[169398]],195074:[[39138]],195075:[[19251]],195076:[[39209]],195077:[[39335]],195078:[[39362]],195079:[[39422]],195080:[[19406]],195081:[[170800]],195082:[[39698]],195083:[[40000]],195084:[[40189]],195085:[[19662]],195086:[[19693]],195087:[[40295]],195088:[[172238]],195089:[[19704]],195090:[[172293]],195091:[[172558]],195092:[[172689]],195093:[[40635]],195094:[[19798]],195095:[[40697]],195096:[[40702]],195097:[[40709]],195098:[[40719]],195099:[[40726]],195100:[[40763]],195101:[[173568]]},
11266464256:{64256:[[102,102],256],64257:[[102,105],256],64258:[[102,108],256],64259:[[102,102,105],256],64260:[[102,102,108],256],64261:[[383,116],256],64262:[[115,116],256],64275:[[1396,1398],256],64276:[[1396,1381],256],64277:[[1396,1387],256],64278:[[1406,1398],256],64279:[[1396,1389],256],64285:[[1497,1460],512],64286:[,26],64287:[[1522,1463],512],64288:[[1506],256],64289:[[1488],256],64290:[[1491],256],64291:[[1492],256],64292:[[1499],256],64293:[[1500],256],64294:[[1501],256],64295:[[1512],256],64296:[[1514],256],64297:[[43],256],64298:[[1513,1473],512],64299:[[1513,1474],512],64300:[[64329,1473],512],64301:[[64329,1474],512],64302:[[1488,1463],512],64303:[[1488,1464],512],64304:[[1488,1468],512],64305:[[1489,1468],512],64306:[[1490,1468],512],64307:[[1491,1468],512],64308:[[1492,1468],512],64309:[[1493,1468],512],64310:[[1494,1468],512],64312:[[1496,1468],512],64313:[[1497,1468],512],64314:[[1498,1468],512],64315:[[1499,1468],512],64316:[[1500,1468],512],64318:[[1502,1468],512],64320:[[1504,1468],512],64321:[[1505,1468],512],64323:[[1507,1468],512],64324:[[1508,1468],512],64326:[[1510,1468],512],64327:[[1511,1468],512],64328:[[1512,1468],512],64329:[[1513,1468],512],64330:[[1514,1468],512],64331:[[1493,1465],512],64332:[[1489,1471],512],64333:[[1499,1471],512],64334:[[1508,1471],512],64335:[[1488,1500],256],64336:[[1649],256],64337:[[1649],256],64338:[[1659],256],64339:[[1659],256],64340:[[1659],256],64341:[[1659],256],64342:[[1662],256],64343:[[1662],256],64344:[[1662],256],64345:[[1662],256],64346:[[1664],256],64347:[[1664],256],64348:[[1664],256],64349:[[1664],256],64350:[[1658],256],64351:[[1658],256],64352:[[1658],256],64353:[[1658],256],64354:[[1663],256],64355:[[1663],256],64356:[[1663],256],64357:[[1663],256],64358:[[1657],256],64359:[[1657],256],64360:[[1657],256],64361:[[1657],256],64362:[[1700],256],64363:[[1700],256],64364:[[1700],256],64365:[[1700],256],64366:[[1702],256],64367:[[1702],256],64368:[[1702],256],64369:[[1702],256],64370:[[1668],256],64371:[[1668],256],64372:[[1668],256],64373:[[1668],256],64374:[[1667],256],64375:[[1667],256],64376:[[1667],256],64377:[[1667],256],64378:[[1670],256],64379:[[1670],256],64380:[[1670],256],64381:[[1670],256],64382:[[1671],256],64383:[[1671],256],64384:[[1671],256],64385:[[1671],256],64386:[[1677],256],64387:[[1677],256],64388:[[1676],256],64389:[[1676],256],64390:[[1678],256],64391:[[1678],256],64392:[[1672],256],64393:[[1672],256],64394:[[1688],256],64395:[[1688],256],64396:[[1681],256],64397:[[1681],256],64398:[[1705],256],64399:[[1705],256],64400:[[1705],256],64401:[[1705],256],64402:[[1711],256],64403:[[1711],256],64404:[[1711],256],64405:[[1711],256],64406:[[1715],256],64407:[[1715],256],64408:[[1715],256],64409:[[1715],256],64410:[[1713],256],64411:[[1713],256],64412:[[1713],256],64413:[[1713],256],64414:[[1722],256],64415:[[1722],256],64416:[[1723],256],64417:[[1723],256],64418:[[1723],256],64419:[[1723],256],64420:[[1728],256],64421:[[1728],256],64422:[[1729],256],64423:[[1729],256],64424:[[1729],256],64425:[[1729],256],64426:[[1726],256],64427:[[1726],256],64428:[[1726],256],64429:[[1726],256],64430:[[1746],256],64431:[[1746],256],64432:[[1747],256],64433:[[1747],256],64467:[[1709],256],64468:[[1709],256],64469:[[1709],256],64470:[[1709],256],64471:[[1735],256],64472:[[1735],256],64473:[[1734],256],64474:[[1734],256],64475:[[1736],256],64476:[[1736],256],64477:[[1655],256],64478:[[1739],256],64479:[[1739],256],64480:[[1733],256],64481:[[1733],256],64482:[[1737],256],64483:[[1737],256],64484:[[1744],256],64485:[[1744],256],64486:[[1744],256],64487:[[1744],256],64488:[[1609],256],64489:[[1609],256],64490:[[1574,1575],256],64491:[[1574,1575],256],64492:[[1574,1749],256],64493:[[1574,1749],256],64494:[[1574,1608],256],64495:[[1574,1608],256],64496:[[1574,1735],256],64497:[[1574,1735],256],64498:[[1574,1734],256],64499:[[1574,1734],256],64500:[[1574,1736],256],64501:[[1574,1736],256],64502:[[1574,1744],256],64503:[[1574,1744],256],64504:[[1574,1744],256],64505:[[1574,1609],256],64506:[[1574,1609],256],64507:[[1574,1609],256],64508:[[1740],256],64509:[[1740],256],64510:[[1740],256],64511:[[1740],256]},
11266564512:{64512:[[1574,1580],256],64513:[[1574,1581],256],64514:[[1574,1605],256],64515:[[1574,1609],256],64516:[[1574,1610],256],64517:[[1576,1580],256],64518:[[1576,1581],256],64519:[[1576,1582],256],64520:[[1576,1605],256],64521:[[1576,1609],256],64522:[[1576,1610],256],64523:[[1578,1580],256],64524:[[1578,1581],256],64525:[[1578,1582],256],64526:[[1578,1605],256],64527:[[1578,1609],256],64528:[[1578,1610],256],64529:[[1579,1580],256],64530:[[1579,1605],256],64531:[[1579,1609],256],64532:[[1579,1610],256],64533:[[1580,1581],256],64534:[[1580,1605],256],64535:[[1581,1580],256],64536:[[1581,1605],256],64537:[[1582,1580],256],64538:[[1582,1581],256],64539:[[1582,1605],256],64540:[[1587,1580],256],64541:[[1587,1581],256],64542:[[1587,1582],256],64543:[[1587,1605],256],64544:[[1589,1581],256],64545:[[1589,1605],256],64546:[[1590,1580],256],64547:[[1590,1581],256],64548:[[1590,1582],256],64549:[[1590,1605],256],64550:[[1591,1581],256],64551:[[1591,1605],256],64552:[[1592,1605],256],64553:[[1593,1580],256],64554:[[1593,1605],256],64555:[[1594,1580],256],64556:[[1594,1605],256],64557:[[1601,1580],256],64558:[[1601,1581],256],64559:[[1601,1582],256],64560:[[1601,1605],256],64561:[[1601,1609],256],64562:[[1601,1610],256],64563:[[1602,1581],256],64564:[[1602,1605],256],64565:[[1602,1609],256],64566:[[1602,1610],256],64567:[[1603,1575],256],64568:[[1603,1580],256],64569:[[1603,1581],256],64570:[[1603,1582],256],64571:[[1603,1604],256],64572:[[1603,1605],256],64573:[[1603,1609],256],64574:[[1603,1610],256],64575:[[1604,1580],256],64576:[[1604,1581],256],64577:[[1604,1582],256],64578:[[1604,1605],256],64579:[[1604,1609],256],64580:[[1604,1610],256],64581:[[1605,1580],256],64582:[[1605,1581],256],64583:[[1605,1582],256],64584:[[1605,1605],256],64585:[[1605,1609],256],64586:[[1605,1610],256],64587:[[1606,1580],256],64588:[[1606,1581],256],64589:[[1606,1582],256],64590:[[1606,1605],256],64591:[[1606,1609],256],64592:[[1606,1610],256],64593:[[1607,1580],256],64594:[[1607,1605],256],64595:[[1607,1609],256],64596:[[1607,1610],256],64597:[[1610,1580],256],64598:[[1610,1581],256],64599:[[1610,1582],256],64600:[[1610,1605],256],64601:[[1610,1609],256],64602:[[1610,1610],256],64603:[[1584,1648],256],64604:[[1585,1648],256],64605:[[1609,1648],256],64606:[[32,1612,1617],256],64607:[[32,1613,1617],256],64608:[[32,1614,1617],256],64609:[[32,1615,1617],256],64610:[[32,1616,1617],256],64611:[[32,1617,1648],256],64612:[[1574,1585],256],64613:[[1574,1586],256],64614:[[1574,1605],256],64615:[[1574,1606],256],64616:[[1574,1609],256],64617:[[1574,1610],256],64618:[[1576,1585],256],64619:[[1576,1586],256],64620:[[1576,1605],256],64621:[[1576,1606],256],64622:[[1576,1609],256],64623:[[1576,1610],256],64624:[[1578,1585],256],64625:[[1578,1586],256],64626:[[1578,1605],256],64627:[[1578,1606],256],64628:[[1578,1609],256],64629:[[1578,1610],256],64630:[[1579,1585],256],64631:[[1579,1586],256],64632:[[1579,1605],256],64633:[[1579,1606],256],64634:[[1579,1609],256],64635:[[1579,1610],256],64636:[[1601,1609],256],64637:[[1601,1610],256],64638:[[1602,1609],256],64639:[[1602,1610],256],64640:[[1603,1575],256],64641:[[1603,1604],256],64642:[[1603,1605],256],64643:[[1603,1609],256],64644:[[1603,1610],256],64645:[[1604,1605],256],64646:[[1604,1609],256],64647:[[1604,1610],256],64648:[[1605,1575],256],64649:[[1605,1605],256],64650:[[1606,1585],256],64651:[[1606,1586],256],64652:[[1606,1605],256],64653:[[1606,1606],256],64654:[[1606,1609],256],64655:[[1606,1610],256],64656:[[1609,1648],256],64657:[[1610,1585],256],64658:[[1610,1586],256],64659:[[1610,1605],256],64660:[[1610,1606],256],64661:[[1610,1609],256],64662:[[1610,1610],256],64663:[[1574,1580],256],64664:[[1574,1581],256],64665:[[1574,1582],256],64666:[[1574,1605],256],64667:[[1574,1607],256],64668:[[1576,1580],256],64669:[[1576,1581],256],64670:[[1576,1582],256],64671:[[1576,1605],256],64672:[[1576,1607],256],64673:[[1578,1580],256],64674:[[1578,1581],256],64675:[[1578,1582],256],64676:[[1578,1605],256],64677:[[1578,1607],256],64678:[[1579,1605],256],64679:[[1580,1581],256],64680:[[1580,1605],256],64681:[[1581,1580],256],64682:[[1581,1605],256],64683:[[1582,1580],256],64684:[[1582,1605],256],64685:[[1587,1580],256],64686:[[1587,1581],256],64687:[[1587,1582],256],64688:[[1587,1605],256],64689:[[1589,1581],256],64690:[[1589,1582],256],64691:[[1589,1605],256],64692:[[1590,1580],256],64693:[[1590,1581],256],64694:[[1590,1582],256],64695:[[1590,1605],256],64696:[[1591,1581],256],64697:[[1592,1605],256],64698:[[1593,1580],256],64699:[[1593,1605],256],64700:[[1594,1580],256],64701:[[1594,1605],256],64702:[[1601,1580],256],64703:[[1601,1581],256],64704:[[1601,1582],256],64705:[[1601,1605],256],64706:[[1602,1581],256],64707:[[1602,1605],256],64708:[[1603,1580],256],64709:[[1603,1581],256],64710:[[1603,1582],256],64711:[[1603,1604],256],64712:[[1603,1605],256],64713:[[1604,1580],256],64714:[[1604,1581],256],64715:[[1604,1582],256],64716:[[1604,1605],256],64717:[[1604,1607],256],64718:[[1605,1580],256],64719:[[1605,1581],256],64720:[[1605,1582],256],64721:[[1605,1605],256],64722:[[1606,1580],256],64723:[[1606,1581],256],64724:[[1606,1582],256],64725:[[1606,1605],256],64726:[[1606,1607],256],64727:[[1607,1580],256],64728:[[1607,1605],256],64729:[[1607,1648],256],64730:[[1610,1580],256],64731:[[1610,1581],256],64732:[[1610,1582],256],64733:[[1610,1605],256],64734:[[1610,1607],256],64735:[[1574,1605],256],64736:[[1574,1607],256],64737:[[1576,1605],256],64738:[[1576,1607],256],64739:[[1578,1605],256],64740:[[1578,1607],256],64741:[[1579,1605],256],64742:[[1579,1607],256],64743:[[1587,1605],256],64744:[[1587,1607],256],64745:[[1588,1605],256],64746:[[1588,1607],256],64747:[[1603,1604],256],64748:[[1603,1605],256],64749:[[1604,1605],256],64750:[[1606,1605],256],64751:[[1606,1607],256],64752:[[1610,1605],256],64753:[[1610,1607],256],64754:[[1600,1614,1617],256],64755:[[1600,1615,1617],256],64756:[[1600,1616,1617],256],64757:[[1591,1609],256],64758:[[1591,1610],256],64759:[[1593,1609],256],64760:[[1593,1610],256],64761:[[1594,1609],256],64762:[[1594,1610],256],64763:[[1587,1609],256],64764:[[1587,1610],256],64765:[[1588,1609],256],64766:[[1588,1610],256],64767:[[1581,1609],256]},
11266664768:{64768:[[1581,1610],256],64769:[[1580,1609],256],64770:[[1580,1610],256],64771:[[1582,1609],256],64772:[[1582,1610],256],64773:[[1589,1609],256],64774:[[1589,1610],256],64775:[[1590,1609],256],64776:[[1590,1610],256],64777:[[1588,1580],256],64778:[[1588,1581],256],64779:[[1588,1582],256],64780:[[1588,1605],256],64781:[[1588,1585],256],64782:[[1587,1585],256],64783:[[1589,1585],256],64784:[[1590,1585],256],64785:[[1591,1609],256],64786:[[1591,1610],256],64787:[[1593,1609],256],64788:[[1593,1610],256],64789:[[1594,1609],256],64790:[[1594,1610],256],64791:[[1587,1609],256],64792:[[1587,1610],256],64793:[[1588,1609],256],64794:[[1588,1610],256],64795:[[1581,1609],256],64796:[[1581,1610],256],64797:[[1580,1609],256],64798:[[1580,1610],256],64799:[[1582,1609],256],64800:[[1582,1610],256],64801:[[1589,1609],256],64802:[[1589,1610],256],64803:[[1590,1609],256],64804:[[1590,1610],256],64805:[[1588,1580],256],64806:[[1588,1581],256],64807:[[1588,1582],256],64808:[[1588,1605],256],64809:[[1588,1585],256],64810:[[1587,1585],256],64811:[[1589,1585],256],64812:[[1590,1585],256],64813:[[1588,1580],256],64814:[[1588,1581],256],64815:[[1588,1582],256],64816:[[1588,1605],256],64817:[[1587,1607],256],64818:[[1588,1607],256],64819:[[1591,1605],256],64820:[[1587,1580],256],64821:[[1587,1581],256],64822:[[1587,1582],256],64823:[[1588,1580],256],64824:[[1588,1581],256],64825:[[1588,1582],256],64826:[[1591,1605],256],64827:[[1592,1605],256],64828:[[1575,1611],256],64829:[[1575,1611],256],64848:[[1578,1580,1605],256],64849:[[1578,1581,1580],256],64850:[[1578,1581,1580],256],64851:[[1578,1581,1605],256],64852:[[1578,1582,1605],256],64853:[[1578,1605,1580],256],64854:[[1578,1605,1581],256],64855:[[1578,1605,1582],256],64856:[[1580,1605,1581],256],64857:[[1580,1605,1581],256],64858:[[1581,1605,1610],256],64859:[[1581,1605,1609],256],64860:[[1587,1581,1580],256],64861:[[1587,1580,1581],256],64862:[[1587,1580,1609],256],64863:[[1587,1605,1581],256],64864:[[1587,1605,1581],256],64865:[[1587,1605,1580],256],64866:[[1587,1605,1605],256],64867:[[1587,1605,1605],256],64868:[[1589,1581,1581],256],64869:[[1589,1581,1581],256],64870:[[1589,1605,1605],256],64871:[[1588,1581,1605],256],64872:[[1588,1581,1605],256],64873:[[1588,1580,1610],256],64874:[[1588,1605,1582],256],64875:[[1588,1605,1582],256],64876:[[1588,1605,1605],256],64877:[[1588,1605,1605],256],64878:[[1590,1581,1609],256],64879:[[1590,1582,1605],256],64880:[[1590,1582,1605],256],64881:[[1591,1605,1581],256],64882:[[1591,1605,1581],256],64883:[[1591,1605,1605],256],64884:[[1591,1605,1610],256],64885:[[1593,1580,1605],256],64886:[[1593,1605,1605],256],64887:[[1593,1605,1605],256],64888:[[1593,1605,1609],256],64889:[[1594,1605,1605],256],64890:[[1594,1605,1610],256],64891:[[1594,1605,1609],256],64892:[[1601,1582,1605],256],64893:[[1601,1582,1605],256],64894:[[1602,1605,1581],256],64895:[[1602,1605,1605],256],64896:[[1604,1581,1605],256],64897:[[1604,1581,1610],256],64898:[[1604,1581,1609],256],64899:[[1604,1580,1580],256],64900:[[1604,1580,1580],256],64901:[[1604,1582,1605],256],64902:[[1604,1582,1605],256],64903:[[1604,1605,1581],256],64904:[[1604,1605,1581],256],64905:[[1605,1581,1580],256],64906:[[1605,1581,1605],256],64907:[[1605,1581,1610],256],64908:[[1605,1580,1581],256],64909:[[1605,1580,1605],256],64910:[[1605,1582,1580],256],64911:[[1605,1582,1605],256],64914:[[1605,1580,1582],256],64915:[[1607,1605,1580],256],64916:[[1607,1605,1605],256],64917:[[1606,1581,1605],256],64918:[[1606,1581,1609],256],64919:[[1606,1580,1605],256],64920:[[1606,1580,1605],256],64921:[[1606,1580,1609],256],64922:[[1606,1605,1610],256],64923:[[1606,1605,1609],256],64924:[[1610,1605,1605],256],64925:[[1610,1605,1605],256],64926:[[1576,1582,1610],256],64927:[[1578,1580,1610],256],64928:[[1578,1580,1609],256],64929:[[1578,1582,1610],256],64930:[[1578,1582,1609],256],64931:[[1578,1605,1610],256],64932:[[1578,1605,1609],256],64933:[[1580,1605,1610],256],64934:[[1580,1581,1609],256],64935:[[1580,1605,1609],256],64936:[[1587,1582,1609],256],64937:[[1589,1581,1610],256],64938:[[1588,1581,1610],256],64939:[[1590,1581,1610],256],64940:[[1604,1580,1610],256],64941:[[1604,1605,1610],256],64942:[[1610,1581,1610],256],64943:[[1610,1580,1610],256],64944:[[1610,1605,1610],256],64945:[[1605,1605,1610],256],64946:[[1602,1605,1610],256],64947:[[1606,1581,1610],256],64948:[[1602,1605,1581],256],64949:[[1604,1581,1605],256],64950:[[1593,1605,1610],256],64951:[[1603,1605,1610],256],64952:[[1606,1580,1581],256],64953:[[1605,1582,1610],256],64954:[[1604,1580,1605],256],64955:[[1603,1605,1605],256],64956:[[1604,1580,1605],256],64957:[[1606,1580,1581],256],64958:[[1580,1581,1610],256],64959:[[1581,1580,1610],256],64960:[[1605,1580,1610],256],64961:[[1601,1605,1610],256],64962:[[1576,1581,1610],256],64963:[[1603,1605,1605],256],64964:[[1593,1580,1605],256],64965:[[1589,1605,1605],256],64966:[[1587,1582,1610],256],64967:[[1606,1580,1610],256],65008:[[1589,1604,1746],256],65009:[[1602,1604,1746],256],65010:[[1575,1604,1604,1607],256],65011:[[1575,1603,1576,1585],256],65012:[[1605,1581,1605,1583],256],65013:[[1589,1604,1593,1605],256],65014:[[1585,1587,1608,1604],256],65015:[[1593,1604,1610,1607],256],65016:[[1608,1587,1604,1605],256],65017:[[1589,1604,1609],256],65018:[[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605],256],65019:[[1580,1604,32,1580,1604,1575,1604,1607],256],65020:[[1585,1740,1575,1604],256]},
11266765024:{65040:[[44],256],65041:[[12289],256],65042:[[12290],256],65043:[[58],256],65044:[[59],256],65045:[[33],256],65046:[[63],256],65047:[[12310],256],65048:[[12311],256],65049:[[8230],256],65056:[,230],65057:[,230],65058:[,230],65059:[,230],65060:[,230],65061:[,230],65062:[,230],65063:[,220],65064:[,220],65065:[,220],65066:[,220],65067:[,220],65068:[,220],65069:[,220],65072:[[8229],256],65073:[[8212],256],65074:[[8211],256],65075:[[95],256],65076:[[95],256],65077:[[40],256],65078:[[41],256],65079:[[123],256],65080:[[125],256],65081:[[12308],256],65082:[[12309],256],65083:[[12304],256],65084:[[12305],256],65085:[[12298],256],65086:[[12299],256],65087:[[12296],256],65088:[[12297],256],65089:[[12300],256],65090:[[12301],256],65091:[[12302],256],65092:[[12303],256],65095:[[91],256],65096:[[93],256],65097:[[8254],256],65098:[[8254],256],65099:[[8254],256],65100:[[8254],256],65101:[[95],256],65102:[[95],256],65103:[[95],256],65104:[[44],256],65105:[[12289],256],65106:[[46],256],65108:[[59],256],65109:[[58],256],65110:[[63],256],65111:[[33],256],65112:[[8212],256],65113:[[40],256],65114:[[41],256],65115:[[123],256],65116:[[125],256],65117:[[12308],256],65118:[[12309],256],65119:[[35],256],65120:[[38],256],65121:[[42],256],65122:[[43],256],65123:[[45],256],65124:[[60],256],65125:[[62],256],65126:[[61],256],65128:[[92],256],65129:[[36],256],65130:[[37],256],65131:[[64],256],65136:[[32,1611],256],65137:[[1600,1611],256],65138:[[32,1612],256],65140:[[32,1613],256],65142:[[32,1614],256],65143:[[1600,1614],256],65144:[[32,1615],256],65145:[[1600,1615],256],65146:[[32,1616],256],65147:[[1600,1616],256],65148:[[32,1617],256],65149:[[1600,1617],256],65150:[[32,1618],256],65151:[[1600,1618],256],65152:[[1569],256],65153:[[1570],256],65154:[[1570],256],65155:[[1571],256],65156:[[1571],256],65157:[[1572],256],65158:[[1572],256],65159:[[1573],256],65160:[[1573],256],65161:[[1574],256],65162:[[1574],256],65163:[[1574],256],65164:[[1574],256],65165:[[1575],256],65166:[[1575],256],65167:[[1576],256],65168:[[1576],256],65169:[[1576],256],65170:[[1576],256],65171:[[1577],256],65172:[[1577],256],65173:[[1578],256],65174:[[1578],256],65175:[[1578],256],65176:[[1578],256],65177:[[1579],256],65178:[[1579],256],65179:[[1579],256],65180:[[1579],256],65181:[[1580],256],65182:[[1580],256],65183:[[1580],256],65184:[[1580],256],65185:[[1581],256],65186:[[1581],256],65187:[[1581],256],65188:[[1581],256],65189:[[1582],256],65190:[[1582],256],65191:[[1582],256],65192:[[1582],256],65193:[[1583],256],65194:[[1583],256],65195:[[1584],256],65196:[[1584],256],65197:[[1585],256],65198:[[1585],256],65199:[[1586],256],65200:[[1586],256],65201:[[1587],256],65202:[[1587],256],65203:[[1587],256],65204:[[1587],256],65205:[[1588],256],65206:[[1588],256],65207:[[1588],256],65208:[[1588],256],65209:[[1589],256],65210:[[1589],256],65211:[[1589],256],65212:[[1589],256],65213:[[1590],256],65214:[[1590],256],65215:[[1590],256],65216:[[1590],256],65217:[[1591],256],65218:[[1591],256],65219:[[1591],256],65220:[[1591],256],65221:[[1592],256],65222:[[1592],256],65223:[[1592],256],65224:[[1592],256],65225:[[1593],256],65226:[[1593],256],65227:[[1593],256],65228:[[1593],256],65229:[[1594],256],65230:[[1594],256],65231:[[1594],256],65232:[[1594],256],65233:[[1601],256],65234:[[1601],256],65235:[[1601],256],65236:[[1601],256],65237:[[1602],256],65238:[[1602],256],65239:[[1602],256],65240:[[1602],256],65241:[[1603],256],65242:[[1603],256],65243:[[1603],256],65244:[[1603],256],65245:[[1604],256],65246:[[1604],256],65247:[[1604],256],65248:[[1604],256],65249:[[1605],256],65250:[[1605],256],65251:[[1605],256],65252:[[1605],256],65253:[[1606],256],65254:[[1606],256],65255:[[1606],256],65256:[[1606],256],65257:[[1607],256],65258:[[1607],256],65259:[[1607],256],65260:[[1607],256],65261:[[1608],256],65262:[[1608],256],65263:[[1609],256],65264:[[1609],256],65265:[[1610],256],65266:[[1610],256],65267:[[1610],256],65268:[[1610],256],65269:[[1604,1570],256],65270:[[1604,1570],256],65271:[[1604,1571],256],65272:[[1604,1571],256],65273:[[1604,1573],256],65274:[[1604,1573],256],65275:[[1604,1575],256],65276:[[1604,1575],256]},
11266865280:{65281:[[33],256],65282:[[34],256],65283:[[35],256],65284:[[36],256],65285:[[37],256],65286:[[38],256],65287:[[39],256],65288:[[40],256],65289:[[41],256],65290:[[42],256],65291:[[43],256],65292:[[44],256],65293:[[45],256],65294:[[46],256],65295:[[47],256],65296:[[48],256],65297:[[49],256],65298:[[50],256],65299:[[51],256],65300:[[52],256],65301:[[53],256],65302:[[54],256],65303:[[55],256],65304:[[56],256],65305:[[57],256],65306:[[58],256],65307:[[59],256],65308:[[60],256],65309:[[61],256],65310:[[62],256],65311:[[63],256],65312:[[64],256],65313:[[65],256],65314:[[66],256],65315:[[67],256],65316:[[68],256],65317:[[69],256],65318:[[70],256],65319:[[71],256],65320:[[72],256],65321:[[73],256],65322:[[74],256],65323:[[75],256],65324:[[76],256],65325:[[77],256],65326:[[78],256],65327:[[79],256],65328:[[80],256],65329:[[81],256],65330:[[82],256],65331:[[83],256],65332:[[84],256],65333:[[85],256],65334:[[86],256],65335:[[87],256],65336:[[88],256],65337:[[89],256],65338:[[90],256],65339:[[91],256],65340:[[92],256],65341:[[93],256],65342:[[94],256],65343:[[95],256],65344:[[96],256],65345:[[97],256],65346:[[98],256],65347:[[99],256],65348:[[100],256],65349:[[101],256],65350:[[102],256],65351:[[103],256],65352:[[104],256],65353:[[105],256],65354:[[106],256],65355:[[107],256],65356:[[108],256],65357:[[109],256],65358:[[110],256],65359:[[111],256],65360:[[112],256],65361:[[113],256],65362:[[114],256],65363:[[115],256],65364:[[116],256],65365:[[117],256],65366:[[118],256],65367:[[119],256],65368:[[120],256],65369:[[121],256],65370:[[122],256],65371:[[123],256],65372:[[124],256],65373:[[125],256],65374:[[126],256],65375:[[10629],256],65376:[[10630],256],65377:[[12290],256],65378:[[12300],256],65379:[[12301],256],65380:[[12289],256],65381:[[12539],256],65382:[[12530],256],65383:[[12449],256],65384:[[12451],256],65385:[[12453],256],65386:[[12455],256],65387:[[12457],256],65388:[[12515],256],65389:[[12517],256],65390:[[12519],256],65391:[[12483],256],65392:[[12540],256],65393:[[12450],256],65394:[[12452],256],65395:[[12454],256],65396:[[12456],256],65397:[[12458],256],65398:[[12459],256],65399:[[12461],256],65400:[[12463],256],65401:[[12465],256],65402:[[12467],256],65403:[[12469],256],65404:[[12471],256],65405:[[12473],256],65406:[[12475],256],65407:[[12477],256],65408:[[12479],256],65409:[[12481],256],65410:[[12484],256],65411:[[12486],256],65412:[[12488],256],65413:[[12490],256],65414:[[12491],256],65415:[[12492],256],65416:[[12493],256],65417:[[12494],256],65418:[[12495],256],65419:[[12498],256],65420:[[12501],256],65421:[[12504],256],65422:[[12507],256],65423:[[12510],256],65424:[[12511],256],65425:[[12512],256],65426:[[12513],256],65427:[[12514],256],65428:[[12516],256],65429:[[12518],256],65430:[[12520],256],65431:[[12521],256],65432:[[12522],256],65433:[[12523],256],65434:[[12524],256],65435:[[12525],256],65436:[[12527],256],65437:[[12531],256],65438:[[12441],256],65439:[[12442],256],65440:[[12644],256],65441:[[12593],256],65442:[[12594],256],65443:[[12595],256],65444:[[12596],256],65445:[[12597],256],65446:[[12598],256],65447:[[12599],256],65448:[[12600],256],65449:[[12601],256],65450:[[12602],256],65451:[[12603],256],65452:[[12604],256],65453:[[12605],256],65454:[[12606],256],65455:[[12607],256],65456:[[12608],256],65457:[[12609],256],65458:[[12610],256],65459:[[12611],256],65460:[[12612],256],65461:[[12613],256],65462:[[12614],256],65463:[[12615],256],65464:[[12616],256],65465:[[12617],256],65466:[[12618],256],65467:[[12619],256],65468:[[12620],256],65469:[[12621],256],65470:[[12622],256],65474:[[12623],256],65475:[[12624],256],65476:[[12625],256],65477:[[12626],256],65478:[[12627],256],65479:[[12628],256],65482:[[12629],256],65483:[[12630],256],65484:[[12631],256],65485:[[12632],256],65486:[[12633],256],65487:[[12634],256],65490:[[12635],256],65491:[[12636],256],65492:[[12637],256],65493:[[12638],256],65494:[[12639],256],65495:[[12640],256],65498:[[12641],256],65499:[[12642],256],65500:[[12643],256],65504:[[162],256],65505:[[163],256],65506:[[172],256],65507:[[175],256],65508:[[166],256],65509:[[165],256],65510:[[8361],256],65512:[[9474],256],65513:[[8592],256],65514:[[8593],256],65515:[[8594],256],65516:[[8595],256],65517:[[9632],256],65518:[[9675],256]}
112669
112670};
112671
112672 /***** Module to export */
112673 var unorm = {
112674 nfc: nfc,
112675 nfd: nfd,
112676 nfkc: nfkc,
112677 nfkd: nfkd
112678 };
112679
112680 /*globals module:true,define:true*/
112681
112682 // CommonJS
112683 if (typeof module === "object") {
112684 module.exports = unorm;
112685
112686 // AMD
112687 } else if (typeof define === "function" && define.amd) {
112688 define("unorm", function () {
112689 return unorm;
112690 });
112691
112692 // Global
112693 } else {
112694 root.unorm = unorm;
112695 }
112696
112697 /***** Export as shim for String::normalize method *****/
112698 /*
112699 http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#november_8_2013_draft_rev_21
112700
112701 21.1.3.12 String.prototype.normalize(form="NFC")
112702 When the normalize method is called with one argument form, the following steps are taken:
112703
112704 1. Let O be CheckObjectCoercible(this value).
112705 2. Let S be ToString(O).
112706 3. ReturnIfAbrupt(S).
112707 4. If form is not provided or undefined let form be "NFC".
112708 5. Let f be ToString(form).
112709 6. ReturnIfAbrupt(f).
112710 7. If f is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw a RangeError Exception.
112711 8. Let ns be the String value is the result of normalizing S into the normalization form named by f as specified in Unicode Standard Annex #15, UnicodeNormalizatoin Forms.
112712 9. Return ns.
112713
112714 The length property of the normalize method is 0.
112715
112716 *NOTE* The normalize function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.
112717 */
112718 unorm.shimApplied = false;
112719
112720 if (!String.prototype.normalize) {
112721 Object.defineProperty(String.prototype, "normalize", {
112722 enumerable: false,
112723 configurable: true,
112724 writable: true,
112725 value: function normalize (/*form*/) {
112726
112727 var str = "" + this;
112728 var form = arguments[0] === undefined ? "NFC" : arguments[0];
112729
112730 if (this === null || this === undefined) {
112731 throw new TypeError("Cannot call method on " + Object.prototype.toString.call(this));
112732 }
112733
112734 if (form === "NFC") {
112735 return unorm.nfc(str);
112736 } else if (form === "NFD") {
112737 return unorm.nfd(str);
112738 } else if (form === "NFKC") {
112739 return unorm.nfkc(str);
112740 } else if (form === "NFKD") {
112741 return unorm.nfkd(str);
112742 } else {
112743 throw new RangeError("Invalid normalization form: " + form);
112744 }
112745 }
112746 });
112747
112748 unorm.shimApplied = true;
112749 }
112750}(this));
112751
112752},{}],819:[function(require,module,exports){
112753// Copyright Joyent, Inc. and other Node contributors.
112754//
112755// Permission is hereby granted, free of charge, to any person obtaining a
112756// copy of this software and associated documentation files (the
112757// "Software"), to deal in the Software without restriction, including
112758// without limitation the rights to use, copy, modify, merge, publish,
112759// distribute, sublicense, and/or sell copies of the Software, and to permit
112760// persons to whom the Software is furnished to do so, subject to the
112761// following conditions:
112762//
112763// The above copyright notice and this permission notice shall be included
112764// in all copies or substantial portions of the Software.
112765//
112766// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
112767// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
112768// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
112769// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
112770// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
112771// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
112772// USE OR OTHER DEALINGS IN THE SOFTWARE.
112773
112774'use strict';
112775
112776var punycode = require('punycode');
112777var util = require('./util');
112778
112779exports.parse = urlParse;
112780exports.resolve = urlResolve;
112781exports.resolveObject = urlResolveObject;
112782exports.format = urlFormat;
112783
112784exports.Url = Url;
112785
112786function Url() {
112787 this.protocol = null;
112788 this.slashes = null;
112789 this.auth = null;
112790 this.host = null;
112791 this.port = null;
112792 this.hostname = null;
112793 this.hash = null;
112794 this.search = null;
112795 this.query = null;
112796 this.pathname = null;
112797 this.path = null;
112798 this.href = null;
112799}
112800
112801// Reference: RFC 3986, RFC 1808, RFC 2396
112802
112803// define these here so at least they only have to be
112804// compiled once on the first module load.
112805var protocolPattern = /^([a-z0-9.+-]+:)/i,
112806 portPattern = /:[0-9]*$/,
112807
112808 // Special case for a simple path URL
112809 simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
112810
112811 // RFC 2396: characters reserved for delimiting URLs.
112812 // We actually just auto-escape these.
112813 delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
112814
112815 // RFC 2396: characters not allowed for various reasons.
112816 unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
112817
112818 // Allowed by RFCs, but cause of XSS attacks. Always escape these.
112819 autoEscape = ['\''].concat(unwise),
112820 // Characters that are never ever allowed in a hostname.
112821 // Note that any invalid chars are also handled, but these
112822 // are the ones that are *expected* to be seen, so we fast-path
112823 // them.
112824 nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
112825 hostEndingChars = ['/', '?', '#'],
112826 hostnameMaxLen = 255,
112827 hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
112828 hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
112829 // protocols that can allow "unsafe" and "unwise" chars.
112830 unsafeProtocol = {
112831 'javascript': true,
112832 'javascript:': true
112833 },
112834 // protocols that never have a hostname.
112835 hostlessProtocol = {
112836 'javascript': true,
112837 'javascript:': true
112838 },
112839 // protocols that always contain a // bit.
112840 slashedProtocol = {
112841 'http': true,
112842 'https': true,
112843 'ftp': true,
112844 'gopher': true,
112845 'file': true,
112846 'http:': true,
112847 'https:': true,
112848 'ftp:': true,
112849 'gopher:': true,
112850 'file:': true
112851 },
112852 querystring = require('querystring');
112853
112854function urlParse(url, parseQueryString, slashesDenoteHost) {
112855 if (url && util.isObject(url) && url instanceof Url) return url;
112856
112857 var u = new Url;
112858 u.parse(url, parseQueryString, slashesDenoteHost);
112859 return u;
112860}
112861
112862Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
112863 if (!util.isString(url)) {
112864 throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
112865 }
112866
112867 // Copy chrome, IE, opera backslash-handling behavior.
112868 // Back slashes before the query string get converted to forward slashes
112869 // See: https://code.google.com/p/chromium/issues/detail?id=25916
112870 var queryIndex = url.indexOf('?'),
112871 splitter =
112872 (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
112873 uSplit = url.split(splitter),
112874 slashRegex = /\\/g;
112875 uSplit[0] = uSplit[0].replace(slashRegex, '/');
112876 url = uSplit.join(splitter);
112877
112878 var rest = url;
112879
112880 // trim before proceeding.
112881 // This is to support parse stuff like " http://foo.com \n"
112882 rest = rest.trim();
112883
112884 if (!slashesDenoteHost && url.split('#').length === 1) {
112885 // Try fast path regexp
112886 var simplePath = simplePathPattern.exec(rest);
112887 if (simplePath) {
112888 this.path = rest;
112889 this.href = rest;
112890 this.pathname = simplePath[1];
112891 if (simplePath[2]) {
112892 this.search = simplePath[2];
112893 if (parseQueryString) {
112894 this.query = querystring.parse(this.search.substr(1));
112895 } else {
112896 this.query = this.search.substr(1);
112897 }
112898 } else if (parseQueryString) {
112899 this.search = '';
112900 this.query = {};
112901 }
112902 return this;
112903 }
112904 }
112905
112906 var proto = protocolPattern.exec(rest);
112907 if (proto) {
112908 proto = proto[0];
112909 var lowerProto = proto.toLowerCase();
112910 this.protocol = lowerProto;
112911 rest = rest.substr(proto.length);
112912 }
112913
112914 // figure out if it's got a host
112915 // user@server is *always* interpreted as a hostname, and url
112916 // resolution will treat //foo/bar as host=foo,path=bar because that's
112917 // how the browser resolves relative URLs.
112918 if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
112919 var slashes = rest.substr(0, 2) === '//';
112920 if (slashes && !(proto && hostlessProtocol[proto])) {
112921 rest = rest.substr(2);
112922 this.slashes = true;
112923 }
112924 }
112925
112926 if (!hostlessProtocol[proto] &&
112927 (slashes || (proto && !slashedProtocol[proto]))) {
112928
112929 // there's a hostname.
112930 // the first instance of /, ?, ;, or # ends the host.
112931 //
112932 // If there is an @ in the hostname, then non-host chars *are* allowed
112933 // to the left of the last @ sign, unless some host-ending character
112934 // comes *before* the @-sign.
112935 // URLs are obnoxious.
112936 //
112937 // ex:
112938 // http://a@b@c/ => user:a@b host:c
112939 // http://a@b?@c => user:a host:c path:/?@c
112940
112941 // v0.12 TODO(isaacs): This is not quite how Chrome does things.
112942 // Review our test case against browsers more comprehensively.
112943
112944 // find the first instance of any hostEndingChars
112945 var hostEnd = -1;
112946 for (var i = 0; i < hostEndingChars.length; i++) {
112947 var hec = rest.indexOf(hostEndingChars[i]);
112948 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
112949 hostEnd = hec;
112950 }
112951
112952 // at this point, either we have an explicit point where the
112953 // auth portion cannot go past, or the last @ char is the decider.
112954 var auth, atSign;
112955 if (hostEnd === -1) {
112956 // atSign can be anywhere.
112957 atSign = rest.lastIndexOf('@');
112958 } else {
112959 // atSign must be in auth portion.
112960 // http://a@b/c@d => host:b auth:a path:/c@d
112961 atSign = rest.lastIndexOf('@', hostEnd);
112962 }
112963
112964 // Now we have a portion which is definitely the auth.
112965 // Pull that off.
112966 if (atSign !== -1) {
112967 auth = rest.slice(0, atSign);
112968 rest = rest.slice(atSign + 1);
112969 this.auth = decodeURIComponent(auth);
112970 }
112971
112972 // the host is the remaining to the left of the first non-host char
112973 hostEnd = -1;
112974 for (var i = 0; i < nonHostChars.length; i++) {
112975 var hec = rest.indexOf(nonHostChars[i]);
112976 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
112977 hostEnd = hec;
112978 }
112979 // if we still have not hit it, then the entire thing is a host.
112980 if (hostEnd === -1)
112981 hostEnd = rest.length;
112982
112983 this.host = rest.slice(0, hostEnd);
112984 rest = rest.slice(hostEnd);
112985
112986 // pull out port.
112987 this.parseHost();
112988
112989 // we've indicated that there is a hostname,
112990 // so even if it's empty, it has to be present.
112991 this.hostname = this.hostname || '';
112992
112993 // if hostname begins with [ and ends with ]
112994 // assume that it's an IPv6 address.
112995 var ipv6Hostname = this.hostname[0] === '[' &&
112996 this.hostname[this.hostname.length - 1] === ']';
112997
112998 // validate a little.
112999 if (!ipv6Hostname) {
113000 var hostparts = this.hostname.split(/\./);
113001 for (var i = 0, l = hostparts.length; i < l; i++) {
113002 var part = hostparts[i];
113003 if (!part) continue;
113004 if (!part.match(hostnamePartPattern)) {
113005 var newpart = '';
113006 for (var j = 0, k = part.length; j < k; j++) {
113007 if (part.charCodeAt(j) > 127) {
113008 // we replace non-ASCII char with a temporary placeholder
113009 // we need this to make sure size of hostname is not
113010 // broken by replacing non-ASCII by nothing
113011 newpart += 'x';
113012 } else {
113013 newpart += part[j];
113014 }
113015 }
113016 // we test again with ASCII char only
113017 if (!newpart.match(hostnamePartPattern)) {
113018 var validParts = hostparts.slice(0, i);
113019 var notHost = hostparts.slice(i + 1);
113020 var bit = part.match(hostnamePartStart);
113021 if (bit) {
113022 validParts.push(bit[1]);
113023 notHost.unshift(bit[2]);
113024 }
113025 if (notHost.length) {
113026 rest = '/' + notHost.join('.') + rest;
113027 }
113028 this.hostname = validParts.join('.');
113029 break;
113030 }
113031 }
113032 }
113033 }
113034
113035 if (this.hostname.length > hostnameMaxLen) {
113036 this.hostname = '';
113037 } else {
113038 // hostnames are always lower case.
113039 this.hostname = this.hostname.toLowerCase();
113040 }
113041
113042 if (!ipv6Hostname) {
113043 // IDNA Support: Returns a punycoded representation of "domain".
113044 // It only converts parts of the domain name that
113045 // have non-ASCII characters, i.e. it doesn't matter if
113046 // you call it with a domain that already is ASCII-only.
113047 this.hostname = punycode.toASCII(this.hostname);
113048 }
113049
113050 var p = this.port ? ':' + this.port : '';
113051 var h = this.hostname || '';
113052 this.host = h + p;
113053 this.href += this.host;
113054
113055 // strip [ and ] from the hostname
113056 // the host field still retains them, though
113057 if (ipv6Hostname) {
113058 this.hostname = this.hostname.substr(1, this.hostname.length - 2);
113059 if (rest[0] !== '/') {
113060 rest = '/' + rest;
113061 }
113062 }
113063 }
113064
113065 // now rest is set to the post-host stuff.
113066 // chop off any delim chars.
113067 if (!unsafeProtocol[lowerProto]) {
113068
113069 // First, make 100% sure that any "autoEscape" chars get
113070 // escaped, even if encodeURIComponent doesn't think they
113071 // need to be.
113072 for (var i = 0, l = autoEscape.length; i < l; i++) {
113073 var ae = autoEscape[i];
113074 if (rest.indexOf(ae) === -1)
113075 continue;
113076 var esc = encodeURIComponent(ae);
113077 if (esc === ae) {
113078 esc = escape(ae);
113079 }
113080 rest = rest.split(ae).join(esc);
113081 }
113082 }
113083
113084
113085 // chop off from the tail first.
113086 var hash = rest.indexOf('#');
113087 if (hash !== -1) {
113088 // got a fragment string.
113089 this.hash = rest.substr(hash);
113090 rest = rest.slice(0, hash);
113091 }
113092 var qm = rest.indexOf('?');
113093 if (qm !== -1) {
113094 this.search = rest.substr(qm);
113095 this.query = rest.substr(qm + 1);
113096 if (parseQueryString) {
113097 this.query = querystring.parse(this.query);
113098 }
113099 rest = rest.slice(0, qm);
113100 } else if (parseQueryString) {
113101 // no query string, but parseQueryString still requested
113102 this.search = '';
113103 this.query = {};
113104 }
113105 if (rest) this.pathname = rest;
113106 if (slashedProtocol[lowerProto] &&
113107 this.hostname && !this.pathname) {
113108 this.pathname = '/';
113109 }
113110
113111 //to support http.request
113112 if (this.pathname || this.search) {
113113 var p = this.pathname || '';
113114 var s = this.search || '';
113115 this.path = p + s;
113116 }
113117
113118 // finally, reconstruct the href based on what has been validated.
113119 this.href = this.format();
113120 return this;
113121};
113122
113123// format a parsed object into a url string
113124function urlFormat(obj) {
113125 // ensure it's an object, and not a string url.
113126 // If it's an obj, this is a no-op.
113127 // this way, you can call url_format() on strings
113128 // to clean up potentially wonky urls.
113129 if (util.isString(obj)) obj = urlParse(obj);
113130 if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
113131 return obj.format();
113132}
113133
113134Url.prototype.format = function() {
113135 var auth = this.auth || '';
113136 if (auth) {
113137 auth = encodeURIComponent(auth);
113138 auth = auth.replace(/%3A/i, ':');
113139 auth += '@';
113140 }
113141
113142 var protocol = this.protocol || '',
113143 pathname = this.pathname || '',
113144 hash = this.hash || '',
113145 host = false,
113146 query = '';
113147
113148 if (this.host) {
113149 host = auth + this.host;
113150 } else if (this.hostname) {
113151 host = auth + (this.hostname.indexOf(':') === -1 ?
113152 this.hostname :
113153 '[' + this.hostname + ']');
113154 if (this.port) {
113155 host += ':' + this.port;
113156 }
113157 }
113158
113159 if (this.query &&
113160 util.isObject(this.query) &&
113161 Object.keys(this.query).length) {
113162 query = querystring.stringify(this.query);
113163 }
113164
113165 var search = this.search || (query && ('?' + query)) || '';
113166
113167 if (protocol && protocol.substr(-1) !== ':') protocol += ':';
113168
113169 // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
113170 // unless they had them to begin with.
113171 if (this.slashes ||
113172 (!protocol || slashedProtocol[protocol]) && host !== false) {
113173 host = '//' + (host || '');
113174 if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
113175 } else if (!host) {
113176 host = '';
113177 }
113178
113179 if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
113180 if (search && search.charAt(0) !== '?') search = '?' + search;
113181
113182 pathname = pathname.replace(/[?#]/g, function(match) {
113183 return encodeURIComponent(match);
113184 });
113185 search = search.replace('#', '%23');
113186
113187 return protocol + host + pathname + search + hash;
113188};
113189
113190function urlResolve(source, relative) {
113191 return urlParse(source, false, true).resolve(relative);
113192}
113193
113194Url.prototype.resolve = function(relative) {
113195 return this.resolveObject(urlParse(relative, false, true)).format();
113196};
113197
113198function urlResolveObject(source, relative) {
113199 if (!source) return relative;
113200 return urlParse(source, false, true).resolveObject(relative);
113201}
113202
113203Url.prototype.resolveObject = function(relative) {
113204 if (util.isString(relative)) {
113205 var rel = new Url();
113206 rel.parse(relative, false, true);
113207 relative = rel;
113208 }
113209
113210 var result = new Url();
113211 var tkeys = Object.keys(this);
113212 for (var tk = 0; tk < tkeys.length; tk++) {
113213 var tkey = tkeys[tk];
113214 result[tkey] = this[tkey];
113215 }
113216
113217 // hash is always overridden, no matter what.
113218 // even href="" will remove it.
113219 result.hash = relative.hash;
113220
113221 // if the relative url is empty, then there's nothing left to do here.
113222 if (relative.href === '') {
113223 result.href = result.format();
113224 return result;
113225 }
113226
113227 // hrefs like //foo/bar always cut to the protocol.
113228 if (relative.slashes && !relative.protocol) {
113229 // take everything except the protocol from relative
113230 var rkeys = Object.keys(relative);
113231 for (var rk = 0; rk < rkeys.length; rk++) {
113232 var rkey = rkeys[rk];
113233 if (rkey !== 'protocol')
113234 result[rkey] = relative[rkey];
113235 }
113236
113237 //urlParse appends trailing / to urls like http://www.example.com
113238 if (slashedProtocol[result.protocol] &&
113239 result.hostname && !result.pathname) {
113240 result.path = result.pathname = '/';
113241 }
113242
113243 result.href = result.format();
113244 return result;
113245 }
113246
113247 if (relative.protocol && relative.protocol !== result.protocol) {
113248 // if it's a known url protocol, then changing
113249 // the protocol does weird things
113250 // first, if it's not file:, then we MUST have a host,
113251 // and if there was a path
113252 // to begin with, then we MUST have a path.
113253 // if it is file:, then the host is dropped,
113254 // because that's known to be hostless.
113255 // anything else is assumed to be absolute.
113256 if (!slashedProtocol[relative.protocol]) {
113257 var keys = Object.keys(relative);
113258 for (var v = 0; v < keys.length; v++) {
113259 var k = keys[v];
113260 result[k] = relative[k];
113261 }
113262 result.href = result.format();
113263 return result;
113264 }
113265
113266 result.protocol = relative.protocol;
113267 if (!relative.host && !hostlessProtocol[relative.protocol]) {
113268 var relPath = (relative.pathname || '').split('/');
113269 while (relPath.length && !(relative.host = relPath.shift()));
113270 if (!relative.host) relative.host = '';
113271 if (!relative.hostname) relative.hostname = '';
113272 if (relPath[0] !== '') relPath.unshift('');
113273 if (relPath.length < 2) relPath.unshift('');
113274 result.pathname = relPath.join('/');
113275 } else {
113276 result.pathname = relative.pathname;
113277 }
113278 result.search = relative.search;
113279 result.query = relative.query;
113280 result.host = relative.host || '';
113281 result.auth = relative.auth;
113282 result.hostname = relative.hostname || relative.host;
113283 result.port = relative.port;
113284 // to support http.request
113285 if (result.pathname || result.search) {
113286 var p = result.pathname || '';
113287 var s = result.search || '';
113288 result.path = p + s;
113289 }
113290 result.slashes = result.slashes || relative.slashes;
113291 result.href = result.format();
113292 return result;
113293 }
113294
113295 var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
113296 isRelAbs = (
113297 relative.host ||
113298 relative.pathname && relative.pathname.charAt(0) === '/'
113299 ),
113300 mustEndAbs = (isRelAbs || isSourceAbs ||
113301 (result.host && relative.pathname)),
113302 removeAllDots = mustEndAbs,
113303 srcPath = result.pathname && result.pathname.split('/') || [],
113304 relPath = relative.pathname && relative.pathname.split('/') || [],
113305 psychotic = result.protocol && !slashedProtocol[result.protocol];
113306
113307 // if the url is a non-slashed url, then relative
113308 // links like ../.. should be able
113309 // to crawl up to the hostname, as well. This is strange.
113310 // result.protocol has already been set by now.
113311 // Later on, put the first path part into the host field.
113312 if (psychotic) {
113313 result.hostname = '';
113314 result.port = null;
113315 if (result.host) {
113316 if (srcPath[0] === '') srcPath[0] = result.host;
113317 else srcPath.unshift(result.host);
113318 }
113319 result.host = '';
113320 if (relative.protocol) {
113321 relative.hostname = null;
113322 relative.port = null;
113323 if (relative.host) {
113324 if (relPath[0] === '') relPath[0] = relative.host;
113325 else relPath.unshift(relative.host);
113326 }
113327 relative.host = null;
113328 }
113329 mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
113330 }
113331
113332 if (isRelAbs) {
113333 // it's absolute.
113334 result.host = (relative.host || relative.host === '') ?
113335 relative.host : result.host;
113336 result.hostname = (relative.hostname || relative.hostname === '') ?
113337 relative.hostname : result.hostname;
113338 result.search = relative.search;
113339 result.query = relative.query;
113340 srcPath = relPath;
113341 // fall through to the dot-handling below.
113342 } else if (relPath.length) {
113343 // it's relative
113344 // throw away the existing file, and take the new path instead.
113345 if (!srcPath) srcPath = [];
113346 srcPath.pop();
113347 srcPath = srcPath.concat(relPath);
113348 result.search = relative.search;
113349 result.query = relative.query;
113350 } else if (!util.isNullOrUndefined(relative.search)) {
113351 // just pull out the search.
113352 // like href='?foo'.
113353 // Put this after the other two cases because it simplifies the booleans
113354 if (psychotic) {
113355 result.hostname = result.host = srcPath.shift();
113356 //occationaly the auth can get stuck only in host
113357 //this especially happens in cases like
113358 //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
113359 var authInHost = result.host && result.host.indexOf('@') > 0 ?
113360 result.host.split('@') : false;
113361 if (authInHost) {
113362 result.auth = authInHost.shift();
113363 result.host = result.hostname = authInHost.shift();
113364 }
113365 }
113366 result.search = relative.search;
113367 result.query = relative.query;
113368 //to support http.request
113369 if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
113370 result.path = (result.pathname ? result.pathname : '') +
113371 (result.search ? result.search : '');
113372 }
113373 result.href = result.format();
113374 return result;
113375 }
113376
113377 if (!srcPath.length) {
113378 // no path at all. easy.
113379 // we've already handled the other stuff above.
113380 result.pathname = null;
113381 //to support http.request
113382 if (result.search) {
113383 result.path = '/' + result.search;
113384 } else {
113385 result.path = null;
113386 }
113387 result.href = result.format();
113388 return result;
113389 }
113390
113391 // if a url ENDs in . or .., then it must get a trailing slash.
113392 // however, if it ends in anything else non-slashy,
113393 // then it must NOT get a trailing slash.
113394 var last = srcPath.slice(-1)[0];
113395 var hasTrailingSlash = (
113396 (result.host || relative.host || srcPath.length > 1) &&
113397 (last === '.' || last === '..') || last === '');
113398
113399 // strip single dots, resolve double dots to parent dir
113400 // if the path tries to go above the root, `up` ends up > 0
113401 var up = 0;
113402 for (var i = srcPath.length; i >= 0; i--) {
113403 last = srcPath[i];
113404 if (last === '.') {
113405 srcPath.splice(i, 1);
113406 } else if (last === '..') {
113407 srcPath.splice(i, 1);
113408 up++;
113409 } else if (up) {
113410 srcPath.splice(i, 1);
113411 up--;
113412 }
113413 }
113414
113415 // if the path is allowed to go above the root, restore leading ..s
113416 if (!mustEndAbs && !removeAllDots) {
113417 for (; up--; up) {
113418 srcPath.unshift('..');
113419 }
113420 }
113421
113422 if (mustEndAbs && srcPath[0] !== '' &&
113423 (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
113424 srcPath.unshift('');
113425 }
113426
113427 if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
113428 srcPath.push('');
113429 }
113430
113431 var isAbsolute = srcPath[0] === '' ||
113432 (srcPath[0] && srcPath[0].charAt(0) === '/');
113433
113434 // put the host back
113435 if (psychotic) {
113436 result.hostname = result.host = isAbsolute ? '' :
113437 srcPath.length ? srcPath.shift() : '';
113438 //occationaly the auth can get stuck only in host
113439 //this especially happens in cases like
113440 //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
113441 var authInHost = result.host && result.host.indexOf('@') > 0 ?
113442 result.host.split('@') : false;
113443 if (authInHost) {
113444 result.auth = authInHost.shift();
113445 result.host = result.hostname = authInHost.shift();
113446 }
113447 }
113448
113449 mustEndAbs = mustEndAbs || (result.host && srcPath.length);
113450
113451 if (mustEndAbs && !isAbsolute) {
113452 srcPath.unshift('');
113453 }
113454
113455 if (!srcPath.length) {
113456 result.pathname = null;
113457 result.path = null;
113458 } else {
113459 result.pathname = srcPath.join('/');
113460 }
113461
113462 //to support request.http
113463 if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
113464 result.path = (result.pathname ? result.pathname : '') +
113465 (result.search ? result.search : '');
113466 }
113467 result.auth = relative.auth || result.auth;
113468 result.slashes = result.slashes || relative.slashes;
113469 result.href = result.format();
113470 return result;
113471};
113472
113473Url.prototype.parseHost = function() {
113474 var host = this.host;
113475 var port = portPattern.exec(host);
113476 if (port) {
113477 port = port[0];
113478 if (port !== ':') {
113479 this.port = port.substr(1);
113480 }
113481 host = host.substr(0, host.length - port.length);
113482 }
113483 if (host) this.hostname = host;
113484};
113485
113486},{"./util":820,"punycode":719,"querystring":723}],820:[function(require,module,exports){
113487'use strict';
113488
113489module.exports = {
113490 isString: function(arg) {
113491 return typeof(arg) === 'string';
113492 },
113493 isObject: function(arg) {
113494 return typeof(arg) === 'object' && arg !== null;
113495 },
113496 isNull: function(arg) {
113497 return arg === null;
113498 },
113499 isNullOrUndefined: function(arg) {
113500 return arg == null;
113501 }
113502};
113503
113504},{}],821:[function(require,module,exports){
113505(function (global){
113506
113507/**
113508 * Module exports.
113509 */
113510
113511module.exports = deprecate;
113512
113513/**
113514 * Mark that a method should not be used.
113515 * Returns a modified function which warns once by default.
113516 *
113517 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
113518 *
113519 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
113520 * will throw an Error when invoked.
113521 *
113522 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
113523 * will invoke `console.trace()` instead of `console.error()`.
113524 *
113525 * @param {Function} fn - the function to deprecate
113526 * @param {String} msg - the string to print to the console when `fn` is invoked
113527 * @returns {Function} a new "deprecated" version of `fn`
113528 * @api public
113529 */
113530
113531function deprecate (fn, msg) {
113532 if (config('noDeprecation')) {
113533 return fn;
113534 }
113535
113536 var warned = false;
113537 function deprecated() {
113538 if (!warned) {
113539 if (config('throwDeprecation')) {
113540 throw new Error(msg);
113541 } else if (config('traceDeprecation')) {
113542 console.trace(msg);
113543 } else {
113544 console.warn(msg);
113545 }
113546 warned = true;
113547 }
113548 return fn.apply(this, arguments);
113549 }
113550
113551 return deprecated;
113552}
113553
113554/**
113555 * Checks `localStorage` for boolean values for the given `name`.
113556 *
113557 * @param {String} name
113558 * @returns {Boolean}
113559 * @api private
113560 */
113561
113562function config (name) {
113563 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
113564 try {
113565 if (!global.localStorage) return false;
113566 } catch (_) {
113567 return false;
113568 }
113569 var val = global.localStorage[name];
113570 if (null == val) return false;
113571 return String(val).toLowerCase() === 'true';
113572}
113573
113574}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
113575},{}],822:[function(require,module,exports){
113576arguments[4][27][0].apply(exports,arguments)
113577},{"dup":27}],823:[function(require,module,exports){
113578arguments[4][28][0].apply(exports,arguments)
113579},{"dup":28}],824:[function(require,module,exports){
113580arguments[4][29][0].apply(exports,arguments)
113581},{"./support/isBuffer":823,"_process":678,"dup":29,"inherits":822}],825:[function(require,module,exports){
113582var v1 = require('./v1');
113583var v4 = require('./v4');
113584
113585var uuid = v4;
113586uuid.v1 = v1;
113587uuid.v4 = v4;
113588
113589module.exports = uuid;
113590
113591},{"./v1":828,"./v4":829}],826:[function(require,module,exports){
113592/**
113593 * Convert array of 16 byte values to UUID string format of the form:
113594 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
113595 */
113596var byteToHex = [];
113597for (var i = 0; i < 256; ++i) {
113598 byteToHex[i] = (i + 0x100).toString(16).substr(1);
113599}
113600
113601function bytesToUuid(buf, offset) {
113602 var i = offset || 0;
113603 var bth = byteToHex;
113604 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
113605 return ([bth[buf[i++]], bth[buf[i++]],
113606 bth[buf[i++]], bth[buf[i++]], '-',
113607 bth[buf[i++]], bth[buf[i++]], '-',
113608 bth[buf[i++]], bth[buf[i++]], '-',
113609 bth[buf[i++]], bth[buf[i++]], '-',
113610 bth[buf[i++]], bth[buf[i++]],
113611 bth[buf[i++]], bth[buf[i++]],
113612 bth[buf[i++]], bth[buf[i++]]]).join('');
113613}
113614
113615module.exports = bytesToUuid;
113616
113617},{}],827:[function(require,module,exports){
113618// Unique ID creation requires a high quality random # generator. In the
113619// browser this is a little complicated due to unknown quality of Math.random()
113620// and inconsistent support for the `crypto` API. We do the best we can via
113621// feature-detection
113622
113623// getRandomValues needs to be invoked in a context where "this" is a Crypto
113624// implementation. Also, find the complete implementation of crypto on IE11.
113625var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
113626 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
113627
113628if (getRandomValues) {
113629 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
113630 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
113631
113632 module.exports = function whatwgRNG() {
113633 getRandomValues(rnds8);
113634 return rnds8;
113635 };
113636} else {
113637 // Math.random()-based (RNG)
113638 //
113639 // If all else fails, use Math.random(). It's fast, but is of unspecified
113640 // quality.
113641 var rnds = new Array(16);
113642
113643 module.exports = function mathRNG() {
113644 for (var i = 0, r; i < 16; i++) {
113645 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
113646 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
113647 }
113648
113649 return rnds;
113650 };
113651}
113652
113653},{}],828:[function(require,module,exports){
113654var rng = require('./lib/rng');
113655var bytesToUuid = require('./lib/bytesToUuid');
113656
113657// **`v1()` - Generate time-based UUID**
113658//
113659// Inspired by https://github.com/LiosK/UUID.js
113660// and http://docs.python.org/library/uuid.html
113661
113662var _nodeId;
113663var _clockseq;
113664
113665// Previous uuid creation time
113666var _lastMSecs = 0;
113667var _lastNSecs = 0;
113668
113669// See https://github.com/broofa/node-uuid for API details
113670function v1(options, buf, offset) {
113671 var i = buf && offset || 0;
113672 var b = buf || [];
113673
113674 options = options || {};
113675 var node = options.node || _nodeId;
113676 var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
113677
113678 // node and clockseq need to be initialized to random values if they're not
113679 // specified. We do this lazily to minimize issues related to insufficient
113680 // system entropy. See #189
113681 if (node == null || clockseq == null) {
113682 var seedBytes = rng();
113683 if (node == null) {
113684 // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
113685 node = _nodeId = [
113686 seedBytes[0] | 0x01,
113687 seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
113688 ];
113689 }
113690 if (clockseq == null) {
113691 // Per 4.2.2, randomize (14 bit) clockseq
113692 clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
113693 }
113694 }
113695
113696 // UUID timestamps are 100 nano-second units since the Gregorian epoch,
113697 // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
113698 // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
113699 // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
113700 var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
113701
113702 // Per 4.2.1.2, use count of uuid's generated during the current clock
113703 // cycle to simulate higher resolution clock
113704 var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
113705
113706 // Time since last uuid creation (in msecs)
113707 var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
113708
113709 // Per 4.2.1.2, Bump clockseq on clock regression
113710 if (dt < 0 && options.clockseq === undefined) {
113711 clockseq = clockseq + 1 & 0x3fff;
113712 }
113713
113714 // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
113715 // time interval
113716 if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
113717 nsecs = 0;
113718 }
113719
113720 // Per 4.2.1.2 Throw error if too many uuids are requested
113721 if (nsecs >= 10000) {
113722 throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
113723 }
113724
113725 _lastMSecs = msecs;
113726 _lastNSecs = nsecs;
113727 _clockseq = clockseq;
113728
113729 // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
113730 msecs += 12219292800000;
113731
113732 // `time_low`
113733 var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
113734 b[i++] = tl >>> 24 & 0xff;
113735 b[i++] = tl >>> 16 & 0xff;
113736 b[i++] = tl >>> 8 & 0xff;
113737 b[i++] = tl & 0xff;
113738
113739 // `time_mid`
113740 var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
113741 b[i++] = tmh >>> 8 & 0xff;
113742 b[i++] = tmh & 0xff;
113743
113744 // `time_high_and_version`
113745 b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
113746 b[i++] = tmh >>> 16 & 0xff;
113747
113748 // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
113749 b[i++] = clockseq >>> 8 | 0x80;
113750
113751 // `clock_seq_low`
113752 b[i++] = clockseq & 0xff;
113753
113754 // `node`
113755 for (var n = 0; n < 6; ++n) {
113756 b[i + n] = node[n];
113757 }
113758
113759 return buf ? buf : bytesToUuid(b);
113760}
113761
113762module.exports = v1;
113763
113764},{"./lib/bytesToUuid":826,"./lib/rng":827}],829:[function(require,module,exports){
113765var rng = require('./lib/rng');
113766var bytesToUuid = require('./lib/bytesToUuid');
113767
113768function v4(options, buf, offset) {
113769 var i = buf && offset || 0;
113770
113771 if (typeof(options) == 'string') {
113772 buf = options === 'binary' ? new Array(16) : null;
113773 options = null;
113774 }
113775 options = options || {};
113776
113777 var rnds = options.random || (options.rng || rng)();
113778
113779 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
113780 rnds[6] = (rnds[6] & 0x0f) | 0x40;
113781 rnds[8] = (rnds[8] & 0x3f) | 0x80;
113782
113783 // Copy bytes to buffer, if provided
113784 if (buf) {
113785 for (var ii = 0; ii < 16; ++ii) {
113786 buf[i + ii] = rnds[ii];
113787 }
113788 }
113789
113790 return buf || bytesToUuid(rnds);
113791}
113792
113793module.exports = v4;
113794
113795},{"./lib/bytesToUuid":826,"./lib/rng":827}],830:[function(require,module,exports){
113796'use strict'
113797var Buffer = require('safe-buffer').Buffer
113798
113799// Number.MAX_SAFE_INTEGER
113800var MAX_SAFE_INTEGER = 9007199254740991
113801
113802function checkUInt53 (n) {
113803 if (n < 0 || n > MAX_SAFE_INTEGER || n % 1 !== 0) throw new RangeError('value out of range')
113804}
113805
113806function encode (number, buffer, offset) {
113807 checkUInt53(number)
113808
113809 if (!buffer) buffer = Buffer.allocUnsafe(encodingLength(number))
113810 if (!Buffer.isBuffer(buffer)) throw new TypeError('buffer must be a Buffer instance')
113811 if (!offset) offset = 0
113812
113813 // 8 bit
113814 if (number < 0xfd) {
113815 buffer.writeUInt8(number, offset)
113816 encode.bytes = 1
113817
113818 // 16 bit
113819 } else if (number <= 0xffff) {
113820 buffer.writeUInt8(0xfd, offset)
113821 buffer.writeUInt16LE(number, offset + 1)
113822 encode.bytes = 3
113823
113824 // 32 bit
113825 } else if (number <= 0xffffffff) {
113826 buffer.writeUInt8(0xfe, offset)
113827 buffer.writeUInt32LE(number, offset + 1)
113828 encode.bytes = 5
113829
113830 // 64 bit
113831 } else {
113832 buffer.writeUInt8(0xff, offset)
113833 buffer.writeUInt32LE(number >>> 0, offset + 1)
113834 buffer.writeUInt32LE((number / 0x100000000) | 0, offset + 5)
113835 encode.bytes = 9
113836 }
113837
113838 return buffer
113839}
113840
113841function decode (buffer, offset) {
113842 if (!Buffer.isBuffer(buffer)) throw new TypeError('buffer must be a Buffer instance')
113843 if (!offset) offset = 0
113844
113845 var first = buffer.readUInt8(offset)
113846
113847 // 8 bit
113848 if (first < 0xfd) {
113849 decode.bytes = 1
113850 return first
113851
113852 // 16 bit
113853 } else if (first === 0xfd) {
113854 decode.bytes = 3
113855 return buffer.readUInt16LE(offset + 1)
113856
113857 // 32 bit
113858 } else if (first === 0xfe) {
113859 decode.bytes = 5
113860 return buffer.readUInt32LE(offset + 1)
113861
113862 // 64 bit
113863 } else {
113864 decode.bytes = 9
113865 var lo = buffer.readUInt32LE(offset + 1)
113866 var hi = buffer.readUInt32LE(offset + 5)
113867 var number = hi * 0x0100000000 + lo
113868 checkUInt53(number)
113869
113870 return number
113871 }
113872}
113873
113874function encodingLength (number) {
113875 checkUInt53(number)
113876
113877 return (
113878 number < 0xfd ? 1
113879 : number <= 0xffff ? 3
113880 : number <= 0xffffffff ? 5
113881 : 9
113882 )
113883}
113884
113885module.exports = { encode: encode, decode: decode, encodingLength: encodingLength }
113886
113887},{"safe-buffer":742}],831:[function(require,module,exports){
113888var indexOf = function (xs, item) {
113889 if (xs.indexOf) return xs.indexOf(item);
113890 else for (var i = 0; i < xs.length; i++) {
113891 if (xs[i] === item) return i;
113892 }
113893 return -1;
113894};
113895var Object_keys = function (obj) {
113896 if (Object.keys) return Object.keys(obj)
113897 else {
113898 var res = [];
113899 for (var key in obj) res.push(key)
113900 return res;
113901 }
113902};
113903
113904var forEach = function (xs, fn) {
113905 if (xs.forEach) return xs.forEach(fn)
113906 else for (var i = 0; i < xs.length; i++) {
113907 fn(xs[i], i, xs);
113908 }
113909};
113910
113911var defineProp = (function() {
113912 try {
113913 Object.defineProperty({}, '_', {});
113914 return function(obj, name, value) {
113915 Object.defineProperty(obj, name, {
113916 writable: true,
113917 enumerable: false,
113918 configurable: true,
113919 value: value
113920 })
113921 };
113922 } catch(e) {
113923 return function(obj, name, value) {
113924 obj[name] = value;
113925 };
113926 }
113927}());
113928
113929var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
113930'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
113931'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
113932'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
113933'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
113934
113935function Context() {}
113936Context.prototype = {};
113937
113938var Script = exports.Script = function NodeScript (code) {
113939 if (!(this instanceof Script)) return new Script(code);
113940 this.code = code;
113941};
113942
113943Script.prototype.runInContext = function (context) {
113944 if (!(context instanceof Context)) {
113945 throw new TypeError("needs a 'context' argument.");
113946 }
113947
113948 var iframe = document.createElement('iframe');
113949 if (!iframe.style) iframe.style = {};
113950 iframe.style.display = 'none';
113951
113952 document.body.appendChild(iframe);
113953
113954 var win = iframe.contentWindow;
113955 var wEval = win.eval, wExecScript = win.execScript;
113956
113957 if (!wEval && wExecScript) {
113958 // win.eval() magically appears when this is called in IE:
113959 wExecScript.call(win, 'null');
113960 wEval = win.eval;
113961 }
113962
113963 forEach(Object_keys(context), function (key) {
113964 win[key] = context[key];
113965 });
113966 forEach(globals, function (key) {
113967 if (context[key]) {
113968 win[key] = context[key];
113969 }
113970 });
113971
113972 var winKeys = Object_keys(win);
113973
113974 var res = wEval.call(win, this.code);
113975
113976 forEach(Object_keys(win), function (key) {
113977 // Avoid copying circular objects like `top` and `window` by only
113978 // updating existing context properties or new properties in the `win`
113979 // that was only introduced after the eval.
113980 if (key in context || indexOf(winKeys, key) === -1) {
113981 context[key] = win[key];
113982 }
113983 });
113984
113985 forEach(globals, function (key) {
113986 if (!(key in context)) {
113987 defineProp(context, key, win[key]);
113988 }
113989 });
113990
113991 document.body.removeChild(iframe);
113992
113993 return res;
113994};
113995
113996Script.prototype.runInThisContext = function () {
113997 return eval(this.code); // maybe...
113998};
113999
114000Script.prototype.runInNewContext = function (context) {
114001 var ctx = Script.createContext(context);
114002 var res = this.runInContext(ctx);
114003
114004 if (context) {
114005 forEach(Object_keys(ctx), function (key) {
114006 context[key] = ctx[key];
114007 });
114008 }
114009
114010 return res;
114011};
114012
114013forEach(Object_keys(Script.prototype), function (name) {
114014 exports[name] = Script[name] = function (code) {
114015 var s = Script(code);
114016 return s[name].apply(s, [].slice.call(arguments, 1));
114017 };
114018});
114019
114020exports.isContext = function (context) {
114021 return context instanceof Context;
114022};
114023
114024exports.createScript = function (code) {
114025 return exports.Script(code);
114026};
114027
114028exports.createContext = Script.createContext = function (context) {
114029 var copy = new Context();
114030 if(typeof context === 'object') {
114031 forEach(Object_keys(context), function (key) {
114032 copy[key] = context[key];
114033 });
114034 }
114035 return copy;
114036};
114037
114038},{}],832:[function(require,module,exports){
114039(function (Buffer){
114040var bs58check = require('bs58check')
114041
114042function decodeRaw (buffer, version) {
114043 // check version only if defined
114044 if (version !== undefined && buffer[0] !== version) throw new Error('Invalid network version')
114045
114046 // uncompressed
114047 if (buffer.length === 33) {
114048 return {
114049 version: buffer[0],
114050 privateKey: buffer.slice(1, 33),
114051 compressed: false
114052 }
114053 }
114054
114055 // invalid length
114056 if (buffer.length !== 34) throw new Error('Invalid WIF length')
114057
114058 // invalid compression flag
114059 if (buffer[33] !== 0x01) throw new Error('Invalid compression flag')
114060
114061 return {
114062 version: buffer[0],
114063 privateKey: buffer.slice(1, 33),
114064 compressed: true
114065 }
114066}
114067
114068function encodeRaw (version, privateKey, compressed) {
114069 var result = new Buffer(compressed ? 34 : 33)
114070
114071 result.writeUInt8(version, 0)
114072 privateKey.copy(result, 1)
114073
114074 if (compressed) {
114075 result[33] = 0x01
114076 }
114077
114078 return result
114079}
114080
114081function decode (string, version) {
114082 return decodeRaw(bs58check.decode(string), version)
114083}
114084
114085function encode (version, privateKey, compressed) {
114086 if (typeof version === 'number') return bs58check.encode(encodeRaw(version, privateKey, compressed))
114087
114088 return bs58check.encode(
114089 encodeRaw(
114090 version.version,
114091 version.privateKey,
114092 version.compressed
114093 )
114094 )
114095}
114096
114097module.exports = {
114098 decode: decode,
114099 decodeRaw: decodeRaw,
114100 encode: encode,
114101 encodeRaw: encodeRaw
114102}
114103
114104}).call(this,require("buffer").Buffer)
114105},{"bs58check":140,"buffer":146}],833:[function(require,module,exports){
114106var bs58grscheck = require('bs58grscheck')
114107var Buffer = require('safe-buffer').Buffer
114108
114109function decodeRaw (buffer, version) {
114110 // check version only if defined
114111 if (version !== undefined && buffer[0] !== version) throw new Error('Invalid network version')
114112
114113 // uncompressed
114114 if (buffer.length === 33) {
114115 return {
114116 version: buffer[0],
114117 privateKey: buffer.slice(1, 33),
114118 compressed: false
114119 }
114120 }
114121
114122 // invalid length
114123 if (buffer.length !== 34) throw new Error('Invalid WIF length')
114124
114125 // invalid compression flag
114126 if (buffer[33] !== 0x01) throw new Error('Invalid compression flag')
114127
114128 return {
114129 version: buffer[0],
114130 privateKey: buffer.slice(1, 33),
114131 compressed: true
114132 }
114133}
114134
114135function encodeRaw (version, privateKey, compressed) {
114136 if (privateKey.length !== 32) throw new TypeError('Invalid privateKey length')
114137
114138 var result = Buffer.alloc(compressed ? 34 : 33)
114139 result.writeUInt8(version, 0)
114140 privateKey.copy(result, 1)
114141
114142 if (compressed) {
114143 result[33] = 0x01
114144 }
114145
114146 return result
114147}
114148
114149function decode (string, version) {
114150 return decodeRaw(bs58grscheck.decode(string), version)
114151}
114152
114153function encode (version, privateKey, compressed) {
114154 if (typeof version === 'number') return bs58grscheck.encode(encodeRaw(version, privateKey, compressed))
114155
114156 return bs58grscheck.encode(
114157 encodeRaw(
114158 version.version,
114159 version.privateKey,
114160 version.compressed
114161 )
114162 )
114163}
114164
114165module.exports = {
114166 decode: decode,
114167 decodeRaw: decodeRaw,
114168 encode: encode,
114169 encodeRaw: encodeRaw
114170}
114171
114172},{"bs58grscheck":142,"safe-buffer":742}],834:[function(require,module,exports){
114173// Generated by CoffeeScript 1.10.0
114174var adjacency_graphs;
114175
114176adjacency_graphs = {
114177 qwerty: {
114178 "!": ["`~", null, null, "2@", "qQ", null],
114179 "\"": [";:", "[{", "]}", null, null, "/?"],
114180 "#": ["2@", null, null, "4$", "eE", "wW"],
114181 "$": ["3#", null, null, "5%", "rR", "eE"],
114182 "%": ["4$", null, null, "6^", "tT", "rR"],
114183 "&": ["6^", null, null, "8*", "uU", "yY"],
114184 "'": [";:", "[{", "]}", null, null, "/?"],
114185 "(": ["8*", null, null, "0)", "oO", "iI"],
114186 ")": ["9(", null, null, "-_", "pP", "oO"],
114187 "*": ["7&", null, null, "9(", "iI", "uU"],
114188 "+": ["-_", null, null, null, "]}", "[{"],
114189 ",": ["mM", "kK", "lL", ".>", null, null],
114190 "-": ["0)", null, null, "=+", "[{", "pP"],
114191 ".": [",<", "lL", ";:", "/?", null, null],
114192 "/": [".>", ";:", "'\"", null, null, null],
114193 "0": ["9(", null, null, "-_", "pP", "oO"],
114194 "1": ["`~", null, null, "2@", "qQ", null],
114195 "2": ["1!", null, null, "3#", "wW", "qQ"],
114196 "3": ["2@", null, null, "4$", "eE", "wW"],
114197 "4": ["3#", null, null, "5%", "rR", "eE"],
114198 "5": ["4$", null, null, "6^", "tT", "rR"],
114199 "6": ["5%", null, null, "7&", "yY", "tT"],
114200 "7": ["6^", null, null, "8*", "uU", "yY"],
114201 "8": ["7&", null, null, "9(", "iI", "uU"],
114202 "9": ["8*", null, null, "0)", "oO", "iI"],
114203 ":": ["lL", "pP", "[{", "'\"", "/?", ".>"],
114204 ";": ["lL", "pP", "[{", "'\"", "/?", ".>"],
114205 "<": ["mM", "kK", "lL", ".>", null, null],
114206 "=": ["-_", null, null, null, "]}", "[{"],
114207 ">": [",<", "lL", ";:", "/?", null, null],
114208 "?": [".>", ";:", "'\"", null, null, null],
114209 "@": ["1!", null, null, "3#", "wW", "qQ"],
114210 "A": [null, "qQ", "wW", "sS", "zZ", null],
114211 "B": ["vV", "gG", "hH", "nN", null, null],
114212 "C": ["xX", "dD", "fF", "vV", null, null],
114213 "D": ["sS", "eE", "rR", "fF", "cC", "xX"],
114214 "E": ["wW", "3#", "4$", "rR", "dD", "sS"],
114215 "F": ["dD", "rR", "tT", "gG", "vV", "cC"],
114216 "G": ["fF", "tT", "yY", "hH", "bB", "vV"],
114217 "H": ["gG", "yY", "uU", "jJ", "nN", "bB"],
114218 "I": ["uU", "8*", "9(", "oO", "kK", "jJ"],
114219 "J": ["hH", "uU", "iI", "kK", "mM", "nN"],
114220 "K": ["jJ", "iI", "oO", "lL", ",<", "mM"],
114221 "L": ["kK", "oO", "pP", ";:", ".>", ",<"],
114222 "M": ["nN", "jJ", "kK", ",<", null, null],
114223 "N": ["bB", "hH", "jJ", "mM", null, null],
114224 "O": ["iI", "9(", "0)", "pP", "lL", "kK"],
114225 "P": ["oO", "0)", "-_", "[{", ";:", "lL"],
114226 "Q": [null, "1!", "2@", "wW", "aA", null],
114227 "R": ["eE", "4$", "5%", "tT", "fF", "dD"],
114228 "S": ["aA", "wW", "eE", "dD", "xX", "zZ"],
114229 "T": ["rR", "5%", "6^", "yY", "gG", "fF"],
114230 "U": ["yY", "7&", "8*", "iI", "jJ", "hH"],
114231 "V": ["cC", "fF", "gG", "bB", null, null],
114232 "W": ["qQ", "2@", "3#", "eE", "sS", "aA"],
114233 "X": ["zZ", "sS", "dD", "cC", null, null],
114234 "Y": ["tT", "6^", "7&", "uU", "hH", "gG"],
114235 "Z": [null, "aA", "sS", "xX", null, null],
114236 "[": ["pP", "-_", "=+", "]}", "'\"", ";:"],
114237 "\\": ["]}", null, null, null, null, null],
114238 "]": ["[{", "=+", null, "\\|", null, "'\""],
114239 "^": ["5%", null, null, "7&", "yY", "tT"],
114240 "_": ["0)", null, null, "=+", "[{", "pP"],
114241 "`": [null, null, null, "1!", null, null],
114242 "a": [null, "qQ", "wW", "sS", "zZ", null],
114243 "b": ["vV", "gG", "hH", "nN", null, null],
114244 "c": ["xX", "dD", "fF", "vV", null, null],
114245 "d": ["sS", "eE", "rR", "fF", "cC", "xX"],
114246 "e": ["wW", "3#", "4$", "rR", "dD", "sS"],
114247 "f": ["dD", "rR", "tT", "gG", "vV", "cC"],
114248 "g": ["fF", "tT", "yY", "hH", "bB", "vV"],
114249 "h": ["gG", "yY", "uU", "jJ", "nN", "bB"],
114250 "i": ["uU", "8*", "9(", "oO", "kK", "jJ"],
114251 "j": ["hH", "uU", "iI", "kK", "mM", "nN"],
114252 "k": ["jJ", "iI", "oO", "lL", ",<", "mM"],
114253 "l": ["kK", "oO", "pP", ";:", ".>", ",<"],
114254 "m": ["nN", "jJ", "kK", ",<", null, null],
114255 "n": ["bB", "hH", "jJ", "mM", null, null],
114256 "o": ["iI", "9(", "0)", "pP", "lL", "kK"],
114257 "p": ["oO", "0)", "-_", "[{", ";:", "lL"],
114258 "q": [null, "1!", "2@", "wW", "aA", null],
114259 "r": ["eE", "4$", "5%", "tT", "fF", "dD"],
114260 "s": ["aA", "wW", "eE", "dD", "xX", "zZ"],
114261 "t": ["rR", "5%", "6^", "yY", "gG", "fF"],
114262 "u": ["yY", "7&", "8*", "iI", "jJ", "hH"],
114263 "v": ["cC", "fF", "gG", "bB", null, null],
114264 "w": ["qQ", "2@", "3#", "eE", "sS", "aA"],
114265 "x": ["zZ", "sS", "dD", "cC", null, null],
114266 "y": ["tT", "6^", "7&", "uU", "hH", "gG"],
114267 "z": [null, "aA", "sS", "xX", null, null],
114268 "{": ["pP", "-_", "=+", "]}", "'\"", ";:"],
114269 "|": ["]}", null, null, null, null, null],
114270 "}": ["[{", "=+", null, "\\|", null, "'\""],
114271 "~": [null, null, null, "1!", null, null]
114272 },
114273 dvorak: {
114274 "!": ["`~", null, null, "2@", "'\"", null],
114275 "\"": [null, "1!", "2@", ",<", "aA", null],
114276 "#": ["2@", null, null, "4$", ".>", ",<"],
114277 "$": ["3#", null, null, "5%", "pP", ".>"],
114278 "%": ["4$", null, null, "6^", "yY", "pP"],
114279 "&": ["6^", null, null, "8*", "gG", "fF"],
114280 "'": [null, "1!", "2@", ",<", "aA", null],
114281 "(": ["8*", null, null, "0)", "rR", "cC"],
114282 ")": ["9(", null, null, "[{", "lL", "rR"],
114283 "*": ["7&", null, null, "9(", "cC", "gG"],
114284 "+": ["/?", "]}", null, "\\|", null, "-_"],
114285 ",": ["'\"", "2@", "3#", ".>", "oO", "aA"],
114286 "-": ["sS", "/?", "=+", null, null, "zZ"],
114287 ".": [",<", "3#", "4$", "pP", "eE", "oO"],
114288 "/": ["lL", "[{", "]}", "=+", "-_", "sS"],
114289 "0": ["9(", null, null, "[{", "lL", "rR"],
114290 "1": ["`~", null, null, "2@", "'\"", null],
114291 "2": ["1!", null, null, "3#", ",<", "'\""],
114292 "3": ["2@", null, null, "4$", ".>", ",<"],
114293 "4": ["3#", null, null, "5%", "pP", ".>"],
114294 "5": ["4$", null, null, "6^", "yY", "pP"],
114295 "6": ["5%", null, null, "7&", "fF", "yY"],
114296 "7": ["6^", null, null, "8*", "gG", "fF"],
114297 "8": ["7&", null, null, "9(", "cC", "gG"],
114298 "9": ["8*", null, null, "0)", "rR", "cC"],
114299 ":": [null, "aA", "oO", "qQ", null, null],
114300 ";": [null, "aA", "oO", "qQ", null, null],
114301 "<": ["'\"", "2@", "3#", ".>", "oO", "aA"],
114302 "=": ["/?", "]}", null, "\\|", null, "-_"],
114303 ">": [",<", "3#", "4$", "pP", "eE", "oO"],
114304 "?": ["lL", "[{", "]}", "=+", "-_", "sS"],
114305 "@": ["1!", null, null, "3#", ",<", "'\""],
114306 "A": [null, "'\"", ",<", "oO", ";:", null],
114307 "B": ["xX", "dD", "hH", "mM", null, null],
114308 "C": ["gG", "8*", "9(", "rR", "tT", "hH"],
114309 "D": ["iI", "fF", "gG", "hH", "bB", "xX"],
114310 "E": ["oO", ".>", "pP", "uU", "jJ", "qQ"],
114311 "F": ["yY", "6^", "7&", "gG", "dD", "iI"],
114312 "G": ["fF", "7&", "8*", "cC", "hH", "dD"],
114313 "H": ["dD", "gG", "cC", "tT", "mM", "bB"],
114314 "I": ["uU", "yY", "fF", "dD", "xX", "kK"],
114315 "J": ["qQ", "eE", "uU", "kK", null, null],
114316 "K": ["jJ", "uU", "iI", "xX", null, null],
114317 "L": ["rR", "0)", "[{", "/?", "sS", "nN"],
114318 "M": ["bB", "hH", "tT", "wW", null, null],
114319 "N": ["tT", "rR", "lL", "sS", "vV", "wW"],
114320 "O": ["aA", ",<", ".>", "eE", "qQ", ";:"],
114321 "P": [".>", "4$", "5%", "yY", "uU", "eE"],
114322 "Q": [";:", "oO", "eE", "jJ", null, null],
114323 "R": ["cC", "9(", "0)", "lL", "nN", "tT"],
114324 "S": ["nN", "lL", "/?", "-_", "zZ", "vV"],
114325 "T": ["hH", "cC", "rR", "nN", "wW", "mM"],
114326 "U": ["eE", "pP", "yY", "iI", "kK", "jJ"],
114327 "V": ["wW", "nN", "sS", "zZ", null, null],
114328 "W": ["mM", "tT", "nN", "vV", null, null],
114329 "X": ["kK", "iI", "dD", "bB", null, null],
114330 "Y": ["pP", "5%", "6^", "fF", "iI", "uU"],
114331 "Z": ["vV", "sS", "-_", null, null, null],
114332 "[": ["0)", null, null, "]}", "/?", "lL"],
114333 "\\": ["=+", null, null, null, null, null],
114334 "]": ["[{", null, null, null, "=+", "/?"],
114335 "^": ["5%", null, null, "7&", "fF", "yY"],
114336 "_": ["sS", "/?", "=+", null, null, "zZ"],
114337 "`": [null, null, null, "1!", null, null],
114338 "a": [null, "'\"", ",<", "oO", ";:", null],
114339 "b": ["xX", "dD", "hH", "mM", null, null],
114340 "c": ["gG", "8*", "9(", "rR", "tT", "hH"],
114341 "d": ["iI", "fF", "gG", "hH", "bB", "xX"],
114342 "e": ["oO", ".>", "pP", "uU", "jJ", "qQ"],
114343 "f": ["yY", "6^", "7&", "gG", "dD", "iI"],
114344 "g": ["fF", "7&", "8*", "cC", "hH", "dD"],
114345 "h": ["dD", "gG", "cC", "tT", "mM", "bB"],
114346 "i": ["uU", "yY", "fF", "dD", "xX", "kK"],
114347 "j": ["qQ", "eE", "uU", "kK", null, null],
114348 "k": ["jJ", "uU", "iI", "xX", null, null],
114349 "l": ["rR", "0)", "[{", "/?", "sS", "nN"],
114350 "m": ["bB", "hH", "tT", "wW", null, null],
114351 "n": ["tT", "rR", "lL", "sS", "vV", "wW"],
114352 "o": ["aA", ",<", ".>", "eE", "qQ", ";:"],
114353 "p": [".>", "4$", "5%", "yY", "uU", "eE"],
114354 "q": [";:", "oO", "eE", "jJ", null, null],
114355 "r": ["cC", "9(", "0)", "lL", "nN", "tT"],
114356 "s": ["nN", "lL", "/?", "-_", "zZ", "vV"],
114357 "t": ["hH", "cC", "rR", "nN", "wW", "mM"],
114358 "u": ["eE", "pP", "yY", "iI", "kK", "jJ"],
114359 "v": ["wW", "nN", "sS", "zZ", null, null],
114360 "w": ["mM", "tT", "nN", "vV", null, null],
114361 "x": ["kK", "iI", "dD", "bB", null, null],
114362 "y": ["pP", "5%", "6^", "fF", "iI", "uU"],
114363 "z": ["vV", "sS", "-_", null, null, null],
114364 "{": ["0)", null, null, "]}", "/?", "lL"],
114365 "|": ["=+", null, null, null, null, null],
114366 "}": ["[{", null, null, null, "=+", "/?"],
114367 "~": [null, null, null, "1!", null, null]
114368 },
114369 keypad: {
114370 "*": ["/", null, null, null, "-", "+", "9", "8"],
114371 "+": ["9", "*", "-", null, null, null, null, "6"],
114372 "-": ["*", null, null, null, null, null, "+", "9"],
114373 ".": ["0", "2", "3", null, null, null, null, null],
114374 "/": [null, null, null, null, "*", "9", "8", "7"],
114375 "0": [null, "1", "2", "3", ".", null, null, null],
114376 "1": [null, null, "4", "5", "2", "0", null, null],
114377 "2": ["1", "4", "5", "6", "3", ".", "0", null],
114378 "3": ["2", "5", "6", null, null, null, ".", "0"],
114379 "4": [null, null, "7", "8", "5", "2", "1", null],
114380 "5": ["4", "7", "8", "9", "6", "3", "2", "1"],
114381 "6": ["5", "8", "9", "+", null, null, "3", "2"],
114382 "7": [null, null, null, "/", "8", "5", "4", null],
114383 "8": ["7", null, "/", "*", "9", "6", "5", "4"],
114384 "9": ["8", "/", "*", "-", "+", null, "6", "5"]
114385 },
114386 mac_keypad: {
114387 "*": ["/", null, null, null, null, null, "-", "9"],
114388 "+": ["6", "9", "-", null, null, null, null, "3"],
114389 "-": ["9", "/", "*", null, null, null, "+", "6"],
114390 ".": ["0", "2", "3", null, null, null, null, null],
114391 "/": ["=", null, null, null, "*", "-", "9", "8"],
114392 "0": [null, "1", "2", "3", ".", null, null, null],
114393 "1": [null, null, "4", "5", "2", "0", null, null],
114394 "2": ["1", "4", "5", "6", "3", ".", "0", null],
114395 "3": ["2", "5", "6", "+", null, null, ".", "0"],
114396 "4": [null, null, "7", "8", "5", "2", "1", null],
114397 "5": ["4", "7", "8", "9", "6", "3", "2", "1"],
114398 "6": ["5", "8", "9", "-", "+", null, "3", "2"],
114399 "7": [null, null, null, "=", "8", "5", "4", null],
114400 "8": ["7", null, "=", "/", "9", "6", "5", "4"],
114401 "9": ["8", "=", "/", "*", "-", "+", "6", "5"],
114402 "=": [null, null, null, null, "/", "9", "8", "7"]
114403 }
114404};
114405
114406module.exports = adjacency_graphs;
114407
114408
114409
114410},{}],835:[function(require,module,exports){
114411// Generated by CoffeeScript 1.10.0
114412var feedback, scoring;
114413
114414scoring = require('./scoring');
114415
114416feedback = {
114417 default_feedback: {
114418 warning: '',
114419 suggestions: ["Use a few words, avoid common phrases", "No need for symbols, digits, or uppercase letters"]
114420 },
114421 get_feedback: function(score, sequence) {
114422 var extra_feedback, i, len, longest_match, match, ref;
114423 if (sequence.length === 0) {
114424 return this.default_feedback;
114425 }
114426 if (score > 2) {
114427 return {
114428 warning: '',
114429 suggestions: []
114430 };
114431 }
114432 longest_match = sequence[0];
114433 ref = sequence.slice(1);
114434 for (i = 0, len = ref.length; i < len; i++) {
114435 match = ref[i];
114436 if (match.token.length > longest_match.token.length) {
114437 longest_match = match;
114438 }
114439 }
114440 feedback = this.get_match_feedback(longest_match, sequence.length === 1);
114441 extra_feedback = 'Add another word or two. Uncommon words are better.';
114442 if (feedback != null) {
114443 feedback.suggestions.unshift(extra_feedback);
114444 if (feedback.warning == null) {
114445 feedback.warning = '';
114446 }
114447 } else {
114448 feedback = {
114449 warning: '',
114450 suggestions: [extra_feedback]
114451 };
114452 }
114453 return feedback;
114454 },
114455 get_match_feedback: function(match, is_sole_match) {
114456 var layout, warning;
114457 switch (match.pattern) {
114458 case 'dictionary':
114459 return this.get_dictionary_match_feedback(match, is_sole_match);
114460 case 'spatial':
114461 layout = match.graph.toUpperCase();
114462 warning = match.turns === 1 ? 'Straight rows of keys are easy to guess' : 'Short keyboard patterns are easy to guess';
114463 return {
114464 warning: warning,
114465 suggestions: ['Use a longer keyboard pattern with more turns']
114466 };
114467 case 'repeat':
114468 warning = match.base_token.length === 1 ? 'Repeats like "aaa" are easy to guess' : 'Repeats like "abcabcabc" are only slightly harder to guess than "abc"';
114469 return {
114470 warning: warning,
114471 suggestions: ['Avoid repeated words and characters']
114472 };
114473 case 'sequence':
114474 return {
114475 warning: "Sequences like abc or 6543 are easy to guess",
114476 suggestions: ['Avoid sequences']
114477 };
114478 case 'regex':
114479 if (match.regex_name === 'recent_year') {
114480 return {
114481 warning: "Recent years are easy to guess",
114482 suggestions: ['Avoid recent years', 'Avoid years that are associated with you']
114483 };
114484 }
114485 break;
114486 case 'date':
114487 return {
114488 warning: "Dates are often easy to guess",
114489 suggestions: ['Avoid dates and years that are associated with you']
114490 };
114491 }
114492 },
114493 get_dictionary_match_feedback: function(match, is_sole_match) {
114494 var ref, result, suggestions, warning, word;
114495 warning = match.dictionary_name === 'passwords' ? is_sole_match && !match.l33t && !match.reversed ? match.rank <= 10 ? 'This is a top-10 common password' : match.rank <= 100 ? 'This is a top-100 common password' : 'This is a very common password' : match.guesses_log10 <= 4 ? 'This is similar to a commonly used password' : void 0 : match.dictionary_name === 'english_wikipedia' ? is_sole_match ? 'A word by itself is easy to guess' : void 0 : (ref = match.dictionary_name) === 'surnames' || ref === 'male_names' || ref === 'female_names' ? is_sole_match ? 'Names and surnames by themselves are easy to guess' : 'Common names and surnames are easy to guess' : '';
114496 suggestions = [];
114497 word = match.token;
114498 if (word.match(scoring.START_UPPER)) {
114499 suggestions.push("Capitalization doesn't help very much");
114500 } else if (word.match(scoring.ALL_UPPER) && word.toLowerCase() !== word) {
114501 suggestions.push("All-uppercase is almost as easy to guess as all-lowercase");
114502 }
114503 if (match.reversed && match.token.length >= 4) {
114504 suggestions.push("Reversed words aren't much harder to guess");
114505 }
114506 if (match.l33t) {
114507 suggestions.push("Predictable substitutions like '@' instead of 'a' don't help very much");
114508 }
114509 result = {
114510 warning: warning,
114511 suggestions: suggestions
114512 };
114513 return result;
114514 }
114515};
114516
114517module.exports = feedback;
114518
114519
114520
114521},{"./scoring":839}],836:[function(require,module,exports){
114522// Generated by CoffeeScript 1.10.0
114523var frequency_lists;
114524
114525frequency_lists = {
114526 passwords: "123456,password,12345678,qwerty,123456789,12345,1234,111111,1234567,dragon,123123,baseball,abc123,football,monkey,letmein,shadow,master,696969,mustang,666666,qwertyuiop,123321,1234567890,pussy,superman,654321,1qaz2wsx,7777777,fuckyou,qazwsx,jordan,123qwe,000000,killer,trustno1,hunter,harley,zxcvbnm,asdfgh,buster,batman,soccer,tigger,charlie,sunshine,iloveyou,fuckme,ranger,hockey,computer,starwars,asshole,pepper,klaster,112233,zxcvbn,freedom,princess,maggie,pass,ginger,11111111,131313,fuck,love,cheese,159753,summer,chelsea,dallas,biteme,matrix,yankees,6969,corvette,austin,access,thunder,merlin,secret,diamond,hello,hammer,fucker,1234qwer,silver,gfhjkm,internet,samantha,golfer,scooter,test,orange,cookie,q1w2e3r4t5,maverick,sparky,phoenix,mickey,bigdog,snoopy,guitar,whatever,chicken,camaro,mercedes,peanut,ferrari,falcon,cowboy,welcome,sexy,samsung,steelers,smokey,dakota,arsenal,boomer,eagles,tigers,marina,nascar,booboo,gateway,yellow,porsche,monster,spider,diablo,hannah,bulldog,junior,london,purple,compaq,lakers,iceman,qwer1234,hardcore,cowboys,money,banana,ncc1701,boston,tennis,q1w2e3r4,coffee,scooby,123654,nikita,yamaha,mother,barney,brandy,chester,fuckoff,oliver,player,forever,rangers,midnight,chicago,bigdaddy,redsox,angel,badboy,fender,jasper,slayer,rabbit,natasha,marine,bigdick,wizard,marlboro,raiders,prince,casper,fishing,flower,jasmine,iwantu,panties,adidas,winter,winner,gandalf,password1,enter,ghbdtn,1q2w3e4r,golden,cocacola,jordan23,winston,madison,angels,panther,blowme,sexsex,bigtits,spanky,bitch,sophie,asdfasdf,horny,thx1138,toyota,tiger,dick,canada,12344321,blowjob,8675309,muffin,liverpoo,apples,qwerty123,passw0rd,abcd1234,pokemon,123abc,slipknot,qazxsw,123456a,scorpion,qwaszx,butter,startrek,rainbow,asdfghjkl,razz,newyork,redskins,gemini,cameron,qazwsxedc,florida,liverpool,turtle,sierra,viking,booger,butthead,doctor,rocket,159357,dolphins,captain,bandit,jaguar,packers,pookie,peaches,789456,asdf,dolphin,helpme,blue,theman,maxwell,qwertyui,shithead,lovers,maddog,giants,nirvana,metallic,hotdog,rosebud,mountain,warrior,stupid,elephant,suckit,success,bond007,jackass,alexis,porn,lucky,scorpio,samson,q1w2e3,azerty,rush2112,driver,freddy,1q2w3e4r5t,sydney,gators,dexter,red123,123456q,12345a,bubba,creative,voodoo,golf,trouble,america,nissan,gunner,garfield,bullshit,asdfghjk,5150,fucking,apollo,1qazxsw2,2112,eminem,legend,airborne,bear,beavis,apple,brooklyn,godzilla,skippy,4815162342,buddy,qwert,kitten,magic,shelby,beaver,phantom,asdasd,xavier,braves,darkness,blink182,copper,platinum,qweqwe,tomcat,01012011,girls,bigboy,102030,animal,police,online,11223344,voyager,lifehack,12qwaszx,fish,sniper,315475,trinity,blazer,heaven,lover,snowball,playboy,loveme,bubbles,hooters,cricket,willow,donkey,topgun,nintendo,saturn,destiny,pakistan,pumpkin,digital,sergey,redwings,explorer,tits,private,runner,therock,guinness,lasvegas,beatles,789456123,fire,cassie,christin,qwerty1,celtic,asdf1234,andrey,broncos,007007,babygirl,eclipse,fluffy,cartman,michigan,carolina,testing,alexande,birdie,pantera,cherry,vampire,mexico,dickhead,buffalo,genius,montana,beer,minecraft,maximus,flyers,lovely,stalker,metallica,doggie,snickers,speedy,bronco,lol123,paradise,yankee,horses,magnum,dreams,147258369,lacrosse,ou812,goober,enigma,qwertyu,scotty,pimpin,bollocks,surfer,cock,poohbear,genesis,star,asd123,qweasdzxc,racing,hello1,hawaii,eagle1,viper,poopoo,einstein,boobies,12345q,bitches,drowssap,simple,badger,alaska,action,jester,drummer,111222,spitfire,forest,maryjane,champion,diesel,svetlana,friday,hotrod,147258,chevy,lucky1,westside,security,google,badass,tester,shorty,thumper,hitman,mozart,zaq12wsx,boobs,reddog,010203,lizard,a123456,123456789a,ruslan,eagle,1232323q,scarface,qwerty12,147852,a12345,buddha,porno,420420,spirit,money1,stargate,qwe123,naruto,mercury,liberty,12345qwert,semperfi,suzuki,popcorn,spooky,marley,scotland,kitty,cherokee,vikings,simpsons,rascal,qweasd,hummer,loveyou,michael1,patches,russia,jupiter,penguin,passion,cumshot,vfhbyf,honda,vladimir,sandman,passport,raider,bastard,123789,infinity,assman,bulldogs,fantasy,sucker,1234554321,horney,domino,budlight,disney,ironman,usuckballz1,softball,brutus,redrum,bigred,mnbvcxz,fktrcfylh,karina,marines,digger,kawasaki,cougar,fireman,oksana,monday,cunt,justice,nigger,super,wildcats,tinker,logitech,dancer,swordfis,avalon,everton,alexandr,motorola,patriots,hentai,madonna,pussy1,ducati,colorado,connor,juventus,galore,smooth,freeuser,warcraft,boogie,titanic,wolverin,elizabet,arizona,valentin,saints,asdfg,accord,test123,password123,christ,yfnfif,stinky,slut,spiderma,naughty,chopper,hello123,ncc1701d,extreme,skyline,poop,zombie,pearljam,123qweasd,froggy,awesome,vision,pirate,fylhtq,dreamer,bullet,predator,empire,123123a,kirill,charlie1,panthers,penis,skipper,nemesis,rasdzv3,peekaboo,rolltide,cardinal,psycho,danger,mookie,happy1,wanker,chevelle,manutd,goblue,9379992,hobbes,vegeta,fyfcnfcbz,852456,picard,159951,windows,loverboy,victory,vfrcbv,bambam,serega,123654789,turkey,tweety,galina,hiphop,rooster,changeme,berlin,taurus,suckme,polina,electric,avatar,134679,maksim,raptor,alpha1,hendrix,newport,bigcock,brazil,spring,a1b2c3,madmax,alpha,britney,sublime,darkside,bigman,wolfpack,classic,hercules,ronaldo,letmein1,1q2w3e,741852963,spiderman,blizzard,123456789q,cheyenne,cjkysirj,tiger1,wombat,bubba1,pandora,zxc123,holiday,wildcat,devils,horse,alabama,147852369,caesar,12312,buddy1,bondage,pussycat,pickle,shaggy,catch22,leather,chronic,a1b2c3d4,admin,qqq111,qaz123,airplane,kodiak,freepass,billybob,sunset,katana,phpbb,chocolat,snowman,angel1,stingray,firebird,wolves,zeppelin,detroit,pontiac,gundam,panzer,vagina,outlaw,redhead,tarheels,greenday,nastya,01011980,hardon,engineer,dragon1,hellfire,serenity,cobra,fireball,lickme,darkstar,1029384756,01011,mustang1,flash,124578,strike,beauty,pavilion,01012000,bobafett,dbrnjhbz,bigmac,bowling,chris1,ytrewq,natali,pyramid,rulez,welcome1,dodgers,apache,swimming,whynot,teens,trooper,fuckit,defender,precious,135790,packard,weasel,popeye,lucifer,cancer,icecream,142536,raven,swordfish,presario,viktor,rockstar,blonde,james1,wutang,spike,pimp,atlanta,airforce,thailand,casino,lennon,mouse,741852,hacker,bluebird,hawkeye,456123,theone,catfish,sailor,goldfish,nfnmzyf,tattoo,pervert,barbie,maxima,nipples,machine,trucks,wrangler,rocks,tornado,lights,cadillac,bubble,pegasus,madman,longhorn,browns,target,666999,eatme,qazwsx123,microsoft,dilbert,christia,baller,lesbian,shooter,xfiles,seattle,qazqaz,cthutq,amateur,prelude,corona,freaky,malibu,123qweasdzxc,assassin,246810,atlantis,integra,pussies,iloveu,lonewolf,dragons,monkey1,unicorn,software,bobcat,stealth,peewee,openup,753951,srinivas,zaqwsx,valentina,shotgun,trigger,veronika,bruins,coyote,babydoll,joker,dollar,lestat,rocky1,hottie,random,butterfly,wordpass,smiley,sweety,snake,chipper,woody,samurai,devildog,gizmo,maddie,soso123aljg,mistress,freedom1,flipper,express,hjvfirf,moose,cessna,piglet,polaris,teacher,montreal,cookies,wolfgang,scully,fatboy,wicked,balls,tickle,bunny,dfvgbh,foobar,transam,pepsi,fetish,oicu812,basketba,toshiba,hotstuff,sunday,booty,gambit,31415926,impala,stephani,jessica1,hooker,lancer,knicks,shamrock,fuckyou2,stinger,314159,redneck,deftones,squirt,siemens,blaster,trucker,subaru,renegade,ibanez,manson,swinger,reaper,blondie,mylove,galaxy,blahblah,enterpri,travel,1234abcd,babylon5,indiana,skeeter,master1,sugar,ficken,smoke,bigone,sweetpea,fucked,trfnthbyf,marino,escort,smitty,bigfoot,babes,larisa,trumpet,spartan,valera,babylon,asdfghj,yankees1,bigboobs,stormy,mister,hamlet,aardvark,butterfl,marathon,paladin,cavalier,manchester,skater,indigo,hornet,buckeyes,01011990,indians,karate,hesoyam,toronto,diamonds,chiefs,buckeye,1qaz2wsx3edc,highland,hotsex,charger,redman,passwor,maiden,drpepper,storm,pornstar,garden,12345678910,pencil,sherlock,timber,thuglife,insane,pizza,jungle,jesus1,aragorn,1a2b3c,hamster,david1,triumph,techno,lollol,pioneer,catdog,321654,fktrctq,morpheus,141627,pascal,shadow1,hobbit,wetpussy,erotic,consumer,blabla,justme,stones,chrissy,spartak,goforit,burger,pitbull,adgjmptw,italia,barcelona,hunting,colors,kissme,virgin,overlord,pebbles,sundance,emerald,doggy,racecar,irina,element,1478963,zipper,alpine,basket,goddess,poison,nipple,sakura,chichi,huskers,13579,pussys,q12345,ultimate,ncc1701e,blackie,nicola,rommel,matthew1,caserta,omega,geronimo,sammy1,trojan,123qwe123,philips,nugget,tarzan,chicks,aleksandr,bassman,trixie,portugal,anakin,dodger,bomber,superfly,madness,q1w2e3r4t5y6,loser,123asd,fatcat,ybrbnf,soldier,warlock,wrinkle1,desire,sexual,babe,seminole,alejandr,951753,11235813,westham,andrei,concrete,access14,weed,letmein2,ladybug,naked,christop,trombone,tintin,bluesky,rhbcnbyf,qazxswedc,onelove,cdtnkfyf,whore,vfvjxrf,titans,stallion,truck,hansolo,blue22,smiles,beagle,panama,kingkong,flatron,inferno,mongoose,connect,poiuyt,snatch,qawsed,juice,blessed,rocker,snakes,turbo,bluemoon,sex4me,finger,jamaica,a1234567,mulder,beetle,fuckyou1,passat,immortal,plastic,123454321,anthony1,whiskey,dietcoke,suck,spunky,magic1,monitor,cactus,exigen,planet,ripper,teen,spyder,apple1,nolimit,hollywoo,sluts,sticky,trunks,1234321,14789632,pickles,sailing,bonehead,ghbdtnbr,delta,charlott,rubber,911911,112358,molly1,yomama,hongkong,jumper,william1,ilovesex,faster,unreal,cumming,memphis,1123581321,nylons,legion,sebastia,shalom,pentium,geheim,werewolf,funtime,ferret,orion,curious,555666,niners,cantona,sprite,philly,pirates,abgrtyu,lollipop,eternity,boeing,super123,sweets,cooldude,tottenha,green1,jackoff,stocking,7895123,moomoo,martini,biscuit,drizzt,colt45,fossil,makaveli,snapper,satan666,maniac,salmon,patriot,verbatim,nasty,shasta,asdzxc,shaved,blackcat,raistlin,qwerty12345,punkrock,cjkywt,01012010,4128,waterloo,crimson,twister,oxford,musicman,seinfeld,biggie,condor,ravens,megadeth,wolfman,cosmos,sharks,banshee,keeper,foxtrot,gn56gn56,skywalke,velvet,black1,sesame,dogs,squirrel,privet,sunrise,wolverine,sucks,legolas,grendel,ghost,cats,carrot,frosty,lvbnhbq,blades,stardust,frog,qazwsxed,121314,coolio,brownie,groovy,twilight,daytona,vanhalen,pikachu,peanuts,licker,hershey,jericho,intrepid,ninja,1234567a,zaq123,lobster,goblin,punisher,strider,shogun,kansas,amadeus,seven7,jason1,neptune,showtime,muscle,oldman,ekaterina,rfrfirf,getsome,showme,111222333,obiwan,skittles,danni,tanker,maestro,tarheel,anubis,hannibal,anal,newlife,gothic,shark,fighter,blue123,blues,123456z,princes,slick,chaos,thunder1,sabine,1q2w3e4r5t6y,python,test1,mirage,devil,clover,tequila,chelsea1,surfing,delete,potato,chubby,panasonic,sandiego,portland,baggins,fusion,sooners,blackdog,buttons,californ,moscow,playtime,mature,1a2b3c4d,dagger,dima,stimpy,asdf123,gangster,warriors,iverson,chargers,byteme,swallow,liquid,lucky7,dingdong,nymets,cracker,mushroom,456852,crusader,bigguy,miami,dkflbvbh,bugger,nimrod,tazman,stranger,newpass,doodle,powder,gotcha,guardian,dublin,slapshot,septembe,147896325,pepsi1,milano,grizzly,woody1,knights,photos,2468,nookie,charly,rammstein,brasil,123321123,scruffy,munchkin,poopie,123098,kittycat,latino,walnut,1701,thegame,viper1,1passwor,kolobok,picasso,robert1,barcelon,bananas,trance,auburn,coltrane,eatshit,goodluck,starcraft,wheels,parrot,postal,blade,wisdom,pink,gorilla,katerina,pass123,andrew1,shaney14,dumbass,osiris,fuck_inside,oakland,discover,ranger1,spanking,lonestar,bingo,meridian,ping,heather1,dookie,stonecol,megaman,192837465,rjntyjr,ledzep,lowrider,25802580,richard1,firefly,griffey,racerx,paradox,ghjcnj,gangsta,zaq1xsw2,tacobell,weezer,sirius,halflife,buffett,shiloh,123698745,vertigo,sergei,aliens,sobaka,keyboard,kangaroo,sinner,soccer1,0.0.000,bonjour,socrates,chucky,hotboy,sprint,0007,sarah1,scarlet,celica,shazam,formula1,sommer,trebor,qwerasdf,jeep,mailcreated5240,bollox,asshole1,fuckface,honda1,rebels,vacation,lexmark,penguins,12369874,ragnarok,formula,258456,tempest,vfhecz,tacoma,qwertz,colombia,flames,rockon,duck,prodigy,wookie,dodgeram,mustangs,123qaz,sithlord,smoker,server,bang,incubus,scoobydo,oblivion,molson,kitkat,titleist,rescue,zxcv1234,carpet,1122,bigballs,tardis,jimbob,xanadu,blueeyes,shaman,mersedes,pooper,pussy69,golfing,hearts,mallard,12312312,kenwood,patrick1,dogg,cowboys1,oracle,123zxc,nuttertools,102938,topper,1122334455,shemale,sleepy,gremlin,yourmom,123987,gateway1,printer,monkeys,peterpan,mikey,kingston,cooler,analsex,jimbo,pa55word,asterix,freckles,birdman,frank1,defiant,aussie,stud,blondes,tatyana,445566,aspirine,mariners,jackal,deadhead,katrin,anime,rootbeer,frogger,polo,scooter1,hallo,noodles,thomas1,parola,shaolin,celine,11112222,plymouth,creampie,justdoit,ohyeah,fatass,assfuck,amazon,1234567q,kisses,magnus,camel,nopass,bosco,987456,6751520,harley1,putter,champs,massive,spidey,lightnin,camelot,letsgo,gizmodo,aezakmi,bones,caliente,12121,goodtime,thankyou,raiders1,brucelee,redalert,aquarius,456654,catherin,smokin,pooh,mypass,astros,roller,porkchop,sapphire,qwert123,kevin1,a1s2d3f4,beckham,atomic,rusty1,vanilla,qazwsxedcrfv,hunter1,kaktus,cxfcnmt,blacky,753159,elvis1,aggies,blackjac,bangkok,scream,123321q,iforgot,power1,kasper,abc12,buster1,slappy,shitty,veritas,chevrole,amber1,01012001,vader,amsterdam,jammer,primus,spectrum,eduard,granny,horny1,sasha1,clancy,usa123,satan,diamond1,hitler,avenger,1221,spankme,123456qwerty,simba,smudge,scrappy,labrador,john316,syracuse,front242,falcons,husker,candyman,commando,gator,pacman,delta1,pancho,krishna,fatman,clitoris,pineappl,lesbians,8j4ye3uz,barkley,vulcan,punkin,boner,celtics,monopoly,flyboy,romashka,hamburg,123456aa,lick,gangbang,223344,area51,spartans,aaa111,tricky,snuggles,drago,homerun,vectra,homer1,hermes,topcat,cuddles,infiniti,1234567890q,cosworth,goose,phoenix1,killer1,ivanov,bossman,qawsedrf,peugeot,exigent,doberman,durango,brandon1,plumber,telefon,horndog,laguna,rbhbkk,dawg,webmaster,breeze,beast,porsche9,beefcake,leopard,redbull,oscar1,topdog,godsmack,theking,pics,omega1,speaker,viktoria,fuckers,bowler,starbuck,gjkbyf,valhalla,anarchy,blacks,herbie,kingpin,starfish,nokia,loveit,achilles,906090,labtec,ncc1701a,fitness,jordan1,brando,arsenal1,bull,kicker,napass,desert,sailboat,bohica,tractor,hidden,muppet,jackson1,jimmy1,terminator,phillies,pa55w0rd,terror,farside,swingers,legacy,frontier,butthole,doughboy,jrcfyf,tuesday,sabbath,daniel1,nebraska,homers,qwertyuio,azamat,fallen,agent007,striker,camels,iguana,looker,pinkfloy,moloko,qwerty123456,dannyboy,luckydog,789654,pistol,whocares,charmed,skiing,select,franky,puppy,daniil,vladik,vette,vfrcbvrf,ihateyou,nevada,moneys,vkontakte,mandingo,puppies,666777,mystic,zidane,kotenok,dilligaf,budman,bunghole,zvezda,123457,triton,golfball,technics,trojans,panda,laptop,rookie,01011991,15426378,aberdeen,gustav,jethro,enterprise,igor,stripper,filter,hurrican,rfnthbyf,lespaul,gizmo1,butch,132435,dthjybrf,1366613,excalibu,963852,nofear,momoney,possum,cutter,oilers,moocow,cupcake,gbpltw,batman1,splash,svetik,super1,soleil,bogdan,melissa1,vipers,babyboy,tdutybq,lancelot,ccbill,keystone,passwort,flamingo,firefox,dogman,vortex,rebel,noodle,raven1,zaphod,killme,pokemon1,coolman,danila,designer,skinny,kamikaze,deadman,gopher,doobie,warhammer,deeznuts,freaks,engage,chevy1,steve1,apollo13,poncho,hammers,azsxdc,dracula,000007,sassy,bitch1,boots,deskjet,12332,macdaddy,mighty,rangers1,manchest,sterlin,casey1,meatball,mailman,sinatra,cthulhu,summer1,bubbas,cartoon,bicycle,eatpussy,truelove,sentinel,tolkien,breast,capone,lickit,summit,123456k,peter1,daisy1,kitty1,123456789z,crazy1,jamesbon,texas1,sexygirl,362436,sonic,billyboy,redhot,microsof,microlab,daddy1,rockets,iloveyo,fernand,gordon24,danie,cutlass,polska,star69,titties,pantyhos,01011985,thekid,aikido,gofish,mayday,1234qwe,coke,anfield,sony,lansing,smut,scotch,sexx,catman,73501505,hustler,saun,dfkthbz,passwor1,jenny1,azsxdcfv,cheers,irish1,gabrie,tinman,orioles,1225,charlton,fortuna,01011970,airbus,rustam,xtreme,bigmoney,zxcasd,retard,grumpy,huskies,boxing,4runner,kelly1,ultima,warlord,fordf150,oranges,rotten,asdfjkl,superstar,denali,sultan,bikini,saratoga,thor,figaro,sixers,wildfire,vladislav,128500,sparta,mayhem,greenbay,chewie,music1,number1,cancun,fabie,mellon,poiuytrewq,cloud9,crunch,bigtime,chicken1,piccolo,bigbird,321654987,billy1,mojo,01011981,maradona,sandro,chester1,bizkit,rjirfrgbde,789123,rightnow,jasmine1,hyperion,treasure,meatloaf,armani,rovers,jarhead,01011986,cruise,coconut,dragoon,utopia,davids,cosmo,rfhbyf,reebok,1066,charli,giorgi,sticks,sayang,pass1234,exodus,anaconda,zaqxsw,illini,woofwoof,emily1,sandy1,packer,poontang,govols,jedi,tomato,beaner,cooter,creamy,lionking,happy123,albatros,poodle,kenworth,dinosaur,greens,goku,happyday,eeyore,tsunami,cabbage,holyshit,turkey50,memorex,chaser,bogart,orgasm,tommy1,volley,whisper,knopka,ericsson,walleye,321123,pepper1,katie1,chickens,tyler1,corrado,twisted,100000,zorro,clemson,zxcasdqwe,tootsie,milana,zenith,fktrcfylhf,shania,frisco,polniypizdec0211,crazybab,junebug,fugazi,rereirf,vfvekz,1001,sausage,vfczyz,koshka,clapton,justin1,anhyeuem,condom,fubar,hardrock,skywalker,tundra,cocks,gringo,150781,canon,vitalik,aspire,stocks,samsung1,applepie,abc12345,arjay,gandalf1,boob,pillow,sparkle,gmoney,rockhard,lucky13,samiam,everest,hellyeah,bigsexy,skorpion,rfrnec,hedgehog,australi,candle,slacker,dicks,voyeur,jazzman,america1,bobby1,br0d3r,wolfie,vfksirf,1qa2ws3ed,13243546,fright,yosemite,temp,karolina,fart,barsik,surf,cheetah,baddog,deniska,starship,bootie,milena,hithere,kume,greatone,dildo,50cent,0.0.0.000,albion,amanda1,midget,lion,maxell,football1,cyclone,freeporn,nikola,bonsai,kenshin,slider,balloon,roadkill,killbill,222333,jerkoff,78945612,dinamo,tekken,rambler,goliath,cinnamon,malaka,backdoor,fiesta,packers1,rastaman,fletch,sojdlg123aljg,stefano,artemis,calico,nyjets,damnit,robotech,duchess,rctybz,hooter,keywest,18436572,hal9000,mechanic,pingpong,operator,presto,sword,rasputin,spank,bristol,faggot,shado,963852741,amsterda,321456,wibble,carrera,alibaba,majestic,ramses,duster,route66,trident,clipper,steeler,wrestlin,divine,kipper,gotohell,kingfish,snake1,passwords,buttman,pompey,viagra,zxcvbnm1,spurs,332211,slutty,lineage2,oleg,macross,pooter,brian1,qwert1,charles1,slave,jokers,yzerman,swimmer,ne1469,nwo4life,solnce,seamus,lolipop,pupsik,moose1,ivanova,secret1,matador,love69,420247,ktyjxrf,subway,cinder,vermont,pussie,chico,florian,magick,guiness,allsop,ghetto,flash1,a123456789,typhoon,dfkthf,depeche,skydive,dammit,seeker,fuckthis,crysis,kcj9wx5n,umbrella,r2d2c3po,123123q,snoopdog,critter,theboss,ding,162534,splinter,kinky,cyclops,jayhawk,456321,caramel,qwer123,underdog,caveman,onlyme,grapes,feather,hotshot,fuckher,renault,george1,sex123,pippen,000001,789987,floppy,cunts,megapass,1000,pornos,usmc,kickass,great1,quattro,135246,wassup,helloo,p0015123,nicole1,chivas,shannon1,bullseye,java,fishes,blackhaw,jamesbond,tunafish,juggalo,dkflbckfd,123789456,dallas1,translator,122333,beanie,alucard,gfhjkm123,supersta,magicman,ashley1,cohiba,xbox360,caligula,12131415,facial,7753191,dfktynbyf,cobra1,cigars,fang,klingon,bob123,safari,looser,10203,deepthroat,malina,200000,tazmania,gonzo,goalie,jacob1,monaco,cruiser,misfit,vh5150,tommyboy,marino13,yousuck,sharky,vfhufhbnf,horizon,absolut,brighton,123456r,death1,kungfu,maxx,forfun,mamapapa,enter1,budweise,banker,getmoney,kostya,qazwsx12,bigbear,vector,fallout,nudist,gunners,royals,chainsaw,scania,trader,blueboy,walrus,eastside,kahuna,qwerty1234,love123,steph,01011989,cypress,champ,undertaker,ybrjkfq,europa,snowboar,sabres,moneyman,chrisbln,minime,nipper,groucho,whitey,viewsonic,penthous,wolf359,fabric,flounder,coolguy,whitesox,passme,smegma,skidoo,thanatos,fucku2,snapple,dalejr,mondeo,thesims,mybaby,panasoni,sinbad,thecat,topher,frodo,sneakers,q123456,z1x2c3,alfa,chicago1,taylor1,ghjcnjnfr,cat123,olivier,cyber,titanium,0420,madison1,jabroni,dang,hambone,intruder,holly1,gargoyle,sadie1,static,poseidon,studly,newcastl,sexxxx,poppy,johannes,danzig,beastie,musica,buckshot,sunnyday,adonis,bluedog,bonkers,2128506,chrono,compute,spawn,01011988,turbo1,smelly,wapbbs,goldstar,ferrari1,778899,quantum,pisces,boomboom,gunnar,1024,test1234,florida1,nike,superman1,multiplelo,custom,motherlode,1qwerty,westwood,usnavy,apple123,daewoo,korn,stereo,sasuke,sunflowe,watcher,dharma,555777,mouse1,assholes,babyblue,123qwerty,marius,walmart,snoop,starfire,tigger1,paintbal,knickers,aaliyah,lokomotiv,theend,winston1,sapper,rover,erotica,scanner,racer,zeus,sexy69,doogie,bayern,joshua1,newbie,scott1,losers,droopy,outkast,martin1,dodge1,wasser,ufkbyf,rjycnfynby,thirteen,12345z,112211,hotred,deejay,hotpussy,192837,jessic,philippe,scout,panther1,cubbies,havefun,magpie,fghtkm,avalanch,newyork1,pudding,leonid,harry1,cbr600,audia4,bimmer,fucku,01011984,idontknow,vfvfgfgf,1357,aleksey,builder,01011987,zerocool,godfather,mylife,donuts,allmine,redfish,777888,sascha,nitram,bounce,333666,smokes,1x2zkg8w,rodman,stunner,zxasqw12,hoosier,hairy,beretta,insert,123456s,rtyuehe,francesc,tights,cheese1,micron,quartz,hockey1,gegcbr,searay,jewels,bogey,paintball,celeron,padres,bing,syncmaster,ziggy,simon1,beaches,prissy,diehard,orange1,mittens,aleksandra,queens,02071986,biggles,thongs,southpark,artur,twinkle,gretzky,rabota,cambiami,monalisa,gollum,chuckles,spike1,gladiator,whisky,spongebob,sexy1,03082006,mazafaka,meathead,4121,ou8122,barefoot,12345678q,cfitymrf,bigass,a1s2d3,kosmos,blessing,titty,clevelan,terrapin,ginger1,johnboy,maggot,clarinet,deeznutz,336699,stumpy,stoney,footbal,traveler,volvo,bucket,snapon,pianoman,hawkeyes,futbol,casanova,tango,goodboy,scuba,honey1,sexyman,warthog,mustard,abc1234,nickel,10203040,meowmeow,1012,boricua,prophet,sauron,12qwas,reefer,andromeda,crystal1,joker1,90210,goofy,loco,lovesex,triangle,whatsup,mellow,bengals,monster1,maste,01011910,lover1,love1,123aaa,sunshin,smeghead,hokies,sting,welder,rambo,cerberus,bunny1,rockford,monke,1q2w3e4r5,goldwing,gabriell,buzzard,crjhgbjy,james007,rainman,groove,tiberius,purdue,nokia6300,hayabusa,shou,jagger,diver,zigzag,poochie,usarmy,phish,redwood,redwing,12345679,salamander,silver1,abcd123,sputnik,boobie,ripple,eternal,12qw34er,thegreat,allstar,slinky,gesperrt,mishka,whiskers,pinhead,overkill,sweet1,rhfcjnrf,montgom240,sersolution,jamie1,starman,proxy,swords,nikolay,bacardi,rasta,badgirl,rebecca1,wildman,penny1,spaceman,1007,10101,logan1,hacked,bulldog1,helmet,windsor,buffy1,runescape,trapper,123451,banane,dbrnjh,ripken,12345qwe,frisky,shun,fester,oasis,lightning,ib6ub9,cicero,kool,pony,thedog,784512,01011992,megatron,illusion,edward1,napster,11223,squash,roadking,woohoo,19411945,hoosiers,01091989,tracker,bagira,midway,leavemealone,br549,14725836,235689,menace,rachel1,feng,laser,stoned,realmadrid,787898,balloons,tinkerbell,5551212,maria1,pobeda,heineken,sonics,moonlight,optimus,comet,orchid,02071982,jaybird,kashmir,12345678a,chuang,chunky,peach,mortgage,rulezzz,saleen,chuckie,zippy,fishing1,gsxr750,doghouse,maxim,reader,shai,buddah,benfica,chou,salomon,meister,eraser,blackbir,bigmike,starter,pissing,angus,deluxe,eagles1,hardcock,135792468,mian,seahawks,godfathe,bookworm,gregor,intel,talisman,blackjack,babyface,hawaiian,dogfood,zhong,01011975,sancho,ludmila,medusa,mortimer,123456654321,roadrunn,just4me,stalin,01011993,handyman,alphabet,pizzas,calgary,clouds,password2,cgfhnfr,f**k,cubswin,gong,lexus,max123,xxx123,digital1,gfhjkm1,7779311,missy1,michae,beautifu,gator1,1005,pacers,buddie,chinook,heckfy,dutchess,sally1,breasts,beowulf,darkman,jenn,tiffany1,zhei,quan,qazwsx1,satana,shang,idontkno,smiths,puddin,nasty1,teddybea,valkyrie,passwd,chao,boxster,killers,yoda,cheater,inuyasha,beast1,wareagle,foryou,dragonball,mermaid,bhbirf,teddy1,dolphin1,misty1,delphi,gromit,sponge,qazzaq,fytxrf,gameover,diao,sergi,beamer,beemer,kittykat,rancid,manowar,adam12,diggler,assword,austin1,wishbone,gonavy,sparky1,fisting,thedude,sinister,1213,venera,novell,salsero,jayden,fuckoff1,linda1,vedder,02021987,1pussy,redline,lust,jktymrf,02011985,dfcbkbq,dragon12,chrome,gamecube,titten,cong,bella1,leng,02081988,eureka,bitchass,147369,banner,lakota,123321a,mustafa,preacher,hotbox,02041986,z1x2c3v4,playstation,01011977,claymore,electra,checkers,zheng,qing,armagedon,02051986,wrestle,svoboda,bulls,nimbus,alenka,madina,newpass6,onetime,aa123456,bartman,02091987,silverad,electron,12345t,devil666,oliver1,skylar,rhtdtlrj,gobucks,johann,12011987,milkman,02101985,camper,thunderb,bigbutt,jammin,davide,cheeks,goaway,lighter,claudi,thumbs,pissoff,ghostrider,cocaine,teng,squall,lotus,hootie,blackout,doitnow,subzero,02031986,marine1,02021988,pothead,123456qw,skate,1369,peng,antoni,neng,miao,bcfields,1492,marika,794613,musashi,tulips,nong,piao,chai,ruan,southpar,02061985,nude,mandarin,654123,ninjas,cannabis,jetski,xerxes,zhuang,kleopatra,dickie,bilbo,pinky,morgan1,1020,1017,dieter,baseball1,tottenham,quest,yfnfkmz,dirtbike,1234567890a,mango,jackson5,ipswich,iamgod,02011987,tdutybz,modena,qiao,slippery,qweasd123,bluefish,samtron,toon,111333,iscool,02091986,petrov,fuzzy,zhou,1357924680,mollydog,deng,02021986,1236987,pheonix,zhun,ghblehjr,othello,starcraf,000111,sanfran,a11111,cameltoe,badman,vasilisa,jiang,1qaz2ws,luan,sveta,12qw12,akira,chuai,369963,cheech,beatle,pickup,paloma,01011983,caravan,elizaveta,gawker,banzai,pussey,mullet,seng,bingo1,bearcat,flexible,farscape,borussia,zhuai,templar,guitar1,toolman,yfcntymrf,chloe1,xiang,slave1,guai,nuggets,02081984,mantis,slim,scorpio1,fyutkbyf,thedoors,02081987,02061986,123qq123,zappa,fergie,7ugd5hip2j,huai,asdfzxcv,sunflower,pussyman,deadpool,bigtit,01011982,love12,lassie,skyler,gatorade,carpedie,jockey,mancity,spectre,02021984,cameron1,artemka,reng,02031984,iomega,jing,moritz,spice,rhino,spinner,heater,zhai,hover,talon,grease,qiong,corleone,ltybcrf,tian,cowboy1,hippie,chimera,ting,alex123,02021985,mickey1,corsair,sonoma,aaron1,xxxpass,bacchus,webmaste,chuo,xyz123,chrysler,spurs1,artem,shei,cosmic,01020304,deutsch,gabriel1,123455,oceans,987456321,binladen,latinas,a12345678,speedo,buttercu,02081989,21031988,merlot,millwall,ceng,kotaku,jiong,dragonba,2580,stonecold,snuffy,01011999,02011986,hellos,blaze,maggie1,slapper,istanbul,bonjovi,babylove,mazda,bullfrog,phoeni,meng,porsche1,nomore,02061989,bobdylan,capslock,orion1,zaraza,teddybear,ntktajy,myname,rong,wraith,mets,niao,02041984,smokie,chevrolet,dialog,gfhjkmgfhjkm,dotcom,vadim,monarch,athlon,mikey1,hamish,pian,liang,coolness,chui,thoma,ramones,ciccio,chippy,eddie1,house1,ning,marker,cougars,jackpot,barbados,reds,pdtplf,knockers,cobalt,amateurs,dipshit,napoli,kilroy,pulsar,jayhawks,daemon,alexey,weng,shuang,9293709b13,shiner,eldorado,soulmate,mclaren,golfer1,andromed,duan,50spanks,sexyboy,dogshit,02021983,shuo,kakashka,syzygy,111111a,yeahbaby,qiang,netscape,fulham,120676,gooner,zhui,rainbow6,laurent,dog123,halifax,freeway,carlitos,147963,eastwood,microphone,monkey12,1123,persik,coldbeer,geng,nuan,danny1,fgtkmcby,entropy,gadget,just4fun,sophi,baggio,carlito,1234567891,02021989,02041983,specialk,piramida,suan,bigblue,salasana,hopeful,mephisto,bailey1,hack,annie1,generic,violetta,spencer1,arcadia,02051983,hondas,9562876,trainer,jones1,smashing,liao,159632,iceberg,rebel1,snooker,temp123,zang,matteo,fastball,q2w3e4r5,bamboo,fuckyo,shutup,astro,buddyboy,nikitos,redbird,maxxxx,shitface,02031987,kuai,kissmyass,sahara,radiohea,1234asdf,wildcard,maxwell1,patric,plasma,heynow,bruno1,shao,bigfish,misfits,sassy1,sheng,02011988,02081986,testpass,nanook,cygnus,licking,slavik,pringles,xing,1022,ninja1,submit,dundee,tiburon,pinkfloyd,yummy,shuai,guang,chopin,obelix,insomnia,stroker,1a2s3d4f,1223,playboy1,lazarus,jorda,spider1,homerj,sleeper,02041982,darklord,cang,02041988,02041987,tripod,magician,jelly,telephon,15975,vsjasnel12,pasword,iverson3,pavlov,homeboy,gamecock,amigo,brodie,budapest,yjdsqgfhjkm,reckless,02011980,pang,tiger123,2469,mason1,orient,01011979,zong,cdtnbr,maksimka,1011,bushido,taxman,giorgio,sphinx,kazantip,02101984,concorde,verizon,lovebug,georg,sam123,seadoo,qazwsxedc123,jiao,jezebel,pharmacy,abnormal,jellybea,maxime,puffy,islander,bunnies,jiggaman,drakon,010180,pluto,zhjckfd,12365,classics,crusher,mordor,hooligan,strawberry,02081985,scrabble,hawaii50,1224,wg8e3wjf,cthtuf,premium,arrow,123456qwe,mazda626,ramrod,tootie,rhjrjlbk,ghost1,1211,bounty,niang,02071984,goat,killer12,sweetnes,porno1,masamune,426hemi,corolla,mariposa,hjccbz,doomsday,bummer,blue12,zhao,bird33,excalibur,samsun,kirsty,buttfuck,kfhbcf,zhuo,marcello,ozzy,02021982,dynamite,655321,master12,123465,lollypop,stepan,1qa2ws,spiker,goirish,callum,michael2,moonbeam,attila,henry1,lindros,andrea1,sporty,lantern,12365478,nextel,violin,volcom,998877,water1,imation,inspiron,dynamo,citadel,placebo,clowns,tiao,02061988,tripper,dabears,haggis,merlin1,02031985,anthrax,amerika,iloveme,vsegda,burrito,bombers,snowboard,forsaken,katarina,a1a2a3,woofer,tigger2,fullmoon,tiger2,spock,hannah1,snoopy1,sexxxy,sausages,stanislav,cobain,robotics,exotic,green123,mobydick,senators,pumpkins,fergus,asddsa,147741,258852,windsurf,reddevil,vfitymrf,nevermind,nang,woodland,4417,mick,shui,q1q2q3,wingman,69696,superb,zuan,ganesh,pecker,zephyr,anastasiya,icu812,larry1,02081982,broker,zalupa,mihail,vfibyf,dogger,7007,paddle,varvara,schalke,1z2x3c,presiden,yankees2,tuning,poopy,02051982,concord,vanguard,stiffy,rjhjktdf,felix1,wrench,firewall,boxer,bubba69,popper,02011984,temppass,gobears,cuan,tipper,fuckme1,kamila,thong,puss,bigcat,drummer1,02031982,sowhat,digimon,tigers1,rang,jingle,bian,uranus,soprano,mandy1,dusty1,fandango,aloha,pumpkin1,postman,02061980,dogcat,bombay,pussy123,onetwo,highheel,pippo,julie1,laura1,pepito,beng,smokey1,stylus,stratus,reload,duckie,karen1,jimbo1,225588,369258,krusty,snappy,asdf12,electro,111qqq,kuang,fishin,clit,abstr,christma,qqqqq1,1234560,carnage,guyver,boxers,kittens,zeng,1000000,qwerty11,toaster,cramps,yugioh,02061987,icehouse,zxcvbnm123,pineapple,namaste,harrypotter,mygirl,falcon1,earnhard,fender1,spikes,nutmeg,01081989,dogboy,02091983,369852,softail,mypassword,prowler,bigboss,1112,harvest,heng,jubilee,killjoy,basset,keng,zaqxswcde,redsox1,biao,titan,misfit99,robot,wifey,kidrock,02101987,gameboy,enrico,1z2x3c4v,broncos1,arrows,havana,banger,cookie1,chriss,123qw,platypus,cindy1,lumber,pinball,foxy,london1,1023,05051987,02041985,password12,superma,longbow,radiohead,nigga,12051988,spongebo,qwert12345,abrakadabra,dodgers1,02101989,chillin,niceguy,pistons,hookup,santafe,bigben,jets,1013,vikings1,mankind,viktoriya,beardog,hammer1,02071980,reddwarf,magelan,longjohn,jennife,gilles,carmex2,02071987,stasik,bumper,doofus,slamdunk,pixies,garion,steffi,alessandro,beerman,niceass,warrior1,honolulu,134679852,visa,johndeer,mother1,windmill,boozer,oatmeal,aptiva,busty,delight,tasty,slick1,bergkamp,badgers,guitars,puffin,02091981,nikki1,irishman,miller1,zildjian,123000,airwolf,magnet,anai,install,02041981,02061983,astra,romans,megan1,mudvayne,freebird,muscles,dogbert,02091980,02091984,snowflak,01011900,mang,joseph1,nygiants,playstat,junior1,vjcrdf,qwer12,webhompas,giraffe,pelican,jefferso,comanche,bruiser,monkeybo,kjkszpj,123456l,micro,albany,02051987,angel123,epsilon,aladin,death666,hounddog,josephin,altima,chilly,02071988,78945,ultra,02041979,gasman,thisisit,pavel,idunno,kimmie,05051985,paulie,ballin,medion,moondog,manolo,pallmall,climber,fishbone,genesis1,153624,toffee,tbone,clippers,krypton,jerry1,picturs,compass,111111q,02051988,1121,02081977,sairam,getout,333777,cobras,22041987,bigblock,severin,booster,norwich,whiteout,ctrhtn,123456m,02061984,hewlett,shocker,fuckinside,02031981,chase1,white1,versace,123456789s,basebal,iloveyou2,bluebell,08031986,anthon,stubby,foreve,undertak,werder,saiyan,mama123,medic,chipmunk,mike123,mazdarx7,qwe123qwe,bowwow,kjrjvjnbd,celeb,choochoo,demo,lovelife,02051984,colnago,lithium,02051989,15051981,zzzxxx,welcom,anastasi,fidelio,franc,26061987,roadster,stone55,drifter,hookem,hellboy,1234qw,cbr900rr,sinned,good123654,storm1,gypsy,zebra,zachary1,toejam,buceta,02021979,testing1,redfox,lineage,mike1,highbury,koroleva,nathan1,washingt,02061982,02091985,vintage,redbaron,dalshe,mykids,11051987,macbeth,julien,james123,krasotka,111000,10011986,987123,pipeline,tatarin,sensei,codered,komodo,frogman,7894561230,nascar24,juicy,01031988,redrose,mydick,pigeon,tkbpfdtnf,smirnoff,1215,spam,winner1,flyfish,moskva,81fukkc,21031987,olesya,starligh,summer99,13041988,fishhead,freesex,super12,06061986,azazel,scoobydoo,02021981,cabron,yogibear,sheba1,konstantin,tranny,chilli,terminat,ghbywtccf,slowhand,soccer12,cricket1,fuckhead,1002,seagull,achtung,blam,bigbob,bdsm,nostromo,survivor,cnfybckfd,lemonade,boomer1,rainbow1,rober,irinka,cocksuck,peaches1,itsme,sugar1,zodiac,upyours,dinara,135791,sunny1,chiara,johnson1,02041989,solitude,habibi,sushi,markiz,smoke1,rockies,catwoman,johnny1,qwerty7,bearcats,username,01011978,wanderer,ohshit,02101986,sigma,stephen1,paradigm,02011989,flanker,sanity,jsbach,spotty,bologna,fantasia,chevys,borabora,cocker,74108520,123ewq,12021988,01061990,gtnhjdbx,02071981,01011960,sundevil,3000gt,mustang6,gagging,maggi,armstron,yfnfkb,13041987,revolver,02021976,trouble1,madcat,jeremy1,jackass1,volkswag,30051985,corndog,pool6123,marines1,03041991,pizza1,piggy,sissy,02031979,sunfire,angelus,undead,24061986,14061991,wildbill,shinobi,45m2do5bs,123qwer,21011989,cleopatr,lasvega,hornets,amorcit,11081989,coventry,nirvana1,destin,sidekick,20061988,02081983,gbhfvblf,sneaky,bmw325,22021989,nfytxrf,sekret,kalina,zanzibar,hotone,qazws,wasabi,heidi1,highlander,blues1,hitachi,paolo,23041987,slayer1,simba1,02011981,tinkerbe,kieran,01121986,172839,boiler,1125,bluesman,waffle,asdfgh01,threesom,conan,1102,reflex,18011987,nautilus,everlast,fatty,vader1,01071986,cyborg,ghbdtn123,birddog,rubble,02071983,suckers,02021973,skyhawk,12qw12qw,dakota1,joebob,nokia6233,woodie,longdong,lamer,troll,ghjcnjgfhjkm,420000,boating,nitro,armada,messiah,1031,penguin1,02091989,americ,02071989,redeye,asdqwe123,07071987,monty1,goten,spikey,sonata,635241,tokiohotel,sonyericsson,citroen,compaq1,1812,umpire,belmont,jonny,pantera1,nudes,palmtree,14111986,fenway,bighead,razor,gryphon,andyod22,aaaaa1,taco,10031988,enterme,malachi,dogface,reptile,01041985,dindom,handball,marseille,candy1,19101987,torino,tigge,matthias,viewsoni,13031987,stinker,evangelion,24011985,123456123,rampage,sandrine,02081980,thecrow,astral,28041987,sprinter,private1,seabee,shibby,02101988,25081988,fearless,junkie,01091987,aramis,antelope,draven,fuck1,mazda6,eggman,02021990,barselona,buddy123,19061987,fyfnjkbq,nancy1,12121990,10071987,sluggo,kille,hotties,irishka,zxcasdqwe123,shamus,fairlane,honeybee,soccer10,13061986,fantomas,17051988,10051987,20111986,gladiato,karachi,gambler,gordo,01011995,biatch,matthe,25800852,papito,excite,buffalo1,bobdole,cheshire,player1,28021992,thewho,10101986,pinky1,mentor,tomahawk,brown1,03041986,bismillah,bigpoppa,ijrjkfl,01121988,runaway,08121986,skibum,studman,helper,squeak,holycow,manfred,harlem,glock,gideon,987321,14021985,yellow1,wizard1,margarit,success1,medved,sf49ers,lambda,pasadena,johngalt,quasar,1776,02031980,coldplay,amand,playa,bigpimp,04041991,capricorn,elefant,sweetness,bruce1,luca,dominik,10011990,biker,09051945,datsun,elcamino,trinitro,malice,audi,voyager1,02101983,joe123,carpente,spartan1,mario1,glamour,diaper,12121985,22011988,winter1,asimov,callisto,nikolai,pebble,02101981,vendetta,david123,boytoy,11061985,02031989,iloveyou1,stupid1,cayman,casper1,zippo,yamahar1,wildwood,foxylady,calibra,02041980,27061988,dungeon,leedsutd,30041986,11051990,bestbuy,antares,dominion,24680,01061986,skillet,enforcer,derparol,01041988,196969,29071983,f00tball,purple1,mingus,25031987,21031990,remingto,giggles,klaste,3x7pxr,01011994,coolcat,29051989,megane,20031987,02051980,04041988,synergy,0000007,macman,iforget,adgjmp,vjqgfhjkm,28011987,rfvfcenhf,16051989,25121987,16051987,rogue,mamamia,08051990,20091991,1210,carnival,bolitas,paris1,dmitriy,dimas,05051989,papillon,knuckles,29011985,hola,tophat,28021990,100500,cutiepie,devo,415263,ducks,ghjuhfvvf,asdqwe,22021986,freefall,parol,02011983,zarina,buste,vitamin,warez,bigones,17061988,baritone,jamess,twiggy,mischief,bitchy,hetfield,1003,dontknow,grinch,sasha_007,18061990,12031985,12031987,calimero,224466,letmei,15011987,acmilan,alexandre,02031977,08081988,whiteboy,21051991,barney1,02071978,money123,18091985,bigdawg,02031988,cygnusx1,zoloto,31011987,firefigh,blowfish,screamer,lfybbk,20051988,chelse,11121986,01031989,harddick,sexylady,30031988,02041974,auditt,pizdec,kojak,kfgjxrf,20091988,123456ru,wp2003wp,1204,15051990,slugger,kordell1,03031986,swinging,01011974,02071979,rockie,dimples,1234123,1dragon,trucking,rusty2,roger1,marijuana,kerouac,02051978,08031985,paco,thecure,keepout,kernel,noname123,13121985,francisc,bozo,02011982,22071986,02101979,obsidian,12345qw,spud,tabasco,02051985,jaguars,dfktynby,kokomo,popova,notused,sevens,4200,magneto,02051976,roswell,15101986,21101986,lakeside,bigbang,aspen,little1,14021986,loki,suckmydick,strawber,carlos1,nokian73,dirty1,joshu,25091987,16121987,02041975,advent,17011987,slimshady,whistler,10101990,stryker,22031984,15021985,01031985,blueball,26031988,ksusha,bahamut,robocop,w_pass,chris123,impreza,prozac,bookie,bricks,13021990,alice1,cassandr,11111q,john123,4ever,korova,02051973,142857,25041988,paramedi,eclipse1,salope,07091990,1124,darkangel,23021986,999666,nomad,02051981,smackdow,01021990,yoyoma,argentin,moonligh,57chevy,bootys,hardone,capricor,galant,spanker,dkflbr,24111989,magpies,krolik,21051988,cevthrb,cheddar,22041988,bigbooty,scuba1,qwedsa,duffman,bukkake,acura,johncena,sexxy,p@ssw0rd,258369,cherries,12345s,asgard,leopold,fuck123,mopar,lalakers,dogpound,matrix1,crusty,spanner,kestrel,fenris,universa,peachy,assasin,lemmein,eggplant,hejsan,canucks,wendy1,doggy1,aikman,tupac,turnip,godlike,fussball,golden1,19283746,april1,django,petrova,captain1,vincent1,ratman,taekwondo,chocha,serpent,perfect1,capetown,vampir,amore,gymnast,timeout,nbvjatq,blue32,ksenia,k.lvbkf,nazgul,budweiser,clutch,mariya,sylveste,02051972,beaker,cartman1,q11111,sexxx,forever1,loser1,marseill,magellan,vehpbr,sexgod,jktxrf,hallo123,132456,liverpool1,southpaw,seneca,camden,357159,camero,tenchi,johndoe,145236,roofer,741963,vlad,02041978,fktyrf,zxcv123,wingnut,wolfpac,notebook,pufunga7782,brandy1,biteme1,goodgirl,redhat,02031978,challeng,millenium,hoops,maveric,noname,angus1,gaell,onion,olympus,sabrina1,ricard,sixpack,gratis,gagged,camaross,hotgirls,flasher,02051977,bubba123,goldfing,moonshin,gerrard,volkov,sonyfuck,mandrake,258963,tracer,lakers1,asians,susan1,money12,helmut,boater,diablo2,1234zxcv,dogwood,bubbles1,happy2,randy1,aries,beach1,marcius2,navigator,goodie,hellokitty,fkbyjxrf,earthlink,lookout,jumbo,opendoor,stanley1,marie1,12345m,07071977,ashle,wormix,murzik,02081976,lakewood,bluejays,loveya,commande,gateway2,peppe,01011976,7896321,goth,oreo,slammer,rasmus,faith1,knight1,stone1,redskin,ironmaiden,gotmilk,destiny1,dejavu,1master,midnite,timosha,espresso,delfin,toriamos,oberon,ceasar,markie,1a2s3d,ghhh47hj7649,vjkjrj,daddyo,dougie,disco,auggie,lekker,therock1,ou8123,start1,noway,p4ssw0rd,shadow12,333444,saigon,2fast4u,capecod,23skidoo,qazxcv,beater,bremen,aaasss,roadrunner,peace1,12345qwer,02071975,platon,bordeaux,vbkfirf,135798642,test12,supernov,beatles1,qwert40,optimist,vanessa1,prince1,ilovegod,nightwish,natasha1,alchemy,bimbo,blue99,patches1,gsxr1000,richar,hattrick,hott,solaris,proton,nevets,enternow,beavis1,amigos,159357a,ambers,lenochka,147896,suckdick,shag,intercourse,blue1234,spiral,02061977,tosser,ilove,02031975,cowgirl,canuck,q2w3e4,munch,spoons,waterboy,123567,evgeniy,savior,zasada,redcar,mamacita,terefon,globus,doggies,htubcnhfwbz,1008,cuervo,suslik,azertyui,limewire,houston1,stratfor,steaua,coors,tennis1,12345qwerty,stigmata,derf,klondike,patrici,marijuan,hardball,odyssey,nineinch,boston1,pass1,beezer,sandr,charon,power123,a1234,vauxhall,875421,awesome1,reggae,boulder,funstuff,iriska,krokodil,rfntymrf,sterva,champ1,bball,peeper,m123456,toolbox,cabernet,sheepdog,magic32,pigpen,02041977,holein1,lhfrjy,banan,dabomb,natalie1,jennaj,montana1,joecool,funky,steven1,ringo,junio,sammy123,qqqwww,baltimor,footjob,geezer,357951,mash4077,cashmone,pancake,monic,grandam,bongo,yessir,gocubs,nastia,vancouve,barley,dragon69,watford,ilikepie,02071976,laddie,123456789m,hairball,toonarmy,pimpdadd,cvthnm,hunte,davinci,lback,sophie1,firenze,q1234567,admin1,bonanza,elway7,daman,strap,azert,wxcvbn,afrika,theforce,123456t,idefix,wolfen,houdini,scheisse,default,beech,maserati,02061976,sigmachi,dylan1,bigdicks,eskimo,mizzou,02101976,riccardo,egghead,111777,kronos,ghbrjk,chaos1,jomama,rfhnjirf,rodeo,dolemite,cafc91,nittany,pathfind,mikael,password9,vqsablpzla,purpl,gabber,modelsne,myxworld,hellsing,punker,rocknrol,fishon,fuck69,02041976,lolol,twinkie,tripleh,cirrus,redbone,killer123,biggun,allegro,gthcbr,smith1,wanking,bootsy,barry1,mohawk,koolaid,5329,futurama,samoht,klizma,996633,lobo,honeys,peanut1,556677,zxasqw,joemama,javelin,samm,223322,sandra1,flicks,montag,nataly,3006,tasha1,1235789,dogbone,poker1,p0o9i8u7,goodday,smoothie,toocool,max333,metroid,archange,vagabond,billabon,22061941,tyson1,02031973,darkange,skateboard,evolutio,morrowind,wizards,frodo1,rockin,cumslut,plastics,zaqwsxcde,5201314,doit,outback,bumble,dominiqu,persona,nevermore,alinka,02021971,forgetit,sexo,all4one,c2h5oh,petunia,sheeba,kenny1,elisabet,aolsucks,woodstoc,pumper,02011975,fabio,granada,scrapper,123459,minimoni,q123456789,breaker,1004,02091976,ncc74656,slimshad,friendster,austin31,wiseguy,donner,dilbert1,132465,blackbird,buffet,jellybean,barfly,behappy,01011971,carebear,fireblad,02051975,boxcar,cheeky,kiteboy,hello12,panda1,elvisp,opennow,doktor,alex12,02101977,pornking,flamengo,02091975,snowbird,lonesome,robin1,11111a,weed420,baracuda,bleach,12345abc,nokia1,metall,singapor,mariner,herewego,dingo,tycoon,cubs,blunts,proview,123456789d,kamasutra,lagnaf,vipergts,navyseal,starwar,masterbate,wildone,peterbil,cucumber,butkus,123qwert,climax,deniro,gotribe,cement,scooby1,summer69,harrier,shodan,newyear,02091977,starwars1,romeo1,sedona,harald,doubled,sasha123,bigguns,salami,awnyce,kiwi,homemade,pimping,azzer,bradley1,warhamme,linkin,dudeman,qwe321,pinnacle,maxdog,flipflop,lfitymrf,fucker1,acidburn,esquire,sperma,fellatio,jeepster,thedon,sexybitch,pookey,spliff,widget,vfntvfnbrf,trinity1,mutant,samuel1,meliss,gohome,1q2q3q,mercede,comein,grin,cartoons,paragon,henrik,rainyday,pacino,senna,bigdog1,alleycat,12345qaz,narnia,mustang2,tanya1,gianni,apollo11,wetter,clovis,escalade,rainbows,freddy1,smart1,daisydog,s123456,cocksucker,pushkin,lefty,sambo,fyutkjxtr,hiziad,boyz,whiplash,orchard,newark,adrenalin,1598753,bootsie,chelle,trustme,chewy,golfgti,tuscl,ambrosia,5wr2i7h8,penetration,shonuf,jughead,payday,stickman,gotham,kolokol,johnny5,kolbasa,stang,puppydog,charisma,gators1,mone,jakarta,draco,nightmar,01011973,inlove,laetitia,02091973,tarpon,nautica,meadow,0192837465,luckyone,14881488,chessie,goldeney,tarakan,69camaro,bungle,wordup,interne,fuckme2,515000,dragonfl,sprout,02081974,gerbil,bandit1,02071971,melanie1,phialpha,camber,kathy1,adriano,gonzo1,10293847,bigjohn,bismarck,7777777a,scamper,12348765,rabbits,222777,bynthytn,dima123,alexander1,mallorca,dragster,favorite6,beethove,burner,cooper1,fosters,hello2,normandy,777999,sebring,1michael,lauren1,blake1,killa,02091971,nounours,trumpet1,thumper1,playball,xantia,rugby1,rocknroll,guillaum,angela1,strelok,prosper,buttercup,masterp,dbnfkbr,cambridg,venom,treefrog,lumina,1234566,supra,sexybabe,freee,shen,frogs,driller,pavement,grace1,dicky,checker,smackdown,pandas,cannibal,asdffdsa,blue42,zyjxrf,nthvbyfnjh,melrose,neon,jabber,gamma,369258147,aprilia,atticus,benessere,catcher,skipper1,azertyuiop,sixty9,thierry,treetop,jello,melons,123456789qwe,tantra,buzzer,catnip,bouncer,computer1,sexyone,ananas,young1,olenka,sexman,mooses,kittys,sephiroth,contra,hallowee,skylark,sparkles,777333,1qazxsw23edc,lucas1,q1w2e3r,gofast,hannes,amethyst,ploppy,flower2,hotass,amatory,volleyba,dixie1,bettyboo,ticklish,02061974,frenchy,phish1,murphy1,trustno,02061972,leinad,mynameis,spooge,jupiter1,hyundai,frosch,junkmail,abacab,marbles,32167,casio,sunshine1,wayne1,longhair,caster,snicker,02101973,gannibal,skinhead,hansol,gatsby,segblue2,montecar,plato,gumby,kaboom,matty,bosco1,888999,jazzy,panter,jesus123,charlie2,giulia,candyass,sex69,travis1,farmboy,special1,02041973,letsdoit,password01,allison1,abcdefg1,notredam,ilikeit,789654123,liberty1,rugger,uptown,alcatraz,123456w,airman,007bond,navajo,kenobi,terrier,stayout,grisha,frankie1,fluff,1qazzaq1,1234561,virginie,1234568,tango1,werdna,octopus,fitter,dfcbkbcf,blacklab,115599,montrose,allen1,supernova,frederik,ilovepussy,justice1,radeon,playboy2,blubber,sliver,swoosh,motocros,lockdown,pearls,thebear,istheman,pinetree,biit,1234rewq,rustydog,tampabay,titts,babycake,jehovah,vampire1,streaming,collie,camil,fidelity,calvin1,stitch,gatit,restart,puppy1,budgie,grunt,capitals,hiking,dreamcas,zorro1,321678,riffraff,makaka,playmate,napalm,rollin,amstel,zxcvb123,samanth,rumble,fuckme69,jimmys,951357,pizzaman,1234567899,tralala,delpiero,alexi,yamato,itisme,1million,vfndtq,kahlua,londo,wonderboy,carrots,tazz,ratboy,rfgecnf,02081973,nico,fujitsu,tujhrf,sergbest,blobby,02051970,sonic1,1357911,smirnov,video1,panhead,bucky,02031974,44332211,duffer,cashmoney,left4dead,bagpuss,salman,01011972,titfuck,66613666,england1,malish,dresden,lemans,darina,zapper,123456as,123456qqq,met2002,02041972,redstar,blue23,1234509876,pajero,booyah,please1,tetsuo,semper,finder,hanuman,sunlight,123456n,02061971,treble,cupoi,password99,dimitri,3ip76k2,popcorn1,lol12345,stellar,nympho,shark1,keith1,saskia,bigtruck,revoluti,rambo1,asd222,feelgood,phat,gogators,bismark,cola,puck,furball,burnout,slonik,bowtie,mommy1,icecube,fabienn,mouser,papamama,rolex,giants1,blue11,trooper1,momdad,iklo,morten,rhubarb,gareth,123456d,blitz,canada1,r2d2,brest,tigercat,usmarine,lilbit,benny1,azrael,lebowski,12345r,madagaskar,begemot,loverman,dragonballz,italiano,mazda3,naughty1,onions,diver1,cyrano,capcom,asdfg123,forlife,fisherman,weare138,requiem,mufasa,alpha123,piercing,hellas,abracadabra,duckman,caracas,macintos,02011971,jordan2,crescent,fduecn,hogtied,eatmenow,ramjet,18121812,kicksass,whatthe,discus,rfhfvtkmrf,rufus1,sqdwfe,mantle,vegitto,trek,dan123,paladin1,rudeboy,liliya,lunchbox,riversid,acapulco,libero,dnsadm,maison,toomuch,boobear,hemlock,sextoy,pugsley,misiek,athome,migue,altoids,marcin,123450,rhfcfdbwf,jeter2,rhinos,rjhjkm,mercury1,ronaldinho,shampoo,makayla,kamilla,masterbating,tennesse,holger,john1,matchbox,hores,poptart,parlament,goodyear,asdfgh1,02081970,hardwood,alain,erection,hfytnrb,highlife,implants,benjami,dipper,jeeper,bendover,supersonic,babybear,laserjet,gotenks,bama,natedogg,aol123,pokemo,rabbit1,raduga,sopranos,cashflow,menthol,pharao,hacking,334455,ghjcnbnenrf,lizzy,muffin1,pooky,penis1,flyer,gramma,dipset,becca,ireland1,diana1,donjuan,pong,ziggy1,alterego,simple1,cbr900,logger,111555,claudia1,cantona7,matisse,ljxtymrf,victori,harle,mamas,encore,mangos,iceman1,diamon,alexxx,tiamat,5000,desktop,mafia,smurf,princesa,shojou,blueberr,welkom,maximka,123890,123q123,tammy1,bobmarley,clips,demon666,ismail,termite,laser1,missie,altair,donna1,bauhaus,trinitron,mogwai,flyers88,juniper,nokia5800,boroda,jingles,qwerasdfzxcv,shakur,777666,legos,mallrats,1qazxsw,goldeneye,tamerlan,julia1,backbone,spleen,49ers,shady,darkone,medic1,justi,giggle,cloudy,aisan,douche,parkour,bluejay,huskers1,redwine,1qw23er4,satchmo,1231234,nineball,stewart1,ballsack,probes,kappa,amiga,flipper1,dortmund,963258,trigun,1237895,homepage,blinky,screwy,gizzmo,belkin,chemist,coolhand,chachi,braves1,thebest,greedisgood,pro100,banana1,101091m,123456g,wonderfu,barefeet,8inches,1111qqqq,kcchiefs,qweasdzxc123,metal1,jennifer1,xian,asdasd123,pollux,cheerleaers,fruity,mustang5,turbos,shopper,photon,espana,hillbill,oyster,macaroni,gigabyte,jesper,motown,tuxedo,buster12,triplex,cyclones,estrell,mortis,holla,456987,fiddle,sapphic,jurassic,thebeast,ghjcnjq,baura,spock1,metallica1,karaoke,nemrac58,love1234,02031970,flvbybcnhfnjh,frisbee,diva,ajax,feathers,flower1,soccer11,allday,mierda,pearl1,amature,marauder,333555,redheads,womans,egorka,godbless,159263,nimitz,aaaa1111,sashka,madcow,socce,greywolf,baboon,pimpdaddy,123456789r,reloaded,lancia,rfhfylfi,dicker,placid,grimace,22446688,olemiss,whores,culinary,wannabe,maxi,1234567aa,amelie,riley1,trample,phantom1,baberuth,bramble,asdfqwer,vides,4you,abc123456,taichi,aztnm,smother,outsider,hakr,blackhawk,bigblack,girlie,spook,valeriya,gianluca,freedo,1q2q3q4q,handbag,lavalamp,cumm,pertinant,whatup,nokia123,redlight,patrik,111aaa,poppy1,dfytxrf,aviator,sweeps,kristin1,cypher,elway,yinyang,access1,poophead,tucson,noles1,monterey,waterfal,dank,dougal,918273,suede,minnesot,legman,bukowski,ganja,mammoth,riverrat,asswipe,daredevi,lian,arizona1,kamikadze,alex1234,smile1,angel2,55bgates,bellagio,0001,wanrltw,stiletto,lipton,arsena,biohazard,bbking,chappy,tetris,as123456,darthvad,lilwayne,nopassword,7412369,123456789987654321,natchez,glitter,14785236,mytime,rubicon,moto,pyon,wazzup,tbird,shane1,nightowl,getoff,beckham7,trueblue,hotgirl,nevermin,deathnote,13131,taffy,bigal,copenhag,apricot,gallaries,dtkjcbgtl,totoro,onlyone,civicsi,jesse1,baby123,sierra1,festus,abacus,sickboy,fishtank,fungus,charle,golfpro,teensex,mario66,seaside,aleksei,rosewood,blackberry,1020304050,bedlam,schumi,deerhunt,contour,darkelf,surveyor,deltas,pitchers,741258963,dipstick,funny1,lizzard,112233445566,jupiter2,softtail,titman,greenman,z1x2c3v4b5,smartass,12345677,notnow,myworld,nascar1,chewbacc,nosferatu,downhill,dallas22,kuan,blazers,whales,soldat,craving,powerman,yfcntyf,hotrats,cfvceyu,qweasdzx,princess1,feline,qqwwee,chitown,1234qaz,mastermind,114477,dingbat,care1839,standby,kismet,atreides,dogmeat,icarus,monkeyboy,alex1,mouses,nicetits,sealteam,chopper1,crispy,winter99,rrpass1,myporn,myspace1,corazo,topolino,ass123,lawman,muffy,orgy,1love,passord,hooyah,ekmzyf,pretzel,amonra,nestle,01011950,jimbeam,happyman,z12345,stonewal,helios,manunited,harcore,dick1,gaymen,2hot4u,light1,qwerty13,kakashi,pjkjnj,alcatel,taylo,allah,buddydog,ltkmaby,mongo,blonds,start123,audia6,123456v,civilwar,bellaco,turtles,mustan,deadspin,aaa123,fynjirf,lucky123,tortoise,amor,summe,waterski,zulu,drag0n,dtxyjcnm,gizmos,strife,interacial,pusyy,goose1,bear1,equinox,matri,jaguar1,tobydog,sammys,nachos,traktor,bryan1,morgoth,444555,dasani,miami1,mashka,xxxxxx1,ownage,nightwin,hotlips,passmast,cool123,skolko,eldiablo,manu,1357908642,screwyou,badabing,foreplay,hydro,kubrick,seductive,demon1,comeon,galileo,aladdin,metoo,happines,902100,mizuno,caddy,bizzare,girls1,redone,ohmygod,sable,bonovox,girlies,hamper,opus,gizmodo1,aaabbb,pizzahut,999888,rocky2,anton1,kikimora,peavey,ocelot,a1a2a3a4,2wsx3edc,jackie1,solace,sprocket,galary,chuck1,volvo1,shurik,poop123,locutus,virago,wdtnjxtr,tequier,bisexual,doodles,makeitso,fishy,789632145,nothing1,fishcake,sentry,libertad,oaktree,fivestar,adidas1,vegitta,mississi,spiffy,carme,neutron,vantage,agassi,boners,123456789v,hilltop,taipan,barrage,kenneth1,fister,martian,willem,lfybkf,bluestar,moonman,ntktdbpjh,paperino,bikers,daffy,benji,quake,dragonfly,suckcock,danilka,lapochka,belinea,calypso,asshol,camero1,abraxas,mike1234,womam,q1q2q3q4q5,youknow,maxpower,pic\'s,audi80,sonora,raymond1,tickler,tadpole,belair,crazyman,finalfantasy,999000,jonatha,paisley,kissmyas,morgana,monste,mantra,spunk,magic123,jonesy,mark1,alessand,741258,baddest,ghbdtnrfrltkf,zxccxz,tictac,augustin,racers,7grout,foxfire,99762000,openit,nathanie,1z2x3c4v5b,seadog,gangbanged,lovehate,hondacbr,harpoon,mamochka,fisherma,bismilla,locust,wally1,spiderman1,saffron,utjhubq,123456987,20spanks,safeway,pisser,bdfyjd,kristen1,bigdick1,magenta,vfhujif,anfisa,friday13,qaz123wsx,0987654321q,tyrant,guan,meggie,kontol,nurlan,ayanami,rocket1,yaroslav,websol76,mutley,hugoboss,websolutions,elpaso,gagarin,badboys,sephirot,918273645,newuser,qian,edcrfv,booger1,852258,lockout,timoxa94,mazda323,firedog,sokolova,skydiver,jesus777,1234567890z,soulfly,canary,malinka,guillerm,hookers,dogfart,surfer1,osprey,india123,rhjkbr,stoppedby,nokia5530,123456789o,blue1,werter,divers,3000,123456f,alpina,cali,whoknows,godspeed,986532,foreskin,fuzzy1,heyyou,didier,slapnuts,fresno,rosebud1,sandman1,bears1,blade1,honeybun,queen1,baronn,pakista,philipp,9111961,topsecret,sniper1,214365,slipper,letsfuck,pippen33,godawgs,mousey,qw123456,scrotum,loveis,lighthou,bp2002,nancy123,jeffrey1,susieq,buddy2,ralphie,trout1,willi,antonov,sluttey,rehbwf,marty1,darian,losangeles,letme1n,12345d,pusssy,godiva,ender,golfnut,leonidas,a1b2c3d4e5,puffer,general1,wizzard,lehjxrf,racer1,bigbucks,cool12,buddys,zinger,esprit,vbienrf,josep,tickling,froggie,987654321a,895623,daddys,crumbs,gucci,mikkel,opiate,tracy1,christophe,came11,777555,petrovich,humbug,dirtydog,allstate,horatio,wachtwoord,creepers,squirts,rotary,bigd,georgia1,fujifilm,2sweet,dasha,yorkie,slimjim,wiccan,kenzie,system1,skunk,b12345,getit,pommes,daredevil,sugars,bucker,piston,lionheart,1bitch,515051,catfight,recon,icecold,fantom,vodafone,kontakt,boris1,vfcnth,canine,01011961,valleywa,faraon,chickenwing101,qq123456,livewire,livelife,roosters,jeepers,ilya1234,coochie,pavlik,dewalt,dfhdfhf,architec,blackops,1qaz2wsx3edc4rfv,rhfcjnf,wsxedc,teaser,sebora,25252,rhino1,ankara,swifty,decimal,redleg,shanno,nermal,candies,smirnova,dragon01,photo1,ranetki,a1s2d3f4g5,axio,wertzu,maurizio,6uldv8,zxcvasdf,punkass,flowe,graywolf,peddler,3rjs1la7qe,mpegs,seawolf,ladyboy,pianos,piggies,vixen,alexus,orpheus,gdtrfb,z123456,macgyver,hugetits,ralph1,flathead,maurici,mailru,goofball,nissan1,nikon,stopit,odin,big1,smooch,reboot,famil,bullit,anthony7,gerhard,methos,124038,morena,eagle2,jessica2,zebras,getlost,gfynthf,123581321,sarajevo,indon,comets,tatjana,rfgbnjirf,joystick,batman12,123456c,sabre,beerme,victory1,kitties,1475369,badboy1,booboo1,comcast,slava,squid,saxophon,lionhear,qaywsx,bustle,nastena,roadway,loader,hillside,starlight,24681012,niggers,access99,bazooka,molly123,blackice,bandi,cocacol,nfhfrfy,timur,muschi,horse1,quant4307s,squerting,oscars,mygirls,flashman,tangerin,goofy1,p0o9i8,housewifes,newness,monkey69,escorpio,password11,hippo,warcraft3,qazxsw123,qpalzm,ribbit,ghbdtndctv,bogota,star123,258000,lincoln1,bigjim,lacoste,firestorm,legenda,indain,ludacris,milamber,1009,evangeli,letmesee,a111111,hooters1,bigred1,shaker,husky,a4tech,cnfkrth,argyle,rjhjdf,nataha,0o9i8u7y,gibson1,sooners1,glendale,archery,hoochie,stooge,aaaaaa1,scorpions,school1,vegas1,rapier,mike23,bassoon,groupd2013,macaco,baker1,labia,freewill,santiag,silverado,butch1,vflfufcrfh,monica1,rugrat,cornhole,aerosmit,bionicle,gfgfvfvf,daniel12,virgo,fmale,favorite2,detroit1,pokey,shredder,baggies,wednesda,cosmo1,mimosa,sparhawk,firehawk,romario,911turbo,funtimes,fhntvrf,nexus6,159753456,timothy1,bajingan,terry1,frenchie,raiden,1mustang,babemagnet,74123698,nadejda,truffles,rapture,douglas1,lamborghini,motocross,rjcvjc,748596,skeeter1,dante1,angel666,telecom,carsten,pietro,bmw318,astro1,carpediem,samir,orang,helium,scirocco,fuzzball,rushmore,rebelz,hotspur,lacrimosa,chevys10,madonna1,domenico,yfnfirf,jachin,shelby1,bloke,dawgs,dunhill,atlanta1,service1,mikado,devilman,angelit,reznor,euphoria,lesbain,checkmat,browndog,phreak,blaze1,crash1,farida,mutter,luckyme,horsemen,vgirl,jediknig,asdas,cesare,allnight,rockey,starlite,truck1,passfan,close-up,samue,cazzo,wrinkles,homely,eatme1,sexpot,snapshot,dima1995,asthma,thetruth,ducky,blender,priyanka,gaucho,dutchman,sizzle,kakarot,651550,passcode,justinbieber,666333,elodie,sanjay,110442,alex01,lotus1,2300mj,lakshmi,zoomer,quake3,12349876,teapot,12345687,ramada,pennywis,striper,pilot1,chingon,optima,nudity,ethan1,euclid,beeline,loyola,biguns,zaq12345,bravo1,disney1,buffa,assmunch,vivid,6661313,wellingt,aqwzsx,madala11,9874123,sigmar,pictere,tiptop,bettyboop,dinero,tahiti,gregory1,bionic,speed1,fubar1,lexus1,denis1,hawthorn,saxman,suntzu,bernhard,dominika,camaro1,hunter12,balboa,bmw2002,seville,diablo1,vfhbyjxrf,1234abc,carling,lockerroom,punani,darth,baron1,vaness,1password,libido,picher,232425,karamba,futyn007,daydream,11001001,dragon123,friends1,bopper,rocky123,chooch,asslover,shimmer,riddler,openme,tugboat,sexy123,midori,gulnara,christo,swatch,laker,offroad,puddles,hackers,mannheim,manager1,horseman,roman1,dancer1,komputer,pictuers,nokia5130,ejaculation,lioness,123456y,evilone,nastenka,pushok,javie,lilman,3141592,mjolnir,toulouse,pussy2,bigworm,smoke420,fullback,extensa,dreamcast,belize,delboy,willie1,casablanca,csyjxtr,ricky1,bonghit,salvator,basher,pussylover,rosie1,963258741,vivitron,cobra427,meonly,armageddon,myfriend,zardoz,qwedsazxc,kraken,fzappa,starfox,333999,illmatic,capoeira,weenie,ramzes,freedom2,toasty,pupkin,shinigami,fhvfutljy,nocturne,churchil,thumbnils,tailgate,neworder,sexymama,goarmy,cerebus,michelle1,vbifyz,surfsup,earthlin,dabulls,basketbal,aligator,mojojojo,saibaba,welcome2,wifes,wdtnjr,12345w,slasher,papabear,terran,footman,hocke,153759,texans,tom123,sfgiants,billabong,aassdd,monolith,xxx777,l3tm31n,ticktock,newone,hellno,japanees,contortionist,admin123,scout1,alabama1,divx1,rochard,privat,radar1,bigdad,fhctybq,tortuga,citrus,avanti,fantasy1,woodstock,s12345,fireman1,embalmer,woodwork,bonzai,konyor,newstart,jigga,panorama,goats,smithy,rugrats,hotmama,daedalus,nonstop,fruitbat,lisenok,quaker,violator,12345123,my3sons,cajun,fraggle,gayboy,oldfart,vulva,knickerless,orgasms,undertow,binky,litle,kfcnjxrf,masturbation,bunnie,alexis1,planner,transexual,sparty,leeloo,monies,fozzie,stinger1,landrove,anakonda,scoobie,yamaha1,henti,star12,rfhlbyfk,beyonce,catfood,cjytxrf,zealots,strat,fordtruc,archangel,silvi,sativa,boogers,miles1,bigjoe,tulip,petite,greentea,shitter,jonboy,voltron,morticia,evanescence,3edc4rfv,longshot,windows1,serge,aabbcc,starbucks,sinful,drywall,prelude1,www123,camel1,homebrew,marlins,123412,letmeinn,domini,swampy,plokij,fordf350,webcam,michele1,bolivi,27731828,wingzero,qawsedrftg,shinji,sverige,jasper1,piper1,cummer,iiyama,gocats,amour,alfarome,jumanji,mike69,fantasti,1monkey,w00t88,shawn1,lorien,1a2s3d4f5g,koleso,murph,natascha,sunkist,kennwort,emine,grinder,m12345,q1q2q3q4,cheeba,money2,qazwsxedc1,diamante,prosto,pdiddy,stinky1,gabby1,luckys,franci,pornographic,moochie,gfhjdjp,samdog,empire1,comicbookdb,emili,motdepasse,iphone,braveheart,reeses,nebula,sanjose,bubba2,kickflip,arcangel,superbow,porsche911,xyzzy,nigger1,dagobert,devil1,alatam,monkey2,barbara1,12345v,vfpfafrf,alessio,babemagn,aceman,arrakis,kavkaz,987789,jasons,berserk,sublime1,rogue1,myspace,buckwhea,csyekz,pussy4me,vette1,boots1,boingo,arnaud,budlite,redstorm,paramore,becky1,imtheman,chango,marley1,milkyway,666555,giveme,mahalo,lux2000,lucian,paddy,praxis,shimano,bigpenis,creeper,newproject2004,rammstei,j3qq4h7h2v,hfljcnm,lambchop,anthony2,bugman,gfhjkm12,dreamer1,stooges,cybersex,diamant,cowboyup,maximus1,sentra,615243,goethe,manhatta,fastcar,selmer,1213141516,yfnfitymrf,denni,chewey,yankee1,elektra,123456789p,trousers,fishface,topspin,orwell,vorona,sodapop,motherfu,ibilltes,forall,kookie,ronald1,balrog,maximilian,mypasswo,sonny1,zzxxcc,tkfkdg,magoo,mdogg,heeled,gitara,lesbos,marajade,tippy,morozova,enter123,lesbean,pounded,asd456,fialka,scarab,sharpie,spanky1,gstring,sachin,12345asd,princeto,hellohel,ursitesux,billows,1234kekc,kombat,cashew,duracell,kseniya,sevenof9,kostik,arthur1,corvet07,rdfhnbhf,songoku,tiberian,needforspeed,1qwert,dropkick,kevin123,panache,libra,a123456a,kjiflm,vfhnsirf,cntgfy,iamcool,narut,buffer,sk8ordie,urlaub,fireblade,blanked,marishka,gemini1,altec,gorillaz,chief1,revival47,ironman1,space1,ramstein,doorknob,devilmaycry,nemesis1,sosiska,pennstat,monday1,pioner,shevchenko,detectiv,evildead,blessed1,aggie,coffees,tical,scotts,bullwink,marsel,krypto,adrock,rjitxrf,asmodeus,rapunzel,theboys,hotdogs,deepthro,maxpayne,veronic,fyyeirf,otter,cheste,abbey1,thanos,bedrock,bartok,google1,xxxzzz,rodent,montecarlo,hernande,mikayla,123456789l,bravehea,12locked,ltymub,pegasus1,ameteur,saltydog,faisal,milfnew,momsuck,everques,ytngfhjkz,m0nkey,businessbabe,cooki,custard,123456ab,lbvjxrf,outlaws,753357,qwerty78,udacha,insider,chees,fuckmehard,shotokan,katya,seahorse,vtldtlm,turtle1,mike12,beebop,heathe,everton1,darknes,barnie,rbcekz,alisher,toohot,theduke,555222,reddog1,breezy,bulldawg,monkeyman,baylee,losangel,mastermi,apollo1,aurelie,zxcvb12345,cayenne,bastet,wsxzaq,geibcnbr,yello,fucmy69,redwall,ladybird,bitchs,cccccc1,rktjgfnhf,ghjdthrf,quest1,oedipus,linus,impalass,fartman,12345k,fokker,159753a,optiplex,bbbbbb1,realtor,slipkno,santacru,rowdy,jelena,smeller,3984240,ddddd1,sexyme,janet1,3698741,eatme69,cazzone,today1,poobear,ignatius,master123,newpass1,heather2,snoopdogg,blondinka,pass12,honeydew,fuckthat,890098890,lovem,goldrush,gecko,biker1,llama,pendejo,avalanche,fremont,snowman1,gandolf,chowder,1a2b3c4d5e,flyguy,magadan,1fuck,pingvin,nokia5230,ab1234,lothar,lasers,bignuts,renee1,royboy,skynet,12340987,1122334,dragrace,lovely1,22334455,booter,12345612,corvett,123456qq,capital1,videoes,funtik,wyvern,flange,sammydog,hulkster,13245768,not4you,vorlon,omegared,l58jkdjp!,filippo,123mudar,samadams,petrus,chris12,charlie123,123456789123,icetea,sunderla,adrian1,123qweas,kazanova,aslan,monkey123,fktyeirf,goodsex,123ab,lbtest,banaan,bluenose,837519,asd12345,waffenss,whateve,1a2a3a4a,trailers,vfhbirf,bhbcrf,klaatu,turk182,monsoon,beachbum,sunbeam,succes,clyde1,viking1,rawhide,bubblegum,princ,mackenzi,hershey1,222555,dima55,niggaz,manatee,aquila,anechka,pamel,bugsbunn,lovel,sestra,newport1,althor,hornyman,wakeup,zzz111,phishy,cerber,torrent,thething,solnishko,babel,buckeye1,peanu,ethernet,uncencored,baraka,665544,chris2,rb26dett,willy1,choppers,texaco,biggirl,123456b,anna2614,sukebe,caralho,callofduty,rt6ytere,jesus7,angel12,1money,timelord,allblack,pavlova,romanov,tequiero,yitbos,lookup,bulls23,snowflake,dickweed,barks,lever,irisha,firestar,fred1234,ghjnjnbg,danman,gatito,betty1,milhouse,kbctyjr,masterbaiting,delsol,papit,doggys,123698741,bdfyjdf,invictus,bloods,kayla1,yourmama,apple2,angelok,bigboy1,pontiac1,verygood,yeshua,twins2,porn4me,141516,rasta69,james2,bosshog,candys,adventur,stripe,djkjlz,dokken,austin316,skins,hogwarts,vbhevbh,navigato,desperado,xxx666,cneltyn,vasiliy,hazmat,daytek,eightbal,fred1,four20,74227422,fabia,aerosmith,manue,wingchun,boohoo,hombre,sanity72,goatboy,fuckm,partizan,avrora,utahjazz,submarin,pussyeat,heinlein,control1,costaric,smarty,chuan,triplets,snowy,snafu,teacher1,vangogh,vandal,evergree,cochise,qwerty99,pyramid1,saab900,sniffer,qaz741,lebron23,mark123,wolvie,blackbelt,yoshi,feeder,janeway,nutella,fuking,asscock,deepak,poppie,bigshow,housewife,grils,tonto,cynthia1,temptress,irakli,belle1,russell1,manders,frank123,seabass,gforce,songbird,zippy1,naught,brenda1,chewy1,hotshit,topaz,43046721,girfriend,marinka,jakester,thatsme,planeta,falstaff,patrizia,reborn,riptide,cherry1,shuan,nogard,chino,oasis1,qwaszx12,goodlife,davis1,1911a1,harrys,shitfuck,12345678900,russian7,007700,bulls1,porshe,danil,dolphi,river1,sabaka,gobigred,deborah1,volkswagen,miamo,alkaline,muffdive,1letmein,fkbyrf,goodguy,hallo1,nirvan,ozzie,cannonda,cvbhyjdf,marmite,germany1,joeblow,radio1,love11,raindrop,159852,jacko,newday,fathead,elvis123,caspe,citibank,sports1,deuce,boxter,fakepass,golfman,snowdog,birthday4,nonmembe,niklas,parsifal,krasota,theshit,1235813,maganda,nikita1,omicron,cassie1,columbo,buick,sigma1,thistle,bassin,rickster,apteka,sienna,skulls,miamor,coolgirl,gravis,1qazxc,virgini,hunter2,akasha,batma,motorcyc,bambino,tenerife,fordf250,zhuan,iloveporn,markiza,hotbabes,becool,fynjybyf,wapapapa,forme,mamont,pizda,dragonz,sharon1,scrooge,mrbill,pfloyd,leeroy,natedog,ishmael,777111,tecumseh,carajo,nfy.irf,0000000000o,blackcock,fedorov,antigone,feanor,novikova,bobert,peregrin,spartan117,pumkin,rayman,manuals,tooltime,555333,bonethug,marina1,bonnie1,tonyhawk,laracroft,mahalkita,18273645,terriers,gamer,hoser,littlema,molotok,glennwei,lemon1,caboose,tater,12345654321,brians,fritz1,mistral,jigsaw,fuckshit,hornyguy,southside,edthom,antonio1,bobmarle,pitures,ilikesex,crafty,nexus,boarder,fulcrum,astonvil,yanks1,yngwie,account1,zooropa,hotlegs,sammi,gumbo,rover1,perkele,maurolarastefy,lampard,357753,barracud,dmband,abcxyz,pathfinder,335577,yuliya,micky,jayman,asdfg12345,1596321,halcyon,rerfhtre,feniks,zaxscd,gotyoass,jaycee,samson1,jamesb,vibrate,grandpri,camino,colossus,davidb,mamo4ka,nicky1,homer123,pinguin,watermelon,shadow01,lasttime,glider,823762,helen1,pyramids,tulane,osama,rostov,john12,scoote,bhbyrf,gohan,galeries,joyful,bigpussy,tonka,mowgli,astalavista,zzz123,leafs,dalejr8,unicorn1,777000,primal,bigmama,okmijn,killzone,qaz12345,snookie,zxcvvcxz,davidc,epson,rockman,ceaser,beanbag,katten,3151020,duckhunt,segreto,matros,ragnar,699669,sexsexse,123123z,fuckyeah,bigbutts,gbcmrf,element1,marketin,saratov,elbereth,blaster1,yamahar6,grime,masha,juneau,1230123,pappy,lindsay1,mooner,seattle1,katzen,lucent,polly1,lagwagon,pixie,misiaczek,666666a,smokedog,lakers24,eyeball,ironhors,ametuer,volkodav,vepsrf,kimmy,gumby1,poi098,ovation,1q2w3,drinker,penetrating,summertime,1dallas,prima,modles,takamine,hardwork,macintosh,tahoe,passthie,chiks,sundown,flowers1,boromir,music123,phaedrus,albert1,joung,malakas,gulliver,parker1,balder,sonne,jessie1,domainlock2005,express1,vfkbyf,youandme,raketa,koala,dhjnvytyjub,nhfrnjh,testibil,ybrbnjc,987654321q,axeman,pintail,pokemon123,dogggg,shandy,thesaint,11122233,x72jhhu3z,theclash,raptors,zappa1,djdjxrf,hell666,friday1,vivaldi,pluto1,lance1,guesswho,jeadmi,corgan,skillz,skippy1,mango1,gymnastic,satori,362514,theedge,cxfcnkbdfz,sparkey,deicide,bagels,lololol,lemmings,r4e3w2q1,silve,staind,schnuffi,dazzle,basebal1,leroy1,bilbo1,luckie,qwerty2,goodfell,hermione,peaceout,davidoff,yesterda,killah,flippy,chrisb,zelda1,headless,muttley,fuckof,tittys,catdaddy,photog,beeker,reaver,ram1500,yorktown,bolero,tryagain,arman,chicco,learjet,alexei,jenna1,go2hell,12s3t4p55,momsanaladventure,mustang9,protoss,rooter,ginola,dingo1,mojave,erica1,1qazse4,marvin1,redwolf,sunbird,dangerou,maciek,girsl,hawks1,packard1,excellen,dashka,soleda,toonces,acetate,nacked,jbond007,alligator,debbie1,wellhung,monkeyma,supers,rigger,larsson,vaseline,rjnzhf,maripos,123456asd,cbr600rr,doggydog,cronic,jason123,trekker,flipmode,druid,sonyvaio,dodges,mayfair,mystuff,fun4me,samanta,sofiya,magics,1ranger,arcane,sixtynin,222444,omerta,luscious,gbyudby,bobcats,envision,chance1,seaweed,holdem,tomate,mensch,slicer,acura1,goochi,qweewq,punter,repoman,tomboy,never1,cortina,gomets,147896321,369852147,dogma,bhjxrf,loglatin,eragon,strato,gazelle,growler,885522,klaudia,payton34,fuckem,butchie,scorpi,lugano,123456789k,nichola,chipper1,spide,uhbujhbq,rsalinas,vfylfhby,longhorns,bugatti,everquest,!qaz2wsx,blackass,999111,snakeman,p455w0rd,fanatic,family1,pfqxbr,777vlad,mysecret,marat,phoenix2,october1,genghis,panties1,cooker,citron,ace123,1234569,gramps,blackcoc,kodiak1,hickory,ivanhoe,blackboy,escher,sincity,beaks,meandyou,spaniel,canon1,timmy1,lancaste,polaroid,edinburg,fuckedup,hotman,cueball,golfclub,gopack,bookcase,worldcup,dkflbvbhjdbx,twostep,17171717aa,letsplay,zolushka,stella1,pfkegf,kingtut,67camaro,barracuda,wiggles,gjhjkm,prancer,patata,kjifhf,theman1,romanova,sexyass,copper1,dobber,sokolov,pomidor,algernon,cadman,amoremio,william2,silly1,bobbys,hercule,hd764nw5d7e1vb1,defcon,deutschland,robinhood,alfalfa,machoman,lesbens,pandora1,easypay,tomservo,nadezhda,goonies,saab9000,jordyn,f15eagle,dbrecz,12qwerty,greatsex,thrawn,blunted,baywatch,doggystyle,loloxx,chevy2,january1,kodak,bushel,78963214,ub6ib9,zz8807zpl,briefs,hawker,224488,first1,bonzo,brent1,erasure,69213124,sidewind,soccer13,622521,mentos,kolibri,onepiece,united1,ponyboy,keksa12,wayer,mypussy,andrej,mischa,mille,bruno123,garter,bigpun,talgat,familia,jazzy1,mustang8,newjob,747400,bobber,blackbel,hatteras,ginge,asdfjkl;,camelot1,blue44,rebbyt34,ebony1,vegas123,myboys,aleksander,ijrjkflrf,lopata,pilsner,lotus123,m0nk3y,andreev,freiheit,balls1,drjynfrnt,mazda1,waterpolo,shibumi,852963,123bbb,cezer121,blondie1,volkova,rattler,kleenex,ben123,sanane,happydog,satellit,qazplm,qazwsxedcrfvtgb,meowmix,badguy,facefuck,spice1,blondy,major1,25000,anna123,654321a,sober1,deathrow,patterso,china1,naruto1,hawkeye1,waldo1,butchy,crayon,5tgb6yhn,klopik,crocodil,mothra,imhorny,pookie1,splatter,slippy,lizard1,router,buratino,yahweh,123698,dragon11,123qwe456,peepers,trucker1,ganjaman,1hxboqg2,cheyanne,storys,sebastie,zztop,maddison,4rfv3edc,darthvader,jeffro,iloveit,victor1,hotty,delphin,lifeisgood,gooseman,shifty,insertions,dude123,abrupt,123masha,boogaloo,chronos,stamford,pimpster,kthjxrf,getmein,amidala,flubber,fettish,grapeape,dantes,oralsex,jack1,foxcg33,winchest,francis1,getin,archon,cliffy,blueman,1basebal,sport1,emmitt22,porn123,bignasty,morga,123hfjdk147,ferrar,juanito,fabiol,caseydog,steveo,peternorth,paroll,kimchi,bootleg,gaijin,secre,acacia,eatme2,amarillo,monkey11,rfhfgep,tylers,a1a2a3a4a5,sweetass,blower,rodina,babushka,camilo,cimbom,tiffan,vfnbkmlf,ohbaby,gotigers,lindsey1,dragon13,romulus,qazxsw12,zxcvbn1,dropdead,hitman47,snuggle,eleven11,bloopers,357mag,avangard,bmw320,ginscoot,dshade,masterkey,voodoo1,rootedit,caramba,leahcim,hannover,8phrowz622,tim123,cassius,000000a,angelito,zzzzz1,badkarma,star1,malaga,glenwood,footlove,golf1,summer12,helpme1,fastcars,titan1,police1,polinka,k.jdm,marusya,augusto,shiraz,pantyhose,donald1,blaise,arabella,brigada,c3por2d2,peter01,marco1,hellow,dillweed,uzumymw,geraldin,loveyou2,toyota1,088011,gophers,indy500,slainte,5hsu75kpot,teejay,renat,racoon,sabrin,angie1,shiznit,harpua,sexyred,latex,tucker1,alexandru,wahoo,teamwork,deepblue,goodison,rundmc,r2d2c3p0,puppys,samba,ayrton,boobed,999777,topsecre,blowme1,123321z,loudog,random1,pantie,drevil,mandolin,121212q,hottub,brother1,failsafe,spade1,matvey,open1234,carmen1,priscill,schatzi,kajak,gooddog,trojans1,gordon1,kayak,calamity,argent,ufhvjybz,seviyi,penfold,assface,dildos,hawkwind,crowbar,yanks,ruffles,rastus,luv2epus,open123,aquafina,dawns,jared1,teufel,12345c,vwgolf,pepsi123,amores,passwerd,01478520,boliva,smutty,headshot,password3,davidd,zydfhm,gbgbcmrf,pornpass,insertion,ceckbr,test2,car123,checkit,dbnfkbq,niggas,nyyankee,muskrat,nbuhtyjr,gunner1,ocean1,fabienne,chrissy1,wendys,loveme89,batgirl,cerveza,igorek,steel1,ragman,boris123,novifarm,sexy12,qwerty777,mike01,giveitup,123456abc,fuckall,crevice,hackerz,gspot,eight8,assassins,texass,swallows,123458,baldur,moonshine,labatt,modem,sydney1,voland,dbnfkz,hotchick,jacker,princessa,dawgs1,holiday1,booper,reliant,miranda1,jamaica1,andre1,badnaamhere,barnaby,tiger7,david12,margaux,corsica,085tzzqi,universi,thewall,nevermor,martin6,qwerty77,cipher,apples1,0102030405,seraphim,black123,imzadi,gandon,ducati99,1shadow,dkflbvbhjdyf,44magnum,bigbad,feedme,samantha1,ultraman,redneck1,jackdog,usmc0311,fresh1,monique1,tigre,alphaman,cool1,greyhoun,indycar,crunchy,55chevy,carefree,willow1,063dyjuy,xrated,assclown,federica,hilfiger,trivia,bronco1,mamita,100200300,simcity,lexingky,akatsuki,retsam,johndeere,abudfv,raster,elgato,businka,satanas,mattingl,redwing1,shamil,patate,mannn,moonstar,evil666,b123456,bowl300,tanechka,34523452,carthage,babygir,santino,bondarenko,jesuss,chico1,numlock,shyguy,sound1,kirby1,needit,mostwanted,427900,funky1,steve123,passions,anduril,kermit1,prospero,lusty,barakuda,dream1,broodwar,porky,christy1,mahal,yyyyyy1,allan1,1sexy,flintsto,capri,cumeater,heretic,robert2,hippos,blindax,marykay,collecti,kasumi,1qaz!qaz,112233q,123258,chemistr,coolboy,0o9i8u,kabuki,righton,tigress,nessie,sergej,andrew12,yfafyz,ytrhjvfyn,angel7,victo,mobbdeep,lemming,transfor,1725782,myhouse,aeynbr,muskie,leno4ka,westham1,cvbhyjd,daffodil,pussylicker,pamela1,stuffer,warehous,tinker1,2w3e4r,pluton,louise1,polarbea,253634,prime1,anatoliy,januar,wysiwyg,cobraya,ralphy,whaler,xterra,cableguy,112233a,porn69,jamesd,aqualung,jimmy123,lumpy,luckyman,kingsize,golfing1,alpha7,leeds1,marigold,lol1234,teabag,alex11,10sne1,saopaulo,shanny,roland1,basser,3216732167,carol1,year2005,morozov,saturn1,joseluis,bushed,redrock,memnoch,lalaland,indiana1,lovegod,gulnaz,buffalos,loveyou1,anteater,pattaya,jaydee,redshift,bartek,summerti,coffee1,ricochet,incest,schastie,rakkaus,h2opolo,suikoden,perro,dance1,loveme1,whoopass,vladvlad,boober,flyers1,alessia,gfcgjhn,pipers,papaya,gunsling,coolone,blackie1,gonads,gfhjkzytn,foxhound,qwert12,gangrel,ghjvtntq,bluedevi,mywife,summer01,hangman,licorice,patter,vfr750,thorsten,515253,ninguna,dakine,strange1,mexic,vergeten,12345432,8phrowz624,stampede,floyd1,sailfish,raziel,ananda,giacomo,freeme,crfprf,74185296,allstars,master01,solrac,gfnhbjn,bayliner,bmw525,3465xxx,catter,single1,michael3,pentium4,nitrox,mapet123456,halibut,killroy,xxxxx1,phillip1,poopsie,arsenalfc,buffys,kosova,all4me,32165498,arslan,opensesame,brutis,charles2,pochta,nadegda,backspac,mustang0,invis,gogeta,654321q,adam25,niceday,truckin,gfdkbr,biceps,sceptre,bigdave,lauras,user345,sandys,shabba,ratdog,cristiano,natha,march13,gumball,getsdown,wasdwasd,redhead1,dddddd1,longlegs,13572468,starsky,ducksoup,bunnys,omsairam,whoami,fred123,danmark,flapper,swanky,lakings,yfhenj,asterios,rainier,searcher,dapper,ltdjxrf,horsey,seahawk,shroom,tkfkdgo,aquaman,tashkent,number9,messi10,1asshole,milenium,illumina,vegita,jodeci,buster01,bareback,goldfinger,fire1,33rjhjds,sabian,thinkpad,smooth1,sully,bonghits,sushi1,magnavox,colombi,voiture,limpone,oldone,aruba,rooster1,zhenya,nomar5,touchdow,limpbizkit,rhfcfdxbr,baphomet,afrodita,bball1,madiso,ladles,lovefeet,matthew2,theworld,thunderbird,dolly1,123rrr,forklift,alfons,berkut,speedy1,saphire,oilman,creatine,pussylov,bastard1,456258,wicked1,filimon,skyline1,fucing,yfnfkbz,hot123,abdulla,nippon,nolimits,billiard,booty1,buttplug,westlife,coolbean,aloha1,lopas,asasin,1212121,october2,whodat,good4u,d12345,kostas,ilya1992,regal,pioneer1,volodya,focus1,bastos,nbvjif,fenix,anita1,vadimka,nickle,jesusc,123321456,teste,christ1,essendon,evgenii,celticfc,adam1,forumwp,lovesme,26exkp,chillout,burly,thelast1,marcus1,metalgear,test11,ronaldo7,socrate,world1,franki,mommie,vicecity,postov1000,charlie3,oldschool,333221,legoland,antoshka,counterstrike,buggy,mustang3,123454,qwertzui,toons,chesty,bigtoe,tigger12,limpopo,rerehepf,diddle,nokia3250,solidsnake,conan1,rockroll,963369,titanic1,qwezxc,cloggy,prashant,katharin,maxfli,takashi,cumonme,michael9,mymother,pennstate,khalid,48151623,fightclub,showboat,mateusz,elrond,teenie,arrow1,mammamia,dustydog,dominator,erasmus,zxcvb1,1a2a3a,bones1,dennis1,galaxie,pleaseme,whatever1,junkyard,galadriel,charlies,2wsxzaq1,crimson1,behemoth,teres,master11,fairway,shady1,pass99,1batman,joshua12,baraban,apelsin,mousepad,melon,twodogs,123321qwe,metalica,ryjgrf,pipiska,rerfhfxf,lugnut,cretin,iloveu2,powerade,aaaaaaa1,omanko,kovalenko,isabe,chobits,151nxjmt,shadow11,zcxfcnkbdf,gy3yt2rgls,vfhbyrf,159753123,bladerunner,goodone,wonton,doodie,333666999,fuckyou123,kitty123,chisox,orlando1,skateboa,red12345,destroye,snoogans,satan1,juancarlo,goheels,jetson,scottt,fuckup,aleksa,gfhfljrc,passfind,oscar123,derrick1,hateme,viper123,pieman,audi100,tuffy,andover,shooter1,10000,makarov,grant1,nighthaw,13576479,browneye,batigol,nfvfhf,chocolate1,7hrdnw23,petter,bantam,morlii,jediknight,brenden,argonaut,goodstuf,wisconsi,315920,abigail1,dirtbag,splurge,k123456,lucky777,valdepen,gsxr600,322223,ghjnjrjk,zaq1xsw2cde3,schwanz,walter1,letmein22,nomads,124356,codeblue,nokian70,fucke,footbal1,agyvorc,aztecs,passw0r,smuggles,femmes,ballgag,krasnodar,tamuna,schule,sixtynine,empires,erfolg,dvader,ladygaga,elite1,venezuel,nitrous,kochamcie,olivia1,trustn01,arioch,sting1,131415,tristar,555000,maroon,135799,marsik,555556,fomoco,natalka,cwoui,tartan,davecole,nosferat,hotsauce,dmitry,horus,dimasik,skazka,boss302,bluebear,vesper,ultras,tarantul,asd123asd,azteca,theflash,8ball,1footbal,titlover,lucas123,number6,sampson1,789852,party1,dragon99,adonai,carwash,metropol,psychnau,vthctltc,hounds,firework,blink18,145632,wildcat1,satchel,rice80,ghtktcnm,sailor1,cubano,anderso,rocks1,mike11,famili,dfghjc,besiktas,roygbiv,nikko,bethan,minotaur,rakesh,orange12,hfleuf,jackel,myangel,favorite7,1478520,asssss,agnieszka,haley1,raisin,htubyf,1buster,cfiekz,derevo,1a2a3a4a5a,baltika,raffles,scruffy1,clitlick,louis1,buddha1,fy.nrf,walker1,makoto,shadow2,redbeard,vfvfvskfhfve,mycock,sandydog,lineman,network1,favorite8,longdick,mustangg,mavericks,indica,1killer,cisco1,angelofwar,blue69,brianna1,bubbaa,slayer666,level42,baldrick,brutus1,lowdown,haribo,lovesexy,500000,thissuck,picker,stephy,1fuckme,characte,telecast,1bigdog,repytwjdf,thematrix,hammerhe,chucha,ganesha,gunsmoke,georgi,sheltie,1harley,knulla,sallas,westie,dragon7,conker,crappie,margosha,lisboa,3e2w1q,shrike,grifter,ghjcnjghjcnj,asdfg1,mnbvcxz1,myszka,posture,boggie,rocketman,flhtyfkby,twiztid,vostok,pi314159,force1,televizor,gtkmvtym,samhain,imcool,jadzia,dreamers,strannik,k2trix,steelhea,nikitin,commodor,brian123,chocobo,whopper,ibilljpf,megafon,ararat,thomas12,ghbrjkbcn,q1234567890,hibernia,kings1,jim123,redfive,68camaro,iawgk2,xavier1,1234567u,d123456,ndirish,airborn,halfmoon,fluffy1,ranchero,sneaker,soccer2,passion1,cowman,birthday1,johnn,razzle,glock17,wsxqaz,nubian,lucky2,jelly1,henderso,eric1,123123e,boscoe01,fuck0ff,simpson1,sassie,rjyjgkz,nascar3,watashi,loredana,janus,wilso,conman,david2,mothe,iloveher,snikers,davidj,fkmnthyfnbdf,mettss,ratfink,123456h,lostsoul,sweet16,brabus,wobble,petra1,fuckfest,otters,sable1,svetka,spartacu,bigstick,milashka,1lover,pasport,champagn,papichul,hrvatska,hondacivic,kevins,tacit,moneybag,gohogs,rasta1,246813579,ytyfdbcnm,gubber,darkmoon,vitaliy,233223,playboys,tristan1,joyce1,oriflame,mugwump,access2,autocad,thematri,qweqwe123,lolwut,ibill01,multisyn,1233211,pelikan,rob123,chacal,1234432,griffon,pooch,dagestan,geisha,satriani,anjali,rocketma,gixxer,pendrago,vincen,hellokit,killyou,ruger,doodah,bumblebe,badlands,galactic,emachines,foghorn,jackso,jerem,avgust,frontera,123369,daisymae,hornyboy,welcome123,tigger01,diabl,angel13,interex,iwantsex,rockydog,kukolka,sawdust,online1,3234412,bigpapa,jewboy,3263827,dave123,riches,333222,tony1,toggle,farter,124816,tities,balle,brasilia,southsid,micke,ghbdtn12,patit,ctdfcnjgjkm,olds442,zzzzzz1,nelso,gremlins,gypsy1,carter1,slut69,farcry,7415963,michael8,birdie1,charl,123456789abc,100001,aztec,sinjin,bigpimpi,closeup,atlas1,nvidia,doggone,classic1,manana,malcolm1,rfkbyf,hotbabe,rajesh,dimebag,ganjubas,rodion,jagr68,seren,syrinx,funnyman,karapuz,123456789n,bloomin,admin18533362,biggdogg,ocarina,poopy1,hellome,internet1,booties,blowjobs,matt1,donkey1,swede,1jennife,evgeniya,lfhbyf,coach1,444777,green12,patryk,pinewood,justin12,271828,89600506779,notredame,tuborg,lemond,sk8ter,million1,wowser,pablo1,st0n3,jeeves,funhouse,hiroshi,gobucs,angeleye,bereza,winter12,catalin,qazedc,andros,ramazan,vampyre,sweethea,imperium,murat,jamest,flossy,sandeep,morgen,salamandra,bigdogg,stroller,njdevils,nutsack,vittorio,%%passwo,playful,rjyatnrf,tookie,ubnfhf,michi,777444,shadow13,devils1,radiance,toshiba1,beluga,amormi,dandfa,trust1,killemall,smallville,polgara,billyb,landscap,steves,exploite,zamboni,damage11,dzxtckfd,trader12,pokey1,kobe08,damager,egorov,dragon88,ckfdbr,lisa69,blade2,audis4,nelson1,nibbles,23176djivanfros,mutabor,artofwar,matvei,metal666,hrfzlz,schwinn,poohbea,seven77,thinker,123456789qwerty,sobriety,jakers,karamelka,vbkfyf,volodin,iddqd,dale03,roberto1,lizaveta,qqqqqq1,cathy1,08154711,davidm,quixote,bluenote,tazdevil,katrina1,bigfoot1,bublik,marma,olechka,fatpussy,marduk,arina,nonrev67,qqqq1111,camill,wtpfhm,truffle,fairview,mashina,voltaire,qazxswedcvfr,dickface,grassy,lapdance,bosstone,crazy8,yackwin,mobil,danielit,mounta1n,player69,bluegill,mewtwo,reverb,cnthdf,pablito,a123321,elena1,warcraft1,orland,ilovemyself,rfntyjr,joyride,schoo,dthjxrf,thetachi,goodtimes,blacksun,humpty,chewbacca,guyute,123xyz,lexicon,blue45,qwe789,galatasaray,centrino,hendrix1,deimos,saturn5,craig1,vlad1996,sarah123,tupelo,ljrnjh,hotwife,bingos,1231231,nicholas1,flamer,pusher,1233210,heart1,hun999,jiggy,giddyup,oktober,123456zxc,budda,galahad,glamur,samwise,oneton,bugsbunny,dominic1,scooby2,freetime,internat,159753852,sc00ter,wantit,mazinger,inflames,laracrof,greedo,014789,godofwar,repytwjd,water123,fishnet,venus1,wallace1,tenpin,paula1,1475963,mania,novikov,qwertyasdfgh,goldmine,homies,777888999,8balls,holeinon,paper1,samael,013579,mansur,nikit,ak1234,blueline,polska1,hotcock,laredo,windstar,vbkbwbz,raider1,newworld,lfybkrf,catfish1,shorty1,piranha,treacle,royale,2234562,smurfs,minion,cadence,flapjack,123456p,sydne,135531,robinhoo,nasdaq,decatur,cyberonline,newage,gemstone,jabba,touchme,hooch,pigdog,indahous,fonzie,zebra1,juggle,patrick2,nihongo,hitomi,oldnavy,qwerfdsa,ukraina,shakti,allure,kingrich,diane1,canad,piramide,hottie1,clarion,college1,5641110,connect1,therion,clubber,velcro,dave1,astra1,13579-,astroboy,skittle,isgreat,photoes,cvzefh1gkc,001100,2cool4u,7555545,ginger12,2wsxcde3,camaro69,invader,domenow,asd1234,colgate,qwertasdfg,jack123,pass01,maxman,bronte,whkzyc,peter123,bogie,yecgaa,abc321,1qay2wsx,enfield,camaroz2,trashman,bonefish,system32,azsxdcfvgb,peterose,iwantyou,dick69,temp1234,blastoff,capa200,connie1,blazin,12233445,sexybaby,123456j,brentfor,pheasant,hommer,jerryg,thunders,august1,lager,kapusta,boobs1,nokia5300,rocco1,xytfu7,stars1,tugger,123sas,blingbling,1bubba,0wnsyo0,1george,baile,richard2,habana,1diamond,sensatio,1golfer,maverick1,1chris,clinton1,michael7,dragons1,sunrise1,pissant,fatim,mopar1,levani,rostik,pizzapie,987412365,oceans11,748159263,cum4me,palmetto,4r3e2w1q,paige1,muncher,arsehole,kratos,gaffer,banderas,billys,prakash,crabby,bungie,silver12,caddis,spawn1,xboxlive,sylvania,littlebi,524645,futura,valdemar,isacs155,prettygirl,big123,555444,slimer,chicke,newstyle,skypilot,sailormoon,fatluvr69,jetaime,sitruc,jesuschrist,sameer,bear12,hellion,yendor,country1,etnies,conejo,jedimast,darkknight,toobad,yxcvbn,snooks,porn4life,calvary,alfaromeo,ghostman,yannick,fnkfynblf,vatoloco,homebase,5550666,barret,1111111111zz,odysseus,edwardss,favre4,jerrys,crybaby,xsw21qaz,firestor,spanks,indians1,squish,kingair,babycakes,haters,sarahs,212223,teddyb,xfactor,cumload,rhapsody,death123,three3,raccoon,thomas2,slayer66,1q2q3q4q5q,thebes,mysterio,thirdeye,orkiox.,nodoubt,bugsy,schweiz,dima1996,angels1,darkwing,jeronimo,moonpie,ronaldo9,peaches2,mack10,manish,denise1,fellowes,carioca,taylor12,epaulson,makemoney,oc247ngucz,kochanie,3edcvfr4,vulture,1qw23e,1234567z,munchie,picard1,xthtgfirf,sportste,psycho1,tahoe1,creativ,perils,slurred,hermit,scoob,diesel1,cards1,wipeout,weeble,integra1,out3xf,powerpc,chrism,kalle,ariadne,kailua,phatty,dexter1,fordman,bungalow,paul123,compa,train1,thejoker,jys6wz,pussyeater,eatmee,sludge,dominus,denisa,tagheuer,yxcvbnm,bill1,ghfdlf,300zx,nikita123,carcass,semaj,ramone,muenchen,animal1,greeny,annemari,dbrf134,jeepcj7,mollys,garten,sashok,ironmaid,coyotes,astoria,george12,westcoast,primetim,123456o,panchito,rafae,japan1,framer,auralo,tooshort,egorova,qwerty22,callme,medicina,warhawk,w1w2w3w4,cristia,merli,alex22,kawaii,chatte,wargames,utvols,muaddib,trinket,andreas1,jjjjj1,cleric,scooters,cuntlick,gggggg1,slipknot1,235711,handcuff,stussy,guess1,leiceste,ppppp1,passe,lovegun,chevyman,hugecock,driver1,buttsex,psychnaut1,cyber1,black2,alpha12,melbourn,man123,metalman,yjdsqujl,blondi,bungee,freak1,stomper,caitlin1,nikitina,flyaway,prikol,begood,desperad,aurelius,john1234,whosyourdaddy,slimed123,bretagne,den123,hotwheel,king123,roodypoo,izzicam,save13tx,warpten,nokia3310,samolet,ready1,coopers,scott123,bonito,1aaaaa,yomomma,dawg1,rache,itworks,asecret,fencer,451236,polka,olivetti,sysadmin,zepplin,sanjuan,479373,lickem,hondacrx,pulamea,future1,naked1,sexyguy,w4g8at,lollol1,declan,runner1,rumple,daddy123,4snz9g,grandprix,calcio,whatthefuck,nagrom,asslick,pennst,negrit,squiggy,1223334444,police22,giovann,toronto1,tweet,yardbird,seagate,truckers,554455,scimitar,pescator,slydog,gaysex,dogfish,fuck777,12332112,qazxswed,morkovka,daniela1,imback,horny69,789123456,123456789w,jimmy2,bagger,ilove69,nikolaus,atdhfkm,rebirth,1111aaaa,pervasive,gjgeufq,dte4uw,gfhnbpfy,skeletor,whitney1,walkman,delorean,disco1,555888,as1234,ishikawa,fuck12,reaper1,dmitrii,bigshot,morrisse,purgen,qwer4321,itachi,willys,123123qwe,kisska,roma123,trafford,sk84life,326159487,pedros,idiom,plover,bebop,159875321,jailbird,arrowhea,qwaszx123,zaxscdvf,catlover,bakers,13579246,bones69,vermont1,helloyou,simeon,chevyz71,funguy,stargaze,parolparol,steph1,bubby,apathy,poppet,laxman,kelly123,goodnews,741236,boner1,gaetano,astonvilla,virtua,luckyboy,rocheste,hello2u,elohim,trigger1,cstrike,pepsicola,miroslav,96385274,fistfuck,cheval,magyar,svetlanka,lbfyjxrf,mamedov,123123123q,ronaldo1,scotty1,1nicole,pittbull,fredd,bbbbb1,dagwood,gfhkfvtyn,ghblehrb,logan5,1jordan,sexbomb,omega2,montauk,258741,dtythf,gibbon,winamp,thebomb,millerli,852654,gemin,baldy,halflife2,dragon22,mulberry,morrigan,hotel6,zorglub,surfin,951159,excell,arhangel,emachine,moses1,968574,reklama,bulldog2,cuties,barca,twingo,saber,elite11,redtruck,casablan,ashish,moneyy,pepper12,cnhtktw,rjcnbr,arschloch,phenix,cachorro,sunita,madoka,joselui,adams1,mymoney,hemicuda,fyutkjr,jake12,chicas,eeeee1,sonnyboy,smarties,birdy,kitten1,cnfcbr,island1,kurosaki,taekwond,konfetka,bennett1,omega3,jackson2,fresca,minako,octavian,kban667,feyenoord,muaythai,jakedog,fktrcfylhjdyf,1357911q,phuket,sexslave,fktrcfylhjdbx,asdfjk,89015173454,qwerty00,kindbud,eltoro,sex6969,nyknicks,12344321q,caballo,evenflow,hoddle,love22,metro1,mahalko,lawdog,tightass,manitou,buckie,whiskey1,anton123,335533,password4,primo,ramair,timbo,brayden,stewie,pedro1,yorkshir,ganster,hellothe,tippy1,direwolf,genesi,rodrig,enkeli,vaz21099,sorcerer,winky,oneshot,boggle,serebro,badger1,japanes,comicbook,kamehame,alcat,denis123,echo45,sexboy,gr8ful,hondo,voetbal,blue33,2112rush,geneviev,danni1,moosey,polkmn,matthew7,ironhead,hot2trot,ashley12,sweeper,imogen,blue21,retep,stealth1,guitarra,bernard1,tatian,frankfur,vfnhbwf,slacking,haha123,963741,asdasdas,katenok,airforce1,123456789qaz,shotgun1,12qwasz,reggie1,sharo,976431,pacifica,dhip6a,neptun,kardon,spooky1,beaut,555555a,toosweet,tiedup,11121314,startac,lover69,rediska,pirata,vfhrbp,1234qwerty,energize,hansolo1,playbo,larry123,oemdlg,cnjvfnjkju,a123123,alexan,gohawks,antonius,fcbayern,mambo,yummy1,kremlin,ellen1,tremere,vfiekz,bellevue,charlie9,izabella,malishka,fermat,rotterda,dawggy,becket,chasey,kramer1,21125150,lolit,cabrio,schlong,arisha,verity,3some,favorit,maricon,travelle,hotpants,red1234,garrett1,home123,knarf,seven777,figment,asdewq,canseco,good2go,warhol,thomas01,pionee,al9agd,panacea,chevy454,brazzers,oriole,azerty123,finalfan,patricio,northsta,rebelde,bulldo,stallone,boogie1,7uftyx,cfhfnjd,compusa,cornholi,config,deere,hoopster,sepultura,grasshop,babygurl,lesbo,diceman,proverbs,reddragon,nurbek,tigerwoo,superdup,buzzsaw,kakaroto,golgo13,edwar,123qaz123,butter1,sssss1,texas2,respekt,ou812ic,123456qaz,55555a,doctor1,mcgwire,maria123,aol999,cinders,aa1234,joness,ghbrjkmyj,makemone,sammyboy,567765,380zliki,theraven,testme,mylene,elvira26,indiglo,tiramisu,shannara,baby1,123666,gfhreh,papercut,johnmish,orange8,bogey1,mustang7,bagpipes,dimarik,vsijyjr,4637324,ravage,cogito,seven11,natashka,warzone,hr3ytm,4free,bigdee,000006,243462536,bigboi,123333,trouts,sandy123,szevasz,monica2,guderian,newlife1,ratchet,r12345,razorbac,12345i,piazza31,oddjob,beauty1,fffff1,anklet,nodrog,pepit,olivi,puravida,robert12,transam1,portman,bubbadog,steelers1,wilson1,eightball,mexico1,superboy,4rfv5tgb,mzepab,samurai1,fuckslut,colleen1,girdle,vfrcbvec,q1w2e3r4t,soldier1,19844891,alyssa1,a12345a,fidelis,skelter,nolove,mickeymouse,frehley,password69,watermel,aliska,soccer15,12345e,ladybug1,abulafia,adagio,tigerlil,takehana,hecate,bootneck,junfan,arigato,wonkette,bobby123,trustnoone,phantasm,132465798,brianjo,w12345,t34vfrc1991,deadeye,1robert,1daddy,adida,check1,grimlock,muffi,airwalk,prizrak,onclick,longbeac,ernie1,eadgbe,moore1,geniu,shadow123,bugaga,jonathan1,cjrjkjdf,orlova,buldog,talon1,westport,aenima,541233432442,barsuk,chicago2,kellys,hellbent,toughguy,iskander,skoal,whatisit,jake123,scooter2,fgjrfkbgcbc,ghandi,love13,adelphia,vjhrjdrf,adrenali,niunia,jemoeder,rainbo,all4u8,anime1,freedom7,seraph,789321,tommys,antman,firetruc,neogeo,natas,bmwm3,froggy1,paul1,mamit,bayview,gateways,kusanagi,ihateu,frederi,rock1,centurion,grizli,biggin,fish1,stalker1,3girls,ilovepor,klootzak,lollo,redsox04,kirill123,jake1,pampers,vasya,hammers1,teacup,towing,celtic1,ishtar,yingyang,4904s677075,dahc1,patriot1,patrick9,redbirds,doremi,rebecc,yoohoo,makarova,epiphone,rfgbnfy,milesd,blister,chelseafc,katana1,blackrose,1james,primrose,shock5,hard1,scooby12,c6h12o6,dustoff,boing,chisel,kamil,1william,defiant1,tyvugq,mp8o6d,aaa340,nafets,sonnet,flyhigh,242526,crewcom,love23,strike1,stairway,katusha,salamand,cupcake1,password0,007james,sunnie,multisync,harley01,tequila1,fred12,driver8,q8zo8wzq,hunter01,mozzer,temporar,eatmeraw,mrbrownxx,kailey,sycamore,flogger,tincup,rahasia,ganymede,bandera,slinger,1111122222,vander,woodys,1cowboy,khaled,jamies,london12,babyboo,tzpvaw,diogenes,budice,mavrick,135797531,cheeta,macros,squonk,blackber,topfuel,apache1,falcon16,darkjedi,cheeze,vfhvtkfl,sparco,change1,gfhfif,freestyl,kukuruza,loveme2,12345f,kozlov,sherpa,marbella,44445555,bocephus,1winner,alvar,hollydog,gonefish,iwantin,barman,godislove,amanda18,rfpfynbg,eugen,abcdef1,redhawk,thelema,spoonman,baller1,harry123,475869,tigerman,cdtnjxrf,marillio,scribble,elnino,carguy,hardhead,l2g7k3,troopers,selen,dragon76,antigua,ewtosi,ulysse,astana,paroli,cristo,carmex,marjan,bassfish,letitbe,kasparov,jay123,19933991,blue13,eyecandy,scribe,mylord,ukflbjkec,ellie1,beaver1,destro,neuken,halfpint,ameli,lilly1,satanic,xngwoj,12345trewq,asdf1,bulldogg,asakura,jesucrist,flipside,packers4,biggy,kadett,biteme69,bobdog,silverfo,saint1,bobbo,packman,knowledg,foolio,fussbal,12345g,kozerog,westcoas,minidisc,nbvcxw,martini1,alastair,rasengan,superbee,memento,porker,lena123,florenc,kakadu,bmw123,getalife,bigsky,monkee,people1,schlampe,red321,memyself,0147896325,12345678900987654321,soccer14,realdeal,gfgjxrf,bella123,juggs,doritos,celtics1,peterbilt,ghbdtnbrb,gnusmas,xcountry,ghbdtn1,batman99,deusex,gtnhjdf,blablabl,juster,marimba,love2,rerjkrf,alhambra,micros,siemens1,assmaste,moonie,dashadasha,atybrc,eeeeee1,wildrose,blue55,davidl,xrp23q,skyblue,leo123,ggggg1,bestfriend,franny,1234rmvb,fun123,rules1,sebastien,chester2,hakeem,winston2,fartripper,atlant,07831505,iluvsex,q1a2z3,larrys,009900,ghjkju,capitan,rider1,qazxsw21,belochka,andy123,hellya,chicca,maximal,juergen,password1234,howard1,quetzal,daniel123,qpwoeiruty,123555,bharat,ferrari3,numbnuts,savant,ladydog,phipsi,lovepussy,etoile,power2,mitten,britneys,chilidog,08522580,2fchbg,kinky1,bluerose,loulo,ricardo1,doqvq3,kswbdu,013cpfza,timoha,ghbdtnghbdtn,3stooges,gearhead,browns1,g00ber,super7,greenbud,kitty2,pootie,toolshed,gamers,coffe,ibill123,freelove,anasazi,sister1,jigger,natash,stacy1,weronika,luzern,soccer7,hoopla,dmoney,valerie1,canes,razdvatri,washere,greenwoo,rfhjkbyf,anselm,pkxe62,maribe,daniel2,maxim1,faceoff,carbine,xtkjdtr,buddy12,stratos,jumpman,buttocks,aqswdefr,pepsis,sonechka,steeler1,lanman,nietzsch,ballz,biscuit1,wrxsti,goodfood,juventu,federic,mattman,vika123,strelec,jledfyxbr,sideshow,4life,fredderf,bigwilly,12347890,12345671,sharik,bmw325i,fylhtqrf,dannon4,marky,mrhappy,drdoom,maddog1,pompier,cerbera,goobers,howler,jenny69,evely,letitrid,cthuttdyf,felip,shizzle,golf12,t123456,yamah,bluearmy,squishy,roxan,10inches,dollface,babygirl1,blacksta,kaneda,lexingto,canadien,222888,kukushka,sistema,224422,shadow69,ppspankp,mellons,barbie1,free4all,alfa156,lostone,2w3e4r5t,painkiller,robbie1,binger,8dihc6,jaspe,rellik,quark,sogood,hoopstar,number2,snowy1,dad2ownu,cresta,qwe123asd,hjvfyjdf,gibsonsg,qbg26i,dockers,grunge,duckling,lfiekz,cuntsoup,kasia1,1tigger,woaini,reksio,tmoney,firefighter,neuron,audia3,woogie,powerboo,powermac,fatcock,12345666,upnfmc,lustful,porn1,gotlove,amylee,kbytqrf,11924704,25251325,sarasota,sexme,ozzie1,berliner,nigga1,guatemal,seagulls,iloveyou!,chicken2,qwerty21,010203040506,1pillow,libby1,vodoley,backlash,piglets,teiubesc,019283,vonnegut,perico,thunde,buckey,gtxtymrf,manunite,iiiii1,lost4815162342,madonn,270873_,britney1,kevlar,piano1,boondock,colt1911,salamat,doma77ns,anuradha,cnhjqrf,rottweil,newmoon,topgun1,mauser,fightclu,birthday21,reviewpa,herons,aassddff,lakers32,melissa2,vredina,jiujitsu,mgoblue,shakey,moss84,12345zxcvb,funsex,benji1,garci,113322,chipie,windex,nokia5310,pwxd5x,bluemax,cosita,chalupa,trotsky,new123,g3ujwg,newguy,canabis,gnaget,happydays,felixx,1patrick,cumface,sparkie,kozlova,123234,newports,broncos7,golf18,recycle,hahah,harrypot,cachondo,open4me,miria,guessit,pepsione,knocker,usmc1775,countach,playe,wiking,landrover,cracksevi,drumline,a7777777,smile123,manzana,panty,liberta,pimp69,dolfan,quality1,schnee,superson,elaine22,webhompass,mrbrownx,deepsea,4wheel,mamasita,rockport,rollie,myhome,jordan12,kfvgjxrf,hockey12,seagrave,ford1,chelsea2,samsara,marissa1,lamesa,mobil1,piotrek,tommygun,yyyyy1,wesley1,billy123,homersim,julies,amanda12,shaka,maldini,suzenet,springst,iiiiii1,yakuza,111111aa,westwind,helpdesk,annamari,bringit,hopefull,hhhhhhh1,saywhat,mazdarx8,bulova,jennife1,baikal,gfhjkmxbr,victoria1,gizmo123,alex99,defjam,2girls,sandrock,positivo,shingo,syncmast,opensesa,silicone,fuckina,senna1,karlos,duffbeer,montagne,gehrig,thetick,pepino,hamburge,paramedic,scamp,smokeweed,fabregas,phantoms,venom121293,2583458,badone,porno69,manwhore,vfvf123,notagain,vbktyf,rfnthbyrf,wildblue,kelly001,dragon66,camell,curtis1,frolova,1212123,dothedew,tyler123,reddrago,planetx,promethe,gigolo,1001001,thisone,eugeni,blackshe,cruzazul,incognito,puller,joonas,quick1,spirit1,gazza,zealot,gordito,hotrod1,mitch1,pollito,hellcat,mythos,duluth,383pdjvl,easy123,hermos,binkie,its420,lovecraf,darien,romina,doraemon,19877891,syclone,hadoken,transpor,ichiro,intell,gargamel,dragon2,wavpzt,557744,rjw7x4,jennys,kickit,rjynfrn,likeit,555111,corvus,nec3520,133113,mookie1,bochum,samsung2,locoman0,154ugeiu,vfvfbgfgf,135792,[start],tenni,20001,vestax,hufmqw,neveragain,wizkid,kjgfnf,nokia6303,tristen,saltanat,louie1,gandalf2,sinfonia,alpha3,tolstoy,ford150,f00bar,1hello,alici,lol12,riker1,hellou,333888,1hunter,qw1234,vibrator,mets86,43211234,gonzale,cookies1,sissy1,john11,bubber,blue01,cup2006,gtkmvtyb,nazareth,heybaby,suresh,teddie,mozilla,rodeo1,madhouse,gamera,123123321,naresh,dominos,foxtrot1,taras,powerup,kipling,jasonb,fidget,galena,meatman,alpacino,bookmark,farting,humper,titsnass,gorgon,castaway,dianka,anutka,gecko1,fucklove,connery,wings1,erika1,peoria,moneymaker,ichabod,heaven1,paperboy,phaser,breakers,nurse1,westbrom,alex13,brendan1,123asd123,almera,grubber,clarkie,thisisme,welkom01,51051051051,crypto,freenet,pflybwf,black12,testme2,changeit,autobahn,attica,chaoss,denver1,tercel,gnasher23,master2,vasilii,sherman1,gomer,bigbuck,derek1,qwerzxcv,jumble,dragon23,art131313,numark,beasty,cxfcnmttcnm,updown,starion,glist,sxhq65,ranger99,monkey7,shifter,wolves1,4r5t6y,phone1,favorite5,skytommy,abracada,1martin,102030405060,gatech,giulio,blacktop,cheer1,africa1,grizzly1,inkjet,shemales,durango1,booner,11223344q,supergirl,vanyarespekt,dickless,srilanka,weaponx,6string,nashvill,spicey,boxer1,fabien,2sexy2ho,bowhunt,jerrylee,acrobat,tawnee,ulisse,nolimit8,l8g3bkde,pershing,gordo1,allover,gobrowns,123432,123444,321456987,spoon1,hhhhh1,sailing1,gardenia,teache,sexmachine,tratata,pirate1,niceone,jimbos,314159265,qsdfgh,bobbyy,ccccc1,carla1,vjkjltw,savana,biotech,frigid,123456789g,dragon10,yesiam,alpha06,oakwood,tooter,winsto,radioman,vavilon,asnaeb,google123,nariman,kellyb,dthyjcnm,password6,parol1,golf72,skate1,lthtdj,1234567890s,kennet,rossia,lindas,nataliya,perfecto,eminem1,kitana,aragorn1,rexona,arsenalf,planot,coope,testing123,timex,blackbox,bullhead,barbarian,dreamon,polaris1,cfvjktn,frdfhbev,gametime,slipknot666,nomad1,hfgcjlbz,happy69,fiddler,brazil1,joeboy,indianali,113355,obelisk,telemark,ghostrid,preston1,anonim,wellcome,verizon1,sayangku,censor,timeport,dummies,adult1,nbnfybr,donger,thales,iamgay,sexy1234,deadlift,pidaras,doroga,123qwe321,portuga,asdfgh12,happys,cadr14nu,pi3141,maksik,dribble,cortland,darken,stepanova,bommel,tropic,sochi2014,bluegras,shahid,merhaba,nacho,2580456,orange44,kongen,3cudjz,78girl,my3kids,marcopol,deadmeat,gabbie,saruman,jeepman,freddie1,katie123,master99,ronal,ballbag,centauri,killer7,xqgann,pinecone,jdeere,geirby,aceshigh,55832811,pepsimax,rayden,razor1,tallyho,ewelina,coldfire,florid,glotest,999333,sevenup,bluefin,limaperu,apostol,bobbins,charmed1,michelin,sundin,centaur,alphaone,christof,trial1,lions1,45645,just4you,starflee,vicki1,cougar1,green2,jellyfis,batman69,games1,hihje863,crazyzil,w0rm1,oklick,dogbite,yssup,sunstar,paprika,postov10,124578963,x24ik3,kanada,buckster,iloveamy,bear123,smiler,nx74205,ohiostat,spacey,bigbill,doudo,nikolaeva,hcleeb,sex666,mindy1,buster11,deacons,boness,njkcnsq,candy2,cracker1,turkey1,qwertyu1,gogreen,tazzzz,edgewise,ranger01,qwerty6,blazer1,arian,letmeinnow,cigar1,jjjjjj1,grigio,frien,tenchu,f9lmwd,imissyou,filipp,heathers,coolie,salem1,woodduck,scubadiv,123kat,raffaele,nikolaev,dapzu455,skooter,9inches,lthgfhjkm,gr8one,ffffff1,zujlrf,amanda69,gldmeo,m5wkqf,rfrltkf,televisi,bonjou,paleale,stuff1,cumalot,fuckmenow,climb7,mark1234,t26gn4,oneeye,george2,utyyflbq,hunting1,tracy71,ready2go,hotguy,accessno,charger1,rudedog,kmfdm,goober1,sweetie1,wtpmjgda,dimensio,ollie1,pickles1,hellraiser,mustdie,123zzz,99887766,stepanov,verdun,tokenbad,anatol,bartende,cidkid86,onkelz,timmie,mooseman,patch1,12345678c,marta1,dummy1,bethany1,myfamily,history1,178500,lsutiger,phydeaux,moren,dbrnjhjdbx,gnbxrf,uniden,drummers,abpbrf,godboy,daisy123,hogan1,ratpack,irland,tangerine,greddy,flore,sqrunch,billyjoe,q55555,clemson1,98745632,marios,ishot,angelin,access12,naruto12,lolly,scxakv,austin12,sallad,cool99,rockit,mongo1,mark22,ghbynth,ariadna,senha,docto,tyler2,mobius,hammarby,192168,anna12,claire1,pxx3eftp,secreto,greeneye,stjabn,baguvix,satana666,rhbcnbyjxrf,dallastx,garfiel,michaelj,1summer,montan,1234ab,filbert,squids,fastback,lyudmila,chucho,eagleone,kimberle,ar3yuk3,jake01,nokids,soccer22,1066ad,ballon,cheeto,review69,madeira,taylor2,sunny123,chubbs,lakeland,striker1,porche,qwertyu8,digiview,go1234,ferari,lovetits,aditya,minnow,green3,matman,cellphon,fortytwo,minni,pucara,69a20a,roman123,fuente,12e3e456,paul12,jacky,demian,littleman,jadakiss,vlad1997,franca,282860,midian,nunzio,xaccess2,colibri,jessica0,revilo,654456,harvey1,wolf1,macarena,corey1,husky1,arsen,milleniu,852147,crowes,redcat,combat123654,hugger,psalms,quixtar,ilovemom,toyot,ballss,ilovekim,serdar,james23,avenger1,serendip,malamute,nalgas,teflon,shagger,letmein6,vyjujnjxbt,assa1234,student1,dixiedog,gznybwf13,fuckass,aq1sw2de3,robroy,hosehead,sosa21,123345,ias100,teddy123,poppin,dgl70460,zanoza,farhan,quicksilver,1701d,tajmahal,depechemode,paulchen,angler,tommy2,recoil,megamanx,scarecro,nicole2,152535,rfvtgb,skunky,fatty1,saturno,wormwood,milwauke,udbwsk,sexlover,stefa,7bgiqk,gfnhbr,omar10,bratan,lbyfvj,slyfox,forest1,jambo,william3,tempus,solitari,lucydog,murzilka,qweasdzxc1,vehpbkrf,12312345,fixit,woobie,andre123,123456789x,lifter,zinaida,soccer17,andone,foxbat,torsten,apple12,teleport,123456i,leglover,bigcocks,vologda,dodger1,martyn,d6o8pm,naciona,eagleeye,maria6,rimshot,bentley1,octagon,barbos,masaki,gremio,siemen,s1107d,mujeres,bigtits1,cherr,saints1,mrpink,simran,ghzybr,ferrari2,secret12,tornado1,kocham,picolo,deneme,onelove1,rolan,fenster,1fuckyou,cabbie,pegaso,nastyboy,password5,aidana,mine2306,mike13,wetone,tigger69,ytreza,bondage1,myass,golova,tolik,happyboy,poilkj,nimda2k,rammer,rubies,hardcore1,jetset,hoops1,jlaudio,misskitt,1charlie,google12,theone1,phred,porsch,aalborg,luft4,charlie5,password7,gnosis,djgabbab,1daniel,vinny,borris,cumulus,member1,trogdor,darthmau,andrew2,ktjybl,relisys,kriste,rasta220,chgobndg,weener,qwerty66,fritter,followme,freeman1,ballen,blood1,peache,mariso,trevor1,biotch,gtfullam,chamonix,friendste,alligato,misha1,1soccer,18821221,venkat,superd,molotov,bongos,mpower,acun3t1x,dfcmrf,h4x3d,rfhfufylf,tigran,booyaa,plastic1,monstr,rfnhby,lookatme,anabolic,tiesto,simon123,soulman,canes1,skyking,tomcat1,madona,bassline,dasha123,tarheel1,dutch1,xsw23edc,qwerty123456789,imperator,slaveboy,bateau,paypal,house123,pentax,wolf666,drgonzo,perros,digger1,juninho,hellomoto,bladerun,zzzzzzz1,keebler,take8422,fffffff1,ginuwine,israe,caesar1,crack1,precious1,garand,magda1,zigazaga,321ewq,johnpaul,mama1234,iceman69,sanjeev,treeman,elric,rebell,1thunder,cochon,deamon,zoltan,straycat,uhbyuj,luvfur,mugsy,primer,wonder1,teetime,candycan,pfchfytw,fromage,gitler,salvatio,piggy1,23049307,zafira,chicky,sergeev,katze,bangers,andriy,jailbait,vaz2107,ghbhjlf,dbjktnnf,aqswde,zaratustra,asroma,1pepper,alyss,kkkkk1,ryan1,radish,cozumel,waterpol,pentium1,rosebowl,farmall,steinway,dbrekz,baranov,jkmuf,another1,chinacat,qqqqqqq1,hadrian,devilmaycry4,ratbag,teddy2,love21,pullings,packrat,robyn1,boobo,qw12er34,tribe1,rosey,celestia,nikkie,fortune12,olga123,danthema,gameon,vfrfhjys,dilshod,henry14,jenova,redblue,chimaera,pennywise,sokrates,danimal,qqaazz,fuaqz4,killer2,198200,tbone1,kolyan,wabbit,lewis1,maxtor,egoist,asdfas,spyglass,omegas,jack12,nikitka,esperanz,doozer,matematika,wwwww1,ssssss1,poiu0987,suchka,courtney1,gungho,alpha2,fktyjxrf,summer06,bud420,devildriver,heavyd,saracen,foucault,choclate,rjdfktyrj,goblue1,monaro,jmoney,dcpugh,efbcapa201,qqh92r,pepsicol,bbb747,ch5nmk,honeyb,beszoptad,tweeter,intheass,iseedeadpeople,123dan,89231243658s,farside1,findme,smiley1,55556666,sartre,ytcnjh,kacper,costarica,134679258,mikeys,nolimit9,vova123,withyou,5rxypn,love143,freebie,rescue1,203040,michael6,12monkey,redgreen,steff,itstime,naveen,good12345,acidrain,1dawg,miramar,playas,daddio,orion2,852741,studmuff,kobe24,senha123,stephe,mehmet,allalone,scarface1,helloworld,smith123,blueyes,vitali,memphis1,mybitch,colin1,159874,1dick,podaria,d6wnro,brahms,f3gh65,dfcbkmtd,xxxman,corran,ugejvp,qcfmtz,marusia,totem,arachnid,matrix2,antonell,fgntrf,zemfira,christos,surfing1,naruto123,plato1,56qhxs,madzia,vanille,043aaa,asq321,mutton,ohiostate,golde,cdznjckfd,rhfcysq,green5,elephan,superdog,jacqueli,bollock,lolitas,nick12,1orange,maplelea,july23,argento,waldorf,wolfer,pokemon12,zxcvbnmm,flicka,drexel,outlawz,harrie,atrain,juice2,falcons1,charlie6,19391945,tower1,dragon21,hotdamn,dirtyboy,love4ever,1ginger,thunder2,virgo1,alien1,bubblegu,4wwvte,123456789qqq,realtime,studio54,passss,vasilek,awsome,giorgia,bigbass,2002tii,sunghile,mosdef,simbas,count0,uwrl7c,summer05,lhepmz,ranger21,sugarbea,principe,5550123,tatanka,9638v,cheerios,majere,nomercy,jamesbond007,bh90210,7550055,jobber,karaganda,pongo,trickle,defamer,6chid8,1q2a3z,tuscan,nick123,.adgjm,loveyo,hobbes1,note1234,shootme,171819,loveporn,9788960,monty123,fabrice,macduff,monkey13,shadowfa,tweeker,hanna1,madball,telnet,loveu2,qwedcxzas,thatsit,vfhcbr,ptfe3xxp,gblfhfcs,ddddddd1,hakkinen,liverune,deathsta,misty123,suka123,recon1,inferno1,232629,polecat,sanibel,grouch,hitech,hamradio,rkfdbfnehf,vandam,nadin,fastlane,shlong,iddqdidkfa,ledzeppelin,sexyfeet,098123,stacey1,negras,roofing,lucifer1,ikarus,tgbyhn,melnik,barbaria,montego,twisted1,bigal1,jiggle,darkwolf,acerview,silvio,treetops,bishop1,iwanna,pornsite,happyme,gfccdjhl,114411,veritech,batterse,casey123,yhntgb,mailto,milli,guster,q12345678,coronet,sleuth,fuckmeha,armadill,kroshka,geordie,lastochka,pynchon,killall,tommy123,sasha1996,godslove,hikaru,clticic,cornbrea,vfkmdbyf,passmaster,123123123a,souris,nailer,diabolo,skipjack,martin12,hinata,mof6681,brookie,dogfight,johnso,karpov,326598,rfvbrflpt,travesti,caballer,galaxy1,wotan,antoha,art123,xakep1234,ricflair,pervert1,p00kie,ambulanc,santosh,berserker,larry33,bitch123,a987654321,dogstar,angel22,cjcbcrf,redhouse,toodles,gold123,hotspot,kennedy1,glock21,chosen1,schneide,mainman,taffy1,3ki42x,4zqauf,ranger2,4meonly,year2000,121212a,kfylsi,netzwerk,diese,picasso1,rerecz,225522,dastan,swimmer1,brooke1,blackbea,oneway,ruslana,dont4get,phidelt,chrisp,gjyxbr,xwing,kickme,shimmy,kimmy1,4815162342lost,qwerty5,fcporto,jazzbo,mierd,252627,basses,sr20det,00133,florin,howdy1,kryten,goshen,koufax,cichlid,imhotep,andyman,wrest666,saveme,dutchy,anonymou,semprini,siempre,mocha1,forest11,wildroid,aspen1,sesam,kfgekz,cbhbec,a55555,sigmanu,slash1,giggs11,vatech,marias,candy123,jericho1,kingme,123a123,drakula,cdjkjxm,mercur,oneman,hoseman,plumper,ilovehim,lancers,sergey1,takeshi,goodtogo,cranberr,ghjcnj123,harvick,qazxs,1972chev,horsesho,freedom3,letmein7,saitek,anguss,vfvfgfgfz,300000,elektro,toonporn,999111999q,mamuka,q9umoz,edelweis,subwoofer,bayside,disturbe,volition,lucky3,12345678z,3mpz4r,march1,atlantida,strekoza,seagrams,090909t,yy5rbfsc,jack1234,sammy12,sampras,mark12,eintrach,chaucer,lllll1,nochance,whitepower,197000,lbvekz,passer,torana,12345as,pallas,koolio,12qw34,nokia8800,findout,1thomas,mmmmm1,654987,mihaela,chinaman,superduper,donnas,ringo1,jeroen,gfdkjdf,professo,cdtnrf,tranmere,tanstaaf,himera,ukflbfnjh,667788,alex32,joschi,w123456,okidoki,flatline,papercli,super8,doris1,2good4u,4z34l0ts,pedigree,freeride,gsxr1100,wulfgar,benjie,ferdinan,king1,charlie7,djdxbr,fhntvbq,ripcurl,2wsx1qaz,kingsx,desade,sn00py,loveboat,rottie,evgesha,4money,dolittle,adgjmpt,buzzers,brett1,makita,123123qweqwe,rusalka,sluts1,123456e,jameson1,bigbaby,1z2z3z,ckjybr,love4u,fucker69,erhfbyf,jeanluc,farhad,fishfood,merkin,giant1,golf69,rfnfcnhjaf,camera1,stromb,smoothy,774411,nylon,juice1,rfn.irf,newyor,123456789t,marmot,star11,jennyff,jester1,hisashi,kumquat,alex777,helicopt,merkur,dehpye,cummin,zsmj2v,kristjan,april12,englan,honeypot,badgirls,uzumaki,keines,p12345,guita,quake1,duncan1,juicer,milkbone,hurtme,123456789b,qq123456789,schwein,p3wqaw,54132442,qwertyytrewq,andreeva,ruffryde,punkie,abfkrf,kristinka,anna1987,ooooo1,335533aa,umberto,amber123,456123789,456789123,beelch,manta,peeker,1112131415,3141592654,gipper,wrinkle5,katies,asd123456,james11,78n3s5af,michael0,daboss,jimmyb,hotdog1,david69,852123,blazed,sickan,eljefe,2n6wvq,gobills,rfhfcm,squeaker,cabowabo,luebri,karups,test01,melkor,angel777,smallvil,modano,olorin,4rkpkt,leslie1,koffie,shadows1,littleon,amiga1,topeka,summer20,asterix1,pitstop,aloysius,k12345,magazin,joker69,panocha,pass1word,1233214,ironpony,368ejhih,88keys,pizza123,sonali,57np39,quake2,1234567890qw,1020304,sword1,fynjif,abcde123,dfktyjr,rockys,grendel1,harley12,kokakola,super2,azathoth,lisa123,shelley1,girlss,ibragim,seven1,jeff24,1bigdick,dragan,autobot,t4nvp7,omega123,900000,hecnfv,889988,nitro1,doggie1,fatjoe,811pahc,tommyt,savage1,pallino,smitty1,jg3h4hfn,jamielee,1qazwsx,zx123456,machine1,asdfgh123,guinnes,789520,sharkman,jochen,legend1,sonic2,extreme1,dima12,photoman,123459876,nokian95,775533,vaz2109,april10,becks,repmvf,pooker,qwer12345,themaster,nabeel,monkey10,gogetit,hockey99,bbbbbbb1,zinedine,dolphin2,anelka,1superma,winter01,muggsy,horny2,669966,kuleshov,jesusis,calavera,bullet1,87t5hdf,sleepers,winkie,vespa,lightsab,carine,magister,1spider,shitbird,salavat,becca1,wc18c2,shirak,galactus,zaskar,barkley1,reshma,dogbreat,fullsail,asasa,boeder,12345ta,zxcvbnm12,lepton,elfquest,tony123,vkaxcs,savatage,sevilia1,badkitty,munkey,pebbles1,diciembr,qapmoc,gabriel2,1qa2ws3e,cbcmrb,welldone,nfyufh,kaizen,jack11,manisha,grommit,g12345,maverik,chessman,heythere,mixail,jjjjjjj1,sylvia1,fairmont,harve,skully,global1,youwish,pikachu1,badcat,zombie1,49527843,ultra1,redrider,offsprin,lovebird,153426,stymie,aq1sw2,sorrento,0000001,r3ady41t,webster1,95175,adam123,coonass,159487,slut1,gerasim,monkey99,slutwife,159963,1pass1page,hobiecat,bigtymer,all4you,maggie2,olamide,comcast1,infinit,bailee,vasileva,.ktxrf,asdfghjkl1,12345678912,setter,fuckyou7,nnagqx,lifesuck,draken,austi,feb2000,cable1,1234qwerasdf,hax0red,zxcv12,vlad7788,nosaj,lenovo,underpar,huskies1,lovegirl,feynman,suerte,babaloo,alskdjfhg,oldsmobi,bomber1,redrover,pupuce,methodman,phenom,cutegirl,countyli,gretsch,godisgood,bysunsu,hardhat,mironova,123qwe456rty,rusty123,salut,187211,555666777,11111z,mahesh,rjntyjxtr,br00klyn,dunce1,timebomb,bovine,makelove,littlee,shaven,rizwan,patrick7,42042042,bobbijo,rustem,buttmunc,dongle,tiger69,bluecat,blackhol,shirin,peaces,cherub,cubase,longwood,lotus7,gwju3g,bruin,pzaiu8,green11,uyxnyd,seventee,dragon5,tinkerbel,bluess,bomba,fedorova,joshua2,bodyshop,peluche,gbpacker,shelly1,d1i2m3a4,ghtpbltyn,talons,sergeevna,misato,chrisc,sexmeup,brend,olddog,davros,hazelnut,bridget1,hzze929b,readme,brethart,wild1,ghbdtnbr1,nortel,kinger,royal1,bucky1,allah1,drakkar,emyeuanh,gallaghe,hardtime,jocker,tanman,flavio,abcdef123,leviatha,squid1,skeet,sexse,123456x,mom4u4mm,lilred,djljktq,ocean11,cadaver,baxter1,808state,fighton,primavera,1andrew,moogle,limabean,goddess1,vitalya,blue56,258025,bullride,cicci,1234567d,connor1,gsxr11,oliveoil,leonard1,legsex,gavrik,rjnjgtc,mexicano,2bad4u,goodfellas,ornw6d,mancheste,hawkmoon,zlzfrh,schorsch,g9zns4,bashful,rossi46,stephie,rfhfntkm,sellout,123fuck,stewar1,solnze,00007,thor5200,compaq12,didit,bigdeal,hjlbyf,zebulon,wpf8eu,kamran,emanuele,197500,carvin,ozlq6qwm,3syqo15hil,pennys,epvjb6,asdfghjkl123,198000,nfbcbz,jazzer,asfnhg66,zoloft,albundy,aeiou,getlaid,planet1,gjkbyjxrf,alex2000,brianb,moveon,maggie11,eieio,vcradq,shaggy1,novartis,cocoloco,dunamis,554uzpad,sundrop,1qwertyu,alfie,feliks,briand,123www,red456,addams,fhntv1998,goodhead,theway,javaman,angel01,stratoca,lonsdale,15987532,bigpimpin,skater1,issue43,muffie,yasmina,slowride,crm114,sanity729,himmel,carolcox,bustanut,parabola,masterlo,computador,crackhea,dynastar,rockbott,doggysty,wantsome,bigten,gaelle,juicy1,alaska1,etower,sixnine,suntan,froggies,nokia7610,hunter11,njnets,alicante,buttons1,diosesamo,elizabeth1,chiron,trustnoo,amatuers,tinytim,mechta,sammy2,cthulu,trs8f7,poonam,m6cjy69u35,cookie12,blue25,jordans,santa1,kalinka,mikey123,lebedeva,12345689,kissss,queenbee,vjybnjh,ghostdog,cuckold,bearshare,rjcntyrj,alinochka,ghjcnjrdfibyj,aggie1,teens1,3qvqod,dauren,tonino,hpk2qc,iqzzt580,bears85,nascar88,theboy,njqcw4,masyanya,pn5jvw,intranet,lollone,shadow99,00096462,techie,cvtifhbrb,redeemed,gocanes,62717315,topman,intj3a,cobrajet,antivirus,whyme,berserke,ikilz083,airedale,brandon2,hopkig,johanna1,danil8098,gojira,arthu,vision1,pendragon,milen,chrissie,vampiro,mudder,chris22,blowme69,omega7,surfers,goterps,italy1,baseba11,diego1,gnatsum,birdies,semenov,joker123,zenit2011,wojtek,cab4ma99,watchmen,damia,forgotte,fdm7ed,strummer,freelanc,cingular,orange77,mcdonalds,vjhjpjdf,kariya,tombston,starlet,hawaii1,dantheman,megabyte,nbvjirf,anjing,ybrjkftdbx,hotmom,kazbek,pacific1,sashimi,asd12,coorslig,yvtte545,kitte,elysium,klimenko,cobblers,kamehameha,only4me,redriver,triforce,sidorov,vittoria,fredi,dank420,m1234567,fallout2,989244342a,crazy123,crapola,servus,volvos,1scooter,griffin1,autopass,ownzyou,deviant,george01,2kgwai,boeing74,simhrq,hermosa,hardcor,griffy,rolex1,hackme,cuddles1,master3,bujhtr,aaron123,popolo,blader,1sexyred,gerry1,cronos,ffvdj474,yeehaw,bob1234,carlos2,mike77,buckwheat,ramesh,acls2h,monster2,montess,11qq22ww,lazer,zx123456789,chimpy,masterch,sargon,lochness,archana,1234qwert,hbxfhl,sarahb,altoid,zxcvbn12,dakot,caterham,dolomite,chazz,r29hqq,longone,pericles,grand1,sherbert,eagle3,pudge,irontree,synapse,boome,nogood,summer2,pooki,gangsta1,mahalkit,elenka,lbhtrnjh,dukedog,19922991,hopkins1,evgenia,domino1,x123456,manny1,tabbycat,drake1,jerico,drahcir,kelly2,708090a,facesit,11c645df,mac123,boodog,kalani,hiphop1,critters,hellothere,tbirds,valerka,551scasi,love777,paloalto,mrbrown,duke3d,killa1,arcturus,spider12,dizzy1,smudger,goddog,75395,spammy,1357997531,78678,datalife,zxcvbn123,1122112211,london22,23dp4x,rxmtkp,biggirls,ownsu,lzbs2twz,sharps,geryfe,237081a,golakers,nemesi,sasha1995,pretty1,mittens1,d1lakiss,speedrac,gfhjkmm,sabbat,hellrais,159753258,qwertyuiop123,playgirl,crippler,salma,strat1,celest,hello5,omega5,cheese12,ndeyl5,edward12,soccer3,cheerio,davido,vfrcbr,gjhjctyjr,boscoe,inessa,shithole,ibill,qwepoi,201jedlz,asdlkj,davidk,spawn2,ariel1,michael4,jamie123,romantik,micro1,pittsbur,canibus,katja,muhtar,thomas123,studboy,masahiro,rebrov,patrick8,hotboys,sarge1,1hammer,nnnnn1,eistee,datalore,jackdani,sasha2010,mwq6qlzo,cmfnpu,klausi,cnhjbntkm,andrzej,ilovejen,lindaa,hunter123,vvvvv1,novembe,hamster1,x35v8l,lacey1,1silver,iluvporn,valter,herson,alexsandr,cojones,backhoe,womens,777angel,beatit,klingon1,ta8g4w,luisito,benedikt,maxwel,inspecto,zaq12ws,wladimir,bobbyd,peterj,asdfg12,hellspawn,bitch69,nick1234,golfer23,sony123,jello1,killie,chubby1,kodaira52,yanochka,buckfast,morris1,roaddogg,snakeeye,sex1234,mike22,mmouse,fucker11,dantist,brittan,vfrfhjdf,doc123,plokijuh,emerald1,batman01,serafim,elementa,soccer9,footlong,cthuttdbx,hapkido,eagle123,getsmart,getiton,batman2,masons,mastiff,098890,cfvfhf,james7,azalea,sherif,saun24865709,123red,cnhtrjpf,martina1,pupper,michael5,alan12,shakir,devin1,ha8fyp,palom,mamulya,trippy,deerhunter,happyone,monkey77,3mta3,123456789f,crownvic,teodor,natusik,0137485,vovchik,strutter,triumph1,cvetok,moremone,sonnen,screwbal,akira1,sexnow,pernille,independ,poopies,samapi,kbcbxrf,master22,swetlana,urchin,viper2,magica,slurpee,postit,gilgames,kissarmy,clubpenguin,limpbizk,timber1,celin,lilkim,fuckhard,lonely1,mom123,goodwood,extasy,sdsadee23,foxglove,malibog,clark1,casey2,shell1,odense,balefire,dcunited,cubbie,pierr,solei,161718,bowling1,areyukesc,batboy,r123456,1pionee,marmelad,maynard1,cn42qj,cfvehfq,heathrow,qazxcvbn,connecti,secret123,newfie,xzsawq21,tubitzen,nikusha,enigma1,yfcnz123,1austin,michaelc,splunge,wanger,phantom2,jason2,pain4me,primetime21,babes1,liberte,sugarray,undergro,zonker,labatts,djhjyf,watch1,eagle5,madison2,cntgfirf,sasha2,masterca,fiction7,slick50,bruins1,sagitari,12481632,peniss,insuranc,2b8riedt,12346789,mrclean,ssptx452,tissot,q1w2e3r4t5y6u7,avatar1,comet1,spacer,vbrjkf,pass11,wanker1,14vbqk9p,noshit,money4me,sayana,fish1234,seaways,pipper,romeo123,karens,wardog,ab123456,gorilla1,andrey123,lifesucks,jamesr,4wcqjn,bearman,glock22,matt11,dflbvrf,barbi,maine1,dima1997,sunnyboy,6bjvpe,bangkok1,666666q,rafiki,letmein0,0raziel0,dalla,london99,wildthin,patrycja,skydog,qcactw,tmjxn151,yqlgr667,jimmyd,stripclub,deadwood,863abgsg,horses1,qn632o,scatman,sonia1,subrosa,woland,kolya,charlie4,moleman,j12345,summer11,angel11,blasen,sandal,mynewpas,retlaw,cambria,mustang4,nohack04,kimber45,fatdog,maiden1,bigload,necron,dupont24,ghost123,turbo2,.ktymrf,radagast,balzac,vsevolod,pankaj,argentum,2bigtits,mamabear,bumblebee,mercury7,maddie1,chomper,jq24nc,snooky,pussylic,1lovers,taltos,warchild,diablo66,jojo12,sumerki,aventura,gagger,annelies,drumset,cumshots,azimut,123580,clambake,bmw540,birthday54,psswrd,paganini,wildwest,filibert,teaseme,1test,scampi,thunder5,antosha,purple12,supersex,hhhhhh1,brujah,111222333a,13579a,bvgthfnjh,4506802a,killians,choco,qqqwwweee,raygun,1grand,koetsu13,sharp1,mimi92139,fastfood,idontcare,bluered,chochoz,4z3al0ts,target1,sheffiel,labrat,stalingrad,147123,cubfan,corvett1,holden1,snapper1,4071505,amadeo,pollo,desperados,lovestory,marcopolo,mumbles,familyguy,kimchee,marcio,support1,tekila,shygirl1,trekkie,submissi,ilaria,salam,loveu,wildstar,master69,sales1,netware,homer2,arseniy,gerrity1,raspberr,atreyu,stick1,aldric,tennis12,matahari,alohomora,dicanio,michae1,michaeld,666111,luvbug,boyscout,esmerald,mjordan,admiral1,steamboa,616913,ybhdfyf,557711,555999,sunray,apokalipsis,theroc,bmw330,buzzy,chicos,lenusik,shadowma,eagles05,444222,peartree,qqq123,sandmann,spring1,430799,phatass,andi03,binky1,arsch,bamba,kenny123,fabolous,loser123,poop12,maman,phobos,tecate,myxworld4,metros,cocorico,nokia6120,johnny69,hater,spanked,313233,markos,love2011,mozart1,viktoriy,reccos,331234,hornyone,vitesse,1um83z,55555q,proline,v12345,skaven,alizee,bimini,fenerbahce,543216,zaqqaz,poi123,stabilo,brownie1,1qwerty1,dinesh,baggins1,1234567t,davidkin,friend1,lietuva,octopuss,spooks,12345qq,myshit,buttface,paradoxx,pop123,golfin,sweet69,rfghbp,sambuca,kayak1,bogus1,girlz,dallas12,millers,123456zx,operatio,pravda,eternal1,chase123,moroni,proust,blueduck,harris1,redbarch,996699,1010101,mouche,millenni,1123456,score1,1234565,1234576,eae21157,dave12,pussyy,gfif1991,1598741,hoppy,darrian,snoogins,fartface,ichbins,vfkbyrf,rusrap,2741001,fyfrjylf,aprils,favre,thisis,bannana,serval,wiggum,satsuma,matt123,ivan123,gulmira,123zxc123,oscar2,acces,annie2,dragon0,emiliano,allthat,pajaro,amandine,rawiswar,sinead,tassie,karma1,piggys,nokias,orions,origami,type40,mondo,ferrets,monker,biteme2,gauntlet,arkham,ascona,ingram01,klem1,quicksil,bingo123,blue66,plazma,onfire,shortie,spjfet,123963,thered,fire777,lobito,vball,1chicken,moosehea,elefante,babe23,jesus12,parallax,elfstone,number5,shrooms,freya,hacker1,roxette,snoops,number7,fellini,dtlmvf,chigger,mission1,mitsubis,kannan,whitedog,james01,ghjgecr,rfnfgekmnf,everythi,getnaked,prettybo,sylvan,chiller,carrera4,cowbo,biochem,azbuka,qwertyuiop1,midnight1,informat,audio1,alfred1,0range,sucker1,scott2,russland,1eagle,torben,djkrjlfd,rocky6,maddy1,bonobo,portos,chrissi,xjznq5,dexte,vdlxuc,teardrop,pktmxr,iamtheone,danijela,eyphed,suzuki1,etvww4,redtail,ranger11,mowerman,asshole2,coolkid,adriana1,bootcamp,longcut,evets,npyxr5,bighurt,bassman1,stryder,giblet,nastja,blackadd,topflite,wizar,cumnow,technolo,bassboat,bullitt,kugm7b,maksimus,wankers,mine12,sunfish,pimpin1,shearer9,user1,vjzgjxnf,tycobb,80070633pc,stanly,vitaly,shirley1,cinzia,carolyn1,angeliqu,teamo,qdarcv,aa123321,ragdoll,bonit,ladyluck,wiggly,vitara,jetbalance,12345600,ozzman,dima12345,mybuddy,shilo,satan66,erebus,warrio,090808qwe,stupi,bigdan,paul1234,chiapet,brooks1,philly1,dually,gowest,farmer1,1qa2ws3ed4rf,alberto1,beachboy,barne,aa12345,aliyah,radman,benson1,dfkthbq,highball,bonou2,i81u812,workit,darter,redhook,csfbr5yy,buttlove,episode1,ewyuza,porthos,lalal,abcd12,papero,toosexy,keeper1,silver7,jujitsu,corset,pilot123,simonsay,pinggolf,katerinka,kender,drunk1,fylhjvtlf,rashmi,nighthawk,maggy,juggernaut,larryb,cabibble,fyabcf,247365,gangstar,jaybee,verycool,123456789qw,forbidde,prufrock,12345zxc,malaika,blackbur,docker,filipe,koshechka,gemma1,djamaal,dfcbkmtdf,gangst,9988aa,ducks1,pthrfkj,puertorico,muppets,griffins,whippet,sauber,timofey,larinso,123456789zxc,quicken,qsefth,liteon,headcase,bigdadd,zxc321,maniak,jamesc,bassmast,bigdogs,1girls,123xxx,trajan,lerochka,noggin,mtndew,04975756,domin,wer123,fumanchu,lambada,thankgod,june22,kayaking,patchy,summer10,timepass,poiu1234,kondor,kakka,lament,zidane10,686xqxfg,l8v53x,caveman1,nfvthkfy,holymoly,pepita,alex1996,mifune,fighter1,asslicker,jack22,abc123abc,zaxxon,midnigh,winni,psalm23,punky,monkey22,password13,mymusic,justyna,annushka,lucky5,briann,495rus19,withlove,almaz,supergir,miata,bingbong,bradpitt,kamasutr,yfgjktjy,vanman,pegleg,amsterdam1,123a321,letmein9,shivan,korona,bmw520,annette1,scotsman,gandal,welcome12,sc00by,qpwoei,fred69,m1sf1t,hamburg1,1access,dfkmrbhbz,excalibe,boobies1,fuckhole,karamel,starfuck,star99,breakfas,georgiy,ywvxpz,smasher,fatcat1,allanon,12345n,coondog,whacko,avalon1,scythe,saab93,timon,khorne,atlast,nemisis,brady12,blenheim,52678677,mick7278,9skw5g,fleetwoo,ruger1,kissass,pussy7,scruff,12345l,bigfun,vpmfsz,yxkck878,evgeny,55667788,lickher,foothill,alesis,poppies,77777778,californi,mannie,bartjek,qhxbij,thehulk,xirt2k,angelo4ek,rfkmrekznjh,tinhorse,1david,sparky12,night1,luojianhua,bobble,nederland,rosemari,travi,minou,ciscokid,beehive,565hlgqo,alpine1,samsung123,trainman,xpress,logistic,vw198m2n,hanter,zaqwsx123,qwasz,mariachi,paska,kmg365,kaulitz,sasha12,north1,polarbear,mighty1,makeksa11,123456781,one4all,gladston,notoriou,polniypizdec110211,gosia,grandad,xholes,timofei,invalidp,speaker1,zaharov,maggiema,loislane,gonoles,br5499,discgolf,kaskad,snooper,newman1,belial,demigod,vicky1,pridurok,alex1990,tardis1,cruzer,hornie,sacramen,babycat,burunduk,mark69,oakland1,me1234,gmctruck,extacy,sexdog,putang,poppen,billyd,1qaz2w,loveable,gimlet,azwebitalia,ragtop,198500,qweas,mirela,rock123,11bravo,sprewell,tigrenok,jaredleto,vfhbif,blue2,rimjob,catwalk,sigsauer,loqse,doromich,jack01,lasombra,jonny5,newpassword,profesor,garcia1,123as123,croucher,demeter,4_life,rfhfvtkm,superman2,rogues,assword1,russia1,jeff1,mydream,z123456789,rascal1,darre,kimberl,pickle1,ztmfcq,ponchik,lovesporn,hikari,gsgba368,pornoman,chbjun,choppy,diggity,nightwolf,viktori,camar,vfhecmrf,alisa1,minstrel,wishmaster,mulder1,aleks,gogirl,gracelan,8womys,highwind,solstice,dbrnjhjdyf,nightman,pimmel,beertje,ms6nud,wwfwcw,fx3tuo,poopface,asshat,dirtyd,jiminy,luv2fuck,ptybnxtvgbjy,dragnet,pornogra,10inch,scarlet1,guido1,raintree,v123456,1aaaaaaa,maxim1935,hotwater,gadzooks,playaz,harri,brando1,defcon1,ivanna,123654a,arsenal2,candela,nt5d27,jaime1,duke1,burton1,allstar1,dragos,newpoint,albacore,1236987z,verygoodbot,1wildcat,fishy1,ptktysq,chris11,puschel,itdxtyrj,7kbe9d,serpico,jazzie,1zzzzz,kindbuds,wenef45313,1compute,tatung,sardor,gfyfcjybr,test99,toucan,meteora,lysander,asscrack,jowgnx,hevnm4,suckthis,masha123,karinka,marit,oqglh565,dragon00,vvvbbb,cheburashka,vfrfrf,downlow,unforgiven,p3e85tr,kim123,sillyboy,gold1,golfvr6,quicksan,irochka,froglegs,shortsto,caleb1,tishka,bigtitts,smurfy,bosto,dropzone,nocode,jazzbass,digdug,green7,saltlake,therat,dmitriev,lunita,deaddog,summer0,1212qq,bobbyg,mty3rh,isaac1,gusher,helloman,sugarbear,corvair,extrem,teatime,tujazopi,titanik,efyreg,jo9k2jw2,counchac,tivoli,utjvtnhbz,bebit,jacob6,clayton1,incubus1,flash123,squirter,dima2010,cock1,rawks,komatsu,forty2,98741236,cajun1,madelein,mudhoney,magomed,q111111,qaswed,consense,12345b,bakayaro,silencer,zoinks,bigdic,werwolf,pinkpuss,96321478,alfie1,ali123,sarit,minette,musics,chato,iaapptfcor,cobaka,strumpf,datnigga,sonic123,yfnecbr,vjzctvmz,pasta1,tribbles,crasher,htlbcrf,1tiger,shock123,bearshar,syphon,a654321,cubbies1,jlhanes,eyespy,fucktheworld,carrie1,bmw325is,suzuk,mander,dorina,mithril,hondo1,vfhnbyb,sachem,newton1,12345x,7777755102q,230857z,xxxsex,scubapro,hayastan,spankit,delasoul,searock6,fallout3,nilrem,24681357,pashka,voluntee,pharoh,willo,india1,badboy69,roflmao,gunslinger,lovergir,mama12,melange,640xwfkv,chaton,darkknig,bigman1,aabbccdd,harleyd,birdhouse,giggsy,hiawatha,tiberium,joker7,hello1234,sloopy,tm371855,greendog,solar1,bignose,djohn11,espanol,oswego,iridium,kavitha,pavell,mirjam,cyjdsvujljv,alpha5,deluge,hamme,luntik,turismo,stasya,kjkbnf,caeser,schnecke,tweety1,tralfaz,lambrett,prodigy1,trstno1,pimpshit,werty1,karman,bigboob,pastel,blackmen,matthew8,moomin,q1w2e,gilly,primaver,jimmyg,house2,elviss,15975321,1jessica,monaliza,salt55,vfylfhbyrf,harley11,tickleme,murder1,nurgle,kickass1,theresa1,fordtruck,pargolf,managua,inkognito,sherry1,gotit,friedric,metro2033,slk230,freeport,cigarett,492529,vfhctkm,thebeach,twocats,bakugan,yzerman1,charlieb,motoko,skiman,1234567w,pussy3,love77,asenna,buffie,260zntpc,kinkos,access20,mallard1,fuckyou69,monami,rrrrr1,bigdog69,mikola,1boomer,godzila,ginger2,dima2000,skorpion39,dima1234,hawkdog79,warrior2,ltleirf,supra1,jerusale,monkey01,333z333,666888,kelsey1,w8gkz2x1,fdfnfh,msnxbi,qwe123rty,mach1,monkey3,123456789qq,c123456,nezabudka,barclays,nisse,dasha1,12345678987654321,dima1993,oldspice,frank2,rabbitt,prettyboy,ov3ajy,iamthema,kawasak,banjo1,gtivr6,collants,gondor,hibees,cowboys2,codfish,buster2,purzel,rubyred,kayaker,bikerboy,qguvyt,masher,sseexx,kenshiro,moonglow,semenova,rosari,eduard1,deltaforce,grouper,bongo1,tempgod,1taylor,goldsink,qazxsw1,1jesus,m69fg2w,maximili,marysia,husker1,kokanee,sideout,googl,south1,plumber1,trillian,00001,1357900,farkle,1xxxxx,pascha,emanuela,bagheera,hound1,mylov,newjersey,swampfox,sakic19,torey,geforce,wu4etd,conrail,pigman,martin2,ber02,nascar2,angel69,barty,kitsune,cornet,yes90125,goomba,daking,anthea,sivart,weather1,ndaswf,scoubidou,masterchief,rectum,3364068,oranges1,copter,1samanth,eddies,mimoza,ahfywbz,celtic88,86mets,applemac,amanda11,taliesin,1angel,imhere,london11,bandit12,killer666,beer1,06225930,psylocke,james69,schumach,24pnz6kc,endymion,wookie1,poiu123,birdland,smoochie,lastone,rclaki,olive1,pirat,thunder7,chris69,rocko,151617,djg4bb4b,lapper,ajcuivd289,colole57,shadow7,dallas21,ajtdmw,executiv,dickies,omegaman,jason12,newhaven,aaaaaas,pmdmscts,s456123789,beatri,applesauce,levelone,strapon,benladen,creaven,ttttt1,saab95,f123456,pitbul,54321a,sex12345,robert3,atilla,mevefalkcakk,1johnny,veedub,lilleke,nitsuj,5t6y7u8i,teddys,bluefox,nascar20,vwjetta,buffy123,playstation3,loverr,qweasd12,lover2,telekom,benjamin1,alemania,neutrino,rockz,valjean,testicle,trinity3,realty,firestarter,794613852,ardvark,guadalup,philmont,arnold1,holas,zw6syj,birthday299,dover1,sexxy1,gojets,741236985,cance,blue77,xzibit,qwerty88,komarova,qweszxc,footer,rainger,silverst,ghjcnb,catmando,tatooine,31217221027711,amalgam,69dude,qwerty321,roscoe1,74185,cubby,alfa147,perry1,darock,katmandu,darknight,knicks1,freestuff,45454,kidman,4tlved,axlrose,cutie1,quantum1,joseph10,ichigo,pentium3,rfhectkm,rowdy1,woodsink,justforfun,sveta123,pornografia,mrbean,bigpig,tujheirf,delta9,portsmou,hotbod,kartal,10111213,fkbyf001,pavel1,pistons1,necromancer,verga,c7lrwu,doober,thegame1,hatesyou,sexisfun,1melissa,tuczno18,bowhunte,gobama,scorch,campeon,bruce2,fudge1,herpderp,bacon1,redsky,blackeye,19966991,19992000,ripken8,masturba,34524815,primax,paulina1,vp6y38,427cobra,4dwvjj,dracon,fkg7h4f3v6,longview,arakis,panama1,honda2,lkjhgfdsaz,razors,steels,fqkw5m,dionysus,mariajos,soroka,enriqu,nissa,barolo,king1234,hshfd4n279,holland1,flyer1,tbones,343104ky,modems,tk421,ybrbnrf,pikapp,sureshot,wooddoor,florida2,mrbungle,vecmrf,catsdogs,axolotl,nowayout,francoi,chris21,toenail,hartland,asdjkl,nikkii,onlyyou,buckskin,fnord,flutie,holen1,rincewind,lefty1,ducky1,199000,fvthbrf,redskin1,ryno23,lostlove,19mtpgam19,abercrom,benhur,jordan11,roflcopter,ranma,phillesh,avondale,igromania,p4ssword,jenny123,tttttt1,spycams,cardigan,2112yyz,sleepy1,paris123,mopars,lakers34,hustler1,james99,matrix3,popimp,12pack,eggbert,medvedev,testit,performa,logitec,marija,sexybeast,supermanboy,iwantit,rjktcj,jeffer,svarog,halo123,whdbtp,nokia3230,heyjoe,marilyn1,speeder,ibxnsm,prostock,bennyboy,charmin,codydog,parol999,ford9402,jimmer,crayola,159357258,alex77,joey1,cayuga,phish420,poligon,specops,tarasova,caramelo,draconis,dimon,cyzkhw,june29,getbent,1guitar,jimjam,dictiona,shammy,flotsam,0okm9ijn,crapper,technic,fwsadn,rhfdxtyrj,zaq11qaz,anfield1,159753q,curious1,hip-hop,1iiiii,gfhjkm2,cocteau,liveevil,friskie,crackhead,b1afra,elektrik,lancer1,b0ll0cks,jasond,z1234567,tempest1,alakazam,asdfasd,duffy1,oneday,dinkle,qazedctgb,kasimir,happy7,salama,hondaciv,nadezda,andretti,cannondale,sparticu,znbvjd,blueice,money01,finster,eldar,moosie,pappa,delta123,neruda,bmw330ci,jeanpaul,malibu1,alevtina,sobeit,travolta,fullmetal,enamorad,mausi,boston12,greggy,smurf1,ratrace,ichiban,ilovepus,davidg,wolf69,villa1,cocopuff,football12,starfury,zxc12345,forfree,fairfiel,dreams1,tayson,mike2,dogday,hej123,oldtimer,sanpedro,clicker,mollycat,roadstar,golfe,lvbnhbq1,topdevice,a1b2c,sevastopol,calli,milosc,fire911,pink123,team3x,nolimit5,snickers1,annies,09877890,jewel1,steve69,justin11,autechre,killerbe,browncow,slava1,christer,fantomen,redcloud,elenberg,beautiful1,passw0rd1,nazira,advantag,cockring,chaka,rjpzdrf,99941,az123456,biohazar,energie,bubble1,bmw323,tellme,printer1,glavine,1starwar,coolbeans,april17,carly1,quagmire,admin2,djkujuhfl,pontoon,texmex,carlos12,thermo,vaz2106,nougat,bob666,1hockey,1john,cricke,qwerty10,twinz,totalwar,underwoo,tijger,lildevil,123q321,germania,freddd,1scott,beefy,5t4r3e2w1q,fishbait,nobby,hogger,dnstuff,jimmyc,redknapp,flame1,tinfloor,balla,nfnfhby,yukon1,vixens,batata,danny123,1zxcvbnm,gaetan,homewood,greats,tester1,green99,1fucker,sc0tland,starss,glori,arnhem,goatman,1234asd,supertra,bill123,elguapo,sexylegs,jackryan,usmc69,innow,roaddog,alukard,winter11,crawler,gogiants,rvd420,alessandr,homegrow,gobbler,esteba,valeriy,happy12,1joshua,hawking,sicnarf,waynes,iamhappy,bayadera,august2,sashas,gotti,dragonfire,pencil1,halogen,borisov,bassingw,15975346,zachar,sweetp,soccer99,sky123,flipyou,spots3,xakepy,cyclops1,dragon77,rattolo58,motorhea,piligrim,helloween,dmb2010,supermen,shad0w,eatcum,sandokan,pinga,ufkfrnbrf,roksana,amista,pusser,sony1234,azerty1,1qasw2,ghbdt,q1w2e3r4t5y6u7i8,ktutylf,brehznev,zaebali,shitass,creosote,gjrtvjy,14938685,naughtyboy,pedro123,21crack,maurice1,joesakic,nicolas1,matthew9,lbyfhf,elocin,hfcgbplzq,pepper123,tiktak,mycroft,ryan11,firefly1,arriva,cyecvevhbr,loreal,peedee,jessica8,lisa01,anamari,pionex,ipanema,airbag,frfltvbz,123456789aa,epwr49,casper12,sweethear,sanandreas,wuschel,cocodog,france1,119911,redroses,erevan,xtvgbjy,bigfella,geneve,volvo850,evermore,amy123,moxie,celebs,geeman,underwor,haslo1,joy123,hallow,chelsea0,12435687,abarth,12332145,tazman1,roshan,yummie,genius1,chrisd,ilovelife,seventy7,qaz1wsx2,rocket88,gaurav,bobbyboy,tauchen,roberts1,locksmit,masterof,www111,d9ungl,volvos40,asdasd1,golfers,jillian1,7xm5rq,arwpls4u,gbhcf2,elloco,football2,muerte,bob101,sabbath1,strider1,killer66,notyou,lawnboy,de7mdf,johnnyb,voodoo2,sashaa,homedepo,bravos,nihao123,braindea,weedhead,rajeev,artem1,camille1,rockss,bobbyb,aniston,frnhbcf,oakridge,biscayne,cxfcnm,dressage,jesus3,kellyann,king69,juillet,holliste,h00ters,ripoff,123645,1999ar,eric12,123777,tommi,dick12,bilder,chris99,rulezz,getpaid,chicubs,ender1,byajhvfnbrf,milkshak,sk8board,freakshow,antonella,monolit,shelb,hannah01,masters1,pitbull1,1matthew,luvpussy,agbdlcid,panther2,alphas,euskadi,8318131,ronnie1,7558795,sweetgirl,cookie59,sequoia,5552555,ktyxbr,4500455,money7,severus,shinobu,dbityrf,phisig,rogue2,fractal,redfred,sebastian1,nelli,b00mer,cyberman,zqjphsyf6ctifgu,oldsmobile,redeemer,pimpi,lovehurts,1slayer,black13,rtynfdh,airmax,g00gle,1panther,artemon,nopasswo,fuck1234,luke1,trinit,666000,ziadma,oscardog,davex,hazel1,isgood,demond,james5,construc,555551,january2,m1911a1,flameboy,merda,nathan12,nicklaus,dukester,hello99,scorpio7,leviathan,dfcbktr,pourquoi,vfrcbv123,shlomo,rfcgth,rocky3,ignatz,ajhneyf,roger123,squeek,4815162342a,biskit,mossimo,soccer21,gridlock,lunker,popstar,ghhh47hj764,chutney,nitehawk,vortec,gamma1,codeman,dragula,kappasig,rainbow2,milehigh,blueballs,ou8124me,rulesyou,collingw,mystere,aster,astrovan,firetruck,fische,crawfish,hornydog,morebeer,tigerpaw,radost,144000,1chance,1234567890qwe,gracie1,myopia,oxnard,seminoles,evgeni,edvard,partytim,domani,tuffy1,jaimatadi,blackmag,kzueirf,peternor,mathew1,maggie12,henrys,k1234567,fasted,pozitiv,cfdtkbq,jessica7,goleafs,bandito,girl78,sharingan,skyhigh,bigrob,zorros,poopers,oldschoo,pentium2,gripper,norcal,kimba,artiller,moneymak,00197400,272829,shadow1212,thebull,handbags,all4u2c,bigman2,civics,godisgoo,section8,bandaid,suzanne1,zorba,159123,racecars,i62gbq,rambo123,ironroad,johnson2,knobby,twinboys,sausage1,kelly69,enter2,rhjirf,yessss,james12,anguilla,boutit,iggypop,vovochka,06060,budwiser,romuald,meditate,good1,sandrin,herkules,lakers8,honeybea,11111111a,miche,rangers9,lobster1,seiko,belova,midcon,mackdadd,bigdaddy1,daddie,sepultur,freddy12,damon1,stormy1,hockey2,bailey12,hedimaptfcor,dcowboys,sadiedog,thuggin,horny123,josie1,nikki2,beaver69,peewee1,mateus,viktorija,barrys,cubswin1,matt1234,timoxa,rileydog,sicilia,luckycat,candybar,julian1,abc456,pussylip,phase1,acadia,catty,246800,evertonf,bojangle,qzwxec,nikolaj,fabrizi,kagome,noncapa0,marle,popol,hahaha1,cossie,carla10,diggers,spankey,sangeeta,cucciolo,breezer,starwar1,cornholio,rastafari,spring99,yyyyyyy1,webstar,72d5tn,sasha1234,inhouse,gobuffs,civic1,redstone,234523,minnie1,rivaldo,angel5,sti2000,xenocide,11qq11,1phoenix,herman1,holly123,tallguy,sharks1,madri,superbad,ronin,jalal123,hardbody,1234567r,assman1,vivahate,buddylee,38972091,bonds25,40028922,qrhmis,wp2005,ceejay,pepper01,51842543,redrum1,renton,varadero,tvxtjk7r,vetteman,djhvbrc,curly1,fruitcak,jessicas,maduro,popmart,acuari,dirkpitt,buick1,bergerac,golfcart,pdtpljxrf,hooch1,dudelove,d9ebk7,123452000,afdjhbn,greener,123455432,parachut,mookie12,123456780,jeepcj5,potatoe,sanya,qwerty2010,waqw3p,gotika,freaky1,chihuahu,buccanee,ecstacy,crazyboy,slickric,blue88,fktdnbyf,2004rj,delta4,333222111,calient,ptbdhw,1bailey,blitz1,sheila1,master23,hoagie,pyf8ah,orbita,daveyboy,prono1,delta2,heman,1horny,tyrik123,ostrov,md2020,herve,rockfish,el546218,rfhbyjxrf,chessmaster,redmoon,lenny1,215487,tomat,guppy,amekpass,amoeba,my3girls,nottingh,kavita,natalia1,puccini,fabiana,8letters,romeos,netgear,casper2,taters,gowings,iforgot1,pokesmot,pollit,lawrun,petey1,rosebuds,007jr,gthtcnhjqrf,k9dls02a,neener,azertyu,duke11,manyak,tiger01,petros,supermar,mangas,twisty,spotter,takagi,dlanod,qcmfd454,tusymo,zz123456,chach,navyblue,gilbert1,2kash6zq,avemaria,1hxboqg2s,viviane,lhbjkjubz2957704,nowwowtg,1a2b3c4,m0rn3,kqigb7,superpuper,juehtw,gethigh,theclown,makeme,pradeep,sergik,deion21,nurik,devo2706,nbvibt,roman222,kalima,nevaeh,martin7,anathema,florian1,tamwsn3sja,dinmamma,133159,123654q,slicks,pnp0c08,yojimbo,skipp,kiran,pussyfuck,teengirl,apples12,myballs,angeli,1234a,125678,opelastra,blind1,armagedd,fish123,pitufo,chelseaf,thedevil,nugget1,cunt69,beetle1,carter15,apolon,collant,password00,fishboy,djkrjdf,deftone,celti,three11,cyrus1,lefthand,skoal1,ferndale,aries1,fred01,roberta1,chucks,cornbread,lloyd1,icecrea,cisco123,newjerse,vfhrbpf,passio,volcom1,rikimaru,yeah11,djembe,facile,a1l2e3x4,batman7,nurbol,lorenzo1,monica69,blowjob1,998899,spank1,233391,n123456,1bear,bellsout,999998,celtic67,sabre1,putas,y9enkj,alfabeta,heatwave,honey123,hard4u,insane1,xthysq,magnum1,lightsaber,123qweqwe,fisher1,pixie1,precios,benfic,thegirls,bootsman,4321rewq,nabokov,hightime,djghjc,1chelsea,junglist,august16,t3fkvkmj,1232123,lsdlsd12,chuckie1,pescado,granit,toogood,cathouse,natedawg,bmw530,123kid,hajime,198400,engine1,wessonnn,kingdom1,novembre,1rocks,kingfisher,qwerty89,jordan22,zasranec,megat,sucess,installutil,fetish01,yanshi1982,1313666,1314520,clemence,wargod,time1,newzealand,snaker,13324124,cfrehf,hepcat,mazahaka,bigjay,denisov,eastwest,1yellow,mistydog,cheetos,1596357,ginger11,mavrik,bubby1,bhbyf,pyramide,giusepp,luthien,honda250,andrewjackie,kentavr,lampoon,zaq123wsx,sonicx,davidh,1ccccc,gorodok,windsong,programm,blunt420,vlad1995,zxcvfdsa,tarasov,mrskin,sachas,mercedes1,koteczek,rawdog,honeybear,stuart1,kaktys,richard7,55555n,azalia,hockey10,scouter,francy,1xxxxxx,julie456,tequilla,penis123,schmoe,tigerwoods,1ferrari,popov,snowdrop,matthieu,smolensk,cornflak,jordan01,love2000,23wesdxc,kswiss,anna2000,geniusnet,baby2000,33ds5x,waverly,onlyone4,networkingpe,raven123,blesse,gocards,wow123,pjflkork,juicey,poorboy,freeee,billybo,shaheen,zxcvbnm.,berlit,truth1,gepard,ludovic,gunther1,bobby2,bob12345,sunmoon,septembr,bigmac1,bcnjhbz,seaking,all4u,12qw34er56ty,bassie,nokia5228,7355608,sylwia,charvel,billgate,davion,chablis,catsmeow,kjiflrf,amylynn,rfvbkkf,mizredhe,handjob,jasper12,erbol,solara,bagpipe,biffer,notime,erlan,8543852,sugaree,oshkosh,fedora,bangbus,5lyedn,longball,teresa1,bootyman,aleksand,qazwsxedc12,nujbhc,tifosi,zpxvwy,lights1,slowpoke,tiger12,kstate,password10,alex69,collins1,9632147,doglover,baseball2,security1,grunts,orange2,godloves,213qwe879,julieb,1qazxsw23edcvfr4,noidea,8uiazp,betsy1,junior2,parol123,123456zz,piehonkii,kanker,bunky,hingis,reese1,qaz123456,sidewinder,tonedup,footsie,blackpoo,jalapeno,mummy1,always1,josh1,rockyboy,plucky,chicag,nadroj,blarney,blood123,wheaties,packer1,ravens1,mrjones,gfhjkm007,anna2010,awatar,guitar12,hashish,scale1,tomwaits,amrita,fantasma,rfpfym,pass2,tigris,bigair,slicker,sylvi,shilpa,cindylou,archie1,bitches1,poppys,ontime,horney1,camaroz28,alladin,bujhm,cq2kph,alina1,wvj5np,1211123a,tetons,scorelan,concordi,morgan2,awacs,shanty,tomcat14,andrew123,bear69,vitae,fred99,chingy,octane,belgario,fatdaddy,rhodan,password23,sexxes,boomtown,joshua01,war3demo,my2kids,buck1,hot4you,monamour,12345aa,yumiko,parool,carlton1,neverland,rose12,right1,sociald,grouse,brandon0,cat222,alex00,civicex,bintang,malkav,arschloc,dodgeviper,qwerty666,goduke,dante123,boss1,ontheroc,corpsman,love14,uiegu451,hardtail,irondoor,ghjrehfnehf,36460341,konijn,h2slca,kondom25,123456ss,cfytxrf,btnjey,nando,freemail,comander,natas666,siouxsie,hummer1,biomed,dimsum,yankees0,diablo666,lesbian1,pot420,jasonm,glock23,jennyb,itsmine,lena2010,whattheh,beandip,abaddon,kishore,signup,apogee,biteme12,suzieq,vgfun4,iseeyou,rifleman,qwerta,4pussy,hawkman,guest1,june17,dicksuck,bootay,cash12,bassale,ktybyuhfl,leetch,nescafe,7ovtgimc,clapton1,auror,boonie,tracker1,john69,bellas,cabinboy,yonkers,silky1,ladyffesta,drache,kamil1,davidp,bad123,snoopy12,sanche,werthvfy,achille,nefertiti,gerald1,slage33,warszawa,macsan26,mason123,kotopes,welcome8,nascar99,kiril,77778888,hairy1,monito,comicsans,81726354,killabee,arclight,yuo67,feelme,86753099,nnssnn,monday12,88351132,88889999,websters,subito,asdf12345,vaz2108,zvbxrpl,159753456852,rezeda,multimed,noaccess,henrique,tascam,captiva,zadrot,hateyou,sophie12,123123456,snoop1,charlie8,birmingh,hardline,libert,azsxdcf,89172735872,rjpthju,bondar,philips1,olegnaruto,myword,yakman,stardog,banana12,1234567890w,farout,annick,duke01,rfj422,billard,glock19,shaolin1,master10,cinderel,deltaone,manning1,biggreen,sidney1,patty1,goforit1,766rglqy,sevendus,aristotl,armagedo,blumen,gfhfyjz,kazakov,lekbyxxx,accord1,idiota,soccer16,texas123,victoire,ololo,chris01,bobbbb,299792458,eeeeeee1,confiden,07070,clarks,techno1,kayley,stang1,wwwwww1,uuuuu1,neverdie,jasonr,cavscout,481516234,mylove1,shaitan,1qazxcvb,barbaros,123456782000,123wer,thissucks,7seven,227722,faerie,hayduke,dbacks,snorkel,zmxncbv,tiger99,unknown1,melmac,polo1234,sssssss1,1fire,369147,bandung,bluejean,nivram,stanle,ctcnhf,soccer20,blingbli,dirtball,alex2112,183461,skylin,boobman,geronto,brittany1,yyz2112,gizmo69,ktrcec,dakota12,chiken,sexy11,vg08k714,bernadet,1bulldog,beachs,hollyb,maryjoy,margo1,danielle1,chakra,alexand,hullcity,matrix12,sarenna,pablos,antler,supercar,chomsky,german1,airjordan,545ettvy,camaron,flight1,netvideo,tootall,valheru,481516,1234as,skimmer,redcross,inuyash,uthvfy,1012nw,edoardo,bjhgfi,golf11,9379992a,lagarto,socball,boopie,krazy,.adgjmptw,gaydar,kovalev,geddylee,firstone,turbodog,loveee,135711,badbo,trapdoor,opopop11,danny2,max2000,526452,kerry1,leapfrog,daisy2,134kzbip,1andrea,playa1,peekab00,heskey,pirrello,gsewfmck,dimon4ik,puppie,chelios,554433,hypnodanny,fantik,yhwnqc,ghbdtngjrf,anchorag,buffett1,fanta,sappho,024680,vialli,chiva,lucylu,hashem,exbntkm,thema,23jordan,jake11,wildside,smartie,emerica,2wj2k9oj,ventrue,timoth,lamers,baerchen,suspende,boobis,denman85,1adam12,otello,king12,dzakuni,qsawbbs,isgay,porno123,jam123,daytona1,tazzie,bunny123,amaterasu,jeffre,crocus,mastercard,bitchedup,chicago7,aynrand,intel1,tamila,alianza,mulch,merlin12,rose123,alcapone,mircea,loveher,joseph12,chelsea6,dorothy1,wolfgar,unlimite,arturik,qwerty3,paddy1,piramid,linda123,cooool,millie1,warlock1,forgotit,tort02,ilikeyou,avensis,loveislife,dumbass1,clint1,2110se,drlove,olesia,kalinina,sergey123,123423,alicia1,markova,tri5a3,media1,willia1,xxxxxxx1,beercan,smk7366,jesusislord,motherfuck,smacker,birthday5,jbaby,harley2,hyper1,a9387670a,honey2,corvet,gjmptw,rjhjkmbien,apollon,madhuri,3a5irt,cessna17,saluki,digweed,tamia1,yja3vo,cfvlehfr,1111111q,martyna,stimpy1,anjana,yankeemp,jupiler,idkfa,1blue,fromv,afric,3xbobobo,liverp00l,nikon1,amadeus1,acer123,napoleo,david7,vbhjckfdf,mojo69,percy1,pirates1,grunt1,alenushka,finbar,zsxdcf,mandy123,1fred,timewarp,747bbb,druids,julia123,123321qq,spacebar,dreads,fcbarcelona,angela12,anima,christopher1,stargazer,123123s,hockey11,brewski,marlbor,blinker,motorhead,damngood,werthrf,letmein3,moremoney,killer99,anneke,eatit,pilatus,andrew01,fiona1,maitai,blucher,zxgdqn,e5pftu,nagual,panic1,andron,openwide,alphabeta,alison1,chelsea8,fende,mmm666,1shot2,a19l1980,123456@,1black,m1chael,vagner,realgood,maxxx,vekmnbr,stifler,2509mmh,tarkan,sherzod,1234567b,gunners1,artem2010,shooby,sammie1,p123456,piggie,abcde12345,nokia6230,moldir,piter,1qaz3edc,frequenc,acuransx,1star,nikeair,alex21,dapimp,ranjan,ilovegirls,anastasiy,berbatov,manso,21436587,leafs1,106666,angelochek,ingodwetrust,123456aaa,deano,korsar,pipetka,thunder9,minka,himura,installdevic,1qqqqq,digitalprodu,suckmeoff,plonker,headers,vlasov,ktr1996,windsor1,mishanya,garfield1,korvin,littlebit,azaz09,vandamme,scripto,s4114d,passward,britt1,r1chard,ferrari5,running1,7xswzaq,falcon2,pepper76,trademan,ea53g5,graham1,volvos80,reanimator,micasa,1234554321q,kairat,escorpion,sanek94,karolina1,kolovrat,karen2,1qaz@wsx,racing1,splooge,sarah2,deadman1,creed1,nooner,minicoop,oceane,room112,charme,12345ab,summer00,wetcunt,drewman,nastyman,redfire,appels,merlin69,dolfin,bornfree,diskette,ohwell,12345678qwe,jasont,madcap,cobra2,dolemit1,whatthehell,juanit,voldemar,rocke,bianc,elendil,vtufgjkbc,hotwheels,spanis,sukram,pokerface,k1ller,freakout,dontae,realmadri,drumss,gorams,258789,snakey,jasonn,whitewolf,befree,johnny99,pooka,theghost,kennys,vfvektxrf,toby1,jumpman23,deadlock,barbwire,stellina,alexa1,dalamar,mustanggt,northwes,tesoro,chameleo,sigtau,satoshi,george11,hotcum,cornell1,golfer12,geek01d,trololo,kellym,megapolis,pepsi2,hea666,monkfish,blue52,sarajane,bowler1,skeets,ddgirls,hfccbz,bailey01,isabella1,dreday,moose123,baobab,crushme,000009,veryhot,roadie,meanone,mike18,henriett,dohcvtec,moulin,gulnur,adastra,angel9,western1,natura,sweetpe,dtnfkm,marsbar,daisys,frogger1,virus1,redwood1,streetball,fridolin,d78unhxq,midas,michelob,cantik,sk2000,kikker,macanudo,rambone,fizzle,20000,peanuts1,cowpie,stone32,astaroth,dakota01,redso,mustard1,sexylove,giantess,teaparty,bobbin,beerbong,monet1,charles3,anniedog,anna1988,cameleon,longbeach,tamere,qpful542,mesquite,waldemar,12345zx,iamhere,lowboy,canard,granp,daisymay,love33,moosejaw,nivek,ninjaman,shrike01,aaa777,88002000600,vodolei,bambush,falcor,harley69,alphaomega,severine,grappler,bosox,twogirls,gatorman,vettes,buttmunch,chyna,excelsio,crayfish,birillo,megumi,lsia9dnb9y,littlebo,stevek,hiroyuki,firehous,master5,briley2,gangste,chrisk,camaleon,bulle,troyboy,froinlaven,mybutt,sandhya,rapala,jagged,crazycat,lucky12,jetman,wavmanuk,1heather,beegee,negril,mario123,funtime1,conehead,abigai,mhorgan,patagoni,travel1,backspace,frenchfr,mudcat,dashenka,baseball3,rustys,741852kk,dickme,baller23,griffey1,suckmycock,fuhrfzgc,jenny2,spuds,berlin1,justfun,icewind,bumerang,pavlusha,minecraft123,shasta1,ranger12,123400,twisters,buthead,miked,finance1,dignity7,hello9,lvjdp383,jgthfnjh,dalmatio,paparoach,miller31,2bornot2b,fathe,monterre,theblues,satans,schaap,jasmine2,sibelius,manon,heslo,jcnhjd,shane123,natasha2,pierrot,bluecar,iloveass,harriso,red12,london20,job314,beholder,reddawg,fuckyou!,pussylick,bologna1,austintx,ole4ka,blotto,onering,jearly,balbes,lightbul,bighorn,crossfir,lee123,prapor,1ashley,gfhjkm22,wwe123,09090,sexsite,marina123,jagua,witch1,schmoo,parkview,dragon3,chilango,ultimo,abramova,nautique,2bornot2,duende,1arthur,nightwing,surfboar,quant4307,15s9pu03,karina1,shitball,walleye1,wildman1,whytesha,1morgan,my2girls,polic,baranova,berezuckiy,kkkkkk1,forzima,fornow,qwerty02,gokart,suckit69,davidlee,whatnow,edgard,tits1,bayshore,36987412,ghbphfr,daddyy,explore1,zoidberg,5qnzjx,morgane,danilov,blacksex,mickey12,balsam,83y6pv,sarahc,slaye,all4u2,slayer69,nadia1,rlzwp503,4cranker,kaylie,numberon,teremok,wolf12,deeppurple,goodbeer,aaa555,66669999,whatif,harmony1,ue8fpw,3tmnej,254xtpss,dusty197,wcksdypk,zerkalo,dfnheirf,motorol,digita,whoareyou,darksoul,manics,rounders,killer11,d2000lb,cegthgfhjkm,catdog1,beograd,pepsico,julius1,123654987,softbal,killer23,weasel1,lifeson,q123456q,444555666,bunches,andy1,darby1,service01,bear11,jordan123,amega,duncan21,yensid,lerxst,rassvet,bronco2,fortis,pornlove,paiste,198900,asdflkjh,1236547890,futur,eugene1,winnipeg261,fk8bhydb,seanjohn,brimston,matthe1,bitchedu,crisco,302731,roxydog,woodlawn,volgograd,ace1210,boy4u2ownnyc,laura123,pronger,parker12,z123456z,andrew13,longlife,sarang,drogba,gobruins,soccer4,holida,espace,almira,murmansk,green22,safina,wm00022,1chevy,schlumpf,doroth,ulises,golf99,hellyes,detlef,mydog,erkina,bastardo,mashenka,sucram,wehttam,generic1,195000,spaceboy,lopas123,scammer,skynyrd,daddy2,titani,ficker,cr250r,kbnthfnehf,takedown,sticky1,davidruiz,desant,nremtp,painter1,bogies,agamemno,kansas1,smallfry,archi,2b4dnvsx,1player,saddie,peapod,6458zn7a,qvw6n2,gfxqx686,twice2,sh4d0w3d,mayfly,375125,phitau,yqmbevgk,89211375759,kumar1,pfhfpf,toyboy,way2go,7pvn4t,pass69,chipster,spoony,buddycat,diamond3,rincewin,hobie,david01,billbo,hxp4life,matild,pokemon2,dimochka,clown1,148888,jenmt3,cuxldv,cqnwhy,cde34rfv,simone1,verynice,toobig,pasha123,mike00,maria2,lolpop,firewire,dragon9,martesana,a1234567890,birthday3,providen,kiska,pitbulls,556655,misawa,damned69,martin11,goldorak,gunship,glory1,winxclub,sixgun,splodge,agent1,splitter,dome69,ifghjb,eliza1,snaiper,wutang36,phoenix7,666425,arshavin,paulaner,namron,m69fg1w,qwert1234,terrys,zesyrmvu,joeman,scoots,dwml9f,625vrobg,sally123,gostoso,symow8,pelota,c43qpul5rz,majinbuu,lithium1,bigstuff,horndog1,kipelov,kringle,1beavis,loshara,octobe,jmzacf,12342000,qw12qw,runescape1,chargers1,krokus,piknik,jessy,778811,gjvbljh,474jdvff,pleaser,misskitty,breaker1,7f4df451,dayan,twinky,yakumo,chippers,matia,tanith,len2ski1,manni,nichol1,f00b4r,nokia3110,standart,123456789i,shami,steffie,larrywn,chucker,john99,chamois,jjjkkk,penmouse,ktnj2010,gooners,hemmelig,rodney1,merlin01,bearcat1,1yyyyy,159753z,1fffff,1ddddd,thomas11,gjkbyrf,ivanka,f1f2f3,petrovna,phunky,conair,brian2,creative1,klipsch,vbitymrf,freek,breitlin,cecili,westwing,gohabsgo,tippmann,1steve,quattro6,fatbob,sp00ky,rastas,1123581,redsea,rfnmrf,jerky1,1aaaaaa,spk666,simba123,qwert54321,123abcd,beavis69,fyfyfc,starr1,1236547,peanutbutter,sintra,12345abcde,1357246,abcde1,climbon,755dfx,mermaids,monte1,serkan,geilesau,777win,jasonc,parkside,imagine1,rockhead,producti,playhard,principa,spammer,gagher,escada,tsv1860,dbyjuhfl,cruiser1,kennyg,montgome,2481632,pompano,cum123,angel6,sooty,bear01,april6,bodyhamm,pugsly,getrich,mikes,pelusa,fosgate,jasonp,rostislav,kimberly1,128mo,dallas11,gooner1,manuel1,cocacola1,imesh,5782790,password8,daboys,1jones,intheend,e3w2q1,whisper1,madone,pjcgujrat,1p2o3i,jamesp,felicida,nemrac,phikap,firecat,jrcfyjxrf,matt12,bigfan,doedel,005500,jasonx,1234567k,badfish,goosey,utjuhfabz,wilco,artem123,igor123,spike123,jor23dan,dga9la,v2jmsz,morgan12,avery1,dogstyle,natasa,221195ws,twopac,oktober7,karthik,poop1,mightymo,davidr,zermatt,jehova,aezakmi1,dimwit,monkey5,serega123,qwerty111,blabl,casey22,boy123,1clutch,asdfjkl1,hariom,bruce10,jeep95,1smith,sm9934,karishma,bazzzz,aristo,669e53e1,nesterov,kill666,fihdfv,1abc2,anna1,silver11,mojoman,telefono,goeagles,sd3lpgdr,rfhfynby,melinda1,llcoolj,idteul,bigchief,rocky13,timberwo,ballers,gatekeep,kashif,hardass,anastasija,max777,vfuyjkbz,riesling,agent99,kappas,dalglish,tincan,orange3,turtoise,abkbvjy,mike24,hugedick,alabala,geolog,aziza,devilboy,habanero,waheguru,funboy,freedom5,natwest,seashore,impaler,qwaszx1,pastas,bmw535,tecktonik,mika00,jobsearc,pinche,puntang,aw96b6,1corvett,skorpio,foundati,zzr1100,gembird,vfnhjcrby,soccer18,vaz2110,peterp,archer1,cross1,samedi,dima1992,hunter99,lipper,hotbody,zhjckfdf,ducati1,trailer1,04325956,cheryl1,benetton,kononenko,sloneczko,rfgtkmrf,nashua,balalaika,ampere,eliston,dorsai,digge,flyrod,oxymoron,minolta,ironmike,majortom,karimov,fortun,putaria,an83546921an13,blade123,franchis,mxaigtg5,dynxyu,devlt4,brasi,terces,wqmfuh,nqdgxz,dale88,minchia,seeyou,housepen,1apple,1buddy,mariusz,bighouse,tango2,flimflam,nicola1,qwertyasd,tomek1,shumaher,kartoshka,bassss,canaries,redman1,123456789as,preciosa,allblacks,navidad,tommaso,beaudog,forrest1,green23,ryjgjxrf,go4it,ironman2,badnews,butterba,1grizzly,isaeva,rembrand,toront,1richard,bigjon,yfltymrf,1kitty,4ng62t,littlejo,wolfdog,ctvtyjd,spain1,megryan,tatertot,raven69,4809594q,tapout,stuntman,a131313,lagers,hotstuf,lfdbl11,stanley2,advokat,boloto,7894561,dooker,adxel187,cleodog,4play,0p9o8i,masterb,bimota,charlee,toystory,6820055,6666667,crevette,6031769,corsa,bingoo,dima1990,tennis11,samuri,avocado,melissa6,unicor,habari,metart,needsex,cockman,hernan,3891576,3334444,amigo1,gobuffs2,mike21,allianz,2835493,179355,midgard,joey123,oneluv,ellis1,towncar,shonuff,scouse,tool69,thomas19,chorizo,jblaze,lisa1,dima1999,sophia1,anna1989,vfvekbxrf,krasavica,redlegs,jason25,tbontb,katrine,eumesmo,vfhufhbnrf,1654321,asdfghj1,motdepas,booga,doogle,1453145,byron1,158272,kardinal,tanne,fallen1,abcd12345,ufyljy,n12345,kucing,burberry,bodger,1234578,februar,1234512,nekkid,prober,harrison1,idlewild,rfnz90,foiegras,pussy21,bigstud,denzel,tiffany2,bigwill,1234567890zzz,hello69,compute1,viper9,hellspaw,trythis,gococks,dogballs,delfi,lupine,millenia,newdelhi,charlest,basspro,1mike,joeblack,975310,1rosebud,batman11,misterio,fucknut,charlie0,august11,juancho,ilonka,jigei743ks,adam1234,889900,goonie,alicat,ggggggg1,1zzzzzzz,sexywife,northstar,chris23,888111,containe,trojan1,jason5,graikos,1ggggg,1eeeee,tigers01,indigo1,hotmale,jacob123,mishima,richard3,cjxb2014,coco123,meagain,thaman,wallst,edgewood,bundas,1power,matilda1,maradon,hookedup,jemima,r3vi3wpass,2004-10-,mudman,taz123,xswzaq,emerson1,anna21,warlord1,toering,pelle,tgwdvu,masterb8,wallstre,moppel,priora,ghjcnjrdfif,yoland,12332100,1j9e7f6f,jazzzz,yesman,brianm,42qwerty42,12345698,darkmanx,nirmal,john31,bb123456,neuspeed,billgates,moguls,fj1200,hbhlair,shaun1,ghbdfn,305pwzlr,nbu3cd,susanb,pimpdad,mangust6403,joedog,dawidek,gigante,708090,703751,700007,ikalcr,tbivbn,697769,marvi,iyaayas,karen123,jimmyboy,dozer1,e6z8jh,bigtime1,getdown,kevin12,brookly,zjduc3,nolan1,cobber,yr8wdxcq,liebe,m1garand,blah123,616879,action1,600000,sumitomo,albcaz,asian1,557799,dave69,556699,sasa123,streaker,michel1,karate1,buddy7,daulet,koks888,roadtrip,wapiti,oldguy,illini1,1234qq,mrspock,kwiatek,buterfly,august31,jibxhq,jackin,taxicab,tristram,talisker,446655,444666,chrisa,freespace,vfhbfyyf,chevell,444333,notyours,442244,christian1,seemore,sniper12,marlin1,joker666,multik,devilish,crf450,cdfoli,eastern1,asshead,duhast,voyager2,cyberia,1wizard,cybernet,iloveme1,veterok,karandash,392781,looksee,diddy,diabolic,foofight,missey,herbert1,bmw318i,premier1,zsfmpv,eric1234,dun6sm,fuck11,345543,spudman,lurker,bitem,lizzy1,ironsink,minami,339311,s7fhs127,sterne,332233,plankton,galax,azuywe,changepa,august25,mouse123,sikici,killer69,xswqaz,quovadis,gnomik,033028pw,777777a,barrakuda,spawn666,goodgod,slurp,morbius,yelnats,cujo31,norman1,fastone,earwig,aureli,wordlife,bnfkbz,yasmi,austin123,timberla,missy2,legalize,netcom,liljon,takeit,georgin,987654321z,warbird,vitalina,all4u3,mmmmmm1,bichon,ellobo,wahoos,fcazmj,aksarben,lodoss,satnam,vasili,197800,maarten,sam138989,0u812,ankita,walte,prince12,anvils,bestia,hoschi,198300,univer,jack10,ktyecbr,gr00vy,hokie,wolfman1,fuckwit,geyser,emmanue,ybrjkftd,qwerty33,karat,dblock,avocat,bobbym,womersle,1please,nostra,dayana,billyray,alternat,iloveu1,qwerty69,rammstein1,mystikal,winne,drawde,executor,craxxxs,ghjcnjnf,999888777,welshman,access123,963214785,951753852,babe69,fvcnthlfv,****me,666999666,testing2,199200,nintendo64,oscarr,guido8,zhanna,gumshoe,jbird,159357456,pasca,123452345,satan6,mithrand,fhbirf,aa1111aa,viggen,ficktjuv,radial9,davids1,rainbow7,futuro,hipho,platin,poppy123,rhenjq,fulle,rosit,chicano,scrumpy,lumpy1,seifer,uvmrysez,autumn1,xenon,susie1,7u8i9o0p,gamer1,sirene,muffy1,monkeys1,kalinin,olcrackmaster,hotmove,uconn,gshock,merson,lthtdyz,pizzaboy,peggy1,pistache,pinto1,fishka,ladydi,pandor,baileys,hungwell,redboy,rookie1,amanda01,passwrd,clean1,matty1,tarkus,jabba1,bobster,beer30,solomon1,moneymon,sesamo,fred11,sunnysid,jasmine5,thebears,putamadre,workhard,flashbac,counter1,liefde,magnat,corky1,green6,abramov,lordik,univers,shortys,david3,vip123,gnarly,1234567s,billy2,honkey,deathstar,grimmy,govinda,direktor,12345678s,linus1,shoppin,rekbrjdf,santeria,prett,berty75,mohican,daftpunk,uekmyfhf,chupa,strats,ironbird,giants56,salisbur,koldun,summer04,pondscum,jimmyj,miata1,george3,redshoes,weezie,bartman1,0p9o8i7u,s1lver,dorkus,125478,omega9,sexisgood,mancow,patric1,jetta1,074401,ghjuhtcc,gfhjk,bibble,terry2,123213,medicin,rebel2,hen3ry,4freedom,aldrin,lovesyou,browny,renwod,winnie1,belladon,1house,tyghbn,blessme,rfhfrfnbwf,haylee,deepdive,booya,phantasy,gansta,cock69,4mnveh,gazza1,redapple,structur,anakin1,manolito,steve01,poolman,chloe123,vlad1998,qazwsxe,pushit,random123,ontherocks,o236nq,brain1,dimedrol,agape,rovnogod,1balls,knigh,alliso,love01,wolf01,flintstone,beernuts,tuffguy,isengard,highfive,alex23,casper99,rubina,getreal,chinita,italian1,airsoft,qwerty23,muffdiver,willi1,grace123,orioles1,redbull1,chino1,ziggy123,breadman,estefan,ljcneg,gotoit,logan123,wideglid,mancity1,treess,qwe123456,kazumi,qweasdqwe,oddworld,naveed,protos,towson,a801016,godislov,at_asp,bambam1,soccer5,dark123,67vette,carlos123,hoser1,scouser,wesdxc,pelus,dragon25,pflhjn,abdula,1freedom,policema,tarkin,eduardo1,mackdad,gfhjkm11,lfplhfgthvf,adilet,zzzzxxxx,childre,samarkand,cegthgegth,shama,fresher,silvestr,greaser,allout,plmokn,sexdrive,nintendo1,fantasy7,oleander,fe126fd,crumpet,pingzing,dionis,hipster,yfcnz,requin,calliope,jerome1,housecat,abc123456789,doghot,snake123,augus,brillig,chronic1,gfhjkbot,expediti,noisette,master7,caliban,whitetai,favorite3,lisamari,educatio,ghjhjr,saber1,zcegth,1958proman,vtkrbq,milkdud,imajica,thehip,bailey10,hockey19,dkflbdjcnjr,j123456,bernar,aeiouy,gamlet,deltachi,endzone,conni,bcgfybz,brandi1,auckland2010,7653ajl1,mardigra,testuser,bunko18,camaro67,36936,greenie,454dfmcq,6xe8j2z4,mrgreen,ranger5,headhunt,banshee1,moonunit,zyltrc,hello3,pussyboy,stoopid,tigger11,yellow12,drums1,blue02,kils123,junkman,banyan,jimmyjam,tbbucs,sportster,badass1,joshie,braves10,lajolla,1amanda,antani,78787,antero,19216801,chich,rhett32,sarahm,beloit,sucker69,corkey,nicosnn,rccola,caracol,daffyduc,bunny2,mantas,monkies,hedonist,cacapipi,ashton1,sid123,19899891,patche,greekgod,cbr1000,leader1,19977991,ettore,chongo,113311,picass,cfif123,rhtfnbd,frances1,andy12,minnette,bigboy12,green69,alices,babcia,partyboy,javabean,freehand,qawsed123,xxx111,harold1,passwo,jonny1,kappa1,w2dlww3v5p,1merlin,222999,tomjones,jakeman,franken,markhegarty,john01,carole1,daveman,caseys,apeman,mookey,moon123,claret,titans1,residentevil,campari,curitiba,dovetail,aerostar,jackdaniels,basenji,zaq12w,glencoe,biglove,goober12,ncc170,far7766,monkey21,eclipse9,1234567v,vanechka,aristote,grumble,belgorod,abhishek,neworleans,pazzword,dummie,sashadog,diablo11,mst3000,koala1,maureen1,jake99,isaiah1,funkster,gillian1,ekaterina20,chibears,astra123,4me2no,winte,skippe,necro,windows9,vinograd,demolay,vika2010,quiksilver,19371ayj,dollar1,shecky,qzwxecrv,butterfly1,merrill1,scoreland,1crazy,megastar,mandragora,track1,dedhed,jacob2,newhope,qawsedrftgyh,shack1,samvel,gatita,shyster,clara1,telstar,office1,crickett,truls,nirmala,joselito,chrisl,lesnik,aaaabbbb,austin01,leto2010,bubbie,aaa12345,widder,234432,salinger,mrsmith,qazsedcft,newshoes,skunks,yt1300,bmw316,arbeit,smoove,123321qweewq,123qazwsx,22221111,seesaw,0987654321a,peach1,1029384756q,sereda,gerrard8,shit123,batcave,energy1,peterb,mytruck,peter12,alesya,tomato1,spirou,laputaxx,magoo1,omgkremidia,knight12,norton1,vladislava,shaddy,austin11,jlbyjxrf,kbdthgekm,punheta,fetish69,exploiter,roger2,manstein,gtnhjd,32615948worms,dogbreath,ujkjdjkjvrf,vodka1,ripcord,fatrat,kotek1,tiziana,larrybir,thunder3,nbvfnb,9kyq6fge,remembe,likemike,gavin1,shinigam,yfcnfcmz,13245678,jabbar,vampyr,ane4ka,lollipo,ashwin,scuderia,limpdick,deagle,3247562,vishenka,fdhjhf,alex02,volvov70,mandys,bioshock,caraca,tombraider,matrix69,jeff123,13579135,parazit,black3,noway1,diablos,hitmen,garden1,aminor,decembe,august12,b00ger,006900,452073t,schach,hitman1,mariner1,vbnmrf,paint1,742617000027,bitchboy,pfqxjyjr,5681392,marryher,sinnet,malik1,muffin12,aninha,piolin,lady12,traffic1,cbvjyf,6345789,june21,ivan2010,ryan123,honda99,gunny,coorslight,asd321,hunter69,7224763,sonofgod,dolphins1,1dolphin,pavlenko,woodwind,lovelov,pinkpant,gblfhfcbyf,hotel1,justinbiebe,vinter,jeff1234,mydogs,1pizza,boats1,parrothe,shawshan,brooklyn1,cbrown,1rocky,hemi426,dragon64,redwings1,porsches,ghostly,hubbahub,buttnut,b929ezzh,sorokina,flashg,fritos,b7mguk,metatron,treehous,vorpal,8902792,marcu,free123,labamba,chiefs1,zxc123zxc,keli_14,hotti,1steeler,money4,rakker,foxwoods,free1,ahjkjd,sidorova,snowwhit,neptune1,mrlover,trader1,nudelamb,baloo,power7,deltasig,bills1,trevo,7gorwell,nokia6630,nokia5320,madhatte,1cowboys,manga1,namtab,sanjar,fanny1,birdman1,adv12775,carlo1,dude1998,babyhuey,nicole11,madmike,ubvyfpbz,qawsedr,lifetec,skyhook,stalker123,toolong,robertso,ripazha,zippy123,1111111a,manol,dirtyman,analslut,jason3,dutches,minhasenha,cerise,fenrir,jayjay1,flatbush,franka,bhbyjxrf,26429vadim,lawntrax,198700,fritzy,nikhil,ripper1,harami,truckman,nemvxyheqdd5oqxyxyzi,gkfytnf,bugaboo,cableman,hairpie,xplorer,movado,hotsex69,mordred,ohyeah1,patrick3,frolov,katieh,4311111q,mochaj,presari,bigdo,753951852,freedom4,kapitan,tomas1,135795,sweet123,pokers,shagme,tane4ka,sentinal,ufgyndmv,jonnyb,skate123,123456798,123456788,very1,gerrit,damocles,dollarbi,caroline1,lloyds,pizdets,flatland,92702689,dave13,meoff,ajnjuhfabz,achmed,madison9,744744z,amonte,avrillavigne,elaine1,norma1,asseater,everlong,buddy23,cmgang1,trash1,mitsu,flyman,ulugbek,june27,magistr,fittan,sebora64,dingos,sleipnir,caterpil,cindys,212121qaz,partys,dialer,gjytltkmybr,qweqaz,janvier,rocawear,lostboy,aileron,sweety1,everest1,pornman,boombox,potter1,blackdic,44448888,eric123,112233aa,2502557i,novass,nanotech,yourname,x12345,indian1,15975300,1234567l,carla51,chicago0,coleta,cxzdsaewq,qqwweerr,marwan,deltic,hollys,qwerasd,pon32029,rainmake,nathan0,matveeva,legioner,kevink,riven,tombraid,blitzen,a54321,jackyl,chinese1,shalimar,oleg1995,beaches1,tommylee,eknock,berli,monkey23,badbob,pugwash,likewhoa,jesus2,yujyd360,belmar,shadow22,utfp5e,angelo1,minimax,pooder,cocoa1,moresex,tortue,lesbia,panthe,snoopy2,drumnbass,alway,gmcz71,6jhwmqku,leppard,dinsdale,blair1,boriqua,money111,virtuagirl,267605,rattlesn,1sunshin,monica12,veritas1,newmexic,millertime,turandot,rfvxfnrf,jaydog,kakawka,bowhunter,booboo12,deerpark,erreway,taylorma,rfkbybyf,wooglin,weegee,rexdog,iamhorny,cazzo1,vhou812,bacardi1,dctktyyfz,godpasi,peanut12,bertha1,fuckyoubitch,ghosty,altavista,jertoot,smokeit,ghjcnbvtyz,fhnehxbr,rolsen,qazxcdews,maddmaxx,redrocke,qazokm,spencer2,thekiller,asdf11,123sex,tupac1,p1234567,dbrown,1biteme,tgo4466,316769,sunghi,shakespe,frosty1,gucci1,arcana,bandit01,lyubov,poochy,dartmout,magpies1,sunnyd,mouseman,summer07,chester7,shalini,danbury,pigboy,dave99,deniss,harryb,ashley11,pppppp1,01081988m,balloon1,tkachenko,bucks1,master77,pussyca,tricky1,zzxxccvv,zoulou,doomer,mukesh,iluv69,supermax,todays,thefox,don123,dontask,diplom,piglett,shiney,fahbrf,qaz12wsx,temitope,reggin,project1,buffy2,inside1,lbpfqyth,vanilla1,lovecock,u4slpwra,fylh.irf,123211,7ertu3ds,necroman,chalky,artist1,simpso,4x7wjr,chaos666,lazyacres,harley99,ch33s3,marusa,eagle7,dilligas,computadora,lucky69,denwer,nissan350z,unforgiv,oddball,schalke0,aztec1,borisova,branden1,parkave,marie123,germa,lafayett,878kckxy,405060,cheeseca,bigwave,fred22,andreea,poulet,mercutio,psycholo,andrew88,o4izdmxu,sanctuar,newhome,milion,suckmydi,rjvgm.nth,warior,goodgame,1qwertyuiop,6339cndh,scorpio2,macker,southbay,crabcake,toadie,paperclip,fatkid,maddo,cliff1,rastafar,maries,twins1,geujdrf,anjela,wc4fun,dolina,mpetroff,rollout,zydeco,shadow3,pumpki,steeda,volvo240,terras,blowjo,blue2000,incognit,badmojo,gambit1,zhukov,station1,aaronb,graci,duke123,clipper1,qazxsw2,ledzeppe,kukareku,sexkitte,cinco,007008,lakers12,a1234b,acmilan1,afhfjy,starrr,slutty3,phoneman,kostyan,bonzo1,sintesi07,ersatz,cloud1,nephilim,nascar03,rey619,kairos,123456789e,hardon1,boeing1,juliya,hfccdtn,vgfun8,polizei,456838,keithb,minouche,ariston,savag,213141,clarkken,microwav,london2,santacla,campeo,qr5mx7,464811,mynuts,bombo,1mickey,lucky8,danger1,ironside,carter12,wyatt1,borntorun,iloveyou123,jose1,pancake1,tadmichaels,monsta,jugger,hunnie,triste,heat7777,ilovejesus,queeny,luckycharm,lieben,gordolee85,jtkirk,forever21,jetlag,skylane,taucher,neworlea,holera,000005,anhnhoem,melissa7,mumdad,massimiliano,dima1994,nigel1,madison3,slicky,shokolad,serenit,jmh1978,soccer123,chris3,drwho,rfpzdrf,1qasw23ed,free4me,wonka,sasquatc,sanan,maytag,verochka,bankone,molly12,monopoli,xfqybr,lamborgini,gondolin,candycane,needsome,jb007,scottie1,brigit,0147258369,kalamazo,lololyo123,bill1234,ilovejes,lol123123,popkorn,april13,567rntvm,downunde,charle1,angelbab,guildwars,homeworld,qazxcvbnm,superma1,dupa123,kryptoni,happyy,artyom,stormie,cool11,calvin69,saphir,konovalov,jansport,october8,liebling,druuna,susans,megans,tujhjdf,wmegrfux,jumbo1,ljb4dt7n,012345678910,kolesnik,speculum,at4gftlw,kurgan,93pn75,cahek0980,dallas01,godswill,fhifdby,chelsea4,jump23,barsoom,catinhat,urlacher,angel99,vidadi1,678910,lickme69,topaz1,westend,loveone,c12345,gold12,alex1959,mamon,barney12,1maggie,alex12345,lp2568cskt,s1234567,gjikbdctyf,anthony0,browns99,chips1,sunking,widespre,lalala1,tdutif,fucklife,master00,alino4ka,stakan,blonde1,phoebus,tenore,bvgthbz,brunos,suzjv8,uvdwgt,revenant,1banana,veroniqu,sexfun,sp1der,4g3izhox,isakov,shiva1,scooba,bluefire,wizard12,dimitris,funbags,perseus,hoodoo,keving,malboro,157953,a32tv8ls,latics,animate,mossad,yejntb,karting,qmpq39zr,busdrive,jtuac3my,jkne9y,sr20dett,4gxrzemq,keylargo,741147,rfktylfhm,toast1,skins1,xcalibur,gattone,seether,kameron,glock9mm,julio1,delenn,gameday,tommyd,str8edge,bulls123,66699,carlsberg,woodbird,adnama,45auto,codyman,truck2,1w2w3w4w,pvjegu,method1,luetdi,41d8cd98f00b,bankai,5432112345,94rwpe,reneee,chrisx,melvins,775577,sam2000,scrappy1,rachid,grizzley,margare,morgan01,winstons,gevorg,gonzal,crawdad,gfhfdjp,babilon,noneya,pussy11,barbell,easyride,c00li0,777771,311music,karla1,golions,19866891,peejay,leadfoot,hfvbkm,kr9z40sy,cobra123,isotwe,grizz,sallys,****you,aaa123a,dembel,foxs14,hillcres,webman,mudshark,alfredo1,weeded,lester1,hovepark,ratface,000777fffa,huskie,wildthing,elbarto,waikiki,masami,call911,goose2,regin,dovajb,agricola,cjytxrj,andy11,penny123,family01,a121212,1braves,upupa68,happy100,824655,cjlove,firsttim,kalel,redhair,dfhtymt,sliders,bananna,loverbo,fifa2008,crouton,chevy350,panties2,kolya1,alyona,hagrid,spagetti,q2w3e4r,867530,narkoman,nhfdvfnjkju123,1ccccccc,napolean,0072563,allay,w8sted,wigwam,jamesk,state1,parovoz,beach69,kevinb,rossella,logitech1,celula,gnocca,canucks1,loginova,marlboro1,aaaa1,kalleanka,mester,mishutka,milenko,alibek,jersey1,peterc,1mouse,nedved,blackone,ghfplybr,682regkh,beejay,newburgh,ruffian,clarets,noreaga,xenophon,hummerh2,tenshi,smeagol,soloyo,vfhnby,ereiamjh,ewq321,goomie,sportin,cellphone,sonnie,jetblack,saudan,gblfhfc,matheus,uhfvjnf,alicja,jayman1,devon1,hexagon,bailey2,vtufajy,yankees7,salty1,908070,killemal,gammas,eurocard,sydney12,tuesday1,antietam,wayfarer,beast666,19952009sa,aq12ws,eveli,hockey21,haloreach,dontcare,xxxx1,andrea11,karlmarx,jelszo,tylerb,protools,timberwolf,ruffneck,pololo,1bbbbb,waleed,sasami,twinss,fairlady,illuminati,alex007,sucks1,homerjay,scooter7,tarbaby,barmaley,amistad,vanes,randers,tigers12,dreamer2,goleafsg,googie,bernie1,as12345,godeep,james3,phanto,gwbush,cumlover,2196dc,studioworks,995511,golf56,titova,kaleka,itali,socks1,kurwamac,daisuke,hevonen,woody123,daisie,wouter,henry123,gostosa,guppie,porpoise,iamsexy,276115,paula123,1020315,38gjgeuftd,rjrfrjkf,knotty,idiot1,sasha12345,matrix13,securit,radical1,ag764ks,jsmith,coolguy1,secretar,juanas,sasha1988,itout,00000001,tiger11,1butthea,putain,cavalo,basia1,kobebryant,1232323,12345asdfg,sunsh1ne,cyfqgth,tomkat,dorota,dashit,pelmen,5t6y7u,whipit,smokeone,helloall,bonjour1,snowshoe,nilknarf,x1x2x3,lammas,1234599,lol123456,atombomb,ironchef,noclue,alekseev,gwbush1,silver2,12345678m,yesican,fahjlbnf,chapstic,alex95,open1,tiger200,lisichka,pogiako,cbr929,searchin,tanya123,alex1973,phil413,alex1991,dominati,geckos,freddi,silenthill,egroeg,vorobey,antoxa,dark666,shkola,apple22,rebellio,shamanking,7f8srt,cumsucker,partagas,bill99,22223333,arnster55,fucknuts,proxima,silversi,goblues,parcells,vfrcbvjdf,piloto,avocet,emily2,1597530,miniskir,himitsu,pepper2,juiceman,venom1,bogdana,jujube,quatro,botafogo,mama2010,junior12,derrickh,asdfrewq,miller2,chitarra,silverfox,napol,prestigio,devil123,mm111qm,ara123,max33484,sex2000,primo1,sephan,anyuta,alena2010,viborg,verysexy,hibiscus,terps,josefin,oxcart,spooker,speciali,raffaello,partyon,vfhvtkflrf,strela,a123456z,worksuck,glasss,lomonosov,dusty123,dukeblue,1winter,sergeeva,lala123,john22,cmc09,sobolev,bettylou,dannyb,gjkrjdybr,hagakure,iecnhbr,awsedr,pmdmsctsk,costco,alekseeva,fktrcttd,bazuka,flyingv,garuda,buffy16,gutierre,beer12,stomatolog,ernies,palmeiras,golf123,love269,n.kmgfy,gjkysqgbpltw,youare,joeboo,baksik,lifeguar,111a111,nascar8,mindgame,dude1,neopets,frdfkfyu,june24,phoenix8,penelopa,merlin99,mercenar,badluck,mishel,bookert,deadsexy,power9,chinchil,1234567m,alex10,skunk1,rfhkcjy,sammycat,wright1,randy2,marakesh,temppassword,elmer251,mooki,patrick0,bonoedge,1tits,chiar,kylie1,graffix,milkman1,cornel,mrkitty,nicole12,ticketmaster,beatles4,number20,ffff1,terps1,superfre,yfdbufnjh,jake1234,flblfc,1111qq,zanuda,jmol01,wpoolejr,polopol,nicolett,omega13,cannonba,123456789.,sandy69,ribeye,bo243ns,marilena,bogdan123,milla,redskins1,19733791,alias1,movie1,ducat,marzena,shadowru,56565,coolman1,pornlover,teepee,spiff,nafanya,gateway3,fuckyou0,hasher,34778,booboo69,staticx,hang10,qq12345,garnier,bosco123,1234567qw,carson1,samso,1xrg4kcq,cbr929rr,allan123,motorbik,andrew22,pussy101,miroslava,cytujdbr,camp0017,cobweb,snusmumrik,salmon1,cindy2,aliya,serendipity,co437at,tincouch,timmy123,hunter22,st1100,vvvvvv1,blanka,krondor,sweeti,nenit,kuzmich,gustavo1,bmw320i,alex2010,trees1,kyliem,essayons,april26,kumari,sprin,fajita,appletre,fghbjhb,1green,katieb,steven2,corrado1,satelite,1michell,123456789c,cfkfvfylhf,acurarsx,slut543,inhere,bob2000,pouncer,k123456789,fishie,aliso,audia8,bluetick,soccer69,jordan99,fromhell,mammoth1,fighting54,mike25,pepper11,extra1,worldwid,chaise,vfr800,sordfish,almat,nofate,listopad,hellgate,dctvghbdf,jeremia,qantas,lokiju,honker,sprint1,maral,triniti,compaq3,sixsix6,married1,loveman,juggalo1,repvtyrj,zxcasdqw,123445,whore1,123678,monkey6,west123,warcraf,pwnage,mystery1,creamyou,ant123,rehjgfnrf,corona1,coleman1,steve121,alderaan,barnaul,celeste1,junebug1,bombshel,gretzky9,tankist,targa,cachou,vaz2101,playgolf,boneyard,strateg,romawka,iforgotit,pullup,garbage1,irock,archmage,shaft1,oceano,sadies,alvin1,135135ab,psalm69,lmfao,ranger02,zaharova,33334444,perkman,realman,salguod,cmoney,astonmartin,glock1,greyfox,viper99,helpm,blackdick,46775575,family5,shazbot,dewey1,qwertyas,shivani,black22,mailman1,greenday1,57392632,red007,stanky,sanchez1,tysons,daruma,altosax,krayzie,85852008,1forever,98798798,irock.,123456654,142536789,ford22,brick1,michela,preciou,crazy4u,01telemike01,nolife,concac,safety1,annie123,brunswic,destini,123456qwer,madison0,snowball1,137946,1133557799,jarule,scout2,songohan,thedead,00009999,murphy01,spycam,hirsute,aurinko,associat,1miller,baklan,hermes1,2183rm,martie,kangoo,shweta,yvonne1,westsid,jackpot1,rotciv,maratik,fabrika,claude1,nursultan,noentry,ytnhjufnm,electra1,ghjcnjnfr1,puneet,smokey01,integrit,bugeye,trouble2,14071789,paul01,omgwtf,dmh415,ekilpool,yourmom1,moimeme,sparky11,boludo,ruslan123,kissme1,demetrio,appelsin,asshole3,raiders2,bunns,fynjybj,billygoa,p030710p$e4o,macdonal,248ujnfk,acorns,schmidt1,sparrow1,vinbylrj,weasle,jerom,ycwvrxxh,skywalk,gerlinde,solidus,postal1,poochie1,1charles,rhianna,terorist,rehnrf,omgwtfbbq,assfucke,deadend,zidan,jimboy,vengence,maroon5,7452tr,dalejr88,sombra,anatole,elodi,amazonas,147789,q12345q,gawker1,juanma,kassidy,greek1,bruces,bilbob,mike44,0o9i8u7y6t,kaligula,agentx,familie,anders1,pimpjuice,0128um,birthday10,lawncare,hownow,grandorgue,juggerna,scarfac,kensai,swatteam,123four,motorbike,repytxbr,other1,celicagt,pleomax,gen0303,godisgreat,icepick,lucifer666,heavy1,tea4two,forsure,02020,shortdog,webhead,chris13,palenque,3techsrl,knights1,orenburg,prong,nomarg,wutang1,80637852730,laika,iamfree,12345670,pillow1,12343412,bigears,peterg,stunna,rocky5,12123434,damir,feuerwehr,7418529630,danone,yanina,valenci,andy69,111222q,silvia1,1jjjjj,loveforever,passwo1,stratocaster,8928190a,motorolla,lateralu,ujujkm,chubba,ujkjdf,signon,123456789zx,serdce,stevo,wifey200,ololo123,popeye1,1pass,central1,melena,luxor,nemezida,poker123,ilovemusic,qaz1234,noodles1,lakeshow,amarill,ginseng,billiam,trento,321cba,fatback,soccer33,master13,marie2,newcar,bigtop,dark1,camron,nosgoth,155555,biglou,redbud,jordan7,159789,diversio,actros,dazed,drizzit,hjcnjd,wiktoria,justic,gooses,luzifer,darren1,chynna,tanuki,11335577,icculus,boobss,biggi,firstson,ceisi123,gatewa,hrothgar,jarhead1,happyjoy,felipe1,bebop1,medman,athena1,boneman,keiths,djljgfl,dicklick,russ120,mylady,zxcdsa,rock12,bluesea,kayaks,provista,luckies,smile4me,bootycal,enduro,123123f,heartbre,ern3sto,apple13,bigpappa,fy.njxrf,bigtom,cool69,perrito,quiet1,puszek,cious,cruella,temp1,david26,alemap,aa123123,teddies,tricolor,smokey12,kikiriki,mickey01,robert01,super5,ranman,stevenso,deliciou,money777,degauss,mozar,susanne1,asdasd12,shitbag,mommy123,wrestle1,imfree,fuckyou12,barbaris,florent,ujhijr,f8yruxoj,tefjps,anemone,toltec,2gether,left4dead2,ximen,gfkmvf,dunca,emilys,diana123,16473a,mark01,bigbro,annarbor,nikita2000,11aa11,tigres,llllll1,loser2,fbi11213,jupite,qwaszxqw,macabre,123ert,rev2000,mooooo,klapaucius,bagel1,chiquit,iyaoyas,bear101,irocz28,vfktymrfz,smokey2,love99,rfhnbyf,dracul,keith123,slicko,peacock1,orgasmic,thesnake,solder,wetass,doofer,david5,rhfcyjlfh,swanny,tammys,turkiye,tubaman,estefani,firehose,funnyguy,servo,grace17,pippa1,arbiter,jimmy69,nfymrf,asdf67nm,rjcnzy,demon123,thicknes,sexysex,kristall,michail,encarta,banderos,minty,marchenko,de1987ma,mo5kva,aircav,naomi1,bonni,tatoo,cronaldo,49ers1,mama1963,1truck,telecaster,punksnotdead,erotik,1eagles,1fender,luv269,acdeehan,tanner1,freema,1q3e5t7u,linksys,tiger6,megaman1,neophyte,australia1,mydaddy,1jeffrey,fgdfgdfg,gfgekz,1986irachka,keyman,m0b1l3,dfcz123,mikeyg,playstation2,abc125,slacker1,110491g,lordsoth,bhavani,ssecca,dctvghbdtn,niblick,hondacar,baby01,worldcom,4034407,51094didi,3657549,3630000,3578951,sweetpussy,majick,supercoo,robert11,abacabb,panda123,gfhjkm13,ford4x4,zippo1,lapin,1726354,lovesong,dude11,moebius,paravoz,1357642,matkhau,solnyshko,daniel4,multiplelog,starik,martusia,iamtheman,greentre,jetblue,motorrad,vfrcbvev,redoak,dogma1,gnorman,komlos,tonka1,1010220,666satan,losenord,lateralus,absinthe,command1,jigga1,iiiiiii1,pants1,jungfrau,926337,ufhhbgjnnth,yamakasi,888555,sunny7,gemini69,alone1,zxcvbnmz,cabezon,skyblues,zxc1234,456123a,zero00,caseih,azzurra,legolas1,menudo,murcielago,785612,779977,benidorm,viperman,dima1985,piglet1,hemligt,hotfeet,7elephants,hardup,gamess,a000000,267ksyjf,kaitlynn,sharkie,sisyphus,yellow22,667766,redvette,666420,mets69,ac2zxdty,hxxrvwcy,cdavis,alan1,noddy,579300,druss,eatshit1,555123,appleseed,simpleplan,kazak,526282,fynfyfyfhbde,birthday6,dragon6,1pookie,bluedevils,omg123,hj8z6e,x5dxwp,455445,batman23,termin,chrisbrown,animals1,lucky9,443322,kzktxrf,takayuki,fermer,assembler,zomu9q,sissyboy,sergant,felina,nokia6230i,eminem12,croco,hunt4red,festina,darknigh,cptnz062,ndshnx4s,twizzler,wnmaz7sd,aamaax,gfhfcjkmrf,alabama123,barrynov,happy5,punt0it,durandal,8xuuobe4,cmu9ggzh,bruno12,316497,crazyfrog,vfvfktyf,apple3,kasey1,mackdaddy,anthon1,sunnys,angel3,cribbage,moon1,donal,bryce1,pandabear,mwss474,whitesta,freaker,197100,bitche,p2ssw0rd,turnb,tiktonik,moonlite,ferret1,jackas,ferrum,bearclaw,liberty2,1diablo,caribe,snakeeyes,janbam,azonic,rainmaker,vetalik,bigeasy,baby1234,sureno13,blink1,kluivert,calbears,lavanda,198600,dhtlbyf,medvedeva,fox123,whirling,bonscott,freedom9,october3,manoman,segredo,cerulean,robinso,bsmith,flatus,dannon,password21,rrrrrr1,callista,romai,rainman1,trantor,mickeymo,bulldog7,g123456,pavlin,pass22,snowie,hookah,7ofnine,bubba22,cabible,nicerack,moomoo1,summer98,yoyo123,milan1,lieve27,mustang69,jackster,exocet,nadege,qaz12,bahama,watson1,libras,eclipse2,bahram,bapezm,up9x8rww,ghjcnjz,themaste,deflep27,ghost16,gattaca,fotograf,junior123,gilber,gbjyth,8vjzus,rosco1,begonia,aldebara,flower12,novastar,buzzman,manchild,lopez1,mama11,william7,yfcnz1,blackstar,spurs123,moom4242,1amber,iownyou,tightend,07931505,paquito,1johnson,smokepot,pi31415,snowmass,ayacdc,jessicam,giuliana,5tgbnhy6,harlee,giuli,bigwig,tentacle,scoubidou2,benelli,vasilina,nimda,284655,jaihind,lero4ka,1tommy,reggi,ididit,jlbyjxtcndj,mike26,qbert,wweraw,lukasz,loosee123,palantir,flint1,mapper,baldie,saturne,virgin1,meeeee,elkcit,iloveme2,blue15,themoon,radmir,number3,shyanne,missle,hannelor,jasmina,karin1,lewie622,ghjcnjqgfhjkm,blasters,oiseau,sheela,grinders,panget,rapido,positiv,twink,fltkbyf,kzsfj874,daniel01,enjoyit,nofags,doodad,rustler,squealer,fortunat,peace123,khushi,devils2,7inches,candlebo,topdawg,armen,soundman,zxcqweasd,april7,gazeta,netman,hoppers,bear99,ghbjhbntn,mantle7,bigbo,harpo,jgordon,bullshi,vinny1,krishn,star22,thunderc,galinka,phish123,tintable,nightcrawler,tigerboy,rbhgbx,messi,basilisk,masha1998,nina123,yomamma,kayla123,geemoney,0000000000d,motoman,a3jtni,ser123,owen10,italien,vintelok,12345rewq,nightime,jeepin,ch1tt1ck,mxyzptlk,bandido,ohboy,doctorj,hussar,superted,parfilev,grundle,1jack,livestrong,chrisj,matthew3,access22,moikka,fatone,miguelit,trivium,glenn1,smooches,heiko,dezember,spaghett,stason,molokai,bossdog,guitarma,waderh,boriska,photosho,path13,hfrtnf,audre,junior24,monkey24,silke,vaz21093,bigblue1,trident1,candide,arcanum,klinker,orange99,bengals1,rosebu,mjujuj,nallepuh,mtwapa1a,ranger69,level1,bissjop,leica,1tiffany,rutabega,elvis77,kellie1,sameas,barada,karabas,frank12,queenb,toutoune,surfcity,samanth1,monitor1,littledo,kazakova,fodase,mistral1,april22,carlit,shakal,batman123,fuckoff2,alpha01,5544332211,buddy3,towtruck,kenwood1,vfiekmrf,jkl123,pypsik,ranger75,sitges,toyman,bartek1,ladygirl,booman,boeing77,installsqlst,222666,gosling,bigmack,223311,bogos,kevin2,gomez1,xohzi3g4,kfnju842,klubnika,cubalibr,123456789101,kenpo,0147852369,raptor1,tallulah,boobys,jjones,1q2s3c,moogie,vid2600,almas,wombat1,extra300,xfiles1,green77,sexsex1,heyjude,sammyy,missy123,maiyeuem,nccpl25282,thicluv,sissie,raven3,fldjrfn,buster22,broncos2,laurab,letmein4,harrydog,solovey,fishlips,asdf4321,ford123,superjet,norwegen,movieman,psw333333,intoit,postbank,deepwate,ola123,geolog323,murphys,eshort,a3eilm2s2y,kimota,belous,saurus,123321qaz,i81b4u,aaa12,monkey20,buckwild,byabybnb,mapleleafs,yfcnzyfcnz,baby69,summer03,twista,246890,246824,ltcnhjth,z1z2z3,monika1,sad123,uto29321,bathory,villan,funkey,poptarts,spam967888,705499fh,sebast,porn1234,earn381,1porsche,whatthef,123456789y,polo12,brillo,soreilly,waters1,eudora,allochka,is_a_bot,winter00,bassplay,531879fiz,onemore,bjarne,red911,kot123,artur1,qazxdr,c0rvette,diamond7,matematica,klesko,beaver12,2enter,seashell,panam,chaching,edward2,browni,xenogear,cornfed,aniram,chicco22,darwin1,ancella2,sophie2,vika1998,anneli,shawn41,babie,resolute,pandora2,william8,twoone,coors1,jesusis1,teh012,cheerlea,renfield,tessa1,anna1986,madness1,bkmlfh,19719870,liebherr,ck6znp42,gary123,123654z,alsscan,eyedoc,matrix7,metalgea,chinito,4iter,falcon11,7jokx7b9du,bigfeet,tassadar,retnuh,muscle1,klimova,darion,batistuta,bigsur,1herbier,noonie,ghjrehjh,karimova,faustus,snowwhite,1manager,dasboot,michael12,analfuck,inbed,dwdrums,jaysoncj,maranell,bsheep75,164379,rolodex,166666,rrrrrrr1,almaz666,167943,russel1,negrito,alianz,goodpussy,veronik,1w2q3r4e,efremov,emb377,sdpass,william6,alanfahy,nastya1995,panther5,automag,123qwe12,vfvf2011,fishe,1peanut,speedie,qazwsx1234,pass999,171204j,ketamine,sheena1,energizer,usethis1,123abc123,buster21,thechamp,flvbhfk,frank69,chane,hopeful1,claybird,pander,anusha,bigmaxxx,faktor,housebed,dimidrol,bigball,shashi,derby1,fredy,dervish,bootycall,80988218126,killerb,cheese2,pariss,mymail,dell123,catbert,christa1,chevytru,gjgjdf,00998877,overdriv,ratten,golf01,nyyanks,dinamite,bloembol,gismo,magnus1,march2,twinkles,ryan22,duckey,118a105b,kitcat,brielle,poussin,lanzarot,youngone,ssvegeta,hero63,battle1,kiler,fktrcfylh1,newera,vika1996,dynomite,oooppp,beer4me,foodie,ljhjuf,sonshine,godess,doug1,constanc,thinkbig,steve2,damnyou,autogod,www333,kyle1,ranger7,roller1,harry2,dustin1,hopalong,tkachuk,b00bies,bill2,deep111,stuffit,fire69,redfish1,andrei123,graphix,1fishing,kimbo1,mlesp31,ifufkbyf,gurkan,44556,emily123,busman,and123,8546404,paladine,1world,bulgakov,4294967296,bball23,1wwwww,mycats,elain,delta6,36363,emilyb,color1,6060842,cdtnkfyrf,hedonism,gfgfrfhkj,5551298,scubad,gostate,sillyme,hdbiker,beardown,fishers,sektor,00000007,newbaby,rapid1,braves95,gator2,nigge,anthony3,sammmy,oou812,heffer,phishin,roxanne1,yourass,hornet1,albator,2521659,underwat,tanusha,dianas,3f3fpht7op,dragon20,bilbobag,cheroke,radiatio,dwarf1,majik,33st33,dochka,garibald,robinh,sham69,temp01,wakeboar,violet1,1w2w3w,registr,tonite,maranello,1593570,parolamea,galatasara,loranthos,1472583,asmodean,1362840,scylla,doneit,jokerr,porkypig,kungen,mercator,koolhaas,come2me,debbie69,calbear,liverpoolfc,yankees4,12344321a,kennyb,madma,85200258,dustin23,thomas13,tooling,mikasa,mistic,crfnbyf,112233445,sofia1,heinz57,colts1,price1,snowey,joakim,mark11,963147,cnhfcnm,kzinti,1bbbbbbb,rubberdu,donthate,rupert1,sasha1992,regis1,nbuhbwf,fanboy,sundial,sooner1,wayout,vjnjhjkf,deskpro,arkangel,willie12,mikeyb,celtic1888,luis1,buddy01,duane1,grandma1,aolcom,weeman,172839456,basshead,hornball,magnu,pagedown,molly2,131517,rfvtgbyhn,astonmar,mistery,madalina,cash1,1happy,shenlong,matrix01,nazarova,369874125,800500,webguy,rse2540,ashley2,briank,789551,786110,chunli,j0nathan,greshnik,courtne,suckmyco,mjollnir,789632147,asdfg1234,754321,odelay,ranma12,zebedee,artem777,bmw318is,butt1,rambler1,yankees9,alabam,5w76rnqp,rosies,mafioso,studio1,babyruth,tranzit,magical123,gfhjkm135,12345$,soboleva,709394,ubique,drizzt1,elmers,teamster,pokemons,1472583690,1597532486,shockers,merckx,melanie2,ttocs,clarisse,earth1,dennys,slobber,flagman,farfalla,troika,4fa82hyx,hakan,x4ww5qdr,cumsuck,leather1,forum1,july20,barbel,zodiak,samuel12,ford01,rushfan,bugsy1,invest1,tumadre,screwme,a666666,money5,henry8,tiddles,sailaway,starburs,100years,killer01,comando,hiromi,ranetka,thordog,blackhole,palmeira,verboten,solidsna,q1w1e1,humme,kevinc,gbrfxe,gevaudan,hannah11,peter2,vangar,sharky7,talktome,jesse123,chuchi,pammy,!qazxsw2,siesta,twenty1,wetwilly,477041,natural1,sun123,daniel3,intersta,shithead1,hellyea,bonethugs,solitair,bubbles2,father1,nick01,444000,adidas12,dripik,cameron2,442200,a7nz8546,respublika,fkojn6gb,428054,snoppy,rulez1,haslo,rachael1,purple01,zldej102,ab12cd34,cytuehjxrf,madhu,astroman,preteen,handsoff,mrblonde,biggio,testin,vfdhif,twolves,unclesam,asmara,kpydskcw,lg2wmgvr,grolsch,biarritz,feather1,williamm,s62i93,bone1,penske,337733,336633,taurus1,334433,billet,diamondd,333000,nukem,fishhook,godogs,thehun,lena1982,blue00,smelly1,unb4g9ty,65pjv22,applegat,mikehunt,giancarlo,krillin,felix123,december1,soapy,46doris,nicole23,bigsexy1,justin10,pingu,bambou,falcon12,dgthtl,1surfer,qwerty01,estrellit,nfqcjy,easygo,konica,qazqwe,1234567890m,stingers,nonrev,3e4r5t,champio,bbbbbb99,196400,allen123,seppel,simba2,rockme,zebra3,tekken3,endgame,sandy2,197300,fitte,monkey00,eldritch,littleone,rfyfgkz,1member,66chevy,oohrah,cormac,hpmrbm41,197600,grayfox,elvis69,celebrit,maxwell7,rodders,krist,1camaro,broken1,kendall1,silkcut,katenka,angrick,maruni,17071994a,tktyf,kruemel,snuffles,iro4ka,baby12,alexis01,marryme,vlad1994,forward1,culero,badaboom,malvin,hardtoon,hatelove,molley,knopo4ka,duchess1,mensuck,cba321,kickbutt,zastava,wayner,fuckyou6,eddie123,cjkysir,john33,dragonfi,cody1,jabell,cjhjrf,badseed,sweden1,marihuana,brownlov,elland,nike1234,kwiettie,jonnyboy,togepi,billyk,robert123,bb334,florenci,ssgoku,198910,bristol1,bob007,allister,yjdujhjl,gauloise,198920,bellaboo,9lives,aguilas,wltfg4ta,foxyroxy,rocket69,fifty50,babalu,master21,malinois,kaluga,gogosox,obsessio,yeahrigh,panthers1,capstan,liza2000,leigh1,paintball1,blueskie,cbr600f3,bagdad,jose98,mandreki,shark01,wonderbo,muledeer,xsvnd4b2,hangten,200001,grenden,anaell,apa195,model1,245lufpq,zip100,ghjcgtrn,wert1234,misty2,charro,juanjose,fkbcrf,frostbit,badminto,buddyy,1doctor,vanya,archibal,parviz,spunky1,footboy,dm6tzsgp,legola,samadhi,poopee,ytdxz2ca,hallowboy,dposton,gautie,theworm,guilherme,dopehead,iluvtits,bobbob1,ranger6,worldwar,lowkey,chewbaca,oooooo99,ducttape,dedalus,celular,8i9o0p,borisenko,taylor01,111111z,arlingto,p3nnywiz,rdgpl3ds,boobless,kcmfwesg,blacksab,mother2,markus1,leachim,secret2,s123456789,1derful,espero,russell2,tazzer,marykate,freakme,mollyb,lindros8,james00,gofaster,stokrotka,kilbosik,aquamann,pawel1,shedevil,mousie,slot2009,october6,146969,mm259up,brewcrew,choucho,uliana,sexfiend,fktirf,pantss,vladimi,starz,sheeps,12341234q,bigun,tiggers,crjhjcnm,libtech,pudge1,home12,zircon,klaus1,jerry2,pink1,lingus,monkey66,dumass,polopolo09,feuerweh,rjyatnf,chessy,beefer,shamen,poohbear1,4jjcho,bennevis,fatgirls,ujnbrf,cdexswzaq,9noize9,rich123,nomoney,racecar1,hacke,clahay,acuario,getsum,hondacrv,william0,cheyenn,techdeck,atljhjdf,wtcacq,suger,fallenangel,bammer,tranquil,carla123,relayer,lespaul1,portvale,idontno,bycnbnen,trooper2,gennadiy,pompon,billbob,amazonka,akitas,chinatow,atkbrc,busters,fitness1,cateye,selfok2013,1murphy,fullhous,mucker,bajskorv,nectarin,littlebitch,love24,feyenoor,bigal37,lambo1,pussybitch,icecube1,biged,kyocera,ltybcjdf,boodle,theking1,gotrice,sunset1,abm1224,fromme,sexsells,inheat,kenya1,swinger1,aphrodit,kurtcobain,rhind101,poidog,poiulkjh,kuzmina,beantown,tony88,stuttgar,drumer,joaqui,messenge,motorman,amber2,nicegirl,rachel69,andreia,faith123,studmuffin,jaiden,red111,vtkmybr,gamecocks,gumper,bosshogg,4me2know,tokyo1,kleaner,roadhog,fuckmeno,phoenix3,seeme,buttnutt,boner69,andreyka,myheart,katerin,rugburn,jvtuepip,dc3ubn,chile1,ashley69,happy99,swissair,balls2,fylhttdf,jimboo,55555d,mickey11,voronin,m7hsqstm,stufff,merete,weihnachte,dowjones,baloo1,freeones,bears34,auburn1,beverl,timberland,1elvis,guinness1,bombadil,flatron1,logging7,telefoon,merl1n,masha1,andrei1,cowabung,yousuck1,1matrix,peopl,asd123qwe,sweett,mirror1,torrente,joker12,diamond6,jackaroo,00000a,millerlite,ironhorse,2twins,stryke,gggg1,zzzxxxccc,roosevel,8363eddy,angel21,depeche1,d0ct0r,blue14,areyou,veloce,grendal,frederiksberg,cbcntvf,cb207sl,sasha2000,was.here,fritzz,rosedale,spinoza,cokeisit,gandalf3,skidmark,ashley01,12345j,1234567890qaz,sexxxxxx,beagles,lennart,12345789,pass10,politic,max007,gcheckou,12345611,tiffy,lightman,mushin,velosiped,brucewayne,gauthie,elena123,greenegg,h2oski,clocker,nitemare,123321s,megiddo,cassidy1,david13,boywonde,flori,peggy12,pgszt6md,batterie,redlands,scooter6,bckhere,trueno,bailey11,maxwell2,bandana,timoth1,startnow,ducati74,tiern,maxine1,blackmetal,suzyq,balla007,phatfarm,kirsten1,titmouse,benhogan,culito,forbin,chess1,warren1,panman,mickey7,24lover,dascha,speed2,redlion,andrew10,johnwayn,nike23,chacha1,bendog,bullyboy,goldtree,spookie,tigger99,1cookie,poutine,cyclone1,woodpony,camaleun,bluesky1,dfadan,eagles20,lovergirl,peepshow,mine1,dima1989,rjdfkmxer,11111aaaaa,machina,august17,1hhhhh,0773417k,1monster,freaksho,jazzmin,davidw,kurupt,chumly,huggies,sashenka,ccccccc1,bridge1,giggalo,cincinna,pistol1,hello22,david77,lightfoo,lucky6,jimmy12,261397,lisa12,tabaluga,mysite,belo4ka,greenn,eagle99,punkrawk,salvado,slick123,wichsen,knight99,dummys,fefolico,contrera,kalle1,anna1984,delray,robert99,garena,pretende,racefan,alons,serenada,ludmilla,cnhtkjr,l0swf9gx,hankster,dfktynbyrf,sheep1,john23,cv141ab,kalyani,944turbo,crystal2,blackfly,zrjdktdf,eus1sue1,mario5,riverplate,harddriv,melissa3,elliott1,sexybitc,cnhfyybr,jimdavis,bollix,beta1,amberlee,skywalk1,natala,1blood,brattax,shitty1,gb15kv99,ronjon,rothmans,thedoc,joey21,hotboi,firedawg,bimbo38,jibber,aftermat,nomar,01478963,phishing,domodo,anna13,materia,martha1,budman1,gunblade,exclusiv,sasha1997,anastas,rebecca2,fackyou,kallisti,fuckmyass,norseman,ipswich1,151500,1edward,intelinside,darcy1,bcrich,yjdjcnbf,failte,buzzzz,cream1,tatiana1,7eleven,green8,153351,1a2s3d4f5g6h,154263,milano1,bambi1,bruins77,rugby2,jamal1,bolita,sundaypunch,bubba12,realmadr,vfyxtcnth,iwojima,notlob,black666,valkiria,nexus1,millerti,birthday100,swiss1,appollo,gefest,greeneyes,celebrat,tigerr,slava123,izumrud,bubbabub,legoman,joesmith,katya123,sweetdream,john44,wwwwwww1,oooooo1,socal,lovespor,s5r8ed67s,258147,heidis,cowboy22,wachovia,michaelb,qwe1234567,i12345,255225,goldie1,alfa155,45colt,safeu851,antonova,longtong,1sparky,gfvznm,busen,hjlbjy,whateva,rocky4,cokeman,joshua3,kekskek1,sirocco,jagman,123456qwert,phinupi,thomas10,loller,sakur,vika2011,fullred,mariska,azucar,ncstate,glenn74,halima,aleshka,ilovemylife,verlaat,baggie,scoubidou6,phatboy,jbruton,scoop1,barney11,blindman,def456,maximus2,master55,nestea,11223355,diego123,sexpistols,sniffy,philip1,f12345,prisonbreak,nokia2700,ajnjuhfa,yankees3,colfax,ak470000,mtnman,bdfyeirf,fotball,ichbin,trebla,ilusha,riobravo,beaner1,thoradin,polkaudi,kurosawa,honda123,ladybu,valerik,poltava,saviola,fuckyouguys,754740g0,anallove,microlab1,juris01,ncc1864,garfild,shania1,qagsud,makarenko,cindy69,lebedev,andrew11,johnnybo,groovy1,booster1,sanders1,tommyb,johnson4,kd189nlcih,hondaman,vlasova,chick1,sokada,sevisgur,bear2327,chacho,sexmania,roma1993,hjcnbckfd,valley1,howdie,tuppence,jimandanne,strike3,y4kuz4,nhfnfnf,tsubasa,19955991,scabby,quincunx,dima1998,uuuuuu1,logica,skinner1,pinguino,lisa1234,xpressmusic,getfucked,qqqq1,bbbb1,matulino,ulyana,upsman,johnsmith,123579,co2000,spanner1,todiefor,mangoes,isabel1,123852,negra,snowdon,nikki123,bronx1,booom,ram2500,chuck123,fireboy,creek1,batman13,princesse,az12345,maksat,1knight,28infern,241455,r7112s,muselman,mets1986,katydid,vlad777,playme,kmfdm1,asssex,1prince,iop890,bigbroth,mollymoo,waitron,lizottes,125412,juggler,quinta,0sister0,zanardi,nata123,heckfyxbr,22q04w90e,engine2,nikita95,zamira,hammer22,lutscher,carolina1,zz6319,sanman,vfuflfy,buster99,rossco,kourniko,aggarwal,tattoo1,janice1,finger1,125521,19911992,shdwlnds,rudenko,vfvfgfgf123,galatea,monkeybu,juhani,premiumcash,classact,devilmay,helpme2,knuddel,hardpack,ramil,perrit,basil1,zombie13,stockcar,tos8217,honeypie,nowayman,alphadog,melon1,talula,125689,tiribon12,tornike,haribol,telefone,tiger22,sucka,lfytxrf,chicken123,muggins,a23456,b1234567,lytdybr,otter1,pippa,vasilisk,cooking1,helter,78978,bestboy,viper7,ahmed1,whitewol,mommys,apple5,shazam1,chelsea7,kumiko,masterma,rallye,bushmast,jkz123,entrar,andrew6,nathan01,alaric,tavasz,heimdall,gravy1,jimmy99,cthlwt,powerr,gthtrhtcnjr,canesfan,sasha11,ybrbnf_25,august9,brucie,artichok,arnie1,superdude,tarelka,mickey22,dooper,luners,holeshot,good123,gettysbu,bicho,hammer99,divine5,1zxcvbn,stronzo,q22222,disne,bmw750il,godhead,hallodu,aerith,nastik,differen,cestmoi,amber69,5string,pornosta,dirtygirl,ginger123,formel1,scott12,honda200,hotspurs,johnatha,firstone123,lexmark1,msconfig,karlmasc,l123456,123qweasdzx,baldman,sungod,furka,retsub,9811020,ryder1,tcglyued,astron,lbvfcbr,minddoc,dirt49,baseball12,tbear,simpl,schuey,artimus,bikman,plat1num,quantex,gotyou,hailey1,justin01,ellada,8481068,000002,manimal,dthjybxrf,buck123,dick123,6969696,nospam,strong1,kodeord,bama12,123321w,superman123,gladiolus,nintend,5792076,dreamgirl,spankme1,gautam,arianna1,titti,tetas,cool1234,belladog,importan,4206969,87e5nclizry,teufelo7,doller,yfl.irf,quaresma,3440172,melis,bradle,nnmaster,fast1,iverso,blargh,lucas12,chrisg,iamsam,123321az,tomjerry,kawika,2597174,standrew,billyg,muskan,gizmodo2,rz93qpmq,870621345,sathya,qmezrxg4,januari,marthe,moom4261,cum2me,hkger286,lou1988,suckit1,croaker,klaudia1,753951456,aidan1,fsunoles,romanenko,abbydog,isthebes,akshay,corgi,fuck666,walkman555,ranger98,scorpian,hardwareid,bluedragon,fastman,2305822q,iddqdiddqd,1597532,gopokes,zvfrfcb,w1234567,sputnik1,tr1993,pa$$w0rd,2i5fdruv,havvoc,1357913,1313131,bnm123,cowd00d,flexscan,thesims2,boogiema,bigsexxy,powerstr,ngc4565,joshman,babyboy1,123jlb,funfunfu,qwe456,honor1,puttana,bobbyj,daniel21,pussy12,shmuck,1232580,123578951,maxthedo,hithere1,bond0007,gehenna,nomames,blueone,r1234567,bwana,gatinho,1011111,torrents,cinta,123451234,tiger25,money69,edibey,pointman,mmcm19,wales1,caffreys,phaedra,bloodlus,321ret32,rufuss,tarbit,joanna1,102030405,stickboy,lotrfotr34,jamshid,mclarenf1,ataman,99ford,yarrak,logan2,ironlung,pushistik,dragoon1,unclebob,tigereye,pinokio,tylerj,mermaid1,stevie1,jaylen,888777,ramana,roman777,brandon7,17711771s,thiago,luigi1,edgar1,brucey,videogam,classi,birder,faramir,twiddle,cubalibre,grizzy,fucky,jjvwd4,august15,idinahui,ranita,nikita1998,123342,w1w2w3,78621323,4cancel,789963,(null,vassago,jaydog472,123452,timt42,canada99,123589,rebenok,htyfnf,785001,osipov,maks123,neverwinter,love2010,777222,67390436,eleanor1,bykemo,aquemini,frogg,roboto,thorny,shipmate,logcabin,66005918,nokian,gonzos,louisian,1abcdefg,triathlo,ilovemar,couger,letmeino,supera,runvs,fibonacci,muttly,58565254,5thgbqi,vfnehsv,electr,jose12,artemis1,newlove,thd1shr,hawkey,grigoryan,saisha,tosca,redder,lifesux,temple1,bunnyman,thekids,sabbeth,tarzan1,182838,158uefas,dell50,1super,666222,47ds8x,jackhamm,mineonly,rfnfhbyf,048ro,665259,kristina1,bombero,52545856,secure1,bigloser,peterk,alex2,51525354,anarchy1,superx,teenslut,money23,sigmapi,sanfrancisco,acme34,private5,eclips,qwerttrewq,axelle,kokain,hardguy,peter69,jesuschr,dyanna,dude69,sarah69,toyota91,amberr,45645645,bugmenot,bigted,44556677,556644,wwr8x9pu,alphaome,harley13,kolia123,wejrpfpu,revelati,nairda,sodoff,cityboy,pinkpussy,dkalis,miami305,wow12345,triplet,tannenbau,asdfasdf1,darkhors,527952,retired1,soxfan,nfyz123,37583867,goddes,515069,gxlmxbewym,1warrior,36925814,dmb2011,topten,karpova,89876065093rax,naturals,gateway9,cepseoun,turbot,493949,cock22,italia1,sasafras,gopnik,stalke,1qazxdr5,wm2006,ace1062,alieva,blue28,aracel,sandia,motoguzz,terri1,emmajane,conej,recoba,alex1995,jerkyboy,cowboy12,arenrone,precisio,31415927,scsa316,panzer1,studly1,powerhou,bensam,mashoutq,billee,eeyore1,reape,thebeatl,rul3z,montesa,doodle1,cvzefh1gk,424365,a159753,zimmerma,gumdrop,ashaman,grimreap,icandoit,borodina,branca,dima2009,keywest1,vaders,bubluk,diavolo,assss,goleta,eatass,napster1,382436,369741,5411pimo,lenchik,pikach,gilgamesh,kalimera,singer1,gordon2,rjycnbnewbz,maulwurf,joker13,2much4u,bond00,alice123,robotec,fuckgirl,zgjybz,redhorse,margaret1,brady1,pumpkin2,chinky,fourplay,1booger,roisin,1brandon,sandan,blackheart,cheez,blackfin,cntgfyjdf,mymoney1,09080706,goodboss,sebring1,rose1,kensingt,bigboner,marcus12,ym3cautj,struppi,thestone,lovebugs,stater,silver99,forest99,qazwsx12345,vasile,longboar,mkonji,huligan,rhfcbdfz,airmail,porn11,1ooooo,sofun,snake2,msouthwa,dougla,1iceman,shahrukh,sharona,dragon666,france98,196800,196820,ps253535,zjses9evpa,sniper01,design1,konfeta,jack99,drum66,good4you,station2,brucew,regedit,school12,mvtnr765,pub113,fantas,tiburon1,king99,ghjcnjgbpltw,checkito,308win,1ladybug,corneliu,svetasveta,197430,icicle,imaccess,ou81269,jjjdsl,brandon6,bimbo1,smokee,piccolo1,3611jcmg,children2,cookie2,conor1,darth1,margera,aoi856,paully,ou812345,sklave,eklhigcz,30624700,amazing1,wahooo,seau55,1beer,apples2,chulo,dolphin9,heather6,198206,198207,hergood,miracle1,njhyflj,4real,milka,silverfi,fabfive,spring12,ermine,mammy,jumpjet,adilbek,toscana,caustic,hotlove,sammy69,lolita1,byoung,whipme,barney01,mistys,tree1,buster3,kaylin,gfccgjhn,132333,aishiteru,pangaea,fathead1,smurph,198701,ryslan,gasto,xexeylhf,anisimov,chevyss,saskatoo,brandy12,tweaker,irish123,music2,denny1,palpatin,outlaw1,lovesuck,woman1,mrpibb,diadora,hfnfneq,poulette,harlock,mclaren1,cooper12,newpass3,bobby12,rfgecnfcerf,alskdjfh,mini14,dukers,raffael,199103,cleo123,1234567qwertyu,mossberg,scoopy,dctulf,starline,hjvjxrf,misfits1,rangers2,bilbos,blackhea,pappnase,atwork,purple2,daywalker,summoner,1jjjjjjj,swansong,chris10,laluna,12345qqq,charly1,lionsden,money99,silver33,hoghead,bdaddy,199430,saisg002,nosaints,tirpitz,1gggggg,jason13,kingss,ernest1,0cdh0v99ue,pkunzip,arowana,spiri,deskjet1,armine,lances,magic2,thetaxi,14159265,cacique,14142135,orange10,richard0,backdraf,255ooo,humtum,kohsamui,c43dae874d,wrestling1,cbhtym,sorento,megha,pepsiman,qweqwe12,bliss7,mario64,korolev,balls123,schlange,gordit,optiquest,fatdick,fish99,richy,nottoday,dianne1,armyof1,1234qwerasdfzxcv,bbonds,aekara,lidiya,baddog1,yellow5,funkie,ryan01,greentree,gcheckout,marshal1,liliput,000000z,rfhbyrf,gtogto43,rumpole,tarado,marcelit,aqwzsxedc,kenshin1,sassydog,system12,belly1,zilla,kissfan,tools1,desember,donsdad,nick11,scorpio6,poopoo1,toto99,steph123,dogfuck,rocket21,thx113,dude12,sanek,sommar,smacky,pimpsta,letmego,k1200rs,lytghjgtnhjdcr,abigale,buddog,deles,baseball9,roofus,carlsbad,hamzah,hereiam,genial,schoolgirlie,yfz450,breads,piesek,washear,chimay,apocalyp,nicole18,gfgf1234,gobulls,dnevnik,wonderwall,beer1234,1moose,beer69,maryann1,adpass,mike34,birdcage,hottuna,gigant,penquin,praveen,donna123,123lol123,thesame,fregat,adidas11,selrahc,pandoras,test3,chasmo,111222333000,pecos,daniel11,ingersol,shana1,mama12345,cessna15,myhero,1simpson,nazarenko,cognit,seattle2,irina1,azfpc310,rfycthdf,hardy1,jazmyn,sl1200,hotlanta,jason22,kumar123,sujatha,fsd9shtyu,highjump,changer,entertai,kolding,mrbig,sayuri,eagle21,qwertzu,jorge1,0101dd,bigdong,ou812a,sinatra1,htcnjhfy,oleg123,videoman,pbyfblf,tv612se,bigbird1,kenaidog,gunite,silverma,ardmore,123123qq,hotbot,cascada,cbr600f4,harakiri,chico123,boscos,aaron12,glasgow1,kmn5hc,lanfear,1light,liveoak,fizika,ybrjkftdyf,surfside,intermilan,multipas,redcard,72chevy,balata,coolio1,schroede,kanat,testerer,camion,kierra,hejmeddig,antonio2,tornados,isidor,pinkey,n8skfswa,ginny1,houndog,1bill,chris25,hastur,1marine,greatdan,french1,hatman,123qqq,z1z2z3z4,kicker1,katiedog,usopen,smith22,mrmagoo,1234512i,assa123,7seven7,monster7,june12,bpvtyf,149521,guenter,alex1985,voronina,mbkugegs,zaqwsxcderfv,rusty5,mystic1,master0,abcdef12,jndfkb,r4zpm3,cheesey,skripka,blackwhite,sharon69,dro8smwq,lektor,techman,boognish,deidara,heckfyf,quietkey,authcode,monkey4,jayboy,pinkerto,merengue,chulita,bushwick,turambar,kittykit,joseph2,dad123,kristo,pepote,scheiss,hambone1,bigballa,restaura,tequil,111luzer,euro2000,motox,denhaag,chelsi,flaco1,preeti,lillo,1001sin,passw,august24,beatoff,555555d,willis1,kissthis,qwertyz,rvgmw2gl,iloveboobies,timati,kimbo,msinfo,dewdrop,sdbaker,fcc5nky2,messiah1,catboy,small1,chode,beastie1,star77,hvidovre,short1,xavie,dagobah,alex1987,papageno,dakota2,toonami,fuerte,jesus33,lawina,souppp,dirtybir,chrish,naturist,channel1,peyote,flibble,gutentag,lactate,killem,zucchero,robinho,ditka,grumpy1,avr7000,boxxer,topcop,berry1,mypass1,beverly1,deuce1,9638527410,cthuttdf,kzkmrf,lovethem,band1t,cantona1,purple11,apples123,wonderwo,123a456,fuzzie,lucky99,dancer2,hoddling,rockcity,winner12,spooty,mansfiel,aimee1,287hf71h,rudiger,culebra,god123,agent86,daniel0,bunky1,notmine,9ball,goofus,puffy1,xyh28af4,kulikov,bankshot,vurdf5i2,kevinm,ercole,sexygirls,razvan,october7,goater,lollie,raissa,thefrog,mdmaiwa3,mascha,jesussaves,union1,anthony9,crossroa,brother2,areyuke,rodman91,toonsex,dopeman,gericom,vaz2115,cockgobbler,12356789,12345699,signatur,alexandra1,coolwhip,erwin1,awdrgyjilp,pens66,ghjrjgtyrj,linkinpark,emergenc,psych0,blood666,bootmort,wetworks,piroca,johnd,iamthe1,supermario,homer69,flameon,image1,bebert,fylhtq1,annapoli,apple11,hockey22,10048,indahouse,mykiss,1penguin,markp,misha123,foghat,march11,hank1,santorin,defcon4,tampico,vbnhjafy,robert22,bunkie,athlon64,sex777,nextdoor,koskesh,lolnoob,seemnemaailm,black23,march15,yeehaa,chiqui,teagan,siegheil,monday2,cornhusk,mamusia,chilis,sthgrtst,feldspar,scottm,pugdog,rfghjy,micmac,gtnhjdyf,terminato,1jackson,kakosja,bogomol,123321aa,rkbvtyrj,tresor,tigertig,fuckitall,vbkkbjy,caramon,zxc12,balin,dildo1,soccer09,avata,abby123,cheetah1,marquise,jennyc,hondavfr,tinti,anna1985,dennis2,jorel,mayflowe,icema,hal2000,nikkis,bigmouth,greenery,nurjan,leonov,liberty7,fafnir,larionov,sat321321,byteme1,nausicaa,hjvfynbrf,everto,zebra123,sergio1,titone,wisdom1,kahala,104328q,marcin1,salima,pcitra,1nnnnn,nalini,galvesto,neeraj,rick1,squeeky,agnes1,jitterbu,agshar,maria12,0112358,traxxas,stivone,prophet1,bananza,sommer1,canoneos,hotfun,redsox11,1bigmac,dctdjkjl,legion1,everclea,valenok,black9,danny001,roxie1,1theman,mudslide,july16,lechef,chula,glamis,emilka,canbeef,ioanna,cactus1,rockshox,im2cool,ninja9,thvfrjdf,june28,milo17,missyou,micky1,nbibyf,nokiaa,goldi,mattias,fuckthem,asdzxc123,ironfist,junior01,nesta,crazzy,killswit,hygge,zantac,kazama,melvin1,allston,maandag,hiccup,prototyp,specboot,dwl610,hello6,159456,baldhead,redwhite,calpoly,whitetail,agile1,cousteau,matt01,aust1n,malcolmx,gjlfhjr,semperf1,ferarri,a1b2c3d,vangelis,mkvdari,bettis36,andzia,comand,tazzman,morgaine,pepluv,anna1990,inandout,anetka,anna1997,wallpape,moonrake,huntress,hogtie,cameron7,sammy7,singe11,clownboy,newzeala,wilmar,safrane,rebeld,poopi,granat,hammertime,nermin,11251422,xyzzy1,bogeys,jkmxbr,fktrcfyl,11223311,nfyrbcn,11223300,powerpla,zoedog,ybrbnbyf,zaphod42,tarawa,jxfhjdfirf,dude1234,g5wks9,goobe,czekolada,blackros,amaranth,medical1,thereds,julija,nhecsyfujkjdt,promopas,buddy4,marmalad,weihnachten,tronic,letici,passthief,67mustan,ds7zamnw,morri,w8woord,cheops,pinarell,sonofsam,av473dv,sf161pn,5c92v5h6,purple13,tango123,plant1,1baby,xufrgemw,fitta,1rangers,spawns,kenned,taratata,19944991,11111118,coronas,4ebouux8,roadrash,corvette1,dfyjdf846,marley12,qwaszxerdfcv,68stang,67stang,racin,ellehcim,sofiko,nicetry,seabass1,jazzman1,zaqwsx1,laz2937,uuuuuuu1,vlad123,rafale,j1234567,223366,nnnnnn1,226622,junkfood,asilas,cer980,daddymac,persepho,neelam,00700,shithappens,255555,qwertyy,xbox36,19755791,qweasd1,bearcub,jerryb,a1b1c1,polkaudio,basketball1,456rty,1loveyou,marcus2,mama1961,palace1,transcend,shuriken,sudhakar,teenlove,anabelle,matrix99,pogoda,notme,bartend,jordana,nihaoma,ataris,littlegi,ferraris,redarmy,giallo,fastdraw,accountbloc,peludo,pornostar,pinoyako,cindee,glassjaw,dameon,johnnyd,finnland,saudade,losbravo,slonko,toplay,smalltit,nicksfun,stockhol,penpal,caraj,divedeep,cannibus,poppydog,pass88,viktory,walhalla,arisia,lucozade,goldenbo,tigers11,caball,ownage123,tonna,handy1,johny,capital5,faith2,stillher,brandan,pooky1,antananarivu,hotdick,1justin,lacrimos,goathead,bobrik,cgtwbfkbcn,maywood,kamilek,gbplf123,gulnar,beanhead,vfvjyn,shash,viper69,ttttttt1,hondacr,kanako,muffer,dukies,justin123,agapov58,mushka,bad11bad,muleman,jojo123,andreika,makeit,vanill,boomers,bigals,merlin11,quacker,aurelien,spartak1922,ligeti,diana2,lawnmowe,fortune1,awesom,rockyy,anna1994,oinker,love88,eastbay,ab55484,poker0,ozzy666,papasmurf,antihero,photogra,ktm250,painkill,jegr2d2,p3orion,canman,dextur,qwest123,samboy,yomismo,sierra01,herber,vfrcbvvfrcbv,gloria1,llama1,pie123,bobbyjoe,buzzkill,skidrow,grabber,phili,javier1,9379992q,geroin,oleg1994,sovereig,rollover,zaq12qaz,battery1,killer13,alina123,groucho1,mario12,peter22,butterbean,elise1,lucycat,neo123,ferdi,golfer01,randie,gfhfyjbr,ventura1,chelsea3,pinoy,mtgox,yrrim7,shoeman,mirko,ffggyyo,65mustan,ufdibyjd,john55,suckfuck,greatgoo,fvfnjhb,mmmnnn,love20,1bullshi,sucesso,easy1234,robin123,rockets1,diamondb,wolfee,nothing0,joker777,glasnost,richar1,guille,sayan,koresh,goshawk,alexx,batman21,a123456b,hball,243122,rockandr,coolfool,isaia,mary1,yjdbrjdf,lolopc,cleocat,cimbo,lovehina,8vfhnf,passking,bonapart,diamond2,bigboys,kreator,ctvtyjdf,sassy123,shellac,table54781,nedkelly,philbert,sux2bu,nomis,sparky99,python1,littlebear,numpty,silmaril,sweeet,jamesw,cbufhtnf,peggysue,wodahs,luvsex,wizardry,venom123,love4you,bama1,samat,reviewpass,ned467,cjkjdtq,mamula,gijoe,amersham,devochka,redhill,gisel,preggo,polock,cando,rewster,greenlantern,panasonik,dave1234,mikeee,1carlos,miledi,darkness1,p0o9i8u7y6,kathryn1,happyguy,dcp500,assmaster,sambuka,sailormo,antonio3,logans,18254288,nokiax2,qwertzuiop,zavilov,totti,xenon1,edward11,targa1,something1,tony_t,q1w2e3r4t5y6u7i8o9p0,02551670,vladimir1,monkeybutt,greenda,neel21,craiger,saveliy,dei008,honda450,fylhtq95,spike2,fjnq8915,passwordstandard,vova12345,talonesi,richi,gigemags,pierre1,westin,trevoga,dorothee,bastogne,25563o,brandon3,truegrit,krimml,iamgreat,servis,a112233,paulinka,azimuth,corperfmonsy,358hkyp,homerun1,dogbert1,eatmyass,cottage1,savina,baseball7,bigtex,gimmesum,asdcxz,lennon1,a159357,1bastard,413276191q,pngfilt,pchealth,netsnip,bodiroga,1matt,webtvs,ravers,adapters,siddis,mashamasha,coffee2,myhoney,anna1982,marcia1,fairchil,maniek,iloveluc,batmonh,wildon,bowie1,netnwlnk,fancy1,tom204,olga1976,vfif123,queens1,ajax01,lovess,mockba,icam4usb,triada,odinthor,rstlne,exciter,sundog,anchorat,girls69,nfnmzyrf,soloma,gti16v,shadowman,ottom,rataros,tonchin,vishal,chicken0,pornlo,christiaan,volante,likesit,mariupol,runfast,gbpltw123,missys,villevalo,kbpjxrf,ghibli,calla,cessna172,kinglear,dell11,swift1,walera,1cricket,pussy5,turbo911,tucke,maprchem56458,rosehill,thekiwi1,ygfxbkgt,mandarinka,98xa29,magnit,cjfrf,paswoord,grandam1,shenmue,leedsuni,hatrick,zagadka,angeldog,michaell,dance123,koichi,bballs,29palms,xanth,228822,ppppppp1,1kkkkk,1lllll,mynewbots,spurss,madmax1,224455,city1,mmmmmmm1,nnnnnnn1,biedronka,thebeatles,elessar,f14tomcat,jordan18,bobo123,ayi000,tedbear,86chevyx,user123,bobolink,maktub,elmer1,flyfishi,franco1,gandalf0,traxdata,david21,enlighte,dmitrij,beckys,1giants,flippe,12345678w,jossie,rugbyman,snowcat,rapeme,peanut11,gemeni,udders,techn9ne,armani1,chappie,war123,vakantie,maddawg,sewanee,jake5253,tautt1,anthony5,letterma,jimbo2,kmdtyjr,hextall,jessica6,amiga500,hotcunt,phoenix9,veronda,saqartvelo,scubas,sixer3,williamj,nightfal,shihan,melnikova,kosssss,handily,killer77,jhrl0821,march17,rushman,6gcf636i,metoyou,irina123,mine11,primus1,formatters,matthew5,infotech,gangster1,jordan45,moose69,kompas,motoxxx,greatwhi,cobra12,kirpich,weezer1,hello23,montse,tracy123,connecte,cjymrf,hemingwa,azreal,gundam00,mobila,boxman,slayers1,ravshan,june26,fktrcfylhjd,bermuda1,tylerd,maersk,qazwsx11,eybdthcbntn,ash123,camelo,kat123,backd00r,cheyenne1,1king,jerkin,tnt123,trabant,warhammer40k,rambos,punto,home77,pedrito,1frank,brille,guitarman,george13,rakas,tgbxtcrbq,flute1,bananas1,lovezp1314,thespot,postie,buster69,sexytime,twistys,zacharia,sportage,toccata,denver7,terry123,bogdanova,devil69,higgins1,whatluck,pele10,kkk666,jeffery1,1qayxsw2,riptide1,chevy11,munchy,lazer1,hooker1,ghfgjh,vergesse,playgrou,4077mash,gusev,humpin,oneputt,hydepark,monster9,tiger8,tangsoo,guy123,hesoyam1,uhtqneyu,thanku,lomond,ortezza,kronik,geetha,rabbit66,killas,qazxswe,alabaste,1234567890qwerty,capone1,andrea12,geral,beatbox,slutfuck,booyaka,jasmine7,ostsee,maestro1,beatme,tracey1,buster123,donaldduck,ironfish,happy6,konnichi,gintonic,momoney1,dugan1,today2,enkidu,destiny2,trim7gun,katuha,fractals,morganstanley,polkadot,gotime,prince11,204060,fifa2010,bobbyt,seemee,amanda10,airbrush,bigtitty,heidie,layla1,cotton1,5speed,fyfnjkmtdyf,flynavy,joxury8f,meeko,akuma,dudley1,flyboy1,moondog1,trotters,mariami,signin,chinna,legs11,pussy4,1s1h1e1f1,felici,optimus1,iluvu,marlins1,gavaec,balance1,glock40,london01,kokot,southwes,comfort1,sammy11,rockbottom,brianc,litebeer,homero,chopsuey,greenlan,charit,freecell,hampster,smalldog,viper12,blofeld,1234567890987654321,realsex,romann,cartman2,cjdthitycndj,nelly1,bmw528,zwezda,masterba,jeep99,turtl,america2,sunburst,sanyco,auntjudy,125wm,blue10,qwsazx,cartma,toby12,robbob,red222,ilovecock,losfix16,1explore,helge,vaz2114,whynotme,baba123,mugen,1qazwsxedc,albertjr,0101198,sextime,supras,nicolas2,wantsex,pussy6,checkm8,winam,24gordon,misterme,curlew,gbljhfcs,medtech,franzi,butthea,voivod,blackhat,egoiste,pjkeirf,maddog69,pakalolo,hockey4,igor1234,rouges,snowhite,homefree,sexfreak,acer12,dsmith,blessyou,199410,vfrcbvjd,falco02,belinda1,yaglasph,april21,groundho,jasmin1,nevergiveup,elvir,gborv526,c00kie,emma01,awesome2,larina,mike12345,maximu,anupam,bltynbabrfwbz,tanushka,sukkel,raptor22,josh12,schalke04,cosmodog,fuckyou8,busybee,198800,bijoux,frame1,blackmor,giveit,issmall,bear13,123-123,bladez,littlegirl,ultra123,fletch1,flashnet,loploprock,rkelly,12step,lukas1,littlewhore,cuntfinger,stinkyfinger,laurenc,198020,n7td4bjl,jackie69,camel123,ben1234,1gateway,adelheid,fatmike,thuglove,zzaaqq,chivas1,4815162342q,mamadou,nadano,james22,benwin,andrea99,rjirf,michou,abkbgg,d50gnn,aaazzz,a123654,blankman,booboo11,medicus,bigbone,197200,justine1,bendix,morphius,njhvjp,44mag,zsecyus56,goodbye1,nokiadermo,a333444,waratsea,4rzp8ab7,fevral,brillian,kirbys,minim,erathia,grazia,zxcvb1234,dukey,snaggle,poppi,hymen,1video,dune2000,jpthjdf,cvbn123,zcxfcnkbdfz,astonv,ginnie,316271,engine3,pr1ncess,64chevy,glass1,laotzu,hollyy,comicbooks,assasins,nuaddn9561,scottsda,hfcnfvfy,accobra,7777777z,werty123,metalhead,romanson,redsand,365214,shalo,arsenii,1989cc,sissi,duramax,382563,petera,414243,mamapap,jollymon,field1,fatgirl,janets,trompete,matchbox20,rambo2,nepenthe,441232,qwertyuiop10,bozo123,phezc419hv,romantika,lifestyl,pengui,decembre,demon6,panther6,444888,scanman,ghjcnjabkz,pachanga,buzzword,indianer,spiderman3,tony12,startre,frog1,fyutk,483422,tupacshakur,albert12,1drummer,bmw328i,green17,aerdna,invisibl,summer13,calimer,mustaine,lgnu9d,morefun,hesoyam123,escort1,scrapland,stargat,barabbas,dead13,545645,mexicali,sierr,gfhfpbn,gonchar,moonstafa,searock,counte,foster1,jayhawk1,floren,maremma,nastya2010,softball1,adaptec,halloo,barrabas,zxcasd123,hunny,mariana1,kafedra,freedom0,green420,vlad1234,method7,665566,tooting,hallo12,davinchi,conducto,medias,666444,invernes,madhatter,456asd,12345678i,687887,le33px,spring00,help123,bellybut,billy5,vitalik1,river123,gorila,bendis,power666,747200,footslav,acehigh,qazxswedc123,q1a1z1,richard9,peterburg,tabletop,gavrilov,123qwe1,kolosov,fredrau,run4fun,789056,jkbvgbflf,chitra,87654321q,steve22,wideopen,access88,surfe,tdfyutkbjy,impossib,kevin69,880888,cantina,887766,wxcvb,dontforg,qwer1209,asslicke,mamma123,indig,arkasha,scrapp,morelia,vehxbr,jones2,scratch1,cody11,cassie12,gerbera,dontgotm,underhil,maks2010,hollywood1,hanibal,elena2010,jason11,1010321,stewar,elaman,fireplug,goodby,sacrific,babyphat,bobcat12,bruce123,1233215,tony45,tiburo,love15,bmw750,wallstreet,2h0t4me,1346795,lamerz,munkee,134679q,granvill,1512198,armastus,aiden1,pipeutvj,g1234567,angeleyes,usmc1,102030q,putangina,brandnew,shadowfax,eagles12,1falcon,brianw,lokomoti,2022958,scooper,pegas,jabroni1,2121212,buffal,siffredi,wewiz,twotone,rosebudd,nightwis,carpet1,mickey2,2525252,sleddog,red333,jamesm,2797349,jeff12,onizuka,felixxxx,rf6666,fine1,ohlala,forplay,chicago5,muncho,scooby11,ptichka,johnnn,19851985p,dogphil3650,totenkopf,monitor2,macross7,3816778,dudder,semaj1,bounder,racerx1,5556633,7085506,ofclr278,brody1,7506751,nantucke,hedj2n4q,drew1,aessedai,trekbike,pussykat,samatron,imani,9124852,wiley1,dukenukem,iampurehaha2,9556035,obvious1,mccool24,apache64,kravchenko,justforf,basura,jamese,s0ccer,safado,darksta,surfer69,damian1,gjpbnbd,gunny1,wolley,sananton,zxcvbn123456,odt4p6sv8,sergei1,modem1,mansikka,zzzz1,rifraf,dima777,mary69,looking4,donttell,red100,ninjutsu,uaeuaeman,bigbri,brasco,queenas8151,demetri,angel007,bubbl,kolort,conny,antonia1,avtoritet,kaka22,kailayu,sassy2,wrongway,chevy3,1nascar,patriots1,chrisrey,mike99,sexy22,chkdsk,sd3utre7,padawan,a6pihd,doming,mesohorny,tamada,donatello,emma22,eather,susan69,pinky123,stud69,fatbitch,pilsbury,thc420,lovepuss,1creativ,golf1234,hurryup,1honda,huskerdu,marino1,gowron,girl1,fucktoy,gtnhjpfdjlcr,dkjfghdk,pinkfl,loreli,7777777s,donkeykong,rockytop,staples1,sone4ka,xxxjay,flywheel,toppdogg,bigbubba,aaa123456,2letmein,shavkat,paule,dlanor,adamas,0147852,aassaa,dixon1,bmw328,mother12,ilikepussy,holly2,tsmith,excaliber,fhutynbyf,nicole3,tulipan,emanue,flyvholm,currahee,godsgift,antonioj,torito,dinky1,sanna,yfcnzvjz,june14,anime123,123321456654,hanswurst,bandman,hello101,xxxyyy,chevy69,technica,tagada,arnol,v00d00,lilone,filles,drumandbass,dinamit,a1234a,eatmeat,elway07,inout,james6,dawid1,thewolf,diapason,yodaddy,qscwdv,fuckit1,liljoe,sloeber,simbacat,sascha1,qwe1234,1badger,prisca,angel17,gravedig,jakeyboy,longboard,truskawka,golfer11,pyramid7,highspee,pistola,theriver,hammer69,1packers,dannyd,alfonse,qwertgfdsa,11119999,basket1,ghjtrn,saralee,12inches,paolo1,zse4xdr5,taproot,sophieh6,grizzlie,hockey69,danang,biggums,hotbitch,5alive,beloved1,bluewave,dimon95,koketka,multiscan,littleb,leghorn,poker2,delite,skyfir,bigjake,persona1,amberdog,hannah12,derren,ziffle,1sarah,1assword,sparky01,seymur,tomtom1,123321qw,goskins,soccer19,luvbekki,bumhole,2balls,1muffin,borodin,monkey9,yfeiybrb,1alex,betmen,freder,nigger123,azizbek,gjkzrjdf,lilmike,1bigdadd,1rock,taganrog,snappy1,andrey1,kolonka,bunyan,gomango,vivia,clarkkent,satur,gaudeamus,mantaray,1month,whitehea,fargus,andrew99,ray123,redhawks,liza2009,qw12345,den12345,vfhnsyjdf,147258369a,mazepa,newyorke,1arsenal,hondas2000,demona,fordgt,steve12,birthday2,12457896,dickster,edcwsxqaz,sahalin,pantyman,skinny1,hubertus,cumshot1,chiro,kappaman,mark3434,canada12,lichking,bonkers1,ivan1985,sybase,valmet,doors1,deedlit,kyjelly,bdfysx,ford11,throatfuck,backwood,fylhsq,lalit,boss429,kotova,bricky,steveh,joshua19,kissa,imladris,star1234,lubimka,partyman,crazyd,tobias1,ilike69,imhome,whome,fourstar,scanner1,ujhjl312,anatoli,85bears,jimbo69,5678ytr,potapova,nokia7070,sunday1,kalleank,1996gta,refinnej,july1,molodec,nothanks,enigm,12play,sugardog,nhfkbdfkb,larousse,cannon1,144444,qazxcdew,stimorol,jhereg,spawn7,143000,fearme,hambur,merlin21,dobie,is3yeusc,partner1,dekal,varsha,478jfszk,flavi,hippo1,9hmlpyjd,july21,7imjfstw,lexxus,truelov,nokia5200,carlos6,anais,mudbone,anahit,taylorc,tashas,larkspur,animal2000,nibiru,jan123,miyvarxar,deflep,dolore,communit,ifoptfcor,laura2,anadrol,mamaliga,mitzi1,blue92,april15,matveev,kajlas,wowlook1,1flowers,shadow14,alucard1,1golf,bantha,scotlan,singapur,mark13,manchester1,telus01,superdav,jackoff1,madnes,bullnuts,world123,clitty,palmer1,david10,spider10,sargsyan,rattlers,david4,windows2,sony12,visigoth,qqqaaa,penfloor,cabledog,camilla1,natasha123,eagleman,softcore,bobrov,dietmar,divad,sss123,d1234567,tlbyjhju,1q1q1q1,paraiso,dav123,lfiekmrf,drachen,lzhan16889,tplate,gfghbrf,casio1,123boots1,123test,sys64738,heavymetal,andiamo,meduza,soarer,coco12,negrita,amigas,heavymet,bespin,1asdfghj,wharfrat,wetsex,tight1,janus1,sword123,ladeda,dragon98,austin2,atep1,jungle1,12345abcd,lexus300,pheonix1,alex1974,123qw123,137955,bigtim,shadow88,igor1994,goodjob,arzen,champ123,121ebay,changeme1,brooksie,frogman1,buldozer,morrowin,achim,trish1,lasse,festiva,bubbaman,scottb,kramit,august22,tyson123,passsword,oompah,al123456,fucking1,green45,noodle1,looking1,ashlynn,al1716,stang50,coco11,greese,bob111,brennan1,jasonj,1cherry,1q2345,1xxxxxxx,fifa2011,brondby,zachar1,satyam,easy1,magic7,1rainbow,cheezit,1eeeeeee,ashley123,assass1,amanda123,jerbear,1bbbbbb,azerty12,15975391,654321z,twinturb,onlyone1,denis1988,6846kg3r,jumbos,pennydog,dandelion,haileris,epervier,snoopy69,afrodite,oldpussy,green55,poopypan,verymuch,katyusha,recon7,mine69,tangos,contro,blowme2,jade1,skydive1,fiveiron,dimo4ka,bokser,stargirl,fordfocus,tigers2,platina,baseball11,raque,pimper,jawbreak,buster88,walter34,chucko,penchair,horizon1,thecure1,scc1975,adrianna1,kareta,duke12,krille,dumbfuck,cunt1,aldebaran,laverda,harumi,knopfler,pongo1,pfhbyf,dogman1,rossigno,1hardon,scarlets,nuggets1,ibelieve,akinfeev,xfhkbr,athene,falcon69,happie,billly,nitsua,fiocco,qwerty09,gizmo2,slava2,125690,doggy123,craigs,vader123,silkeborg,124365,peterm,123978,krakatoa,123699,123592,kgvebmqy,pensacol,d1d2d3,snowstor,goldenboy,gfg65h7,ev700,church1,orange11,g0dz1ll4,chester3,acheron,cynthi,hotshot1,jesuschris,motdepass,zymurgy,one2one,fietsbel,harryp,wisper,pookster,nn527hp,dolla,milkmaid,rustyboy,terrell1,epsilon1,lillian1,dale3,crhbgrf,maxsim,selecta,mamada,fatman1,ufkjxrf,shinchan,fuckuall,women1,000008,bossss,greta1,rbhjxrf,mamasboy,purple69,felicidade,sexy21,cathay,hunglow,splatt,kahless,shopping1,1gandalf,themis,delta7,moon69,blue24,parliame,mamma1,miyuki,2500hd,jackmeof,razer,rocker1,juvis123,noremac,boing747,9z5ve9rrcz,icewater,titania,alley1,moparman,christo1,oliver2,vinicius,tigerfan,chevyy,joshua99,doda99,matrixx,ekbnrf,jackfrost,viper01,kasia,cnfhsq,triton1,ssbt8ae2,rugby8,ramman,1lucky,barabash,ghtlfntkm,junaid,apeshit,enfant,kenpo1,shit12,007000,marge1,shadow10,qwerty789,richard8,vbitkm,lostboys,jesus4me,richard4,hifive,kolawole,damilola,prisma,paranoya,prince2,lisaann,happyness,cardss,methodma,supercop,a8kd47v5,gamgee,polly123,irene1,number8,hoyasaxa,1digital,matthew0,dclxvi,lisica,roy123,2468013579,sparda,queball,vaffanculo,pass1wor,repmvbx,999666333,freedom8,botanik,777555333,marcos1,lubimaya,flash2,einstei,08080,123456789j,159951159,159357123,carrot1,alina1995,sanjos,dilara,mustang67,wisteria,jhnjgtl12,98766789,darksun,arxangel,87062134,creativ1,malyshka,fuckthemall,barsic,rocksta,2big4u,5nizza,genesis2,romance1,ofcourse,1horse,latenite,cubana,sactown,789456123a,milliona,61808861,57699434,imperia,bubba11,yellow3,change12,55495746,flappy,jimbo123,19372846,19380018,cutlass1,craig123,klepto,beagle1,solus,51502112,pasha1,19822891,46466452,19855891,petshop,nikolaevna,119966,nokia6131,evenpar,hoosier1,contrasena,jawa350,gonzo123,mouse2,115511,eetfuk,gfhfvgfvgfv,1crystal,sofaking,coyote1,kwiatuszek,fhrflbq,valeria1,anthro,0123654789,alltheway,zoltar,maasikas,wildchil,fredonia,earlgrey,gtnhjczy,matrix123,solid1,slavko,12monkeys,fjdksl,inter1,nokia6500,59382113kevinp,spuddy,cachero,coorslit,password!,kiba1z,karizma,vova1994,chicony,english1,bondra12,1rocket,hunden,jimbob1,zpflhjn1,th0mas,deuce22,meatwad,fatfree,congas,sambora,cooper2,janne,clancy1,stonie,busta,kamaz,speedy2,jasmine3,fahayek,arsenal0,beerss,trixie1,boobs69,luansantana,toadman,control2,ewing33,maxcat,mama1964,diamond4,tabaco,joshua0,piper2,music101,guybrush,reynald,pincher,katiebug,starrs,pimphard,frontosa,alex97,cootie,clockwor,belluno,skyeseth,booty69,chaparra,boochie,green4,bobcat1,havok,saraann,pipeman,aekdb,jumpshot,wintermu,chaika,1chester,rjnjatq,emokid,reset1,regal1,j0shua,134679a,asmodey,sarahh,zapidoo,ciccione,sosexy,beckham23,hornets1,alex1971,delerium,manageme,connor11,1rabbit,sane4ek,caseyboy,cbljhjdf,redsox20,tttttt99,haustool,ander,pantera6,passwd1,journey1,9988776655,blue135,writerspace,xiaoyua123,justice2,niagra,cassis,scorpius,bpgjldsgjldthnf,gamemaster,bloody1,retrac,stabbin,toybox,fight1,ytpyf.,glasha,va2001,taylor11,shameles,ladylove,10078,karmann,rodeos,eintritt,lanesra,tobasco,jnrhjqcz,navyman,pablit,leshka,jessica3,123vika,alena1,platinu,ilford,storm7,undernet,sasha777,1legend,anna2002,kanmax1994,porkpie,thunder0,gundog,pallina,easypass,duck1,supermom,roach1,twincam,14028,tiziano,qwerty32,123654789a,evropa,shampoo1,yfxfkmybr,cubby1,tsunami1,fktrcttdf,yasacrac,17098,happyhap,bullrun,rodder,oaktown,holde,isbest,taylor9,reeper,hammer11,julias,rolltide1,compaq123,fourx4,subzero1,hockey9,7mary3,busines,ybrbnjcbr,wagoneer,danniash,portishead,digitex,alex1981,david11,infidel,1snoopy,free30,jaden,tonto1,redcar27,footie,moskwa,thomas21,hammer12,burzum,cosmo123,50000,burltree,54343,54354,vwpassat,jack5225,cougars1,burlpony,blackhorse,alegna,petert,katemoss,ram123,nels0n,ferrina,angel77,cstock,1christi,dave55,abc123a,alex1975,av626ss,flipoff,folgore,max1998,science1,si711ne,yams7,wifey1,sveiks,cabin1,volodia,ox3ford,cartagen,platini,picture1,sparkle1,tiedomi,service321,wooody,christi1,gnasher,brunob,hammie,iraffert,bot2010,dtcyeirf,1234567890p,cooper11,alcoholi,savchenko,adam01,chelsea5,niewiem,icebear,lllooottt,ilovedick,sweetpus,money8,cookie13,rfnthbyf1988,booboo2,angus123,blockbus,david9,chica1,nazaret,samsung9,smile4u,daystar,skinnass,john10,thegirl,sexybeas,wasdwasd1,sigge1,1qa2ws3ed4rf5tg,czarny,ripley1,chris5,ashley19,anitha,pokerman,prevert,trfnthby,tony69,georgia2,stoppedb,qwertyuiop12345,miniclip,franky1,durdom,cabbages,1234567890o,delta5,liudmila,nhfycajhvths,court1,josiew,abcd1,doghead,diman,masiania,songline,boogle,triston,deepika,sexy4me,grapple,spacebal,ebonee,winter0,smokewee,nargiza,dragonla,sassys,andy2000,menards,yoshio,massive1,suckmy1k,passat99,sexybo,nastya1996,isdead,stratcat,hokuto,infix,pidoras,daffyduck,cumhard,baldeagl,kerberos,yardman,shibainu,guitare,cqub6553,tommyy,bk.irf,bigfoo,hecto,july27,james4,biggus,esbjerg,isgod,1irish,phenmarr,jamaic,roma1990,diamond0,yjdbrjd,girls4me,tampa1,kabuto,vaduz,hanse,spieng,dianochka,csm101,lorna1,ogoshi,plhy6hql,2wsx4rfv,cameron0,adebayo,oleg1996,sharipov,bouboule,hollister1,frogss,yeababy,kablam,adelante,memem,howies,thering,cecilia1,onetwo12,ojp123456,jordan9,msorcloledbr,neveraga,evh5150,redwin,1august,canno,1mercede,moody1,mudbug,chessmas,tiikeri,stickdaddy77,alex15,kvartira,7654321a,lollol123,qwaszxedc,algore,solana,vfhbyfvfhbyf,blue72,misha1111,smoke20,junior13,mogli,threee,shannon2,fuckmylife,kevinh,saransk,karenw,isolde,sekirarr,orion123,thomas0,debra1,laketaho,alondra,curiva,jazz1234,1tigers,jambos,lickme2,suomi,gandalf7,028526,zygote,brett123,br1ttany,supafly,159000,kingrat,luton1,cool-ca,bocman,thomasd,skiller,katter,mama777,chanc,tomass,1rachel,oldno7,rfpfyjdf,bigkev,yelrah,primas,osito,kipper1,msvcr71,bigboy11,thesun,noskcaj,chicc,sonja1,lozinka,mobile1,1vader,ummagumma,waves1,punter12,tubgtn,server1,irina1991,magic69,dak001,pandemonium,dead1,berlingo,cherrypi,1montana,lohotron,chicklet,asdfgh123456,stepside,ikmvw103,icebaby,trillium,1sucks,ukrnet,glock9,ab12345,thepower,robert8,thugstools,hockey13,buffon,livefree,sexpics,dessar,ja0000,rosenrot,james10,1fish,svoloch,mykitty,muffin11,evbukb,shwing,artem1992,andrey1992,sheldon1,passpage,nikita99,fubar123,vannasx,eight888,marial,max2010,express2,violentj,2ykn5ccf,spartan11,brenda69,jackiech,abagail,robin2,grass1,andy76,bell1,taison,superme,vika1995,xtr451,fred20,89032073168,denis1984,2000jeep,weetabix,199020,daxter,tevion,panther8,h9iymxmc,bigrig,kalambur,tsalagi,12213443,racecar02,jeffrey4,nataxa,bigsam,purgator,acuracl,troutbum,potsmoke,jimmyz,manutd1,nytimes,pureevil,bearss,cool22,dragonage,nodnarb,dbrbyu,4seasons,freude,elric1,werule,hockey14,12758698,corkie,yeahright,blademan,tafkap,clave,liziko,hofner,jeffhardy,nurich,runne,stanisla,lucy1,monk3y,forzaroma,eric99,bonaire,blackwoo,fengshui,1qaz0okm,newmoney,pimpin69,07078,anonymer,laptop1,cherry12,ace111,salsa1,wilbur1,doom12,diablo23,jgtxzbhr,under1,honda01,breadfan,megan2,juancarlos,stratus1,ackbar,love5683,happytim,lambert1,cbljhtyrj,komarov,spam69,nfhtkrf,brownn,sarmat,ifiksr,spike69,hoangen,angelz,economia,tanzen,avogadro,1vampire,spanners,mazdarx,queequeg,oriana,hershil,sulaco,joseph11,8seconds,aquariu,cumberla,heather9,anthony8,burton12,crystal0,maria3,qazwsxc,snow123,notgood,198520,raindog,heehaw,consulta,dasein,miller01,cthulhu1,dukenuke,iubire,baytown,hatebree,198505,sistem,lena12,welcome01,maraca,middleto,sindhu,mitsou,phoenix5,vovan,donaldo,dylandog,domovoy,lauren12,byrjuybnj,123llll,stillers,sanchin,tulpan,smallvill,1mmmmm,patti1,folgers,mike31,colts18,123456rrr,njkmrjz,phoenix0,biene,ironcity,kasperok,password22,fitnes,matthew6,spotligh,bujhm123,tommycat,hazel5,guitar11,145678,vfcmrf,compass1,willee,1barney,jack2000,littleminge,shemp,derrek,xxx12345,littlefuck,spuds1,karolinka,camneely,qwertyu123,142500,brandon00,munson15,falcon3,passssap,z3cn2erv,goahead,baggio10,141592,denali1,37kazoo,copernic,123456789asd,orange88,bravada,rush211,197700,pablo123,uptheass,samsam1,demoman,mattylad10,heydude,mister2,werken,13467985,marantz,a22222,f1f2f3f4,fm12mn12,gerasimova,burrito1,sony1,glenny,baldeagle,rmfidd,fenomen,verbati,forgetme,5element,wer138,chanel1,ooicu812,10293847qp,minicooper,chispa,myturn,deisel,vthrehbq,boredboi4u,filatova,anabe,poiuyt1,barmalei,yyyy1,fourkids,naumenko,bangbros,pornclub,okaykk,euclid90,warrior3,kornet,palevo,patatina,gocart,antanta,jed1054,clock1,111111w,dewars,mankind1,peugeot406,liten,tahira,howlin,naumov,rmracing,corone,cunthole,passit,rock69,jaguarxj,bumsen,197101,sweet2,197010,whitecat,sawadee,money100,yfhrjnbrb,andyboy,9085603566,trace1,fagget,robot1,angel20,6yhn7ujm,specialinsta,kareena,newblood,chingada,boobies2,bugger1,squad51,133andre,call06,ashes1,ilovelucy,success2,kotton,cavalla,philou,deebee,theband,nine09,artefact,196100,kkkkkkk1,nikolay9,onelov,basia,emilyann,sadman,fkrjujkbr,teamomuch,david777,padrino,money21,firdaus,orion3,chevy01,albatro,erdfcv,2legit,sarah7,torock,kevinn,holio,soloy,enron714,starfleet,qwer11,neverman,doctorwh,lucy11,dino12,trinity7,seatleon,o123456,pimpman,1asdfgh,snakebit,chancho,prorok,bleacher,ramire,darkseed,warhorse,michael123,1spanky,1hotdog,34erdfcv,n0th1ng,dimanche,repmvbyf,michaeljackson,login1,icequeen,toshiro,sperme,racer2,veget,birthday26,daniel9,lbvekmrf,charlus,bryan123,wspanic,schreibe,1andonly,dgoins,kewell,apollo12,egypt1,fernie,tiger21,aa123456789,blowj,spandau,bisquit,12345678d,deadmau5,fredie,311420,happyface,samant,gruppa,filmstar,andrew17,bakesale,sexy01,justlook,cbarkley,paul11,bloodred,rideme,birdbath,nfkbcvfy,jaxson,sirius1,kristof,virgos,nimrod1,hardc0re,killerbee,1abcdef,pitcher1,justonce,vlada,dakota99,vespucci,wpass,outside1,puertori,rfvbkf,teamlosi,vgfun2,porol777,empire11,20091989q,jasong,webuivalidat,escrima,lakers08,trigger2,addpass,342500,mongini,dfhtybr,horndogg,palermo1,136900,babyblu,alla98,dasha2010,jkelly,kernow,yfnecz,rockhopper,toeman,tlaloc,silver77,dave01,kevinr,1234567887654321,135642,me2you,8096468644q,remmus,spider7,jamesa,jilly,samba1,drongo,770129ji,supercat,juntas,tema1234,esthe,1234567892000,drew11,qazqaz123,beegees,blome,rattrace,howhigh,tallboy,rufus2,sunny2,sou812,miller12,indiana7,irnbru,patch123,letmeon,welcome5,nabisco,9hotpoin,hpvteb,lovinit,stormin,assmonke,trill,atlanti,money1234,cubsfan,mello1,stars2,ueptkm,agate,dannym88,lover123,wordz,worldnet,julemand,chaser1,s12345678,pissword,cinemax,woodchuc,point1,hotchkis,packers2,bananana,kalender,420666,penguin8,awo8rx3wa8t,hoppie,metlife,ilovemyfamily,weihnachtsbau,pudding1,luckystr,scully1,fatboy1,amizade,dedham,jahbless,blaat,surrende,****er,1panties,bigasses,ghjuhfvbcn,asshole123,dfktyrb,likeme,nickers,plastik,hektor,deeman,muchacha,cerebro,santana5,testdrive,dracula1,canalc,l1750sq,savannah1,murena,1inside,pokemon00,1iiiiiii,jordan20,sexual1,mailliw,calipso,014702580369,1zzzzzz,1jjjjjj,break1,15253545,yomama1,katinka,kevin11,1ffffff,martijn,sslazio,daniel5,porno2,nosmas,leolion,jscript,15975312,pundai,kelli1,kkkddd,obafgkm,marmaris,lilmama,london123,rfhfnt,elgordo,talk87,daniel7,thesims3,444111,bishkek,afrika2002,toby22,1speedy,daishi,2children,afroman,qqqqwwww,oldskool,hawai,v55555,syndicat,pukimak,fanatik,tiger5,parker01,bri5kev6,timexx,wartburg,love55,ecosse,yelena03,madinina,highway1,uhfdbwfgf,karuna,buhjvfybz,wallie,46and2,khalif,europ,qaz123wsx456,bobbybob,wolfone,falloutboy,manning18,scuba10,schnuff,ihateyou1,lindam,sara123,popcor,fallengun,divine1,montblanc,qwerty8,rooney10,roadrage,bertie1,latinus,lexusis,rhfvfnjhcr,opelgt,hitme,agatka,1yamaha,dmfxhkju,imaloser,michell1,sb211st,silver22,lockedup,andrew9,monica01,sassycat,dsobwick,tinroof,ctrhtnyj,bultaco,rhfcyjzhcr,aaaassss,14ss88,joanne1,momanddad,ahjkjdf,yelhsa,zipdrive,telescop,500600,1sexsex,facial1,motaro,511647,stoner1,temujin,elephant1,greatman,honey69,kociak,ukqmwhj6,altezza,cumquat,zippos,kontiki,123max,altec1,bibigon,tontos,qazsew,nopasaran,militar,supratt,oglala,kobayash,agathe,yawetag,dogs1,cfiekmrf,megan123,jamesdea,porosenok,tiger23,berger1,hello11,seemann,stunner1,walker2,imissu,jabari,minfd,lollol12,hjvfy,1-oct,stjohns,2278124q,123456789qwer,alex1983,glowworm,chicho,mallards,bluedevil,explorer1,543211,casita,1time,lachesis,alex1982,airborn1,dubesor,changa,lizzie1,captaink,socool,bidule,march23,1861brr,k.ljxrf,watchout,fotze,1brian,keksa2,aaaa1122,matrim,providian,privado,dreame,merry1,aregdone,davidt,nounour,twenty2,play2win,artcast2,zontik,552255,shit1,sluggy,552861,dr8350,brooze,alpha69,thunder6,kamelia2011,caleb123,mmxxmm,jamesh,lfybkjd,125267,125000,124536,bliss1,dddsss,indonesi,bob69,123888,tgkbxfgy,gerar,themack,hijodeputa,good4now,ddd123,clk430,kalash,tolkien1,132forever,blackb,whatis,s1s2s3s4,lolkin09,yamahar,48n25rcc,djtiesto,111222333444555,bigbull,blade55,coolbree,kelse,ichwill,yamaha12,sakic,bebeto,katoom,donke,sahar,wahine,645202,god666,berni,starwood,june15,sonoio,time123,llbean,deadsoul,lazarev,cdtnf,ksyusha,madarchod,technik,jamesy,4speed,tenorsax,legshow,yoshi1,chrisbl,44e3ebda,trafalga,heather7,serafima,favorite4,havefun1,wolve,55555r,james13,nosredna,bodean,jlettier,borracho,mickael,marinus,brutu,sweet666,kiborg,rollrock,jackson6,macross1,ousooner,9085084232,takeme,123qwaszx,firedept,vfrfhjd,jackfros,123456789000,briane,cookie11,baby22,bobby18,gromova,systemofadown,martin01,silver01,pimaou,darthmaul,hijinx,commo,chech,skyman,sunse,2vrd6,vladimirovna,uthvfybz,nicole01,kreker,bobo1,v123456789,erxtgb,meetoo,drakcap,vfvf12,misiek1,butane,network2,flyers99,riogrand,jennyk,e12345,spinne,avalon11,lovejone,studen,maint,porsche2,qwerty100,chamberl,bluedog1,sungam,just4u,andrew23,summer22,ludic,musiclover,aguil,beardog1,libertin,pippo1,joselit,patito,bigberth,digler,sydnee,jockstra,poopo,jas4an,nastya123,profil,fuesse,default1,titan2,mendoz,kpcofgs,anamika,brillo021,bomberman,guitar69,latching,69pussy,blues2,phelge,ninja123,m7n56xo,qwertasd,alex1976,cunningh,estrela,gladbach,marillion,mike2000,258046,bypop,muffinman,kd5396b,zeratul,djkxbwf,john77,sigma2,1linda,selur,reppep,quartz1,teen1,freeclus,spook1,kudos4ever,clitring,sexiness,blumpkin,macbook,tileman,centra,escaflowne,pentable,shant,grappa,zverev,1albert,lommerse,coffee11,777123,polkilo,muppet1,alex74,lkjhgfdsazx,olesica,april14,ba25547,souths,jasmi,arashi,smile2,2401pedro,mybabe,alex111,quintain,pimp1,tdeir8b2,makenna,122333444455555,%e2%82%ac,tootsie1,pass111,zaqxsw123,gkfdfybt,cnfnbcnbrf,usermane,iloveyou12,hard69,osasuna,firegod,arvind,babochka,kiss123,cookie123,julie123,kamakazi,dylan2,223355,tanguy,nbhtqa,tigger13,tubby1,makavel,asdflkj,sambo1,mononoke,mickeys,gayguy,win123,green33,wcrfxtvgbjy,bigsmall,1newlife,clove,babyfac,bigwaves,mama1970,shockwav,1friday,bassey,yarddog,codered1,victory7,bigrick,kracker,gulfstre,chris200,sunbanna,bertuzzi,begemotik,kuolema,pondus,destinee,123456789zz,abiodun,flopsy,amadeusptfcor,geronim,yggdrasi,contex,daniel6,suck1,adonis1,moorea,el345612,f22raptor,moviebuf,raunchy,6043dkf,zxcvbnm123456789,eric11,deadmoin,ratiug,nosliw,fannies,danno,888889,blank1,mikey2,gullit,thor99,mamiya,ollieb,thoth,dagger1,websolutionssu,bonker,prive,1346798520,03038,q1234q,mommy2,contax,zhipo,gwendoli,gothic1,1234562000,lovedick,gibso,digital2,space199,b26354,987654123,golive,serious1,pivkoo,better1,824358553,794613258,nata1980,logout,fishpond,buttss,squidly,good4me,redsox19,jhonny,zse45rdx,matrixxx,honey12,ramina,213546879,motzart,fall99,newspape,killit,gimpy,photowiz,olesja,thebus,marco123,147852963,bedbug,147369258,hellbound,gjgjxrf,123987456,lovehurt,five55,hammer01,1234554321a,alina2011,peppino,ang238,questor,112358132,alina1994,alina1998,money77,bobjones,aigerim,cressida,madalena,420smoke,tinchair,raven13,mooser,mauric,lovebu,adidas69,krypton1,1111112,loveline,divin,voshod,michaelm,cocotte,gbkbuhbv,76689295,kellyj,rhonda1,sweetu70,steamforums,geeque,nothere,124c41,quixotic,steam181,1169900,rfcgthcrbq,rfvbkm,sexstuff,1231230,djctvm,rockstar1,fulhamfc,bhecbr,rfntyf,quiksilv,56836803,jedimaster,pangit,gfhjkm777,tocool,1237654,stella12,55378008,19216811,potte,fender12,mortalkombat,ball1,nudegirl,palace22,rattrap,debeers,lickpussy,jimmy6,not4u2c,wert12,bigjuggs,sadomaso,1357924,312mas,laser123,arminia,branford,coastie,mrmojo,19801982,scott11,banaan123,ingres,300zxtt,hooters6,sweeties,19821983,19831985,19833891,sinnfein,welcome4,winner69,killerman,tachyon,tigre1,nymets1,kangol,martinet,sooty1,19921993,789qwe,harsingh,1597535,thecount,phantom3,36985214,lukas123,117711,pakistan1,madmax11,willow01,19932916,fucker12,flhrci,opelagila,theword,ashley24,tigger3,crazyj,rapide,deadfish,allana,31359092,sasha1993,sanders2,discman,zaq!2wsx,boilerma,mickey69,jamesg,babybo,jackson9,orion7,alina2010,indien,breeze1,atease,warspite,bazongaz,1celtic,asguard,mygal,fitzgera,1secret,duke33,cyklone,dipascuc,potapov,1escobar2,c0l0rad0,kki177hk,1little,macondo,victoriya,peter7,red666,winston6,kl?benhavn,muneca,jackme,jennan,happylife,am4h39d8nh,bodybuil,201980,dutchie,biggame,lapo4ka,rauchen,black10,flaquit,water12,31021364,command2,lainth88,mazdamx5,typhon,colin123,rcfhlfc,qwaszx11,g0away,ramir,diesirae,hacked1,cessna1,woodfish,enigma2,pqnr67w5,odgez8j3,grisou,hiheels,5gtgiaxm,2580258,ohotnik,transits,quackers,serjik,makenzie,mdmgatew,bryana,superman12,melly,lokit,thegod,slickone,fun4all,netpass,penhorse,1cooper,nsync,asdasd22,otherside,honeydog,herbie1,chiphi,proghouse,l0nd0n,shagg,select1,frost1996,casper123,countr,magichat,greatzyo,jyothi,3bears,thefly,nikkita,fgjcnjk,nitros,hornys,san123,lightspe,maslova,kimber1,newyork2,spammm,mikejone,pumpk1n,bruiser1,bacons,prelude9,boodie,dragon4,kenneth2,love98,power5,yodude,pumba,thinline,blue30,sexxybj,2dumb2live,matt21,forsale,1carolin,innova,ilikeporn,rbgtkjd,a1s2d3f,wu9942,ruffus,blackboo,qwerty999,draco1,marcelin,hideki,gendalf,trevon,saraha,cartmen,yjhbkmcr,time2go,fanclub,ladder1,chinni,6942987,united99,lindac,quadra,paolit,mainstre,beano002,lincoln7,bellend,anomie,8520456,bangalor,goodstuff,chernov,stepashka,gulla,mike007,frasse,harley03,omnislash,8538622,maryjan,sasha2011,gineok,8807031,hornier,gopinath,princesit,bdr529,godown,bosslady,hakaone,1qwe2,madman1,joshua11,lovegame,bayamon,jedi01,stupid12,sport123,aaa666,tony44,collect1,charliem,chimaira,cx18ka,trrim777,chuckd,thedream,redsox99,goodmorning,delta88,iloveyou11,newlife2,figvam,chicago3,jasonk,12qwer,9875321,lestat1,satcom,conditio,capri50,sayaka,9933162,trunks1,chinga,snooch,alexand1,findus,poekie,cfdbyf,kevind,mike1969,fire13,leftie,bigtuna,chinnu,silence1,celos1,blackdra,alex24,gfgfif,2boobs,happy8,enolagay,sataniv1993,turner1,dylans,peugeo,sasha1994,hoppel,conno,moonshot,santa234,meister1,008800,hanako,tree123,qweras,gfitymrf,reggie31,august29,supert,joshua10,akademia,gbljhfc,zorro123,nathalia,redsox12,hfpdjl,mishmash,nokiae51,nyyankees,tu190022,strongbo,none1,not4u2no,katie2,popart,harlequi,santan,michal1,1therock,screwu,csyekmrf,olemiss1,tyrese,hoople,sunshin1,cucina,starbase,topshelf,fostex,california1,castle1,symantec,pippolo,babare,turntabl,1angela,moo123,ipvteb,gogolf,alex88,cycle1,maxie1,phase2,selhurst,furnitur,samfox,fromvermine,shaq34,gators96,captain2,delonge,tomatoe,bisous,zxcvbnma,glacius,pineapple1,cannelle,ganibal,mko09ijn,paraklast1974,hobbes12,petty43,artema,junior8,mylover,1234567890d,fatal1ty,prostreet,peruan,10020,nadya,caution1,marocas,chanel5,summer08,metal123,111lox,scrapy,thatguy,eddie666,washingto,yannis,minnesota_hp,lucky4,playboy6,naumova,azzurro,patat,dale33,pa55wd,speedster,zemanova,saraht,newto,tony22,qscesz,arkady,1oliver,death6,vkfwx046,antiflag,stangs,jzf7qf2e,brianp,fozzy,cody123,startrek1,yoda123,murciela,trabajo,lvbnhbtdf,canario,fliper,adroit,henry5,goducks,papirus,alskdj,soccer6,88mike,gogetter,tanelorn,donking,marky1,leedsu,badmofo,al1916,wetdog,akmaral,pallet,april24,killer00,nesterova,rugby123,coffee12,browseui,ralliart,paigow,calgary1,armyman,vtldtltd,frodo2,frxtgb,iambigal,benno,jaytee,2hot4you,askar,bigtee,brentwoo,palladin,eddie2,al1916w,horosho,entrada,ilovetits,venture1,dragon19,jayde,chuvak,jamesl,fzr600,brandon8,vjqvbh,snowbal,snatch1,bg6njokf,pudder,karolin,candoo,pfuflrf,satchel1,manteca,khongbiet,critter1,partridg,skyclad,bigdon,ginger69,brave1,anthony4,spinnake,chinadol,passout,cochino,nipples1,15058,lopesk,sixflags,lloo999,parkhead,breakdance,cia123,fidodido,yuitre12,fooey,artem1995,gayathri,medin,nondriversig,l12345,bravo7,happy13,kazuya,camster,alex1998,luckyy,zipcode,dizzle,boating1,opusone,newpassw,movies23,kamikazi,zapato,bart316,cowboys0,corsair1,kingshit,hotdog12,rolyat,h200svrm,qwerty4,boofer,rhtyltkm,chris999,vaz21074,simferopol,pitboss,love3,britania,tanyshka,brause,123qwerty123,abeille,moscow1,ilkaev,manut,process1,inetcfg,dragon05,fortknox,castill,rynner,mrmike,koalas,jeebus,stockpor,longman,juanpabl,caiman,roleplay,jeremi,26058,prodojo,002200,magical1,black5,bvlgari,doogie1,cbhtqa,mahina,a1s2d3f4g5h6,jblpro,usmc01,bismilah,guitar01,april9,santana1,1234aa,monkey14,sorokin,evan1,doohan,animalsex,pfqxtyjr,dimitry,catchme,chello,silverch,glock45,dogleg,litespee,nirvana9,peyton18,alydar,warhamer,iluvme,sig229,minotavr,lobzik,jack23,bushwack,onlin,football123,joshua5,federov,winter2,bigmax,fufnfrhbcnb,hfpldfnhb,1dakota,f56307,chipmonk,4nick8,praline,vbhjh123,king11,22tango,gemini12,street1,77879,doodlebu,homyak,165432,chuluthu,trixi,karlito,salom,reisen,cdtnkzxjr,pookie11,tremendo,shazaam,welcome0,00000ty,peewee51,pizzle,gilead,bydand,sarvar,upskirt,legends1,freeway1,teenfuck,ranger9,darkfire,dfymrf,hunt0802,justme1,buffy1ma,1harry,671fsa75yt,burrfoot,budster,pa437tu,jimmyp,alina2006,malacon,charlize,elway1,free12,summer02,gadina,manara,gomer1,1cassie,sanja,kisulya,money3,pujols,ford50,midiland,turga,orange6,demetriu,freakboy,orosie1,radio123,open12,vfufpby,mustek,chris33,animes,meiling,nthtvjr,jasmine9,gfdkjd,oligarh,marimar,chicago9,.kzirf,bugssgub,samuraix,jackie01,pimpjuic,macdad,cagiva,vernost,willyboy,fynjyjdf,tabby1,privet123,torres9,retype,blueroom,raven11,q12we3,alex1989,bringiton,ridered,kareltje,ow8jtcs8t,ciccia,goniners,countryb,24688642,covingto,24861793,beyblade,vikin,badboyz,wlafiga,walstib,mirand,needajob,chloes,balaton,kbpfdtnf,freyja,bond9007,gabriel12,stormbri,hollage,love4eve,fenomeno,darknite,dragstar,kyle123,milfhunter,ma123123123,samia,ghislain,enrique1,ferien12,xjy6721,natalie2,reglisse,wilson2,wesker,rosebud7,amazon1,robertr,roykeane,xtcnth,mamatata,crazyc,mikie,savanah,blowjob69,jackie2,forty1,1coffee,fhbyjxrf,bubbah,goteam,hackedit,risky1,logoff,h397pnvr,buck13,robert23,bronc,st123st,godflesh,pornog,iamking,cisco69,septiembr,dale38,zhongguo,tibbar,panther9,buffa1,bigjohn1,mypuppy,vehvfycr,april16,shippo,fire1234,green15,q123123,gungadin,steveg,olivier1,chinaski,magnoli,faithy,storm12,toadfrog,paul99,78791,august20,automati,squirtle,cheezy,positano,burbon,nunya,llebpmac,kimmi,turtle2,alan123,prokuror,violin1,durex,pussygal,visionar,trick1,chicken6,29024,plowboy,rfybreks,imbue,sasha13,wagner1,vitalogy,cfymrf,thepro,26028,gorbunov,dvdcom,letmein5,duder,fastfun,pronin,libra1,conner1,harley20,stinker1,20068,20038,amitech,syoung,dugway,18068,welcome7,jimmypag,anastaci,kafka1,pfhfnecnhf,catsss,campus100,shamal,nacho1,fire12,vikings2,brasil1,rangerover,mohamma,peresvet,14058,cocomo,aliona,14038,qwaser,vikes,cbkmdf,skyblue1,ou81234,goodlove,dfkmltvfh,108888,roamer,pinky2,static1,zxcv4321,barmen,rock22,shelby2,morgans,1junior,pasword1,logjam,fifty5,nhfrnjhbcn,chaddy,philli,nemesis2,ingenier,djkrjd,ranger3,aikman8,knothead,daddy69,love007,vsythb,ford350,tiger00,renrut,owen11,energy12,march14,alena123,robert19,carisma,orange22,murphy11,podarok,prozak,kfgeirf,wolf13,lydia1,shazza,parasha,akimov,tobbie,pilote,heather4,baster,leones,gznfxjr,megama,987654321g,bullgod,boxster1,minkey,wombats,vergil,colegiata,lincol,smoothe,pride1,carwash1,latrell,bowling3,fylhtq123,pickwick,eider,bubblebox,bunnies1,loquit,slipper1,nutsac,purina,xtutdfhf,plokiju,1qazxs,uhjpysq,zxcvbasdfg,enjoy1,1pumpkin,phantom7,mama22,swordsma,wonderbr,dogdays,milker,u23456,silvan,dfkthbr,slagelse,yeahman,twothree,boston11,wolf100,dannyg,troll1,fynjy123,ghbcnfd,bftest,ballsdeep,bobbyorr,alphasig,cccdemo,fire123,norwest,claire2,august10,lth1108,problemas,sapito,alex06,1rusty,maccom,goirish1,ohyes,bxdumb,nabila,boobear1,rabbit69,princip,alexsander,travail,chantal1,dogggy,greenpea,diablo69,alex2009,bergen09,petticoa,classe,ceilidh,vlad2011,kamakiri,lucidity,qaz321,chileno,cexfhf,99ranger,mcitra,estoppel,volvos60,carter80,webpass,temp12,touareg,fcgbhby,bubba8,sunitha,200190ru,bitch2,shadow23,iluvit,nicole0,ruben1,nikki69,butttt,shocker1,souschef,lopotok01,kantot,corsano,cfnfyf,riverat,makalu,swapna,all4u9,cdtnkfy,ntktgepbr,ronaldo99,thomasj,bmw540i,chrisw,boomba,open321,z1x2c3v4b5n6m7,gaviota,iceman44,frosya,chris100,chris24,cosette,clearwat,micael,boogyman,pussy9,camus1,chumpy,heccrbq,konoplya,chester8,scooter5,ghjgfufylf,giotto,koolkat,zero000,bonita1,ckflrbq,j1964,mandog,18n28n24a,renob,head1,shergar,ringo123,tanita,sex4free,johnny12,halberd,reddevils,biolog,dillinge,fatb0y,c00per,hyperlit,wallace2,spears1,vitamine,buheirf,sloboda,alkash,mooman,marion1,arsenal7,sunder,nokia5610,edifier,pippone,fyfnjkmtdbx,fujimo,pepsi12,kulikova,bolat,duetto,daimon,maddog01,timoshka,ezmoney,desdemon,chesters,aiden,hugues,patrick5,aikman08,robert4,roenick,nyranger,writer1,36169544,foxmulder,118801,kutter,shashank,jamjar,118811,119955,aspirina,dinkus,1sailor,nalgene,19891959,snarf,allie1,cracky,resipsa,45678912,kemerovo,19841989,netware1,alhimik,19801984,nicole123,19761977,51501984,malaka1,montella,peachfuz,jethro1,cypress1,henkie,holdon,esmith,55443322,1friend,quique,bandicoot,statistika,great123,death13,ucht36,master4,67899876,bobsmith,nikko1,jr1234,hillary1,78978978,rsturbo,lzlzdfcz,bloodlust,shadow00,skagen,bambina,yummies,88887777,91328378,matthew4,itdoes,98256518,102938475,alina2002,123123789,fubared,dannys,123456321,nikifor,suck69,newmexico,scubaman,rhbcnb,fifnfy,puffdadd,159357852,dtheyxbr,theman22,212009164,prohor,shirle,nji90okm,newmedia,goose5,roma1995,letssee,iceman11,aksana,wirenut,pimpdady,1212312121,tamplier,pelican1,domodedovo,1928374655,fiction6,duckpond,ybrecz,thwack,onetwo34,gunsmith,murphydo,fallout1,spectre1,jabberwo,jgjesq,turbo6,bobo12,redryder,blackpus,elena1971,danilova,antoin,bobo1234,bobob,bobbobbo,dean1,222222a,jesusgod,matt23,musical1,darkmage,loppol,werrew,josepha,rebel12,toshka,gadfly,hawkwood,alina12,dnomyar,sexaddict,dangit,cool23,yocrack,archimed,farouk,nhfkzkz,lindalou,111zzzzz,ghjatccjh,wethepeople,m123456789,wowsers,kbkbxrf,bulldog5,m_roesel,sissinit,yamoon6,123ewqasd,dangel,miruvor79,kaytee,falcon7,bandit11,dotnet,dannii,arsenal9,miatamx5,1trouble,strip4me,dogpile,sexyred1,rjdfktdf,google10,shortman,crystal7,awesome123,cowdog,haruka,birthday28,jitter,diabolik,boomer12,dknight,bluewate,hockey123,crm0624,blueboys,willy123,jumpup,google2,cobra777,llabesab,vicelord,hopper1,gerryber,remmah,j10e5d4,qqqqqqw,agusti,fre_ak8yj,nahlik,redrobin,scott3,epson1,dumpy,bundao,aniolek,hola123,jergens,itsasecret,maxsam,bluelight,mountai1,bongwater,1london,pepper14,freeuse,dereks,qweqw,fordgt40,rfhfdfy,raider12,hunnybun,compac,splicer,megamon,tuffgong,gymnast1,butter11,modaddy,wapbbs_1,dandelio,soccer77,ghjnbdjcnjzybt,123xyi2,fishead,x002tp00,whodaman,555aaa,oussama,brunodog,technici,pmtgjnbl,qcxdw8ry,schweden,redsox3,throbber,collecto,japan10,dbm123dm,hellhoun,tech1,deadzone,kahlan,wolf123,dethklok,xzsawq,bigguy1,cybrthc,chandle,buck01,qq123123,secreta,williams1,c32649135,delta12,flash33,123joker,spacejam,polopo,holycrap,daman1,tummybed,financia,nusrat,euroline,magicone,jimkirk,ameritec,daniel26,sevenn,topazz,kingpins,dima1991,macdog,spencer5,oi812,geoffre,music11,baffle,123569,usagi,cassiope,polla,lilcrowe,thecakeisalie,vbhjndjhtw,vthokies,oldmans,sophie01,ghoster,penny2,129834,locutus1,meesha,magik,jerry69,daddysgirl,irondesk,andrey12,jasmine123,vepsrfyn,likesdick,1accord,jetboat,grafix,tomuch,showit,protozoa,mosias98,taburetka,blaze420,esenin,anal69,zhv84kv,puissant,charles0,aishwarya,babylon6,bitter1,lenina,raleigh1,lechat,access01,kamilka,fynjy,sparkplu,daisy3112,choppe,zootsuit,1234567j,rubyrose,gorilla9,nightshade,alternativa,cghfdjxybr,snuggles1,10121v,vova1992,leonardo1,dave2,matthewd,vfhfnbr,1986mets,nobull,bacall,mexican1,juanjo,mafia1,boomer22,soylent,edwards1,jordan10,blackwid,alex86,gemini13,lunar2,dctvcjcfnm,malaki,plugger,eagles11,snafu2,1shelly,cintaku,hannah22,tbird1,maks5843,irish88,homer22,amarok,fktrcfylhjdf,lincoln2,acess,gre69kik,need4speed,hightech,core2duo,blunt1,ublhjgjybrf,dragon33,1autopas,autopas1,wwww1,15935746,daniel20,2500aa,massim,1ggggggg,96ford,hardcor1,cobra5,blackdragon,vovan_lt,orochimaru,hjlbntkb,qwertyuiop12,tallen,paradoks,frozenfish,ghjuhfvvbcn,gerri1,nuggett,camilit,doright,trans1,serena1,catch2,bkmyeh,fireston,afhvfwtdn,purple3,figure8,fuckya,scamp1,laranja,ontheoutside,louis123,yellow7,moonwalk,mercury2,tolkein,raide,amenra,a13579,dranreb,5150vh,harish,tracksta,sexking,ozzmosis,katiee,alomar,matrix19,headroom,jahlove,ringding,apollo8,132546,132613,12345672000,saretta,135798,136666,thomas7,136913,onetwothree,hockey33,calida,nefertit,bitwise,tailhook,boop4,kfgecbr,bujhmbujhm,metal69,thedark,meteoro,felicia1,house12,tinuviel,istina,vaz2105,pimp13,toolfan,nina1,tuesday2,maxmotives,lgkp500,locksley,treech,darling1,kurama,aminka,ramin,redhed,dazzler,jager1,stpiliot,cardman,rfvtym,cheeser,14314314,paramoun,samcat,plumpy,stiffie,vsajyjr,panatha,qqq777,car12345,098poi,asdzx,keegan1,furelise,kalifornia,vbhjckfd,beast123,zcfvfzkexifz,harry5,1birdie,96328i,escola,extra330,henry12,gfhfyjqz,14u2nv,max1234,templar1,1dave,02588520,catrin,pangolin,marhaba,latin1,amorcito,dave22,escape1,advance1,yasuhiro,grepw,meetme,orange01,ernes,erdna,zsergn,nautica1,justinb,soundwav,miasma,greg78,nadine1,sexmad,lovebaby,promo1,excel1,babys,dragonma,camry1,sonnenschein,farooq,wazzkaprivet,magal,katinas,elvis99,redsox24,rooney1,chiefy,peggys,aliev,pilsung,mudhen,dontdoit,dennis12,supercal,energia,ballsout,funone,claudiu,brown2,amoco,dabl1125,philos,gjdtkbntkm,servette,13571113,whizzer,nollie,13467982,upiter,12string,bluejay1,silkie,william4,kosta1,143333,connor12,sustanon,06068,corporat,ssnake,laurita,king10,tahoes,arsenal123,sapato,charless,jeanmarc,levent,algerie,marine21,jettas,winsome,dctvgbplf,1701ab,xxxp455w0rd5,lllllll1,ooooooo1,monalis,koufax32,anastasya,debugger,sarita2,jason69,ufkxjyjr,gjlcnfdf,1jerry,daniel10,balinor,sexkitten,death2,qwertasdfgzxcvb,s9te949f,vegeta1,sysman,maxxam,dimabilan,mooose,ilovetit,june23,illest,doesit,mamou,abby12,longjump,transalp,moderato,littleguy,magritte,dilnoza,hawaiiguy,winbig,nemiroff,kokaine,admira,myemail,dream2,browneyes,destiny7,dragonss,suckme1,asa123,andranik,suckem,fleshbot,dandie,timmys,scitra,timdog,hasbeen,guesss,smellyfe,arachne,deutschl,harley88,birthday27,nobody1,papasmur,home1,jonass,bunia3,epatb1,embalm,vfvekmrf,apacer,12345656,estreet,weihnachtsbaum,mrwhite,admin12,kristie1,kelebek,yoda69,socken,tima123,bayern1,fktrcfylth,tamiya,99strenght,andy01,denis2011,19delta,stokecit,aotearoa,stalker2,nicnac,conrad1,popey,agusta,bowl36,1bigfish,mossyoak,1stunner,getinnow,jessejames,gkfnjy,drako,1nissan,egor123,hotness,1hawaii,zxc123456,cantstop,1peaches,madlen,west1234,jeter1,markis,judit,attack1,artemi,silver69,153246,crazy2,green9,yoshimi,1vette,chief123,jasper2,1sierra,twentyon,drstrang,aspirant,yannic,jenna123,bongtoke,slurpy,1sugar,civic97,rusty21,shineon,james19,anna12345,wonderwoman,1kevin,karol1,kanabis,wert21,fktif6115,evil1,kakaha,54gv768,826248s,tyrone1,1winston,sugar2,falcon01,adelya,mopar440,zasxcd,leecher,kinkysex,mercede1,travka,11234567,rebon,geekboy".split(","),
114527 english_wikipedia: "the,of,and,in,was,is,for,as,on,with,by,he,at,from,his,an,were,are,which,doc,https,also,or,has,had,first,one,their,its,after,new,who,they,two,her,she,been,other,when,time,during,there,into,school,more,may,years,over,only,year,most,would,world,city,some,where,between,later,three,state,such,then,national,used,made,known,under,many,university,united,while,part,season,team,these,american,than,film,second,born,south,became,states,war,through,being,including,both,before,north,high,however,people,family,early,history,album,area,them,series,against,until,since,district,county,name,work,life,group,music,following,number,company,several,four,called,played,released,career,league,game,government,house,each,based,day,same,won,use,station,club,international,town,located,population,general,college,east,found,age,march,end,september,began,home,public,church,line,june,river,member,system,place,century,band,july,york,january,october,song,august,best,former,british,party,named,held,village,show,local,november,took,service,december,built,another,major,within,along,members,five,single,due,although,small,old,left,final,large,include,building,served,president,received,games,death,february,main,third,set,children,own,order,species,park,law,air,published,road,died,book,men,women,army,often,according,education,central,country,division,english,top,included,development,french,community,among,water,play,side,list,times,near,late,form,original,different,center,power,led,students,german,moved,court,six,land,council,island,u.s.,record,million,research,art,established,award,street,military,television,given,region,support,western,production,non,political,point,cup,period,business,title,started,various,election,using,england,role,produced,become,program,works,field,total,office,class,written,association,radio,union,level,championship,director,few,force,created,department,founded,services,married,though,per,n't,site,open,act,short,society,version,royal,present,northern,worked,professional,full,returned,joined,story,france,european,currently,language,social,california,india,days,design,st.,further,round,australia,wrote,san,project,control,southern,railway,board,popular,continued,free,battle,considered,video,common,position,living,half,playing,recorded,red,post,described,average,records,special,modern,appeared,announced,areas,rock,release,elected,others,example,term,opened,similar,formed,route,census,current,schools,originally,lake,developed,race,himself,forces,addition,information,upon,province,match,event,songs,result,events,win,eastern,track,lead,teams,science,human,construction,minister,germany,awards,available,throughout,training,style,body,museum,australian,health,seven,signed,chief,eventually,appointed,sea,centre,debut,tour,points,media,light,range,character,across,features,families,largest,indian,network,less,performance,players,refer,europe,sold,festival,usually,taken,despite,designed,committee,process,return,official,episode,institute,stage,followed,performed,japanese,personal,thus,arts,space,low,months,includes,china,study,middle,magazine,leading,japan,groups,aircraft,featured,federal,civil,rights,model,coach,canadian,books,remained,eight,type,independent,completed,capital,academy,instead,kingdom,organization,countries,studies,competition,sports,size,above,section,finished,gold,involved,reported,management,systems,industry,directed,market,fourth,movement,technology,bank,ground,campaign,base,lower,sent,rather,added,provided,coast,grand,historic,valley,conference,bridge,winning,approximately,films,chinese,awarded,degree,russian,shows,native,female,replaced,municipality,square,studio,medical,data,african,successful,mid,bay,attack,previous,operations,spanish,theatre,student,republic,beginning,provide,ship,primary,owned,writing,tournament,culture,introduced,texas,related,natural,parts,governor,reached,ireland,units,senior,decided,italian,whose,higher,africa,standard,income,professor,placed,regional,los,buildings,championships,active,novel,energy,generally,interest,via,economic,previously,stated,itself,channel,below,operation,leader,traditional,trade,structure,limited,runs,prior,regular,famous,saint,navy,foreign,listed,artist,catholic,airport,results,parliament,collection,unit,officer,goal,attended,command,staff,commission,lived,location,plays,commercial,places,foundation,significant,older,medal,self,scored,companies,highway,activities,programs,wide,musical,notable,library,numerous,paris,towards,individual,allowed,plant,property,annual,contract,whom,highest,initially,required,earlier,assembly,artists,rural,seat,practice,defeated,ended,soviet,length,spent,manager,press,associated,author,issues,additional,characters,lord,zealand,policy,engine,township,noted,historical,complete,financial,religious,mission,contains,nine,recent,represented,pennsylvania,administration,opening,secretary,lines,report,executive,youth,closed,theory,writer,italy,angeles,appearance,feature,queen,launched,legal,terms,entered,issue,edition,singer,greek,majority,background,source,anti,cultural,complex,changes,recording,stadium,islands,operated,particularly,basketball,month,uses,port,castle,mostly,names,fort,selected,increased,status,earth,subsequently,pacific,cover,variety,certain,goals,remains,upper,congress,becoming,studied,irish,nature,particular,loss,caused,chart,dr.,forced,create,era,retired,material,review,rate,singles,referred,larger,individuals,shown,provides,products,speed,democratic,poland,parish,olympics,cities,themselves,temple,wing,genus,households,serving,cost,wales,stations,passed,supported,view,cases,forms,actor,male,matches,males,stars,tracks,females,administrative,median,effect,biography,train,engineering,camp,offered,chairman,houses,mainly,19th,surface,therefore,nearly,score,ancient,subject,prime,seasons,claimed,experience,specific,jewish,failed,overall,believed,plot,troops,greater,spain,consists,broadcast,heavy,increase,raised,separate,campus,1980s,appears,presented,lies,composed,recently,influence,fifth,nations,creek,references,elections,britain,double,cast,meaning,earned,carried,producer,latter,housing,brothers,attempt,article,response,border,remaining,nearby,direct,ships,value,workers,politician,academic,label,1970s,commander,rule,fellow,residents,authority,editor,transport,dutch,projects,responsible,covered,territory,flight,races,defense,tower,emperor,albums,facilities,daily,stories,assistant,managed,primarily,quality,function,proposed,distribution,conditions,prize,journal,code,vice,newspaper,corps,highly,constructed,mayor,critical,secondary,corporation,rugby,regiment,ohio,appearances,serve,allow,nation,multiple,discovered,directly,scene,levels,growth,elements,acquired,1990s,officers,physical,20th,latin,host,jersey,graduated,arrived,issued,literature,metal,estate,vote,immediately,quickly,asian,competed,extended,produce,urban,1960s,promoted,contemporary,global,formerly,appear,industrial,types,opera,ministry,soldiers,commonly,mass,formation,smaller,typically,drama,shortly,density,senate,effects,iran,polish,prominent,naval,settlement,divided,basis,republican,languages,distance,treatment,continue,product,mile,sources,footballer,format,clubs,leadership,initial,offers,operating,avenue,officially,columbia,grade,squadron,fleet,percent,farm,leaders,agreement,likely,equipment,website,mount,grew,method,transferred,intended,renamed,iron,asia,reserve,capacity,politics,widely,activity,advanced,relations,scottish,dedicated,crew,founder,episodes,lack,amount,build,efforts,concept,follows,ordered,leaves,positive,economy,entertainment,affairs,memorial,ability,illinois,communities,color,text,railroad,scientific,focus,comedy,serves,exchange,environment,cars,direction,organized,firm,description,agency,analysis,purpose,destroyed,reception,planned,revealed,infantry,architecture,growing,featuring,household,candidate,removed,situated,models,knowledge,solo,technical,organizations,assigned,conducted,participated,largely,purchased,register,gained,combined,headquarters,adopted,potential,protection,scale,approach,spread,independence,mountains,titled,geography,applied,safety,mixed,accepted,continues,captured,rail,defeat,principal,recognized,lieutenant,mentioned,semi,owner,joint,liberal,actress,traffic,creation,basic,notes,unique,supreme,declared,simply,plants,sales,massachusetts,designated,parties,jazz,compared,becomes,resources,titles,concert,learning,remain,teaching,versions,content,alongside,revolution,sons,block,premier,impact,champions,districts,generation,estimated,volume,image,sites,account,roles,sport,quarter,providing,zone,yard,scoring,classes,presence,performances,representatives,hosted,split,taught,origin,olympic,claims,critics,facility,occurred,suffered,municipal,damage,defined,resulted,respectively,expanded,platform,draft,opposition,expected,educational,ontario,climate,reports,atlantic,surrounding,performing,reduced,ranked,allows,birth,nominated,younger,newly,kong,positions,theater,philadelphia,heritage,finals,disease,sixth,laws,reviews,constitution,tradition,swedish,theme,fiction,rome,medicine,trains,resulting,existing,deputy,environmental,labour,classical,develop,fans,granted,receive,alternative,begins,nuclear,fame,buried,connected,identified,palace,falls,letters,combat,sciences,effort,villages,inspired,regions,towns,conservative,chosen,animals,labor,attacks,materials,yards,steel,representative,orchestra,peak,entitled,officials,returning,reference,northwest,imperial,convention,examples,ocean,publication,painting,subsequent,frequently,religion,brigade,fully,sides,acts,cemetery,relatively,oldest,suggested,succeeded,achieved,application,programme,cells,votes,promotion,graduate,armed,supply,flying,communist,figures,literary,netherlands,korea,worldwide,citizens,1950s,faculty,draw,stock,seats,occupied,methods,unknown,articles,claim,holds,authorities,audience,sweden,interview,obtained,covers,settled,transfer,marked,allowing,funding,challenge,southeast,unlike,crown,rise,portion,transportation,sector,phase,properties,edge,tropical,standards,institutions,philosophy,legislative,hills,brand,fund,conflict,unable,founding,refused,attempts,metres,permanent,starring,applications,creating,effective,aired,extensive,employed,enemy,expansion,billboard,rank,battalion,multi,vehicle,fought,alliance,category,perform,federation,poetry,bronze,bands,entry,vehicles,bureau,maximum,billion,trees,intelligence,greatest,screen,refers,commissioned,gallery,injury,confirmed,setting,treaty,adult,americans,broadcasting,supporting,pilot,mobile,writers,programming,existence,squad,minnesota,copies,korean,provincial,sets,defence,offices,agricultural,internal,core,northeast,retirement,factory,actions,prevent,communications,ending,weekly,containing,functions,attempted,interior,weight,bowl,recognition,incorporated,increasing,ultimately,documentary,derived,attacked,lyrics,mexican,external,churches,centuries,metropolitan,selling,opposed,personnel,mill,visited,presidential,roads,pieces,norwegian,controlled,18th,rear,influenced,wrestling,weapons,launch,composer,locations,developing,circuit,specifically,studios,shared,canal,wisconsin,publishing,approved,domestic,consisted,determined,comic,establishment,exhibition,southwest,fuel,electronic,cape,converted,educated,melbourne,hits,wins,producing,norway,slightly,occur,surname,identity,represent,constituency,funds,proved,links,structures,athletic,birds,contest,users,poet,institution,display,receiving,rare,contained,guns,motion,piano,temperature,publications,passenger,contributed,toward,cathedral,inhabitants,architect,exist,athletics,muslim,courses,abandoned,signal,successfully,disambiguation,tennessee,dynasty,heavily,maryland,jews,representing,budget,weather,missouri,introduction,faced,pair,chapel,reform,height,vietnam,occurs,motor,cambridge,lands,focused,sought,patients,shape,invasion,chemical,importance,communication,selection,regarding,homes,voivodeship,maintained,borough,failure,aged,passing,agriculture,oregon,teachers,flow,philippines,trail,seventh,portuguese,resistance,reaching,negative,fashion,scheduled,downtown,universities,trained,skills,scenes,views,notably,typical,incident,candidates,engines,decades,composition,commune,chain,inc.,austria,sale,values,employees,chamber,regarded,winners,registered,task,investment,colonial,swiss,user,entirely,flag,stores,closely,entrance,laid,journalist,coal,equal,causes,turkish,quebec,techniques,promote,junction,easily,dates,kentucky,singapore,residence,violence,advance,survey,humans,expressed,passes,streets,distinguished,qualified,folk,establish,egypt,artillery,visual,improved,actual,finishing,medium,protein,switzerland,productions,operate,poverty,neighborhood,organisation,consisting,consecutive,sections,partnership,extension,reaction,factor,costs,bodies,device,ethnic,racial,flat,objects,chapter,improve,musicians,courts,controversy,membership,merged,wars,expedition,interests,arab,comics,gain,describes,mining,bachelor,crisis,joining,decade,1930s,distributed,habitat,routes,arena,cycle,divisions,briefly,vocals,directors,degrees,object,recordings,installed,adjacent,demand,voted,causing,businesses,ruled,grounds,starred,drawn,opposite,stands,formal,operates,persons,counties,compete,wave,israeli,ncaa,resigned,brief,greece,combination,demographics,historian,contain,commonwealth,musician,collected,argued,louisiana,session,cabinet,parliamentary,electoral,loan,profit,regularly,conservation,islamic,purchase,17th,charts,residential,earliest,designs,paintings,survived,moth,items,goods,grey,anniversary,criticism,images,discovery,observed,underground,progress,additionally,participate,thousands,reduce,elementary,owners,stating,iraq,resolution,capture,tank,rooms,hollywood,finance,queensland,reign,maintain,iowa,landing,broad,outstanding,circle,path,manufacturing,assistance,sequence,gmina,crossing,leads,universal,shaped,kings,attached,medieval,ages,metro,colony,affected,scholars,oklahoma,coastal,soundtrack,painted,attend,definition,meanwhile,purposes,trophy,require,marketing,popularity,cable,mathematics,mississippi,represents,scheme,appeal,distinct,factors,acid,subjects,roughly,terminal,economics,senator,diocese,prix,contrast,argentina,czech,wings,relief,stages,duties,16th,novels,accused,whilst,equivalent,charged,measure,documents,couples,request,danish,defensive,guide,devices,statistics,credited,tries,passengers,allied,frame,puerto,peninsula,concluded,instruments,wounded,differences,associate,forests,afterwards,replace,requirements,aviation,solution,offensive,ownership,inner,legislation,hungarian,contributions,actors,translated,denmark,steam,depending,aspects,assumed,injured,severe,admitted,determine,shore,technique,arrival,measures,translation,debuted,delivered,returns,rejected,separated,visitors,damaged,storage,accompanied,markets,industries,losses,gulf,charter,strategy,corporate,socialist,somewhat,significantly,physics,mounted,satellite,experienced,constant,relative,pattern,restored,belgium,connecticut,partners,harvard,retained,networks,protected,mode,artistic,parallel,collaboration,debate,involving,journey,linked,salt,authors,components,context,occupation,requires,occasionally,policies,tamil,ottoman,revolutionary,hungary,poem,versus,gardens,amongst,audio,makeup,frequency,meters,orthodox,continuing,suggests,legislature,coalition,guitarist,eighth,classification,practices,soil,tokyo,instance,limit,coverage,considerable,ranking,colleges,cavalry,centers,daughters,twin,equipped,broadway,narrow,hosts,rates,domain,boundary,arranged,12th,whereas,brazilian,forming,rating,strategic,competitions,trading,covering,baltimore,commissioner,infrastructure,origins,replacement,praised,disc,collections,expression,ukraine,driven,edited,austrian,solar,ensure,premiered,successor,wooden,operational,hispanic,concerns,rapid,prisoners,childhood,meets,influential,tunnel,employment,tribe,qualifying,adapted,temporary,celebrated,appearing,increasingly,depression,adults,cinema,entering,laboratory,script,flows,romania,accounts,fictional,pittsburgh,achieve,monastery,franchise,formally,tools,newspapers,revival,sponsored,processes,vienna,springs,missions,classified,13th,annually,branches,lakes,gender,manner,advertising,normally,maintenance,adding,characteristics,integrated,decline,modified,strongly,critic,victims,malaysia,arkansas,nazi,restoration,powered,monument,hundreds,depth,15th,controversial,admiral,criticized,brick,honorary,initiative,output,visiting,birmingham,progressive,existed,carbon,1920s,credits,colour,rising,hence,defeating,superior,filmed,listing,column,surrounded,orleans,principles,territories,struck,participation,indonesia,movements,index,commerce,conduct,constitutional,spiritual,ambassador,vocal,completion,edinburgh,residing,tourism,finland,bears,medals,resident,themes,visible,indigenous,involvement,basin,electrical,ukrainian,concerts,boats,styles,processing,rival,drawing,vessels,experimental,declined,touring,supporters,compilation,coaching,cited,dated,roots,string,explained,transit,traditionally,poems,minimum,representation,14th,releases,effectively,architectural,triple,indicated,greatly,elevation,clinical,printed,10th,proposal,peaked,producers,romanized,rapidly,stream,innings,meetings,counter,householder,honour,lasted,agencies,document,exists,surviving,experiences,honors,landscape,hurricane,harbor,panel,competing,profile,vessel,farmers,lists,revenue,exception,customers,11th,participants,wildlife,utah,bible,gradually,preserved,replacing,symphony,begun,longest,siege,provinces,mechanical,genre,transmission,agents,executed,videos,benefits,funded,rated,instrumental,ninth,similarly,dominated,destruction,passage,technologies,thereafter,outer,facing,affiliated,opportunities,instrument,governments,scholar,evolution,channels,shares,sessions,widespread,occasions,engineers,scientists,signing,battery,competitive,alleged,eliminated,supplies,judges,hampshire,regime,portrayed,penalty,taiwan,denied,submarine,scholarship,substantial,transition,victorian,http,nevertheless,filed,supports,continental,tribes,ratio,doubles,useful,honours,blocks,principle,retail,departure,ranks,patrol,yorkshire,vancouver,inter,extent,afghanistan,strip,railways,component,organ,symbol,categories,encouraged,abroad,civilian,periods,traveled,writes,struggle,immediate,recommended,adaptation,egyptian,graduating,assault,drums,nomination,historically,voting,allies,detailed,achievement,percentage,arabic,assist,frequent,toured,apply,and/or,intersection,maine,touchdown,throne,produces,contribution,emerged,obtain,archbishop,seek,researchers,remainder,populations,clan,finnish,overseas,fifa,licensed,chemistry,festivals,mediterranean,injuries,animated,seeking,publisher,volumes,limits,venue,jerusalem,generated,trials,islam,youngest,ruling,glasgow,germans,songwriter,persian,municipalities,donated,viewed,belgian,cooperation,posted,tech,dual,volunteer,settlers,commanded,claiming,approval,delhi,usage,terminus,partly,electricity,locally,editions,premiere,absence,belief,traditions,statue,indicate,manor,stable,attributed,possession,managing,viewers,chile,overview,seed,regulations,essential,minority,cargo,segment,endemic,forum,deaths,monthly,playoffs,erected,practical,machines,suburb,relation,mrs.,descent,indoor,continuous,characterized,solutions,caribbean,rebuilt,serbian,summary,contested,psychology,pitch,attending,muhammad,tenure,drivers,diameter,assets,venture,punk,airlines,concentration,athletes,volunteers,pages,mines,influences,sculpture,protest,ferry,behalf,drafted,apparent,furthermore,ranging,romanian,democracy,lanka,significance,linear,d.c.,certified,voters,recovered,tours,demolished,boundaries,assisted,identify,grades,elsewhere,mechanism,1940s,reportedly,aimed,conversion,suspended,photography,departments,beijing,locomotives,publicly,dispute,magazines,resort,conventional,platforms,internationally,capita,settlements,dramatic,derby,establishing,involves,statistical,implementation,immigrants,exposed,diverse,layer,vast,ceased,connections,belonged,interstate,uefa,organised,abuse,deployed,cattle,partially,filming,mainstream,reduction,automatic,rarely,subsidiary,decides,merger,comprehensive,displayed,amendment,guinea,exclusively,manhattan,concerning,commons,radical,serbia,baptist,buses,initiated,portrait,harbour,choir,citizen,sole,unsuccessful,manufactured,enforcement,connecting,increases,patterns,sacred,muslims,clothing,hindu,unincorporated,sentenced,advisory,tanks,campaigns,fled,repeated,remote,rebellion,implemented,texts,fitted,tribute,writings,sufficient,ministers,21st,devoted,jurisdiction,coaches,interpretation,pole,businessman,peru,sporting,prices,cuba,relocated,opponent,arrangement,elite,manufacturer,responded,suitable,distinction,calendar,dominant,tourist,earning,prefecture,ties,preparation,anglo,pursue,worship,archaeological,chancellor,bangladesh,scores,traded,lowest,horror,outdoor,biology,commented,specialized,loop,arriving,farming,housed,historians,'the,patent,pupils,christianity,opponents,athens,northwestern,maps,promoting,reveals,flights,exclusive,lions,norfolk,hebrew,extensively,eldest,shops,acquisition,virtual,renowned,margin,ongoing,essentially,iranian,alternate,sailed,reporting,conclusion,originated,temperatures,exposure,secured,landed,rifle,framework,identical,martial,focuses,topics,ballet,fighters,belonging,wealthy,negotiations,evolved,bases,oriented,acres,democrat,heights,restricted,vary,graduation,aftermath,chess,illness,participating,vertical,collective,immigration,demonstrated,leaf,completing,organic,missile,leeds,eligible,grammar,confederate,improvement,congressional,wealth,cincinnati,spaces,indicates,corresponding,reaches,repair,isolated,taxes,congregation,ratings,leagues,diplomatic,submitted,winds,awareness,photographs,maritime,nigeria,accessible,animation,restaurants,philippine,inaugural,dismissed,armenian,illustrated,reservoir,speakers,programmes,resource,genetic,interviews,camps,regulation,computers,preferred,travelled,comparison,distinctive,recreation,requested,southeastern,dependent,brisbane,breeding,playoff,expand,bonus,gauge,departed,qualification,inspiration,shipping,slaves,variations,shield,theories,munich,recognised,emphasis,favour,variable,seeds,undergraduate,territorial,intellectual,qualify,mini,banned,pointed,democrats,assessment,judicial,examination,attempting,objective,partial,characteristic,hardware,pradesh,execution,ottawa,metre,drum,exhibitions,withdrew,attendance,phrase,journalism,logo,measured,error,christians,trio,protestant,theology,respective,atmosphere,buddhist,substitute,curriculum,fundamental,outbreak,rabbi,intermediate,designation,globe,liberation,simultaneously,diseases,experiments,locomotive,difficulties,mainland,nepal,relegated,contributing,database,developments,veteran,carries,ranges,instruction,lodge,protests,obama,newcastle,experiment,physician,describing,challenges,corruption,delaware,adventures,ensemble,succession,renaissance,tenth,altitude,receives,approached,crosses,syria,croatia,warsaw,professionals,improvements,worn,airline,compound,permitted,preservation,reducing,printing,scientist,activist,comprises,sized,societies,enters,ruler,gospel,earthquake,extend,autonomous,croatian,serial,decorated,relevant,ideal,grows,grass,tier,towers,wider,welfare,columns,alumni,descendants,interface,reserves,banking,colonies,manufacturers,magnetic,closure,pitched,vocalist,preserve,enrolled,cancelled,equation,2000s,nickname,bulgaria,heroes,exile,mathematical,demands,input,structural,tube,stem,approaches,argentine,axis,manuscript,inherited,depicted,targets,visits,veterans,regard,removal,efficiency,organisations,concepts,lebanon,manga,petersburg,rally,supplied,amounts,yale,tournaments,broadcasts,signals,pilots,azerbaijan,architects,enzyme,literacy,declaration,placing,batting,incumbent,bulgarian,consistent,poll,defended,landmark,southwestern,raid,resignation,travels,casualties,prestigious,namely,aims,recipient,warfare,readers,collapse,coached,controls,volleyball,coup,lesser,verse,pairs,exhibited,proteins,molecular,abilities,integration,consist,aspect,advocate,administered,governing,hospitals,commenced,coins,lords,variation,resumed,canton,artificial,elevated,palm,difficulty,civic,efficient,northeastern,inducted,radiation,affiliate,boards,stakes,byzantine,consumption,freight,interaction,oblast,numbered,seminary,contracts,extinct,predecessor,bearing,cultures,functional,neighboring,revised,cylinder,grants,narrative,reforms,athlete,tales,reflect,presidency,compositions,specialist,cricketer,founders,sequel,widow,disbanded,associations,backed,thereby,pitcher,commanding,boulevard,singers,crops,militia,reviewed,centres,waves,consequently,fortress,tributary,portions,bombing,excellence,nest,payment,mars,plaza,unity,victories,scotia,farms,nominations,variant,attacking,suspension,installation,graphics,estates,comments,acoustic,destination,venues,surrender,retreat,libraries,quarterback,customs,berkeley,collaborated,gathered,syndrome,dialogue,recruited,shanghai,neighbouring,psychological,saudi,moderate,exhibit,innovation,depot,binding,brunswick,situations,certificate,actively,shakespeare,editorial,presentation,ports,relay,nationalist,methodist,archives,experts,maintains,collegiate,bishops,maintaining,temporarily,embassy,essex,wellington,connects,reformed,bengal,recalled,inches,doctrine,deemed,legendary,reconstruction,statements,palestinian,meter,achievements,riders,interchange,spots,auto,accurate,chorus,dissolved,missionary,thai,operators,e.g.,generations,failing,delayed,cork,nashville,perceived,venezuela,cult,emerging,tomb,abolished,documented,gaining,canyon,episcopal,stored,assists,compiled,kerala,kilometers,mosque,grammy,theorem,unions,segments,glacier,arrives,theatrical,circulation,conferences,chapters,displays,circular,authored,conductor,fewer,dimensional,nationwide,liga,yugoslavia,peer,vietnamese,fellowship,armies,regardless,relating,dynamic,politicians,mixture,serie,somerset,imprisoned,posts,beliefs,beta,layout,independently,electronics,provisions,fastest,logic,headquartered,creates,challenged,beaten,appeals,plains,protocol,graphic,accommodate,iraqi,midfielder,span,commentary,freestyle,reflected,palestine,lighting,burial,virtually,backing,prague,tribal,heir,identification,prototype,criteria,dame,arch,tissue,footage,extending,procedures,predominantly,updated,rhythm,preliminary,cafe,disorder,prevented,suburbs,discontinued,retiring,oral,followers,extends,massacre,journalists,conquest,larvae,pronounced,behaviour,diversity,sustained,addressed,geographic,restrictions,voiced,milwaukee,dialect,quoted,grid,nationally,nearest,roster,twentieth,separation,indies,manages,citing,intervention,guidance,severely,migration,artwork,focusing,rivals,trustees,varied,enabled,committees,centered,skating,slavery,cardinals,forcing,tasks,auckland,youtube,argues,colored,advisor,mumbai,requiring,theological,registration,refugees,nineteenth,survivors,runners,colleagues,priests,contribute,variants,workshop,concentrated,creator,lectures,temples,exploration,requirement,interactive,navigation,companion,perth,allegedly,releasing,citizenship,observation,stationed,ph.d.,sheep,breed,discovers,encourage,kilometres,journals,performers,isle,saskatchewan,hybrid,hotels,lancashire,dubbed,airfield,anchor,suburban,theoretical,sussex,anglican,stockholm,permanently,upcoming,privately,receiver,optical,highways,congo,colours,aggregate,authorized,repeatedly,varies,fluid,innovative,transformed,praise,convoy,demanded,discography,attraction,export,audiences,ordained,enlisted,occasional,westminster,syrian,heavyweight,bosnia,consultant,eventual,improving,aires,wickets,epic,reactions,scandal,i.e.,discrimination,buenos,patron,investors,conjunction,testament,construct,encountered,celebrity,expanding,georgian,brands,retain,underwent,algorithm,foods,provision,orbit,transformation,associates,tactical,compact,varieties,stability,refuge,gathering,moreover,manila,configuration,gameplay,discipline,entity,comprising,composers,skill,monitoring,ruins,museums,sustainable,aerial,altered,codes,voyage,friedrich,conflicts,storyline,travelling,conducting,merit,indicating,referendum,currency,encounter,particles,automobile,workshops,acclaimed,inhabited,doctorate,cuban,phenomenon,dome,enrollment,tobacco,governance,trend,equally,manufacture,hydrogen,grande,compensation,download,pianist,grain,shifted,neutral,evaluation,define,cycling,seized,array,relatives,motors,firms,varying,automatically,restore,nicknamed,findings,governed,investigate,manitoba,administrator,vital,integral,indonesian,confusion,publishers,enable,geographical,inland,naming,civilians,reconnaissance,indianapolis,lecturer,deer,tourists,exterior,rhode,bassist,symbols,scope,ammunition,yuan,poets,punjab,nursing,cent,developers,estimates,presbyterian,nasa,holdings,generate,renewed,computing,cyprus,arabia,duration,compounds,gastropod,permit,valid,touchdowns,facade,interactions,mineral,practiced,allegations,consequence,goalkeeper,baronet,copyright,uprising,carved,targeted,competitors,mentions,sanctuary,fees,pursued,tampa,chronicle,capabilities,specified,specimens,toll,accounting,limestone,staged,upgraded,philosophical,streams,guild,revolt,rainfall,supporter,princeton,terrain,hometown,probability,assembled,paulo,surrey,voltage,developer,destroyer,floors,lineup,curve,prevention,potentially,onwards,trips,imposed,hosting,striking,strict,admission,apartments,solely,utility,proceeded,observations,euro,incidents,vinyl,profession,haven,distant,expelled,rivalry,runway,torpedo,zones,shrine,dimensions,investigations,lithuania,idaho,pursuit,copenhagen,considerably,locality,wireless,decrease,genes,thermal,deposits,hindi,habitats,withdrawn,biblical,monuments,casting,plateau,thesis,managers,flooding,assassination,acknowledged,interim,inscription,guided,pastor,finale,insects,transported,activists,marshal,intensity,airing,cardiff,proposals,lifestyle,prey,herald,capitol,aboriginal,measuring,lasting,interpreted,occurring,desired,drawings,healthcare,panels,elimination,oslo,ghana,blog,sabha,intent,superintendent,governors,bankruptcy,p.m.,equity,disk,layers,slovenia,prussia,quartet,mechanics,graduates,politically,monks,screenplay,nato,absorbed,topped,petition,bold,morocco,exhibits,canterbury,publish,rankings,crater,dominican,enhanced,planes,lutheran,governmental,joins,collecting,brussels,unified,streak,strategies,flagship,surfaces,oval,archive,etymology,imprisonment,instructor,noting,remix,opposing,servant,rotation,width,trans,maker,synthesis,excess,tactics,snail,ltd.,lighthouse,sequences,cornwall,plantation,mythology,performs,foundations,populated,horizontal,speedway,activated,performer,diving,conceived,edmonton,subtropical,environments,prompted,semifinals,caps,bulk,treasury,recreational,telegraph,continent,portraits,relegation,catholics,graph,velocity,rulers,endangered,secular,observer,learns,inquiry,idol,dictionary,certification,estimate,cluster,armenia,observatory,revived,nadu,consumers,hypothesis,manuscripts,contents,arguments,editing,trails,arctic,essays,belfast,acquire,promotional,undertaken,corridor,proceedings,antarctic,millennium,labels,delegates,vegetation,acclaim,directing,substance,outcome,diploma,philosopher,malta,albanian,vicinity,degc,legends,regiments,consent,terrorist,scattered,presidents,gravity,orientation,deployment,duchy,refuses,estonia,crowned,separately,renovation,rises,wilderness,objectives,agreements,empress,slopes,inclusion,equality,decree,ballot,criticised,rochester,recurring,struggled,disabled,henri,poles,prussian,convert,bacteria,poorly,sudan,geological,wyoming,consistently,minimal,withdrawal,interviewed,proximity,repairs,initiatives,pakistani,republicans,propaganda,viii,abstract,commercially,availability,mechanisms,naples,discussions,underlying,lens,proclaimed,advised,spelling,auxiliary,attract,lithuanian,editors,o'brien,accordance,measurement,novelist,ussr,formats,councils,contestants,indie,facebook,parishes,barrier,battalions,sponsor,consulting,terrorism,implement,uganda,crucial,unclear,notion,distinguish,collector,attractions,filipino,ecology,investments,capability,renovated,iceland,albania,accredited,scouts,armor,sculptor,cognitive,errors,gaming,condemned,successive,consolidated,baroque,entries,regulatory,reserved,treasurer,variables,arose,technological,rounded,provider,rhine,agrees,accuracy,genera,decreased,frankfurt,ecuador,edges,particle,rendered,calculated,careers,faction,rifles,americas,gaelic,portsmouth,resides,merchants,fiscal,premises,coin,draws,presenter,acceptance,ceremonies,pollution,consensus,membrane,brigadier,nonetheless,genres,supervision,predicted,magnitude,finite,differ,ancestry,vale,delegation,removing,proceeds,placement,emigrated,siblings,molecules,payments,considers,demonstration,proportion,newer,valve,achieving,confederation,continuously,luxury,notre,introducing,coordinates,charitable,squadrons,disorders,geometry,winnipeg,ulster,loans,longtime,receptor,preceding,belgrade,mandate,wrestler,neighbourhood,factories,buddhism,imported,sectors,protagonist,steep,elaborate,prohibited,artifacts,prizes,pupil,cooperative,sovereign,subspecies,carriers,allmusic,nationals,settings,autobiography,neighborhoods,analog,facilitate,voluntary,jointly,newfoundland,organizing,raids,exercises,nobel,machinery,baltic,crop,granite,dense,websites,mandatory,seeks,surrendered,anthology,comedian,bombs,slot,synopsis,critically,arcade,marking,equations,halls,indo,inaugurated,embarked,speeds,clause,invention,premiership,likewise,presenting,demonstrate,designers,organize,examined,km/h,bavaria,troop,referee,detection,zurich,prairie,rapper,wingspan,eurovision,luxembourg,slovakia,inception,disputed,mammals,entrepreneur,makers,evangelical,yield,clergy,trademark,defunct,allocated,depicting,volcanic,batted,conquered,sculptures,providers,reflects,armoured,locals,walt,herzegovina,contracted,entities,sponsorship,prominence,flowing,ethiopia,marketed,corporations,withdraw,carnegie,induced,investigated,portfolio,flowering,opinions,viewing,classroom,donations,bounded,perception,leicester,fruits,charleston,academics,statute,complaints,smallest,deceased,petroleum,resolved,commanders,algebra,southampton,modes,cultivation,transmitter,spelled,obtaining,sizes,acre,pageant,bats,abbreviated,correspondence,barracks,feast,tackles,raja,derives,geology,disputes,translations,counted,constantinople,seating,macedonia,preventing,accommodation,homeland,explored,invaded,provisional,transform,sphere,unsuccessfully,missionaries,conservatives,highlights,traces,organisms,openly,dancers,fossils,absent,monarchy,combining,lanes,stint,dynamics,chains,missiles,screening,module,tribune,generating,miners,nottingham,seoul,unofficial,owing,linking,rehabilitation,citation,louisville,mollusk,depicts,differential,zimbabwe,kosovo,recommendations,responses,pottery,scorer,aided,exceptions,dialects,telecommunications,defines,elderly,lunar,coupled,flown,25th,espn,formula_1,bordered,fragments,guidelines,gymnasium,valued,complexity,papal,presumably,maternal,challenging,reunited,advancing,comprised,uncertain,favorable,twelfth,correspondent,nobility,livestock,expressway,chilean,tide,researcher,emissions,profits,lengths,accompanying,witnessed,itunes,drainage,slope,reinforced,feminist,sanskrit,develops,physicians,outlets,isbn,coordinator,averaged,termed,occupy,diagnosed,yearly,humanitarian,prospect,spacecraft,stems,enacted,linux,ancestors,karnataka,constitute,immigrant,thriller,ecclesiastical,generals,celebrations,enhance,heating,advocated,evident,advances,bombardment,watershed,shuttle,wicket,twitter,adds,branded,teaches,schemes,pension,advocacy,conservatory,cairo,varsity,freshwater,providence,seemingly,shells,cuisine,specially,peaks,intensive,publishes,trilogy,skilled,nacional,unemployment,destinations,parameters,verses,trafficking,determination,infinite,savings,alignment,linguistic,countryside,dissolution,measurements,advantages,licence,subfamily,highlands,modest,regent,algeria,crest,teachings,knockout,brewery,combine,conventions,descended,chassis,primitive,fiji,explicitly,cumberland,uruguay,laboratories,bypass,elect,informal,preceded,holocaust,tackle,minneapolis,quantity,securities,console,doctoral,religions,commissioners,expertise,unveiled,precise,diplomat,standings,infant,disciplines,sicily,endorsed,systematic,charted,armored,mild,lateral,townships,hurling,prolific,invested,wartime,compatible,galleries,moist,battlefield,decoration,convent,tubes,terrestrial,nominee,requests,delegate,leased,dubai,polar,applying,addresses,munster,sings,commercials,teamed,dances,eleventh,midland,cedar,flee,sandstone,snails,inspection,divide,asset,themed,comparable,paramount,dairy,archaeology,intact,institutes,rectangular,instances,phases,reflecting,substantially,applies,vacant,lacked,copa,coloured,encounters,sponsors,encoded,possess,revenues,ucla,chaired,a.m.,enabling,playwright,stoke,sociology,tibetan,frames,motto,financing,illustrations,gibraltar,chateau,bolivia,transmitted,enclosed,persuaded,urged,folded,suffolk,regulated,bros.,submarines,myth,oriental,malaysian,effectiveness,narrowly,acute,sunk,replied,utilized,tasmania,consortium,quantities,gains,parkway,enlarged,sided,employers,adequate,accordingly,assumption,ballad,mascot,distances,peaking,saxony,projected,affiliation,limitations,metals,guatemala,scots,theaters,kindergarten,verb,employer,differs,discharge,controller,seasonal,marching,guru,campuses,avoided,vatican,maori,excessive,chartered,modifications,caves,monetary,sacramento,mixing,institutional,celebrities,irrigation,shapes,broadcaster,anthem,attributes,demolition,offshore,specification,surveys,yugoslav,contributor,auditorium,lebanese,capturing,airports,classrooms,chennai,paths,tendency,determining,lacking,upgrade,sailors,detected,kingdoms,sovereignty,freely,decorative,momentum,scholarly,georges,gandhi,speculation,transactions,undertook,interact,similarities,cove,teammate,constituted,painters,tends,madagascar,partnerships,afghan,personalities,attained,rebounds,masses,synagogue,reopened,asylum,embedded,imaging,catalogue,defenders,taxonomy,fiber,afterward,appealed,communists,lisbon,rica,judaism,adviser,batsman,ecological,commands,lgbt,cooling,accessed,wards,shiva,employs,thirds,scenic,worcester,tallest,contestant,humanities,economist,textile,constituencies,motorway,tram,percussion,cloth,leisure,1880s,baden,flags,resemble,riots,coined,sitcom,composite,implies,daytime,tanzania,penalties,optional,competitor,excluded,steering,reversed,autonomy,reviewer,breakthrough,professionally,damages,pomeranian,deputies,valleys,ventures,highlighted,electorate,mapping,shortened,executives,tertiary,specimen,launching,bibliography,sank,pursuing,binary,descendant,marched,natives,ideology,turks,adolf,archdiocese,tribunal,exceptional,nigerian,preference,fails,loading,comeback,vacuum,favored,alter,remnants,consecrated,spectators,trends,patriarch,feedback,paved,sentences,councillor,astronomy,advocates,broader,commentator,commissions,identifying,revealing,theatres,incomplete,enables,constituent,reformation,tract,haiti,atmospheric,screened,explosive,czechoslovakia,acids,symbolic,subdivision,liberals,incorporate,challenger,erie,filmmaker,laps,kazakhstan,organizational,evolutionary,chemicals,dedication,riverside,fauna,moths,maharashtra,annexed,gen.,resembles,underwater,garnered,timeline,remake,suited,educator,hectares,automotive,feared,latvia,finalist,narrator,portable,airways,plaque,designing,villagers,licensing,flank,statues,struggles,deutsche,migrated,cellular,jacksonville,wimbledon,defining,highlight,preparatory,planets,cologne,employ,frequencies,detachment,readily,libya,resign,halt,helicopters,reef,landmarks,collaborative,irregular,retaining,helsinki,folklore,weakened,viscount,interred,professors,memorable,mega,repertoire,rowing,dorsal,albeit,progressed,operative,coronation,liner,telugu,domains,philharmonic,detect,bengali,synthetic,tensions,atlas,dramatically,paralympics,xbox,shire,kiev,lengthy,sued,notorious,seas,screenwriter,transfers,aquatic,pioneers,unesco,radius,abundant,tunnels,syndicated,inventor,accreditation,janeiro,exeter,ceremonial,omaha,cadet,predators,resided,prose,slavic,precision,abbot,deity,engaging,cambodia,estonian,compliance,demonstrations,protesters,reactor,commodore,successes,chronicles,mare,extant,listings,minerals,tonnes,parody,cultivated,traders,pioneering,supplement,slovak,preparations,collision,partnered,vocational,atoms,malayalam,welcomed,documentation,curved,functioning,presently,formations,incorporates,nazis,botanical,nucleus,ethical,greeks,metric,automated,whereby,stance,europeans,duet,disability,purchasing,email,telescope,displaced,sodium,comparative,processor,inning,precipitation,aesthetic,import,coordination,feud,alternatively,mobility,tibet,regained,succeeding,hierarchy,apostolic,catalog,reproduction,inscriptions,vicar,clusters,posthumously,rican,loosely,additions,photographic,nowadays,selective,derivative,keyboards,guides,collectively,affecting,combines,operas,networking,decisive,terminated,continuity,finishes,ancestor,consul,heated,simulation,leipzig,incorporating,georgetown,formula_2,circa,forestry,portrayal,councillors,advancement,complained,forewings,confined,transaction,definitions,reduces,televised,1890s,rapids,phenomena,belarus,alps,landscapes,quarterly,specifications,commemorate,continuation,isolation,antenna,downstream,patents,ensuing,tended,saga,lifelong,columnist,labeled,gymnastics,papua,anticipated,demise,encompasses,madras,antarctica,interval,icon,rams,midlands,ingredients,priory,strengthen,rouge,explicit,gaza,aging,securing,anthropology,listeners,adaptations,underway,vista,malay,fortified,lightweight,violations,concerto,financed,jesuit,observers,trustee,descriptions,nordic,resistant,opted,accepts,prohibition,andhra,inflation,negro,wholly,imagery,spur,instructed,gloucester,cycles,middlesex,destroyers,statewide,evacuated,hyderabad,peasants,mice,shipyard,coordinate,pitching,colombian,exploring,numbering,compression,countess,hiatus,exceed,raced,archipelago,traits,soils,o'connor,vowel,android,facto,angola,amino,holders,logistics,circuits,emergence,kuwait,partition,emeritus,outcomes,submission,promotes,barack,negotiated,loaned,stripped,50th,excavations,treatments,fierce,participant,exports,decommissioned,cameo,remarked,residences,fuselage,mound,undergo,quarry,node,midwest,specializing,occupies,etc.,showcase,molecule,offs,modules,salon,exposition,revision,peers,positioned,hunters,competes,algorithms,reside,zagreb,calcium,uranium,silicon,airs,counterpart,outlet,collectors,sufficiently,canberra,inmates,anatomy,ensuring,curves,aviv,firearms,basque,volcano,thrust,sheikh,extensions,installations,aluminum,darker,sacked,emphasized,aligned,asserted,pseudonym,spanning,decorations,eighteenth,orbital,spatial,subdivided,notation,decay,macedonian,amended,declining,cyclist,feat,unusually,commuter,birthplace,latitude,activation,overhead,30th,finalists,whites,encyclopedia,tenor,qatar,survives,complement,concentrations,uncommon,astronomical,bangalore,pius,genome,memoir,recruit,prosecutor,modification,paired,container,basilica,arlington,displacement,germanic,mongolia,proportional,debates,matched,calcutta,rows,tehran,aerospace,prevalent,arise,lowland,24th,spokesman,supervised,advertisements,clash,tunes,revelation,wanderers,quarterfinals,fisheries,steadily,memoirs,pastoral,renewable,confluence,acquiring,strips,slogan,upstream,scouting,analyst,practitioners,turbine,strengthened,heavier,prehistoric,plural,excluding,isles,persecution,turin,rotating,villain,hemisphere,unaware,arabs,corpus,relied,singular,unanimous,schooling,passive,angles,dominance,instituted,aria,outskirts,balanced,beginnings,financially,structured,parachute,viewer,attitudes,subjected,escapes,derbyshire,erosion,addressing,styled,declaring,originating,colts,adjusted,stained,occurrence,fortifications,baghdad,nitrogen,localities,yemen,galway,debris,lodz,victorious,pharmaceutical,substances,unnamed,dwelling,atop,developmental,activism,voter,refugee,forested,relates,overlooking,genocide,kannada,insufficient,oversaw,partisan,dioxide,recipients,factions,mortality,capped,expeditions,receptors,reorganized,prominently,atom,flooded,flute,orchestral,scripts,mathematician,airplay,detached,rebuilding,dwarf,brotherhood,salvation,expressions,arabian,cameroon,poetic,recruiting,bundesliga,inserted,scrapped,disabilities,evacuation,pasha,undefeated,crafts,rituals,aluminium,norm,pools,submerged,occupying,pathway,exams,prosperity,wrestlers,promotions,basal,permits,nationalism,trim,merge,gazette,tributaries,transcription,caste,porto,emerge,modeled,adjoining,counterparts,paraguay,redevelopment,renewal,unreleased,equilibrium,similarity,minorities,soviets,comprise,nodes,tasked,unrelated,expired,johan,precursor,examinations,electrons,socialism,exiled,admiralty,floods,wigan,nonprofit,lacks,brigades,screens,repaired,hanover,fascist,labs,osaka,delays,judged,statutory,colt,col.,offspring,solving,bred,assisting,retains,somalia,grouped,corresponds,tunisia,chaplain,eminent,chord,22nd,spans,viral,innovations,possessions,mikhail,kolkata,icelandic,implications,introduces,racism,workforce,alto,compulsory,admits,censorship,onset,reluctant,inferior,iconic,progression,liability,turnout,satellites,behavioral,coordinated,exploitation,posterior,averaging,fringe,krakow,mountainous,greenwich,para,plantations,reinforcements,offerings,famed,intervals,constraints,individually,nutrition,1870s,taxation,threshold,tomatoes,fungi,contractor,ethiopian,apprentice,diabetes,wool,gujarat,honduras,norse,bucharest,23rd,arguably,accompany,prone,teammates,perennial,vacancy,polytechnic,deficit,okinawa,functionality,reminiscent,tolerance,transferring,myanmar,concludes,neighbours,hydraulic,economically,slower,plots,charities,synod,investor,catholicism,identifies,bronx,interpretations,adverse,judiciary,hereditary,nominal,sensor,symmetry,cubic,triangular,tenants,divisional,outreach,representations,passages,undergoing,cartridge,testified,exceeded,impacts,limiting,railroads,defeats,regain,rendering,humid,retreated,reliability,governorate,antwerp,infamous,implied,packaging,lahore,trades,billed,extinction,ecole,rejoined,recognizes,projection,qualifications,stripes,forts,socially,lexington,accurately,sexuality,westward,wikipedia,pilgrimage,abolition,choral,stuttgart,nests,expressing,strikeouts,assessed,monasteries,reconstructed,humorous,marxist,fertile,consort,urdu,patronage,peruvian,devised,lyric,baba,nassau,communism,extraction,popularly,markings,inability,litigation,accounted,processed,emirates,tempo,cadets,eponymous,contests,broadly,oxide,courtyard,frigate,directory,apex,outline,regency,chiefly,patrols,secretariat,cliffs,residency,privy,armament,australians,dorset,geometric,genetics,scholarships,fundraising,flats,demographic,multimedia,captained,documentaries,updates,canvas,blockade,guerrilla,songwriting,administrators,intake,drought,implementing,fraction,cannes,refusal,inscribed,meditation,announcing,exported,ballots,formula_3,curator,basel,arches,flour,subordinate,confrontation,gravel,simplified,berkshire,patriotic,tuition,employing,servers,castile,posting,combinations,discharged,miniature,mutations,constellation,incarnation,ideals,necessity,granting,ancestral,crowds,pioneered,mormon,methodology,rama,indirect,complexes,bavarian,patrons,uttar,skeleton,bollywood,flemish,viable,bloc,breeds,triggered,sustainability,tailed,referenced,comply,takeover,latvian,homestead,platoon,communal,nationality,excavated,targeting,sundays,posed,physicist,turret,endowment,marginal,dispatched,commentators,renovations,attachment,collaborations,ridges,barriers,obligations,shareholders,prof.,defenses,presided,rite,backgrounds,arbitrary,affordable,gloucestershire,thirteenth,inlet,miniseries,possesses,detained,pressures,subscription,realism,solidarity,proto,postgraduate,noun,burmese,abundance,homage,reasoning,anterior,robust,fencing,shifting,vowels,garde,profitable,loch,anchored,coastline,samoa,terminology,prostitution,magistrate,venezuelan,speculated,regulate,fixture,colonists,digit,induction,manned,expeditionary,computational,centennial,principally,vein,preserving,engineered,numerical,cancellation,conferred,continually,borne,seeded,advertisement,unanimously,treaties,infections,ions,sensors,lowered,amphibious,lava,fourteenth,bahrain,niagara,nicaragua,squares,congregations,26th,periodic,proprietary,1860s,contributors,seller,overs,emission,procession,presumed,illustrator,zinc,gases,tens,applicable,stretches,reproductive,sixteenth,apparatus,accomplishments,canoe,guam,oppose,recruitment,accumulated,limerick,namibia,staging,remixes,ordnance,uncertainty,pedestrian,temperate,treason,deposited,registry,cerambycidae,attracting,lankan,reprinted,shipbuilding,homosexuality,neurons,eliminating,1900s,resume,ministries,beneficial,blackpool,surplus,northampton,licenses,constructing,announcer,standardized,alternatives,taipei,inadequate,failures,yields,medalist,titular,obsolete,torah,burlington,predecessors,lublin,retailers,castles,depiction,issuing,gubernatorial,propulsion,tiles,damascus,discs,alternating,pomerania,peasant,tavern,redesignated,27th,illustration,focal,mans,codex,specialists,productivity,antiquity,controversies,promoter,pits,companions,behaviors,lyrical,prestige,creativity,swansea,dramas,approximate,feudal,tissues,crude,campaigned,unprecedented,chancel,amendments,surroundings,allegiance,exchanges,align,firmly,optimal,commenting,reigning,landings,obscure,1850s,contemporaries,paternal,devi,endurance,communes,incorporation,denominations,exchanged,routing,resorts,amnesty,slender,explores,suppression,heats,pronunciation,centred,coupe,stirling,freelance,treatise,linguistics,laos,informs,discovering,pillars,encourages,halted,robots,definitive,maturity,tuberculosis,venetian,silesian,unchanged,originates,mali,lincolnshire,quotes,seniors,premise,contingent,distribute,danube,gorge,logging,dams,curling,seventeenth,specializes,wetlands,deities,assess,thickness,rigid,culminated,utilities,substrate,insignia,nile,assam,shri,currents,suffrage,canadians,mortar,asteroid,bosnian,discoveries,enzymes,sanctioned,replica,hymn,investigators,tidal,dominate,derivatives,converting,leinster,verbs,honoured,criticisms,dismissal,discrete,masculine,reorganization,unlimited,wurttemberg,sacks,allocation,bahn,jurisdictions,participates,lagoon,famine,communion,culminating,surveyed,shortage,cables,intersects,cassette,foremost,adopting,solicitor,outright,bihar,reissued,farmland,dissertation,turnpike,baton,photographed,christchurch,kyoto,finances,rails,histories,linebacker,kilkenny,accelerated,dispersed,handicap,absorption,rancho,ceramic,captivity,cites,font,weighed,mater,utilize,bravery,extract,validity,slovenian,seminars,discourse,ranged,duel,ironically,warships,sega,temporal,surpassed,prolonged,recruits,northumberland,greenland,contributes,patented,eligibility,unification,discusses,reply,translates,beirut,relies,torque,northward,reviewers,monastic,accession,neural,tramway,heirs,sikh,subscribers,amenities,taliban,audit,rotterdam,wagons,kurdish,favoured,combustion,meanings,persia,browser,diagnostic,niger,formula_4,denomination,dividing,parameter,branding,badminton,leningrad,sparked,hurricanes,beetles,propeller,mozambique,refined,diagram,exhaust,vacated,readings,markers,reconciliation,determines,concurrent,imprint,primera,organism,demonstrating,filmmakers,vanderbilt,affiliates,traction,evaluated,defendants,megachile,investigative,zambia,assassinated,rewarded,probable,staffordshire,foreigners,directorate,nominees,consolidation,commandant,reddish,differing,unrest,drilling,bohemia,resembling,instrumentation,considerations,haute,promptly,variously,dwellings,clans,tablet,enforced,cockpit,semifinal,hussein,prisons,ceylon,emblem,monumental,phrases,correspond,crossover,outlined,characterised,acceleration,caucus,crusade,protested,composing,rajasthan,habsburg,rhythmic,interception,inherent,cooled,ponds,spokesperson,gradual,consultation,kuala,globally,suppressed,builders,avengers,suffix,integer,enforce,fibers,unionist,proclamation,uncovered,infrared,adapt,eisenhower,utilizing,captains,stretched,observing,assumes,prevents,analyses,saxophone,caucasus,notices,villains,dartmouth,mongol,hostilities,stretching,veterinary,lenses,texture,prompting,overthrow,excavation,islanders,masovian,battleship,biographer,replay,degradation,departing,luftwaffe,fleeing,oversight,immigrated,serbs,fishermen,strengthening,respiratory,italians,denotes,radial,escorted,motif,wiltshire,expresses,accessories,reverted,establishments,inequality,protocols,charting,famously,satirical,entirety,trench,friction,atletico,sampling,subset,weekday,upheld,sharply,correlation,incorrect,mughal,travelers,hasan,earnings,offset,evaluate,specialised,recognizing,flexibility,nagar,postseason,algebraic,capitalism,crystals,melodies,polynomial,racecourse,defences,austro,wembley,attracts,anarchist,resurrection,reviewing,decreasing,prefix,ratified,mutation,displaying,separating,restoring,assemblies,ordinance,priesthood,cruisers,appoint,moldova,imports,directive,epidemic,militant,senegal,signaling,restriction,critique,retrospective,nationalists,undertake,sioux,canals,algerian,redesigned,philanthropist,depict,conceptual,turbines,intellectuals,eastward,applicants,contractors,vendors,undergone,namesake,ensured,tones,substituted,hindwings,arrests,tombs,transitional,principality,reelection,taiwanese,cavity,manifesto,broadcasters,spawned,thoroughbred,identities,generators,proposes,hydroelectric,johannesburg,cortex,scandinavian,killings,aggression,boycott,catalyst,physiology,fifteenth,waterfront,chromosome,organist,costly,calculation,cemeteries,flourished,recognise,juniors,merging,disciples,ashore,workplace,enlightenment,diminished,debated,hailed,podium,educate,mandated,distributor,litre,electromagnetic,flotilla,estuary,peterborough,staircase,selections,melodic,confronts,wholesale,integrate,intercepted,catalonia,unite,immense,palatinate,switches,earthquakes,occupational,successors,praising,concluding,faculties,firstly,overhaul,empirical,metacritic,inauguration,evergreen,laden,winged,philosophers,amalgamated,geoff,centimeters,napoleonic,upright,planting,brewing,fined,sensory,migrants,wherein,inactive,headmaster,warwickshire,siberia,terminals,denounced,academia,divinity,bilateral,clive,omitted,peerage,relics,apartheid,syndicate,fearing,fixtures,desirable,dismantled,ethnicity,valves,biodiversity,aquarium,ideological,visibility,creators,analyzed,tenant,balkan,postwar,supplier,smithsonian,risen,morphology,digits,bohemian,wilmington,vishnu,demonstrates,aforementioned,biographical,mapped,khorasan,phosphate,presentations,ecosystem,processors,calculations,mosaic,clashes,penned,recalls,coding,angular,lattice,macau,accountability,extracted,pollen,therapeutic,overlap,violinist,deposed,candidacy,infants,covenant,bacterial,restructuring,dungeons,ordination,conducts,builds,invasive,customary,concurrently,relocation,cello,statutes,borneo,entrepreneurs,sanctions,packet,rockefeller,piedmont,comparisons,waterfall,receptions,glacial,surge,signatures,alterations,advertised,enduring,somali,botanist,100th,canonical,motifs,longitude,circulated,alloy,indirectly,margins,preserves,internally,besieged,shale,peripheral,drained,baseman,reassigned,tobago,soloist,socio,grazing,contexts,roofs,portraying,ottomans,shrewsbury,noteworthy,lamps,supplying,beams,qualifier,portray,greenhouse,stronghold,hitter,rites,cretaceous,urging,derive,nautical,aiming,fortunes,verde,donors,reliance,exceeding,exclusion,exercised,simultaneous,continents,guiding,pillar,gradient,poznan,eruption,clinics,moroccan,indicator,trams,piers,parallels,fragment,teatro,potassium,satire,compressed,businessmen,influx,seine,perspectives,shelters,decreases,mounting,formula_5,confederacy,equestrian,expulsion,mayors,liberia,resisted,affinity,shrub,unexpectedly,stimulus,amtrak,deported,perpendicular,statesman,wharf,storylines,romanesque,weights,surfaced,interceptions,dhaka,crambidae,orchestras,rwanda,conclude,constitutes,subsidiaries,admissions,prospective,shear,bilingual,campaigning,presiding,domination,commemorative,trailing,confiscated,petrol,acquisitions,polymer,onlyinclude,chloride,elevations,resolutions,hurdles,pledged,likelihood,objected,erect,encoding,databases,aristotle,hindus,marshes,bowled,ministerial,grange,acronym,annexation,squads,ambient,pilgrims,botany,sofla,astronomer,planetary,descending,bestowed,ceramics,diplomacy,metabolism,colonization,potomac,africans,engraved,recycling,commitments,resonance,disciplinary,jamaican,narrated,spectral,tipperary,waterford,stationary,arbitration,transparency,threatens,crossroads,slalom,oversee,centenary,incidence,economies,livery,moisture,newsletter,autobiographical,bhutan,propelled,dependence,moderately,adobe,barrels,subdivisions,outlook,labelled,stratford,arising,diaspora,barony,automobiles,ornamental,slated,norms,primetime,generalized,analysts,vectors,libyan,yielded,certificates,rooted,vernacular,belarusian,marketplace,prediction,fairfax,malawi,viruses,wooded,demos,mauritius,prosperous,coincided,liberties,huddersfield,ascent,warnings,hinduism,glucose,pulitzer,unused,filters,illegitimate,acquitted,protestants,canopy,staple,psychedelic,winding,abbas,pathways,cheltenham,lagos,niche,invaders,proponents,barred,conversely,doncaster,recession,embraced,rematch,concession,emigration,upgrades,bowls,tablets,remixed,loops,kensington,shootout,monarchs,organizers,harmful,punjabi,broadband,exempt,neolithic,profiles,portrays,parma,cyrillic,quasi,attested,regimental,revive,torpedoes,heidelberg,rhythms,spherical,denote,hymns,icons,theologian,qaeda,exceptionally,reinstated,comune,playhouse,lobbying,grossing,viceroy,delivers,visually,armistice,utrecht,syllable,vertices,analogous,annex,refurbished,entrants,knighted,disciple,rhetoric,detailing,inactivated,ballads,algae,intensified,favourable,sanitation,receivers,pornography,commemorated,cannons,entrusted,manifold,photographers,pueblo,textiles,steamer,myths,marquess,onward,liturgical,romney,uzbekistan,consistency,denoted,hertfordshire,convex,hearings,sulfur,universidad,podcast,selecting,emperors,arises,justices,1840s,mongolian,exploited,termination,digitally,infectious,sedan,symmetric,penal,illustrate,formulation,attribute,problematic,modular,inverse,berth,searches,rutgers,leicestershire,enthusiasts,lockheed,upwards,transverse,accolades,backward,archaeologists,crusaders,nuremberg,defects,ferries,vogue,containers,openings,transporting,separates,lumpur,purchases,attain,wichita,topology,woodlands,deleted,periodically,syntax,overturned,musicals,corp.,strasbourg,instability,nationale,prevailing,cache,marathi,versailles,unmarried,grains,straits,antagonist,segregation,assistants,d'etat,contention,dictatorship,unpopular,motorcycles,criterion,analytical,salzburg,militants,hanged,worcestershire,emphasize,paralympic,erupted,convinces,offences,oxidation,nouns,populace,atari,spanned,hazardous,educators,playable,births,baha'i,preseason,generates,invites,meteorological,handbook,foothills,enclosure,diffusion,mirza,convergence,geelong,coefficient,connector,formula_6,cylindrical,disasters,pleaded,knoxville,contamination,compose,libertarian,arrondissement,franciscan,intercontinental,susceptible,initiation,malaria,unbeaten,consonants,waived,saloon,popularized,estadio,pseudo,interdisciplinary,transports,transformers,carriages,bombings,revolves,ceded,collaborator,celestial,exemption,colchester,maltese,oceanic,ligue,crete,shareholder,routed,depictions,ridden,advisors,calculate,lending,guangzhou,simplicity,newscast,scheduling,snout,eliot,undertaking,armenians,nottinghamshire,whitish,consulted,deficiency,salle,cinemas,superseded,rigorous,kerman,convened,landowners,modernization,evenings,pitches,conditional,scandinavia,differed,formulated,cyclists,swami,guyana,dunes,electrified,appalachian,abdomen,scenarios,prototypes,sindh,consonant,adaptive,boroughs,wolverhampton,modelling,cylinders,amounted,minimize,ambassadors,lenin,settler,coincide,approximation,grouping,murals,bullying,registers,rumours,engagements,energetic,vertex,annals,bordering,geologic,yellowish,runoff,converts,allegheny,facilitated,saturdays,colliery,monitored,rainforest,interfaces,geographically,impaired,prevalence,joachim,paperback,slowed,shankar,distinguishing,seminal,categorized,authorised,auspices,bandwidth,asserts,rebranded,balkans,supplemented,seldom,weaving,capsule,apostles,populous,monmouth,payload,symphonic,densely,shoreline,managerial,masonry,antioch,averages,textbooks,royalist,coliseum,tandem,brewers,diocesan,posthumous,walled,incorrectly,distributions,ensued,reasonably,graffiti,propagation,automation,harmonic,augmented,middleweight,limbs,elongated,landfall,comparatively,literal,grossed,koppen,wavelength,1830s,cerebral,boasts,congestion,physiological,practitioner,coasts,cartoonist,undisclosed,frontal,launches,burgundy,qualifiers,imposing,stade,flanked,assyrian,raided,multiplayer,montane,chesapeake,pathology,drains,vineyards,intercollegiate,semiconductor,grassland,convey,citations,predominant,rejects,benefited,yahoo,graphs,busiest,encompassing,hamlets,explorers,suppress,minors,graphical,calculus,sediment,intends,diverted,mainline,unopposed,cottages,initiate,alumnus,towed,autism,forums,darlington,modernist,oxfordshire,lectured,capitalist,suppliers,panchayat,actresses,foundry,southbound,commodity,wesleyan,divides,palestinians,luton,caretaker,nobleman,mutiny,organizer,preferences,nomenclature,splits,unwilling,offenders,timor,relying,halftime,semitic,arithmetic,milestone,jesuits,arctiidae,retrieved,consuming,contender,edged,plagued,inclusive,transforming,khmer,federally,insurgents,distributing,amherst,rendition,prosecutors,viaduct,disqualified,kabul,liturgy,prevailed,reelected,instructors,swimmers,aperture,churchyard,interventions,totals,darts,metropolis,fuels,fluent,northbound,correctional,inflicted,barrister,realms,culturally,aristocratic,collaborating,emphasizes,choreographer,inputs,ensembles,humboldt,practised,endowed,strains,infringement,archaeologist,congregational,magna,relativity,efficiently,proliferation,mixtape,abruptly,regeneration,commissioning,yukon,archaic,reluctantly,retailer,northamptonshire,universally,crossings,boilers,nickelodeon,revue,abbreviation,retaliation,scripture,routinely,medicinal,benedictine,kenyan,retention,deteriorated,glaciers,apprenticeship,coupling,researched,topography,entrances,anaheim,pivotal,compensate,arched,modify,reinforce,dusseldorf,journeys,motorsport,conceded,sumatra,spaniards,quantitative,loire,cinematography,discarded,botswana,morale,engined,zionist,philanthropy,sainte,fatalities,cypriot,motorsports,indicators,pricing,institut,bethlehem,implicated,gravitational,differentiation,rotor,thriving,precedent,ambiguous,concessions,forecast,conserved,fremantle,asphalt,landslide,middlesbrough,formula_7,humidity,overseeing,chronological,diaries,multinational,crimean,turnover,improvised,youths,declares,tasmanian,canadiens,fumble,refinery,weekdays,unconstitutional,upward,guardians,brownish,imminent,hamas,endorsement,naturalist,martyrs,caledonia,chords,yeshiva,reptiles,severity,mitsubishi,fairs,installment,substitution,repertory,keyboardist,interpreter,silesia,noticeable,rhineland,transmit,inconsistent,booklet,academies,epithet,pertaining,progressively,aquatics,scrutiny,prefect,toxicity,rugged,consume,o'donnell,evolve,uniquely,cabaret,mediated,landowner,transgender,palazzo,compilations,albuquerque,induce,sinai,remastered,efficacy,underside,analogue,specify,possessing,advocating,compatibility,liberated,greenville,mecklenburg,header,memorials,sewage,rhodesia,1800s,salaries,atoll,coordinating,partisans,repealed,amidst,subjective,optimization,nectar,evolving,exploits,madhya,styling,accumulation,raion,postage,responds,buccaneers,frontman,brunei,choreography,coated,kinetic,sampled,inflammatory,complementary,eclectic,norte,vijay,a.k.a,mainz,casualty,connectivity,laureate,franchises,yiddish,reputed,unpublished,economical,periodicals,vertically,bicycles,brethren,capacities,unitary,archeological,tehsil,domesday,wehrmacht,justification,angered,mysore,fielded,abuses,nutrients,ambitions,taluk,battleships,symbolism,superiority,neglect,attendees,commentaries,collaborators,predictions,yorker,breeders,investing,libretto,informally,coefficients,memorandum,pounder,collingwood,tightly,envisioned,arbor,mistakenly,captures,nesting,conflicting,enhancing,streetcar,manufactures,buckinghamshire,rewards,commemorating,stony,expenditure,tornadoes,semantic,relocate,weimar,iberian,sighted,intending,ensign,beverages,expectation,differentiate,centro,utilizes,saxophonist,catchment,transylvania,ecosystems,shortest,sediments,socialists,ineffective,kapoor,formidable,heroine,guantanamo,prepares,scattering,pamphlet,verified,elector,barons,totaling,shrubs,pyrenees,amalgamation,mutually,longitudinal,comte,negatively,masonic,envoy,sexes,akbar,mythical,tonga,bishopric,assessments,malaya,warns,interiors,reefs,reflections,neutrality,musically,nomadic,waterways,provence,collaborate,scaled,adulthood,emerges,euros,optics,incentives,overland,periodical,liege,awarding,realization,slang,affirmed,schooner,hokkaido,czechoslovak,protectorate,undrafted,disagreed,commencement,electors,spruce,swindon,fueled,equatorial,inventions,suites,slovene,backdrop,adjunct,energies,remnant,inhabit,alliances,simulcast,reactors,mosques,travellers,outfielder,plumage,migratory,benin,experimented,fibre,projecting,drafting,laude,evidenced,northernmost,indicted,directional,replication,croydon,comedies,jailed,organizes,devotees,reservoirs,turrets,originate,economists,songwriters,junta,trenches,mounds,proportions,comedic,apostle,azerbaijani,farmhouse,resembled,disrupted,playback,mixes,diagonal,relevance,govern,programmer,gdansk,maize,soundtracks,tendencies,mastered,impacted,believers,kilometre,intervene,chairperson,aerodrome,sails,subsidies,ensures,aesthetics,congresses,ratios,sardinia,southernmost,functioned,controllers,downward,randomly,distortion,regents,palatine,disruption,spirituality,vidhan,tracts,compiler,ventilation,anchorage,symposium,assert,pistols,excelled,avenues,convoys,moniker,constructions,proponent,phased,spines,organising,schleswig,policing,campeonato,mined,hourly,croix,lucrative,authenticity,haitian,stimulation,burkina,espionage,midfield,manually,staffed,awakening,metabolic,biographies,entrepreneurship,conspicuous,guangdong,preface,subgroup,mythological,adjutant,feminism,vilnius,oversees,honourable,tripoli,stylized,kinase,societe,notoriety,altitudes,configurations,outward,transmissions,announces,auditor,ethanol,clube,nanjing,mecca,haifa,blogs,postmaster,paramilitary,depart,positioning,potent,recognizable,spire,brackets,remembrance,overlapping,turkic,articulated,scientology,operatic,deploy,readiness,biotechnology,restrict,cinematographer,inverted,synonymous,administratively,westphalia,commodities,replaces,downloads,centralized,munitions,preached,sichuan,fashionable,implementations,matrices,hiv/aids,loyalist,luzon,celebrates,hazards,heiress,mercenaries,synonym,creole,ljubljana,technician,auditioned,technicians,viewpoint,wetland,mongols,princely,sharif,coating,dynasties,southward,doubling,formula_8,mayoral,harvesting,conjecture,goaltender,oceania,spokane,welterweight,bracket,gatherings,weighted,newscasts,mussolini,affiliations,disadvantage,vibrant,spheres,sultanate,distributors,disliked,establishes,marches,drastically,yielding,jewellery,yokohama,vascular,airlift,canons,subcommittee,repression,strengths,graded,outspoken,fused,pembroke,filmography,redundant,fatigue,repeal,threads,reissue,pennant,edible,vapor,corrections,stimuli,commemoration,dictator,anand,secession,amassed,orchards,pontifical,experimentation,greeted,bangor,forwards,decomposition,quran,trolley,chesterfield,traverse,sermons,burials,skier,climbs,consultants,petitioned,reproduce,parted,illuminated,kurdistan,reigned,occupants,packaged,geometridae,woven,regulating,protagonists,crafted,affluent,clergyman,consoles,migrant,supremacy,attackers,caliph,defect,convection,rallies,huron,resin,segunda,quota,warship,overseen,criticizing,shrines,glamorgan,lowering,beaux,hampered,invasions,conductors,collects,bluegrass,surrounds,substrates,perpetual,chronology,pulmonary,executions,crimea,compiling,noctuidae,battled,tumors,minsk,novgorod,serviced,yeast,computation,swamps,theodor,baronetcy,salford,uruguayan,shortages,odisha,siberian,novelty,cinematic,invitational,decks,dowager,oppression,bandits,appellate,state-of-the-art,clade,palaces,signalling,galaxies,industrialist,tensor,learnt,incurred,magistrates,binds,orbits,ciudad,willingness,peninsular,basins,biomedical,shafts,marlborough,bournemouth,withstand,fitzroy,dunedin,variance,steamship,integrating,muscular,fines,akron,bulbophyllum,malmo,disclosed,cornerstone,runways,medicines,twenty20,gettysburg,progresses,frigates,bodied,transformations,transforms,helens,modelled,versatile,regulator,pursuits,legitimacy,amplifier,scriptures,voyages,examines,presenters,octagonal,poultry,formula_9,anatolia,computed,migrate,directorial,hybrids,localized,preferring,guggenheim,persisted,grassroots,inflammation,fishery,otago,vigorous,professions,instructional,inexpensive,insurgency,legislators,sequels,surnames,agrarian,stainless,nairobi,minas,forerunner,aristocracy,transitions,sicilian,showcased,doses,hiroshima,summarized,gearbox,emancipation,limitation,nuclei,seismic,abandonment,dominating,appropriations,occupations,electrification,hilly,contracting,exaggerated,entertainer,kazan,oricon,cartridges,characterization,parcel,maharaja,exceeds,aspiring,obituary,flattened,contrasted,narration,replies,oblique,outpost,fronts,arranger,talmud,keynes,doctrines,endured,confesses,fortification,supervisors,kilometer,academie,jammu,bathurst,piracy,prostitutes,navarre,cumulative,cruises,lifeboat,twinned,radicals,interacting,expenditures,wexford,libre,futsal,curated,clockwise,colloquially,procurement,immaculate,lyricist,enhancement,porcelain,alzheimer,highlighting,judah,disagreements,storytelling,sheltered,wroclaw,vaudeville,contrasts,neoclassical,compares,contrasting,deciduous,francaise,descriptive,cyclic,reactive,antiquities,meiji,repeats,creditors,forcibly,newmarket,picturesque,impending,uneven,bison,raceway,solvent,ecumenical,optic,professorship,harvested,waterway,banjo,pharaoh,geologist,scanning,dissent,recycled,unmanned,retreating,gospels,aqueduct,branched,tallinn,groundbreaking,syllables,hangar,designations,procedural,craters,cabins,encryption,anthropologist,montevideo,outgoing,inverness,chattanooga,fascism,calais,chapels,groundwater,downfall,misleading,robotic,tortricidae,pixel,handel,prohibit,crewe,renaming,reprised,kickoff,leftist,spaced,integers,causeway,pines,authorship,organise,ptolemy,accessibility,virtues,lesions,iroquois,qur'an,atheist,synthesized,biennial,confederates,dietary,skaters,stresses,tariff,koreans,intercity,republics,quintet,baroness,naive,amplitude,insistence,tbilisi,residues,grammatical,diversified,egyptians,accompaniment,vibration,repository,mandal,topological,distinctions,coherent,invariant,batters,nuevo,internationals,implements,follower,bahia,widened,independents,cantonese,totaled,guadalajara,wolverines,befriended,muzzle,surveying,hungarians,medici,deportation,rayon,approx,recounts,attends,clerical,hellenic,furnished,alleging,soluble,systemic,gallantry,bolshevik,intervened,hostel,gunpowder,specialising,stimulate,leiden,removes,thematic,floral,bafta,printers,conglomerate,eroded,analytic,successively,lehigh,thessaloniki,kilda,clauses,ascended,nehru,scripted,tokugawa,competence,diplomats,exclude,consecration,freedoms,assaults,revisions,blacksmith,textual,sparse,concacaf,slain,uploaded,enraged,whaling,guise,stadiums,debuting,dormitory,cardiovascular,yunnan,dioceses,consultancy,notions,lordship,archdeacon,collided,medial,airfields,garment,wrestled,adriatic,reversal,refueling,verification,jakob,horseshoe,intricate,veracruz,sarawak,syndication,synthesizer,anthologies,stature,feasibility,guillaume,narratives,publicized,antrim,intermittent,constituents,grimsby,filmmaking,doping,unlawful,nominally,transmitting,documenting,seater,internationale,ejected,steamboat,alsace,boise,ineligible,geared,vassal,mustered,ville,inline,pairing,eurasian,kyrgyzstan,barnsley,reprise,stereotypes,rushes,conform,firefighters,deportivo,revolutionaries,rabbis,concurrency,charters,sustaining,aspirations,algiers,chichester,falkland,morphological,systematically,volcanoes,designate,artworks,reclaimed,jurist,anglia,resurrected,chaotic,feasible,circulating,simulated,environmentally,confinement,adventist,harrisburg,laborers,ostensibly,universiade,pensions,influenza,bratislava,octave,refurbishment,gothenburg,putin,barangay,annapolis,breaststroke,illustrates,distorted,choreographed,promo,emphasizing,stakeholders,descends,exhibiting,intrinsic,invertebrates,evenly,roundabout,salts,formula_10,strata,inhibition,branching,stylistic,rumored,realises,mitochondrial,commuted,adherents,logos,bloomberg,telenovela,guineas,charcoal,engages,winery,reflective,siena,cambridgeshire,ventral,flashback,installing,engraving,grasses,traveller,rotated,proprietor,nationalities,precedence,sourced,trainers,cambodian,reductions,depleted,saharan,classifications,biochemistry,plaintiffs,arboretum,humanist,fictitious,aleppo,climates,bazaar,his/her,homogeneous,multiplication,moines,indexed,linguist,skeletal,foliage,societal,differentiated,informing,mammal,infancy,archival,cafes,malls,graeme,musee,schizophrenia,fargo,pronouns,derivation,descend,ascending,terminating,deviation,recaptured,confessions,weakening,tajikistan,bahadur,pasture,b/hip,donegal,supervising,sikhs,thinkers,euclidean,reinforcement,friars,portage,fuscous,lucknow,synchronized,assertion,choirs,privatization,corrosion,multitude,skyscraper,royalties,ligament,usable,spores,directs,clashed,stockport,fronted,dependency,contiguous,biologist,backstroke,powerhouse,frescoes,phylogenetic,welding,kildare,gabon,conveyed,augsburg,severn,continuum,sahib,lille,injuring,passeriformesfamily,succeeds,translating,unitarian,startup,turbulent,outlying,philanthropic,stanislaw,idols,claremont,conical,haryana,armagh,blended,implicit,conditioned,modulation,rochdale,labourers,coinage,shortstop,potsdam,gears,obesity,bestseller,advisers,bouts,comedians,jozef,lausanne,taxonomic,correlated,columbian,marne,indications,psychologists,libel,edict,beaufort,disadvantages,renal,finalized,racehorse,unconventional,disturbances,falsely,zoology,adorned,redesign,executing,narrower,commended,appliances,stalls,resurgence,saskatoon,miscellaneous,permitting,epoch,formula_11,cumbria,forefront,vedic,eastenders,disposed,supermarkets,rower,inhibitor,magnesium,colourful,yusuf,harrow,formulas,centrally,balancing,ionic,nocturnal,consolidate,ornate,raiding,charismatic,accelerate,nominate,residual,dhabi,commemorates,attribution,uninhabited,mindanao,atrocities,genealogical,romani,applicant,enactment,abstraction,trough,pulpit,minuscule,misconduct,grenades,timely,supplements,messaging,curvature,ceasefire,telangana,susquehanna,braking,redistribution,shreveport,neighbourhoods,gregorian,widowed,khuzestan,empowerment,scholastic,evangelist,peptide,topical,theorist,historia,thence,sudanese,museo,jurisprudence,masurian,frankish,headlined,recounted,netball,petitions,tolerant,hectare,truncated,southend,methane,captives,reigns,massif,subunit,acidic,weightlifting,footballers,sabah,britannia,tunisian,segregated,sawmill,withdrawing,unpaid,weaponry,somme,perceptions,unicode,alcoholism,durban,wrought,waterfalls,jihad,auschwitz,upland,eastbound,adjective,anhalt,evaluating,regimes,guildford,reproduced,pamphlets,hierarchical,maneuvers,hanoi,fabricated,repetition,enriched,arterial,replacements,tides,globalization,adequately,westbound,satisfactory,fleets,phosphorus,lastly,neuroscience,anchors,xinjiang,membranes,improvisation,shipments,orthodoxy,submissions,bolivian,mahmud,ramps,leyte,pastures,outlines,flees,transmitters,fares,sequential,stimulated,novice,alternately,symmetrical,breakaway,layered,baronets,lizards,blackish,edouard,horsepower,penang,principals,mercantile,maldives,overwhelmingly,hawke,rallied,prostate,conscription,juveniles,maccabi,carvings,strikers,sudbury,spurred,improves,lombardy,macquarie,parisian,elastic,distillery,shetland,humane,brentford,wrexham,warehouses,routines,encompassed,introductory,isfahan,instituto,palais,revolutions,sporadic,impoverished,portico,fellowships,speculative,enroll,dormant,adhere,fundamentally,sculpted,meritorious,template,upgrading,reformer,rectory,uncredited,indicative,creeks,galveston,radically,hezbollah,firearm,educating,prohibits,trondheim,locus,refit,headwaters,screenings,lowlands,wasps,coarse,attaining,sedimentary,perished,pitchfork,interned,cerro,stagecoach,aeronautical,liter,transitioned,haydn,inaccurate,legislatures,bromwich,knesset,spectroscopy,butte,asiatic,degraded,concordia,catastrophic,lobes,wellness,pensacola,periphery,hapoel,theta,horizontally,freiburg,liberalism,pleas,durable,warmian,offenses,mesopotamia,shandong,unsuitable,hospitalized,appropriately,phonetic,encompass,conversions,observes,illnesses,breakout,assigns,crowns,inhibitors,nightly,manifestation,fountains,maximize,alphabetical,sloop,expands,newtown,widening,gaddafi,commencing,camouflage,footprint,tyrol,barangays,universite,highlanders,budgets,query,lobbied,westchester,equator,stipulated,pointe,distinguishes,allotted,embankment,advises,storing,loyalists,fourier,rehearsals,starvation,gland,rihanna,tubular,expressive,baccalaureate,intersections,revered,carbonate,eritrea,craftsmen,cosmopolitan,sequencing,corridors,shortlisted,bangladeshi,persians,mimic,parades,repetitive,recommends,flanks,promoters,incompatible,teaming,ammonia,greyhound,solos,improper,legislator,newsweek,recurrent,vitro,cavendish,eireann,crises,prophets,mandir,strategically,guerrillas,formula_12,ghent,contenders,equivalence,drone,sociological,hamid,castes,statehood,aland,clinched,relaunched,tariffs,simulations,williamsburg,rotate,mediation,smallpox,harmonica,lodges,lavish,restrictive,o'sullivan,detainees,polynomials,echoes,intersecting,learners,elects,charlemagne,defiance,epsom,liszt,facilitating,absorbing,revelations,padua,pieter,pious,penultimate,mammalian,montenegrin,supplementary,widows,aromatic,croats,roanoke,trieste,legions,subdistrict,babylonian,grasslands,volga,violently,sparsely,oldies,telecommunication,respondents,quarries,downloadable,commandos,taxpayer,catalytic,malabar,afforded,copying,declines,nawab,junctions,assessing,filtering,classed,disused,compliant,christoph,gottingen,civilizations,hermitage,caledonian,whereupon,ethnically,springsteen,mobilization,terraces,indus,excel,zoological,enrichment,simulate,guitarists,registrar,cappella,invoked,reused,manchu,configured,uppsala,genealogy,mergers,casts,curricular,rebelled,subcontinent,horticultural,parramatta,orchestrated,dockyard,claudius,decca,prohibiting,turkmenistan,brahmin,clandestine,obligatory,elaborated,parasitic,helix,constraint,spearheaded,rotherham,eviction,adapting,albans,rescues,sociologist,guiana,convicts,occurrences,kamen,antennas,asturias,wheeled,sanitary,deterioration,trier,theorists,baseline,announcements,valea,planners,factual,serialized,serials,bilbao,demoted,fission,jamestown,cholera,alleviate,alteration,indefinite,sulfate,paced,climatic,valuation,artisans,proficiency,aegean,regulators,fledgling,sealing,influencing,servicemen,frequented,cancers,tambon,narayan,bankers,clarified,embodied,engraver,reorganisation,dissatisfied,dictated,supplemental,temperance,ratification,puget,nutrient,pretoria,papyrus,uniting,ascribed,cores,coptic,schoolhouse,barrio,1910s,armory,defected,transatlantic,regulates,ported,artefacts,specifies,boasted,scorers,mollusks,emitted,navigable,quakers,projective,dialogues,reunification,exponential,vastly,banners,unsigned,dissipated,halves,coincidentally,leasing,purported,escorting,estimation,foxes,lifespan,inflorescence,assimilation,showdown,staunch,prologue,ligand,superliga,telescopes,northwards,keynote,heaviest,taunton,redeveloped,vocalists,podlaskie,soyuz,rodents,azores,moravian,outset,parentheses,apparel,domestically,authoritative,polymers,monterrey,inhibit,launcher,jordanian,folds,taxis,mandates,singled,liechtenstein,subsistence,marxism,ousted,governorship,servicing,offseason,modernism,prism,devout,translators,islamist,chromosomes,pitted,bedfordshire,fabrication,authoritarian,javanese,leaflets,transient,substantive,predatory,sigismund,assassinate,diagrams,arrays,rediscovered,reclamation,spawning,fjord,peacekeeping,strands,fabrics,highs,regulars,tirana,ultraviolet,athenian,filly,barnet,naacp,nueva,favourites,terminates,showcases,clones,inherently,interpreting,bjorn,finely,lauded,unspecified,chola,pleistocene,insulation,antilles,donetsk,funnel,nutritional,biennale,reactivated,southport,primate,cavaliers,austrians,interspersed,restarted,suriname,amplifiers,wladyslaw,blockbuster,sportsman,minogue,brightness,benches,bridgeport,initiating,israelis,orbiting,newcomers,externally,scaling,transcribed,impairment,luxurious,longevity,impetus,temperament,ceilings,tchaikovsky,spreads,pantheon,bureaucracy,1820s,heraldic,villas,formula_13,galician,meath,avoidance,corresponded,headlining,connacht,seekers,rappers,solids,monograph,scoreless,opole,isotopes,himalayas,parodies,garments,microscopic,republished,havilland,orkney,demonstrators,pathogen,saturated,hellenistic,facilitates,aerodynamic,relocating,indochina,laval,astronomers,bequeathed,administrations,extracts,nagoya,torquay,demography,medicare,ambiguity,renumbered,pursuant,concave,syriac,electrode,dispersal,henan,bialystok,walsall,crystalline,puebla,janata,illumination,tianjin,enslaved,coloration,championed,defamation,grille,johor,rejoin,caspian,fatally,planck,workings,appointing,institutionalized,wessex,modernized,exemplified,regatta,jacobite,parochial,programmers,blending,eruptions,insurrection,regression,indices,sited,dentistry,mobilized,furnishings,levant,primaries,ardent,nagasaki,conqueror,dorchester,opined,heartland,amman,mortally,wellesley,bowlers,outputs,coveted,orthography,immersion,disrepair,disadvantaged,curate,childless,condensed,codice_1,remodeled,resultant,bolsheviks,superfamily,saxons,2010s,contractual,rivalries,malacca,oaxaca,magnate,vertebrae,quezon,olympiad,yucatan,tyres,macro,specialization,commendation,caliphate,gunnery,exiles,excerpts,fraudulent,adjustable,aramaic,interceptor,drumming,standardization,reciprocal,adolescents,federalist,aeronautics,favorably,enforcing,reintroduced,zhejiang,refining,biplane,banknotes,accordion,intersect,illustrating,summits,classmate,militias,biomass,massacres,epidemiology,reworked,wrestlemania,nantes,auditory,taxon,elliptical,chemotherapy,asserting,avoids,proficient,airmen,yellowstone,multicultural,alloys,utilization,seniority,kuyavian,huntsville,orthogonal,bloomington,cultivars,casimir,internment,repulsed,impedance,revolving,fermentation,parana,shutout,partnering,empowered,islamabad,polled,classify,amphibians,greyish,obedience,4x100,projectile,khyber,halfback,relational,d'ivoire,synonyms,endeavour,padma,customized,mastery,defenceman,berber,purge,interestingly,covent,promulgated,restricting,condemnation,hillsborough,walkers,privateer,intra,captaincy,naturalized,huffington,detecting,hinted,migrating,bayou,counterattack,anatomical,foraging,unsafe,swiftly,outdated,paraguayan,attire,masjid,endeavors,jerseys,triassic,quechua,growers,axial,accumulate,wastewater,cognition,fungal,animator,pagoda,kochi,uniformly,antibody,yerevan,hypotheses,combatants,italianate,draining,fragmentation,snowfall,formative,inversion,kitchener,identifier,additive,lucha,selects,ashland,cambrian,racetrack,trapping,congenital,primates,wavelengths,expansions,yeomanry,harcourt,wealthiest,awaited,punta,intervening,aggressively,vichy,piloted,midtown,tailored,heyday,metadata,guadalcanal,inorganic,hadith,pulses,francais,tangent,scandals,erroneously,tractors,pigment,constabulary,jiangsu,landfill,merton,basalt,astor,forbade,debuts,collisions,exchequer,stadion,roofed,flavour,sculptors,conservancy,dissemination,electrically,undeveloped,existent,surpassing,pentecostal,manifested,amend,formula_14,superhuman,barges,tunis,analytics,argyll,liquids,mechanized,domes,mansions,himalayan,indexing,reuters,nonlinear,purification,exiting,timbers,triangles,decommissioning,departmental,causal,fonts,americana,sept.,seasonally,incomes,razavi,sheds,memorabilia,rotational,terre,sutra,protege,yarmouth,grandmaster,annum,looted,imperialism,variability,liquidation,baptised,isotope,showcasing,milling,rationale,hammersmith,austen,streamlined,acknowledging,contentious,qaleh,breadth,turing,referees,feral,toulon,unofficially,identifiable,standout,labeling,dissatisfaction,jurgen,angrily,featherweight,cantons,constrained,dominates,standalone,relinquished,theologians,markedly,italics,downed,nitrate,likened,gules,craftsman,singaporean,pixels,mandela,moray,parity,departement,antigen,academically,burgh,brahma,arranges,wounding,triathlon,nouveau,vanuatu,banded,acknowledges,unearthed,stemming,authentication,byzantines,converge,nepali,commonplace,deteriorating,recalling,palette,mathematicians,greenish,pictorial,ahmedabad,rouen,validation,u.s.a.,'best,malvern,archers,converter,undergoes,fluorescent,logistical,notification,transvaal,illicit,symphonies,stabilization,worsened,fukuoka,decrees,enthusiast,seychelles,blogger,louvre,dignitaries,burundi,wreckage,signage,pinyin,bursts,federer,polarization,urbana,lazio,schism,nietzsche,venerable,administers,seton,kilograms,invariably,kathmandu,farmed,disqualification,earldom,appropriated,fluctuations,kermanshah,deployments,deformation,wheelbase,maratha,psalm,bytes,methyl,engravings,skirmish,fayette,vaccines,ideally,astrology,breweries,botanic,opposes,harmonies,irregularities,contended,gaulle,prowess,constants,aground,filipinos,fresco,ochreous,jaipur,willamette,quercus,eastwards,mortars,champaign,braille,reforming,horned,hunan,spacious,agitation,draught,specialties,flourishing,greensboro,necessitated,swedes,elemental,whorls,hugely,structurally,plurality,synthesizers,embassies,assad,contradictory,inference,discontent,recreated,inspectors,unicef,commuters,embryo,modifying,stints,numerals,communicated,boosted,trumpeter,brightly,adherence,remade,leases,restrained,eucalyptus,dwellers,planar,grooves,gainesville,daimler,anzac,szczecin,cornerback,prized,peking,mauritania,khalifa,motorized,lodging,instrumentalist,fortresses,cervical,formula_15,passerine,sectarian,researches,apprenticed,reliefs,disclose,gliding,repairing,queue,kyushu,literate,canoeing,sacrament,separatist,calabria,parkland,flowed,investigates,statistically,visionary,commits,dragoons,scrolls,premieres,revisited,subdued,censored,patterned,elective,outlawed,orphaned,leyland,richly,fujian,miniatures,heresy,plaques,countered,nonfiction,exponent,moravia,dispersion,marylebone,midwestern,enclave,ithaca,federated,electronically,handheld,microscopy,tolls,arrivals,climbers,continual,cossacks,moselle,deserts,ubiquitous,gables,forecasts,deforestation,vertebrates,flanking,drilled,superstructure,inspected,consultative,bypassed,ballast,subsidy,socioeconomic,relic,grenada,journalistic,administering,accommodated,collapses,appropriation,reclassified,foreword,porte,assimilated,observance,fragmented,arundel,thuringia,gonzaga,shenzhen,shipyards,sectional,ayrshire,sloping,dependencies,promenade,ecuadorian,mangrove,constructs,goalscorer,heroism,iteration,transistor,omnibus,hampstead,cochin,overshadowed,chieftain,scalar,finishers,ghanaian,abnormalities,monoplane,encyclopaedia,characterize,travancore,baronetage,bearers,biking,distributes,paving,christened,inspections,banco,humber,corinth,quadratic,albanians,lineages,majored,roadside,inaccessible,inclination,darmstadt,fianna,epilepsy,propellers,papacy,montagu,bhutto,sugarcane,optimized,pilasters,contend,batsmen,brabant,housemates,sligo,ascot,aquinas,supervisory,accorded,gerais,echoed,nunavut,conservatoire,carniola,quartermaster,gminas,impeachment,aquitaine,reformers,quarterfinal,karlsruhe,accelerator,coeducational,archduke,gelechiidae,seaplane,dissident,frenchman,palau,depots,hardcover,aachen,darreh,denominational,groningen,parcels,reluctance,drafts,elliptic,counters,decreed,airship,devotional,contradiction,formula_16,undergraduates,qualitative,guatemalan,slavs,southland,blackhawks,detrimental,abolish,chechen,manifestations,arthritis,perch,fated,hebei,peshawar,palin,immensely,havre,totalling,rampant,ferns,concourse,triples,elites,olympian,larva,herds,lipid,karabakh,distal,monotypic,vojvodina,batavia,multiplied,spacing,spellings,pedestrians,parchment,glossy,industrialization,dehydrogenase,patriotism,abolitionist,mentoring,elizabethan,figurative,dysfunction,abyss,constantin,middletown,stigma,mondays,gambia,gaius,israelites,renounced,nepalese,overcoming,buren,sulphur,divergence,predation,looting,iberia,futuristic,shelved,anthropological,innsbruck,escalated,clermont,entrepreneurial,benchmark,mechanically,detachments,populist,apocalyptic,exited,embryonic,stanza,readership,chiba,landlords,expansive,boniface,therapies,perpetrators,whitehall,kassel,masts,carriageway,clinch,pathogens,mazandaran,undesirable,teutonic,miocene,nagpur,juris,cantata,compile,diffuse,dynastic,reopening,comptroller,o'neal,flourish,electing,scientifically,departs,welded,modal,cosmology,fukushima,libertadores,chang'an,asean,generalization,localization,afrikaans,cricketers,accompanies,emigrants,esoteric,southwards,shutdown,prequel,fittings,innate,wrongly,equitable,dictionaries,senatorial,bipolar,flashbacks,semitism,walkway,lyrically,legality,sorbonne,vigorously,durga,samoan,karel,interchanges,patna,decider,registering,electrodes,anarchists,excursion,overthrown,gilan,recited,michelangelo,advertiser,kinship,taboo,cessation,formula_17,premiers,traversed,madurai,poorest,torneo,exerted,replicate,spelt,sporadically,horde,landscaping,razed,hindered,esperanto,manchuria,propellant,jalan,baha'is,sikkim,linguists,pandit,racially,ligands,dowry,francophone,escarpment,behest,magdeburg,mainstay,villiers,yangtze,grupo,conspirators,martyrdom,noticeably,lexical,kazakh,unrestricted,utilised,sired,inhabits,proofs,joseon,pliny,minted,buddhists,cultivate,interconnected,reuse,viability,australasian,derelict,resolving,overlooks,menon,stewardship,playwrights,thwarted,filmfare,disarmament,protections,bundles,sidelined,hypothesized,singer/songwriter,forage,netted,chancery,townshend,restructured,quotation,hyperbolic,succumbed,parliaments,shenandoah,apical,kibbutz,storeys,pastors,lettering,ukrainians,hardships,chihuahua,avail,aisles,taluka,antisemitism,assent,ventured,banksia,seamen,hospice,faroe,fearful,woreda,outfield,chlorine,transformer,tatar,panoramic,pendulum,haarlem,styria,cornice,importing,catalyzes,subunits,enamel,bakersfield,realignment,sorties,subordinates,deanery,townland,gunmen,tutelage,evaluations,allahabad,thrace,veneto,mennonite,sharia,subgenus,satisfies,puritan,unequal,gastrointestinal,ordinances,bacterium,horticulture,argonauts,adjectives,arable,duets,visualization,woolwich,revamped,euroleague,thorax,completes,originality,vasco,freighter,sardar,oratory,sects,extremes,signatories,exporting,arisen,exacerbated,departures,saipan,furlongs,d'italia,goring,dakar,conquests,docked,offshoot,okrug,referencing,disperse,netting,summed,rewritten,articulation,humanoid,spindle,competitiveness,preventive,facades,westinghouse,wycombe,synthase,emulate,fostering,abdel,hexagonal,myriad,caters,arjun,dismay,axiom,psychotherapy,colloquial,complemented,martinique,fractures,culmination,erstwhile,atrium,electronica,anarchism,nadal,montpellier,algebras,submitting,adopts,stemmed,overcame,internacional,asymmetric,gallipoli,gliders,flushing,extermination,hartlepool,tesla,interwar,patriarchal,hitherto,ganges,combatant,marred,philology,glastonbury,reversible,isthmus,undermined,southwark,gateshead,andalusia,remedies,hastily,optimum,smartphone,evade,patrolled,beheaded,dopamine,waivers,ugandan,gujarati,densities,predicting,intestinal,tentative,interstellar,kolonia,soloists,penetrated,rebellions,qeshlaq,prospered,colegio,deficits,konigsberg,deficient,accessing,relays,kurds,politburo,codified,incarnations,occupancy,cossack,metaphysical,deprivation,chopra,piccadilly,formula_18,makeshift,protestantism,alaskan,frontiers,faiths,tendon,dunkirk,durability,autobots,bonuses,coinciding,emails,gunboat,stucco,magma,neutrons,vizier,subscriptions,visuals,envisaged,carpets,smoky,schema,parliamentarian,immersed,domesticated,parishioners,flinders,diminutive,mahabharata,ballarat,falmouth,vacancies,gilded,twigs,mastering,clerics,dalmatia,islington,slogans,compressor,iconography,congolese,sanction,blends,bulgarians,moderator,outflow,textures,safeguard,trafalgar,tramways,skopje,colonialism,chimneys,jazeera,organisers,denoting,motivations,ganga,longstanding,deficiencies,gwynedd,palladium,holistic,fascia,preachers,embargo,sidings,busan,ignited,artificially,clearwater,cemented,northerly,salim,equivalents,crustaceans,oberliga,quadrangle,historiography,romanians,vaults,fiercely,incidental,peacetime,tonal,bhopal,oskar,radha,pesticides,timeslot,westerly,cathedrals,roadways,aldershot,connectors,brahmins,paler,aqueous,gustave,chromatic,linkage,lothian,specialises,aggregation,tributes,insurgent,enact,hampden,ghulam,federations,instigated,lyceum,fredrik,chairmanship,floated,consequent,antagonists,intimidation,patriarchate,warbler,heraldry,entrenched,expectancy,habitation,partitions,widest,launchers,nascent,ethos,wurzburg,lycee,chittagong,mahatma,merseyside,asteroids,yokosuka,cooperatives,quorum,redistricting,bureaucratic,yachts,deploying,rustic,phonology,chorale,cellist,stochastic,crucifixion,surmounted,confucian,portfolios,geothermal,crested,calibre,tropics,deferred,nasir,iqbal,persistence,essayist,chengdu,aborigines,fayetteville,bastion,interchangeable,burlesque,kilmarnock,specificity,tankers,colonels,fijian,quotations,enquiry,quito,palmerston,delle,multidisciplinary,polynesian,iodine,antennae,emphasised,manganese,baptists,galilee,jutland,latent,excursions,skepticism,tectonic,precursors,negligible,musique,misuse,vitoria,expressly,veneration,sulawesi,footed,mubarak,chongqing,chemically,midday,ravaged,facets,varma,yeovil,ethnographic,discounted,physicists,attache,disbanding,essen,shogunate,cooperated,waikato,realising,motherwell,pharmacology,sulfide,inward,expatriate,devoid,cultivar,monde,andean,groupings,goran,unaffected,moldovan,postdoctoral,coleophora,delegated,pronoun,conductivity,coleridge,disapproval,reappeared,microbial,campground,olsztyn,fostered,vaccination,rabbinical,champlain,milestones,viewership,caterpillar,effected,eupithecia,financier,inferred,uzbek,bundled,bandar,balochistan,mysticism,biosphere,holotype,symbolizes,lovecraft,photons,abkhazia,swaziland,subgroups,measurable,falkirk,valparaiso,ashok,discriminatory,rarity,tabernacle,flyweight,jalisco,westernmost,antiquarian,extracellular,margrave,colspan=9,midsummer,digestive,reversing,burgeoning,substitutes,medallist,khrushchev,guerre,folio,detonated,partido,plentiful,aggregator,medallion,infiltration,shaded,santander,fared,auctioned,permian,ramakrishna,andorra,mentors,diffraction,bukit,potentials,translucent,feminists,tiers,protracted,coburg,wreath,guelph,adventurer,he/she,vertebrate,pipelines,celsius,outbreaks,australasia,deccan,garibaldi,unionists,buildup,biochemical,reconstruct,boulders,stringent,barbed,wording,furnaces,pests,befriends,organises,popes,rizal,tentacles,cadre,tallahassee,punishments,occidental,formatted,mitigation,rulings,rubens,cascades,inducing,choctaw,volta,synagogues,movable,altarpiece,mitigate,practise,intermittently,encountering,memberships,earns,signify,retractable,amounting,pragmatic,wilfrid,dissenting,divergent,kanji,reconstituted,devonian,constitutions,levied,hendrik,starch,costal,honduran,ditches,polygon,eindhoven,superstars,salient,argus,punitive,purana,alluvial,flaps,inefficient,retracted,advantageous,quang,andersson,danville,binghamton,symbolize,conclave,shaanxi,silica,interpersonal,adept,frans,pavilions,lubbock,equip,sunken,limburg,activates,prosecutions,corinthian,venerated,shootings,retreats,parapet,orissa,riviere,animations,parodied,offline,metaphysics,bluffs,plume,piety,fruition,subsidized,steeplechase,shanxi,eurasia,angled,forecasting,suffragan,ashram,larval,labyrinth,chronicler,summaries,trailed,merges,thunderstorms,filtered,formula_19,advertisers,alpes,informatics,parti,constituting,undisputed,certifications,javascript,molten,sclerosis,rumoured,boulogne,hmong,lewes,breslau,notts,bantu,ducal,messengers,radars,nightclubs,bantamweight,carnatic,kaunas,fraternal,triggering,controversially,londonderry,visas,scarcity,offaly,uprisings,repelled,corinthians,pretext,kuomintang,kielce,empties,matriculated,pneumatic,expos,agile,treatises,midpoint,prehistory,oncology,subsets,hydra,hypertension,axioms,wabash,reiterated,swapped,achieves,premio,ageing,overture,curricula,challengers,subic,selangor,liners,frontline,shutter,validated,normalized,entertainers,molluscs,maharaj,allegation,youngstown,synth,thoroughfare,regionally,pillai,transcontinental,pedagogical,riemann,colonia,easternmost,tentatively,profiled,herefordshire,nativity,meuse,nucleotide,inhibits,huntingdon,throughput,recorders,conceding,domed,homeowners,centric,gabled,canoes,fringes,breeder,subtitled,fluoride,haplogroup,zionism,izmir,phylogeny,kharkiv,romanticism,adhesion,usaaf,delegations,lorestan,whalers,biathlon,vaulted,mathematically,pesos,skirmishes,heisman,kalamazoo,gesellschaft,launceston,interacts,quadruple,kowloon,psychoanalysis,toothed,ideologies,navigational,valence,induces,lesotho,frieze,rigging,undercarriage,explorations,spoof,eucharist,profitability,virtuoso,recitals,subterranean,sizeable,herodotus,subscriber,huxley,pivot,forewing,warring,boleslaw,bharatiya,suffixes,trois,percussionist,downturn,garrisons,philosophies,chants,mersin,mentored,dramatist,guilds,frameworks,thermodynamic,venomous,mehmed,assembling,rabbinic,hegemony,replicas,enlargement,claimant,retitled,utica,dumfries,metis,deter,assortment,tubing,afflicted,weavers,rupture,ornamentation,transept,salvaged,upkeep,callsign,rajput,stevenage,trimmed,intracellular,synchronization,consular,unfavorable,royalists,goldwyn,fasting,hussars,doppler,obscurity,currencies,amiens,acorn,tagore,townsville,gaussian,migrations,porta,anjou,graphite,seaport,monographs,gladiators,metrics,calligraphy,sculptural,swietokrzyskie,tolombeh,eredivisie,shoals,queries,carts,exempted,fiberglass,mirrored,bazar,progeny,formalized,mukherjee,professed,amazon.com,cathode,moreton,removable,mountaineers,nagano,transplantation,augustinian,steeply,epilogue,adapter,decisively,accelerating,mediaeval,substituting,tasman,devonshire,litres,enhancements,himmler,nephews,bypassing,imperfect,argentinian,reims,integrates,sochi,ascii,licences,niches,surgeries,fables,versatility,indra,footpath,afonso,crore,evaporation,encodes,shelling,conformity,simplify,updating,quotient,overt,firmware,umpires,architectures,eocene,conservatism,secretion,embroidery,f.c..,tuvalu,mosaics,shipwreck,prefectural,cohort,grievances,garnering,centerpiece,apoptosis,djibouti,bethesda,formula_20,shonen,richland,justinian,dormitories,meteorite,reliably,obtains,pedagogy,hardness,cupola,manifolds,amplification,steamers,familial,dumbarton,jerzy,genital,maidstone,salinity,grumman,signifies,presbytery,meteorology,procured,aegis,streamed,deletion,nuestra,mountaineering,accords,neuronal,khanate,grenoble,axles,dispatches,tokens,turku,auctions,propositions,planters,proclaiming,recommissioned,stravinsky,obverse,bombarded,waged,saviour,massacred,reformist,purportedly,resettlement,ravenna,embroiled,minden,revitalization,hikers,bridging,torpedoed,depletion,nizam,affectionately,latitudes,lubeck,spore,polymerase,aarhus,nazism,101st,buyout,galerie,diets,overflow,motivational,renown,brevet,deriving,melee,goddesses,demolish,amplified,tamworth,retake,brokerage,beneficiaries,henceforth,reorganised,silhouette,browsers,pollutants,peron,lichfield,encircled,defends,bulge,dubbing,flamenco,coimbatore,refinement,enshrined,grizzlies,capacitor,usefulness,evansville,interscholastic,rhodesian,bulletins,diamondbacks,rockers,platted,medalists,formosa,transporter,slabs,guadeloupe,disparate,concertos,violins,regaining,mandible,untitled,agnostic,issuance,hamiltonian,brampton,srpska,homology,downgraded,florentine,epitaph,kanye,rallying,analysed,grandstand,infinitely,antitrust,plundered,modernity,colspan=3|total,amphitheatre,doric,motorists,yemeni,carnivorous,probabilities,prelate,struts,scrapping,bydgoszcz,pancreatic,signings,predicts,compendium,ombudsman,apertura,appoints,rebbe,stereotypical,valladolid,clustered,touted,plywood,inertial,kettering,curving,d'honneur,housewives,grenadier,vandals,barbarossa,necked,waltham,reputedly,jharkhand,cistercian,pursues,viscosity,organiser,cloister,islet,stardom,moorish,himachal,strives,scripps,staggered,blasts,westwards,millimeters,angolan,hubei,agility,admirals,mordellistena,coincides,platte,vehicular,cordillera,riffs,schoolteacher,canaan,acoustics,tinged,reinforcing,concentrates,daleks,monza,selectively,musik,polynesia,exporter,reviving,macclesfield,bunkers,ballets,manors,caudal,microbiology,primes,unbroken,outcry,flocks,pakhtunkhwa,abelian,toowoomba,luminous,mould,appraisal,leuven,experimentally,interoperability,hideout,perak,specifying,knighthood,vasily,excerpt,computerized,niels,networked,byzantium,reaffirmed,geographer,obscured,fraternities,mixtures,allusion,accra,lengthened,inquest,panhandle,pigments,revolts,bluetooth,conjugate,overtaken,foray,coils,breech,streaks,impressionist,mendelssohn,intermediary,panned,suggestive,nevis,upazila,rotunda,mersey,linnaeus,anecdotes,gorbachev,viennese,exhaustive,moldavia,arcades,irrespective,orator,diminishing,predictive,cohesion,polarized,montage,avian,alienation,conus,jaffna,urbanization,seawater,extremity,editorials,scrolling,dreyfus,traverses,topographic,gunboats,extratropical,normans,correspondents,recognises,millennia,filtration,ammonium,voicing,complied,prefixes,diplomas,figurines,weakly,gated,oscillator,lucerne,embroidered,outpatient,airframe,fractional,disobedience,quarterbacks,formula_21,shinto,chiapas,epistle,leakage,pacifist,avignon,penrith,renders,mantua,screenplays,gustaf,tesco,alphabetically,rations,discharges,headland,tapestry,manipur,boolean,mediator,ebenezer,subchannel,fable,bestselling,ateneo,trademarks,recurrence,dwarfs,britannica,signifying,vikram,mediate,condensation,censuses,verbandsgemeinde,cartesian,sprang,surat,britons,chelmsford,courtenay,statistic,retina,abortions,liabilities,closures,mississauga,skyscrapers,saginaw,compounded,aristocrat,msnbc,stavanger,septa,interpretive,hinder,visibly,seeding,shutouts,irregularly,quebecois,footbridge,hydroxide,implicitly,lieutenants,simplex,persuades,midshipman,heterogeneous,officiated,crackdown,lends,tartu,altars,fractions,dissidents,tapered,modernisation,scripting,blazon,aquaculture,thermodynamics,sistan,hasidic,bellator,pavia,propagated,theorized,bedouin,transnational,mekong,chronicled,declarations,kickstarter,quotas,runtime,duquesne,broadened,clarendon,brownsville,saturation,tatars,electorates,malayan,replicated,observable,amphitheater,endorsements,referral,allentown,mormons,pantomime,eliminates,typeface,allegorical,varna,conduction,evoke,interviewer,subordinated,uyghur,landscaped,conventionally,ascend,edifice,postulated,hanja,whitewater,embarking,musicologist,tagalog,frontage,paratroopers,hydrocarbons,transliterated,nicolae,viewpoints,surrealist,asheville,falklands,hacienda,glide,opting,zimbabwean,discal,mortgages,nicaraguan,yadav,ghosh,abstracted,castilian,compositional,cartilage,intergovernmental,forfeited,importation,rapping,artes,republika,narayana,condominium,frisian,bradman,duality,marche,extremist,phosphorylation,genomes,allusions,valencian,habeas,ironworks,multiplex,harpsichord,emigrate,alternated,breda,waffen,smartphones,familiarity,regionalliga,herbaceous,piping,dilapidated,carboniferous,xviii,critiques,carcinoma,sagar,chippewa,postmodern,neapolitan,excludes,notoriously,distillation,tungsten,richness,installments,monoxide,chand,privatisation,molded,maths,projectiles,luoyang,epirus,lemma,concentric,incline,erroneous,sideline,gazetted,leopards,fibres,renovate,corrugated,unilateral,repatriation,orchestration,saeed,rockingham,loughborough,formula_22,bandleader,appellation,openness,nanotechnology,massively,tonnage,dunfermline,exposes,moored,ridership,motte,eurobasket,majoring,feats,silla,laterally,playlist,downwards,methodologies,eastbourne,daimyo,cellulose,leyton,norwalk,oblong,hibernian,opaque,insular,allegory,camogie,inactivation,favoring,masterpieces,rinpoche,serotonin,portrayals,waverley,airliner,longford,minimalist,outsourcing,excise,meyrick,qasim,organisational,synaptic,farmington,gorges,scunthorpe,zoned,tohoku,librarians,davao,decor,theatrically,brentwood,pomona,acquires,planter,capacitors,synchronous,skateboarding,coatings,turbocharged,ephraim,capitulation,scoreboard,hebrides,ensues,cereals,ailing,counterpoint,duplication,antisemitic,clique,aichi,oppressive,transcendental,incursions,rename,renumbering,powys,vestry,bitterly,neurology,supplanted,affine,susceptibility,orbiter,activating,overlaps,ecoregion,raman,canoer,darfur,microorganisms,precipitated,protruding,torun,anthropologists,rennes,kangaroos,parliamentarians,edits,littoral,archived,begum,rensselaer,microphones,ypres,empower,etruscan,wisden,montfort,calibration,isomorphic,rioting,kingship,verbally,smyrna,cohesive,canyons,fredericksburg,rahul,relativistic,micropolitan,maroons,industrialized,henchmen,uplift,earthworks,mahdi,disparity,cultured,transliteration,spiny,fragmentary,extinguished,atypical,inventors,biosynthesis,heralded,curacao,anomalies,aeroplane,surya,mangalore,maastricht,ashkenazi,fusiliers,hangzhou,emitting,monmouthshire,schwarzenegger,ramayana,peptides,thiruvananthapuram,alkali,coimbra,budding,reasoned,epithelial,harbors,rudimentary,classically,parque,ealing,crusades,rotations,riparian,pygmy,inertia,revolted,microprocessor,calendars,solvents,kriegsmarine,accademia,cheshmeh,yoruba,ardabil,mitra,genomic,notables,propagate,narrates,univision,outposts,polio,birkenhead,urinary,crocodiles,pectoral,barrymore,deadliest,rupees,chaim,protons,comical,astrophysics,unifying,formula_23,vassals,cortical,audubon,pedals,tenders,resorted,geophysical,lenders,recognising,tackling,lanarkshire,doctrinal,annan,combating,guangxi,estimating,selectors,tribunals,chambered,inhabiting,exemptions,curtailed,abbasid,kandahar,boron,bissau,150th,codenamed,wearer,whorl,adhered,subversive,famer,smelting,inserting,mogadishu,zoologist,mosul,stumps,almanac,olympiacos,stamens,participatory,cults,honeycomb,geologists,dividend,recursive,skiers,reprint,pandemic,liber,percentages,adversely,stoppage,chieftains,tubingen,southerly,overcrowding,unorganized,hangars,fulfil,hails,cantilever,woodbridge,pinus,wiesbaden,fertilization,fluorescence,enhances,plenary,troublesome,episodic,thrissur,kickboxing,allele,staffing,garda,televisions,philatelic,spacetime,bullpen,oxides,leninist,enrolling,inventive,truro,compatriot,ruskin,normative,assay,gotha,murad,illawarra,gendarmerie,strasse,mazraeh,rebounded,fanfare,liaoning,rembrandt,iranians,emirate,governs,latency,waterfowl,chairmen,katowice,aristocrats,eclipsed,sentient,sonatas,interplay,sacking,decepticons,dynamical,arbitrarily,resonant,petar,velocities,alludes,wastes,prefectures,belleville,sensibility,salvadoran,consolidating,medicaid,trainees,vivekananda,molar,porous,upload,youngster,infused,doctorates,wuhan,annihilation,enthusiastically,gamespot,kanpur,accumulating,monorail,operetta,tiling,sapporo,finns,calvinist,hydrocarbon,sparrows,orienteering,cornelis,minster,vuelta,plebiscite,embraces,panchayats,focussed,remediation,brahman,olfactory,reestablished,uniqueness,northumbria,rwandan,predominately,abode,ghats,balances,californian,uptake,bruges,inert,westerns,reprints,cairn,yarra,resurfaced,audible,rossini,regensburg,italiana,fleshy,irrigated,alerts,yahya,varanasi,marginalized,expatriates,cantonment,normandie,sahitya,directives,rounder,hulls,fictionalized,constables,inserts,hipped,potosi,navies,biologists,canteen,husbandry,augment,fortnight,assamese,kampala,o'keefe,paleolithic,bluish,promontory,consecutively,striving,niall,reuniting,dipole,friendlies,disapproved,thrived,netflix,liberian,dielectric,medway,strategist,sankt,pickups,hitters,encode,rerouted,claimants,anglesey,partitioned,cavan,flutes,reared,repainted,armaments,bowed,thoracic,balliol,piero,chaplains,dehestan,sender,junkers,sindhi,sickle,dividends,metallurgy,honorific,berths,namco,springboard,resettled,gansu,copyrighted,criticizes,utopian,bendigo,ovarian,binomial,spaceflight,oratorio,proprietors,supergroup,duplicated,foreground,strongholds,revolved,optimize,layouts,westland,hurler,anthropomorphic,excelsior,merchandising,reeds,vetoed,cryptography,hollyoaks,monash,flooring,ionian,resilience,johnstown,resolves,lawmakers,alegre,wildcards,intolerance,subculture,selector,slums,formulate,bayonet,istvan,restitution,interchangeably,awakens,rostock,serpentine,oscillation,reichstag,phenotype,recessed,piotr,annotated,preparedness,consultations,clausura,preferential,euthanasia,genoese,outcrops,freemasonry,geometrical,genesee,islets,prometheus,panamanian,thunderbolt,terraced,stara,shipwrecks,futebol,faroese,sharqi,aldermen,zeitung,unify,formula_24,humanism,syntactic,earthen,blyth,taxed,rescinded,suleiman,cymru,dwindled,vitality,superieure,resupply,adolphe,ardennes,rajiv,profiling,olympique,gestation,interfaith,milosevic,tagline,funerary,druze,silvery,plough,shrubland,relaunch,disband,nunatak,minimizing,excessively,waned,attaching,luminosity,bugle,encampment,electrostatic,minesweeper,dubrovnik,rufous,greenock,hochschule,assyrians,extracting,malnutrition,priya,attainment,anhui,connotations,predicate,seabirds,deduced,pseudonyms,gopal,plovdiv,refineries,imitated,kwazulu,terracotta,tenets,discourses,brandeis,whigs,dominions,pulmonate,landslides,tutors,determinant,richelieu,farmstead,tubercles,technicolor,hegel,redundancy,greenpeace,shortening,mules,distilled,xxiii,fundamentalist,acrylic,outbuildings,lighted,corals,signaled,transistors,cavite,austerity,76ers,exposures,dionysius,outlining,commutative,permissible,knowledgeable,howrah,assemblage,inhibited,crewmen,mbit/s,pyramidal,aberdeenshire,bering,rotates,atheism,howitzer,saone,lancet,fermented,contradicted,materiel,ofsted,numeric,uniformity,josephus,nazarene,kuwaiti,noblemen,pediment,emergent,campaigner,akademi,murcia,perugia,gallen,allsvenskan,finned,cavities,matriculation,rosters,twickenham,signatory,propel,readable,contends,artisan,flamboyant,reggio,italo,fumbles,widescreen,rectangle,centimetres,collaborates,envoys,rijeka,phonological,thinly,refractive,civilisation,reductase,cognate,dalhousie,monticello,lighthouses,jitsu,luneburg,socialite,fermi,collectible,optioned,marquee,jokingly,architecturally,kabir,concubine,nationalisation,watercolor,wicklow,acharya,pooja,leibniz,rajendra,nationalized,stalemate,bloggers,glutamate,uplands,shivaji,carolingian,bucuresti,dasht,reappears,muscat,functionally,formulations,hinged,hainan,catechism,autosomal,incremental,asahi,coeur,diversification,multilateral,fewest,recombination,finisher,harrogate,hangul,feasts,photovoltaic,paget,liquidity,alluded,incubation,applauded,choruses,malagasy,hispanics,bequest,underparts,cassava,kazimierz,gastric,eradication,mowtowr,tyrosine,archbishopric,e9e9e9,unproductive,uxbridge,hydrolysis,harbours,officio,deterministic,devonport,kanagawa,breaches,freetown,rhinoceros,chandigarh,janos,sanatorium,liberator,inequalities,agonist,hydrophobic,constructors,nagorno,snowboarding,welcomes,subscribed,iloilo,resuming,catalysts,stallions,jawaharlal,harriers,definitively,roughriders,hertford,inhibiting,elgar,randomized,incumbents,episcopate,rainforests,yangon,improperly,kemal,interpreters,diverged,uttarakhand,umayyad,phnom,panathinaikos,shabbat,diode,jiangxi,forbidding,nozzle,artistry,licensee,processions,staffs,decimated,expressionism,shingle,palsy,ontology,mahayana,maribor,sunil,hostels,edwardian,jetty,freehold,overthrew,eukaryotic,schuylkill,rawalpindi,sheath,recessive,ferenc,mandibles,berlusconi,confessor,convergent,ababa,slugging,rentals,sephardic,equivalently,collagen,markov,dynamically,hailing,depressions,sprawling,fairgrounds,indistinguishable,plutarch,pressurized,banff,coldest,braunschweig,mackintosh,sociedad,wittgenstein,tromso,airbase,lecturers,subtitle,attaches,purified,contemplated,dreamworks,telephony,prophetic,rockland,aylesbury,biscay,coherence,aleksandar,judoka,pageants,theses,homelessness,luthor,sitcoms,hinterland,fifths,derwent,privateers,enigmatic,nationalistic,instructs,superimposed,conformation,tricycle,dusan,attributable,unbeknownst,laptops,etching,archbishops,ayatollah,cranial,gharbi,interprets,lackawanna,abingdon,saltwater,tories,lender,minaj,ancillary,ranching,pembrokeshire,topographical,plagiarism,murong,marque,chameleon,assertions,infiltrated,guildhall,reverence,schenectady,formula_25,kollam,notary,mexicana,initiates,abdication,basra,theorems,ionization,dismantling,eared,censors,budgetary,numeral,verlag,excommunicated,distinguishable,quarried,cagliari,hindustan,symbolizing,watertown,descartes,relayed,enclosures,militarily,sault,devolved,dalian,djokovic,filaments,staunton,tumour,curia,villainous,decentralized,galapagos,moncton,quartets,onscreen,necropolis,brasileiro,multipurpose,alamos,comarca,jorgen,concise,mercia,saitama,billiards,entomologist,montserrat,lindbergh,commuting,lethbridge,phoenician,deviations,anaerobic,denouncing,redoubt,fachhochschule,principalities,negros,announcers,seconded,parrots,konami,revivals,approving,devotee,riyadh,overtook,morecambe,lichen,expressionist,waterline,silverstone,geffen,sternites,aspiration,behavioural,grenville,tripura,mediums,genders,pyotr,charlottesville,sacraments,programmable,ps100,shackleton,garonne,sumerian,surpass,authorizing,interlocking,lagoons,voiceless,advert,steeple,boycotted,alouettes,yosef,oxidative,sassanid,benefiting,sayyid,nauru,predetermined,idealism,maxillary,polymerization,semesters,munchen,conor,outfitted,clapham,progenitor,gheorghe,observational,recognitions,numerically,colonized,hazrat,indore,contaminants,fatality,eradicate,assyria,convocation,cameos,skillful,skoda,corfu,confucius,overtly,ramadan,wollongong,placements,d.c..,permutation,contemporaneous,voltages,elegans,universitat,samar,plunder,dwindling,neuter,antonin,sinhala,campania,solidified,stanzas,fibrous,marburg,modernize,sorcery,deutscher,florets,thakur,disruptive,infielder,disintegration,internazionale,vicariate,effigy,tripartite,corrective,klamath,environs,leavenworth,sandhurst,workmen,compagnie,hoseynabad,strabo,palisades,ordovician,sigurd,grandsons,defection,viacom,sinhalese,innovator,uncontrolled,slavonic,indexes,refrigeration,aircrew,superbike,resumption,neustadt,confrontations,arras,hindenburg,ripon,embedding,isomorphism,dwarves,matchup,unison,lofty,argos,louth,constitutionally,transitive,newington,facelift,degeneration,perceptual,aviators,enclosing,igneous,symbolically,academician,constitutionality,iso/iec,sacrificial,maturation,apprentices,enzymology,naturalistic,hajji,arthropods,abbess,vistula,scuttled,gradients,pentathlon,etudes,freedmen,melaleuca,thrice,conductive,sackville,franciscans,stricter,golds,kites,worshiped,monsignor,trios,orally,tiered,primacy,bodywork,castleford,epidemics,alveolar,chapelle,chemists,hillsboro,soulful,warlords,ngati,huguenot,diurnal,remarking,luger,motorways,gauss,jahan,cutoff,proximal,bandai,catchphrase,jonubi,ossetia,codename,codice_2,throated,itinerant,chechnya,riverfront,leela,evoked,entailed,zamboanga,rejoining,circuitry,haymarket,khartoum,feuds,braced,miyazaki,mirren,lubusz,caricature,buttresses,attrition,characterizes,widnes,evanston,materialism,contradictions,marist,midrash,gainsborough,ulithi,turkmen,vidya,escuela,patrician,inspirations,reagent,premierships,humanistic,euphrates,transitioning,belfry,zedong,adaption,kaliningrad,lobos,epics,waiver,coniferous,polydor,inductee,refitted,moraine,unsatisfactory,worsening,polygamy,rajya,nested,subgenre,broadside,stampeders,lingua,incheon,pretender,peloton,persuading,excitation,multan,predates,tonne,brackish,autoimmune,insulated,podcasts,iraqis,bodybuilding,condominiums,midlothian,delft,debtor,asymmetrical,lycaenidae,forcefully,pathogenic,tamaulipas,andaman,intravenous,advancements,senegalese,chronologically,realigned,inquirer,eusebius,dekalb,additives,shortlist,goldwater,hindustani,auditing,caterpillars,pesticide,nakhon,ingestion,lansdowne,traditionalist,northland,thunderbirds,josip,nominating,locale,ventricular,animators,verandah,epistles,surveyors,anthems,dredd,upheaval,passaic,anatolian,svalbard,associative,floodplain,taranaki,estuaries,irreducible,beginners,hammerstein,allocate,coursework,secreted,counteract,handwritten,foundational,passover,discoverer,decoding,wares,bourgeoisie,playgrounds,nazionale,abbreviations,seanad,golan,mishra,godavari,rebranding,attendances,backstory,interrupts,lettered,hasbro,ultralight,hormozgan,armee,moderne,subdue,disuse,improvisational,enrolment,persists,moderated,carinthia,hatchback,inhibitory,capitalized,anatoly,abstracts,albemarle,bergamo,insolvency,sentai,cellars,walloon,joked,kashmiri,dirac,materialized,renomination,homologous,gusts,eighteens,centrifugal,storied,baluchestan,formula_26,poincare,vettel,infuriated,gauges,streetcars,vedanta,stately,liquidated,goguryeo,swifts,accountancy,levee,acadian,hydropower,eustace,comintern,allotment,designating,torsion,molding,irritation,aerobic,halen,concerted,plantings,garrisoned,gramophone,cytoplasm,onslaught,requisitioned,relieving,genitive,centrist,jeong,espanola,dissolving,chatterjee,sparking,connaught,varese,arjuna,carpathian,empowering,meteorologist,decathlon,opioid,hohenzollern,fenced,ibiza,avionics,footscray,scrum,discounts,filament,directories,a.f.c,stiffness,quaternary,adventurers,transmits,harmonious,taizong,radiating,germantown,ejection,projectors,gaseous,nahuatl,vidyalaya,nightlife,redefined,refuted,destitute,arista,potters,disseminated,distanced,jamboree,kaohsiung,tilted,lakeshore,grained,inflicting,kreis,novelists,descendents,mezzanine,recast,fatah,deregulation,ac/dc,australis,kohgiluyeh,boreal,goths,authoring,intoxicated,nonpartisan,theodosius,pyongyang,shree,boyhood,sanfl,plenipotentiary,photosynthesis,presidium,sinaloa,honshu,texan,avenida,transmembrane,malays,acropolis,catalunya,vases,inconsistencies,methodists,quell,suisse,banat,simcoe,cercle,zealanders,discredited,equine,sages,parthian,fascists,interpolation,classifying,spinoff,yehuda,cruised,gypsum,foaled,wallachia,saraswati,imperialist,seabed,footnotes,nakajima,locales,schoolmaster,drosophila,bridgehead,immanuel,courtier,bookseller,niccolo,stylistically,portmanteau,superleague,konkani,millimetres,arboreal,thanjavur,emulation,sounders,decompression,commoners,infusion,methodological,osage,rococo,anchoring,bayreuth,formula_27,abstracting,symbolized,bayonne,electrolyte,rowed,corvettes,traversing,editorship,sampler,presidio,curzon,adirondack,swahili,rearing,bladed,lemur,pashtun,behaviours,bottling,zaire,recognisable,systematics,leeward,formulae,subdistricts,smithfield,vijaya,buoyancy,boosting,cantonal,rishi,airflow,kamakura,adana,emblems,aquifer,clustering,husayn,woolly,wineries,montessori,turntable,exponentially,caverns,espoused,pianists,vorpommern,vicenza,latterly,o'rourke,williamstown,generale,kosice,duisburg,poirot,marshy,mismanagement,mandalay,dagenham,universes,chiral,radiated,stewards,vegan,crankshaft,kyrgyz,amphibian,cymbals,infrequently,offenbach,environmentalist,repatriated,permutations,midshipmen,loudoun,refereed,bamberg,ornamented,nitric,selim,translational,dorsum,annunciation,gippsland,reflector,informational,regia,reactionary,ahmet,weathering,erlewine,legalized,berne,occupant,divas,manifests,analyzes,disproportionate,mitochondria,totalitarian,paulista,interscope,anarcho,correlate,brookfield,elongate,brunel,ordinal,precincts,volatility,equaliser,hittite,somaliland,ticketing,monochrome,ubuntu,chhattisgarh,titleholder,ranches,referendums,blooms,accommodates,merthyr,religiously,ryukyu,tumultuous,checkpoints,anode,mi'kmaq,cannonball,punctuation,remodelled,assassinations,criminology,alternates,yonge,pixar,namibian,piraeus,trondelag,hautes,lifeboats,shoal,atelier,vehemently,sadat,postcode,jainism,lycoming,undisturbed,lutherans,genomics,popmatters,tabriz,isthmian,notched,autistic,horsham,mites,conseil,bloomsbury,seung,cybertron,idris,overhauled,disbandment,idealized,goldfields,worshippers,lobbyist,ailments,paganism,herbarium,athenians,messerschmitt,faraday,entangled,'olya,untreated,criticising,howitzers,parvati,lobed,debussy,atonement,tadeusz,permeability,mueang,sepals,degli,optionally,fuelled,follies,asterisk,pristina,lewiston,congested,overpass,affixed,pleads,telecasts,stanislaus,cryptographic,friesland,hamstring,selkirk,antisubmarine,inundated,overlay,aggregates,fleur,trolleybus,sagan,ibsen,inductees,beltway,tiled,ladders,cadbury,laplace,ascetic,micronesia,conveying,bellingham,cleft,batches,usaid,conjugation,macedon,assisi,reappointed,brine,jinnah,prairies,screenwriting,oxidized,despatches,linearly,fertilizers,brazilians,absorbs,wagga,modernised,scorsese,ashraf,charlestown,esque,habitable,nizhny,lettres,tuscaloosa,esplanade,coalitions,carbohydrates,legate,vermilion,standardised,galleria,psychoanalytic,rearrangement,substation,competency,nationalised,reshuffle,reconstructions,mehdi,bougainville,receivership,contraception,enlistment,conducive,aberystwyth,solicitors,dismisses,fibrosis,montclair,homeowner,surrealism,s.h.i.e.l.d,peregrine,compilers,1790s,parentage,palmas,rzeszow,worldview,eased,svenska,housemate,bundestag,originator,enlisting,outwards,reciprocity,formula_28,carbohydrate,democratically,firefighting,romagna,acknowledgement,khomeini,carbide,quests,vedas,characteristically,guwahati,brixton,unintended,brothels,parietal,namur,sherbrooke,moldavian,baruch,milieu,undulating,laurier,entre,dijon,ethylene,abilene,heracles,paralleling,ceres,dundalk,falun,auspicious,chisinau,polarity,foreclosure,templates,ojibwe,punic,eriksson,biden,bachchan,glaciation,spitfires,norsk,nonviolent,heidegger,algonquin,capacitance,cassettes,balconies,alleles,airdate,conveys,replays,classifies,infrequent,amine,cuttings,rarer,woking,olomouc,amritsar,rockabilly,illyrian,maoist,poignant,tempore,stalinist,segmented,bandmate,mollusc,muhammed,totalled,byrds,tendered,endogenous,kottayam,aisne,oxidase,overhears,illustrators,verve,commercialization,purplish,directv,moulded,lyttelton,baptismal,captors,saracens,georgios,shorten,polity,grids,fitzwilliam,sculls,impurities,confederations,akhtar,intangible,oscillations,parabolic,harlequin,maulana,ovate,tanzanian,singularity,confiscation,qazvin,speyer,phonemes,overgrown,vicarage,gurion,undocumented,niigata,thrones,preamble,stave,interment,liiga,ataturk,aphrodite,groupe,indentured,habsburgs,caption,utilitarian,ozark,slovenes,reproductions,plasticity,serbo,dulwich,castel,barbuda,salons,feuding,lenape,wikileaks,swamy,breuning,shedding,afield,superficially,operationally,lamented,okanagan,hamadan,accolade,furthering,adolphus,fyodor,abridged,cartoonists,pinkish,suharto,cytochrome,methylation,debit,colspan=9|,refine,taoist,signalled,herding,leaved,bayan,fatherland,rampart,sequenced,negation,storyteller,occupiers,barnabas,pelicans,nadir,conscripted,railcars,prerequisite,furthered,columba,carolinas,markup,gwalior,franche,chaco,eglinton,ramparts,rangoon,metabolites,pollination,croat,televisa,holyoke,testimonial,setlist,safavid,sendai,georgians,shakespearean,galleys,regenerative,krzysztof,overtones,estado,barbary,cherbourg,obispo,sayings,composites,sainsbury,deliberation,cosmological,mahalleh,embellished,ascap,biala,pancras,calumet,grands,canvases,antigens,marianas,defenseman,approximated,seedlings,soren,stele,nuncio,immunology,testimonies,glossary,recollections,suitability,tampere,venous,cohomology,methanol,echoing,ivanovich,warmly,sterilization,imran,multiplying,whitechapel,undersea,xuanzong,tacitus,bayesian,roundhouse,correlations,rioters,molds,fiorentina,bandmates,mezzo,thani,guerilla,200th,premiums,tamils,deepwater,chimpanzees,tribesmen,selwyn,globo,turnovers,punctuated,erode,nouvelle,banbury,exponents,abolishing,helical,maimonides,endothelial,goteborg,infield,encroachment,cottonwood,mazowiecki,parable,saarbrucken,reliever,epistemology,artistes,enrich,rationing,formula_29,palmyra,subfamilies,kauai,zoran,fieldwork,arousal,creditor,friuli,celts,comoros,equated,escalation,negev,tallied,inductive,anion,netanyahu,mesoamerican,lepidoptera,aspirated,remit,westmorland,italic,crosse,vaclav,fuego,owain,balmain,venetians,ethnicities,deflected,ticino,apulia,austere,flycatcher,reprising,repressive,hauptbahnhof,subtype,ophthalmology,summarizes,eniwetok,colonisation,subspace,nymphalidae,earmarked,tempe,burnet,crests,abbots,norwegians,enlarge,ashoka,frankfort,livorno,malware,renters,singly,iliad,moresby,rookies,gustavus,affirming,alleges,legume,chekhov,studded,abdicated,suzhou,isidore,townsite,repayment,quintus,yankovic,amorphous,constructor,narrowing,industrialists,tanganyika,capitalization,connective,mughals,rarities,aerodynamics,worthing,antalya,diagnostics,shaftesbury,thracian,obstetrics,benghazi,multiplier,orbitals,livonia,roscommon,intensify,ravel,oaths,overseer,locomotion,necessities,chickasaw,strathclyde,treviso,erfurt,aortic,contemplation,accrington,markazi,predeceased,hippocampus,whitecaps,assemblyman,incursion,ethnography,extraliga,reproducing,directorship,benzene,byway,stupa,taxable,scottsdale,onondaga,favourably,countermeasures,lithuanians,thatched,deflection,tarsus,consuls,annuity,paralleled,contextual,anglian,klang,hoisted,multilingual,enacting,samaj,taoiseach,carthaginian,apologised,hydrology,entrant,seamless,inflorescences,mugabe,westerners,seminaries,wintering,penzance,mitre,sergeants,unoccupied,delimitation,discriminate,upriver,abortive,nihon,bessarabia,calcareous,buffaloes,patil,daegu,streamline,berks,chaparral,laity,conceptions,typified,kiribati,threaded,mattel,eccentricity,signified,patagonia,slavonia,certifying,adnan,astley,sedition,minimally,enumerated,nikos,goalless,walid,narendra,causa,missoula,coolant,dalek,outcrop,hybridization,schoolchildren,peasantry,afghans,confucianism,shahr,gallic,tajik,kierkegaard,sauvignon,commissar,patriarchs,tuskegee,prussians,laois,ricans,talmudic,officiating,aesthetically,baloch,antiochus,separatists,suzerainty,arafat,shading,u.s.c,chancellors,inc..,toolkit,nepenthes,erebidae,solicited,pratap,kabbalah,alchemist,caltech,darjeeling,biopic,spillway,kaiserslautern,nijmegen,bolstered,neath,pahlavi,eugenics,bureaus,retook,northfield,instantaneous,deerfield,humankind,selectivity,putative,boarders,cornhuskers,marathas,raikkonen,aliabad,mangroves,garages,gulch,karzai,poitiers,chernobyl,thane,alexios,belgrano,scion,solubility,urbanized,executable,guizhou,nucleic,tripled,equalled,harare,houseguests,potency,ghazi,repeater,overarching,regrouped,broward,ragtime,d'art,nandi,regalia,campsites,mamluk,plating,wirral,presumption,zenit,archivist,emmerdale,decepticon,carabidae,kagoshima,franconia,guarani,formalism,diagonally,submarginal,denys,walkways,punts,metrolink,hydrographic,droplets,upperside,martyred,hummingbird,antebellum,curiously,mufti,friary,chabad,czechs,shaykh,reactivity,berklee,turbonilla,tongan,sultans,woodville,unlicensed,enmity,dominicans,operculum,quarrying,watercolour,catalyzed,gatwick,'what,mesozoic,auditors,shizuoka,footballing,haldane,telemundo,appended,deducted,disseminate,o'shea,pskov,abrasive,entente,gauteng,calicut,lemurs,elasticity,suffused,scopula,staining,upholding,excesses,shostakovich,loanwords,naidu,championnat,chromatography,boasting,goaltenders,engulfed,salah,kilogram,morristown,shingles,shi'a,labourer,renditions,frantisek,jekyll,zonal,nanda,sheriffs,eigenvalues,divisione,endorsing,ushered,auvergne,cadres,repentance,freemasons,utilising,laureates,diocletian,semiconductors,o'grady,vladivostok,sarkozy,trackage,masculinity,hydroxyl,mervyn,muskets,speculations,gridiron,opportunistic,mascots,aleutian,fillies,sewerage,excommunication,borrowers,capillary,trending,sydenham,synthpop,rajah,cagayan,deportes,kedah,faure,extremism,michoacan,levski,culminates,occitan,bioinformatics,unknowingly,inciting,emulated,footpaths,piacenza,dreadnought,viceroyalty,oceanographic,scouted,combinatorial,ornithologist,cannibalism,mujahideen,independiente,cilicia,hindwing,minimized,odeon,gyorgy,rubles,purchaser,collieries,kickers,interurban,coiled,lynchburg,respondent,plzen,detractors,etchings,centering,intensification,tomography,ranjit,warblers,retelling,reinstatement,cauchy,modulus,redirected,evaluates,beginner,kalateh,perforated,manoeuvre,scrimmage,internships,megawatts,mottled,haakon,tunbridge,kalyan,summarised,sukarno,quetta,canonized,henryk,agglomeration,coahuila,diluted,chiropractic,yogyakarta,talladega,sheik,cation,halting,reprisals,sulfuric,musharraf,sympathizers,publicised,arles,lectionary,fracturing,startups,sangha,latrobe,rideau,ligaments,blockading,cremona,lichens,fabaceae,modulated,evocative,embodies,battersea,indistinct,altai,subsystem,acidity,somatic,formula_30,tariq,rationality,sortie,ashlar,pokal,cytoplasmic,valour,bangla,displacing,hijacking,spectrometry,westmeath,weill,charing,goias,revolvers,individualized,tenured,nawaz,piquet,chanted,discard,bernd,phalanx,reworking,unilaterally,subclass,yitzhak,piloting,circumvent,disregarded,semicircular,viscous,tibetans,endeavours,retaliated,cretan,vienne,workhouse,sufficiency,aurangzeb,legalization,lipids,expanse,eintracht,sanjak,megas,125th,bahraini,yakima,eukaryotes,thwart,affirmation,peloponnese,retailing,carbonyl,chairwoman,macedonians,dentate,rockaway,correctness,wealthier,metamorphic,aragonese,fermanagh,pituitary,schrodinger,evokes,spoiler,chariots,akita,genitalia,combe,confectionery,desegregation,experiential,commodores,persepolis,viejo,restorations,virtualization,hispania,printmaking,stipend,yisrael,theravada,expended,radium,tweeted,polygonal,lippe,charente,leveraged,cutaneous,fallacy,fragrant,bypasses,elaborately,rigidity,majid,majorca,kongo,plasmodium,skits,audiovisual,eerste,staircases,prompts,coulthard,northwestward,riverdale,beatrix,copyrights,prudential,communicates,mated,obscenity,asynchronous,analyse,hansa,searchlight,farnborough,patras,asquith,qarah,contours,fumbled,pasteur,redistributed,almeria,sanctuaries,jewry,israelite,clinicians,koblenz,bookshop,affective,goulburn,panelist,sikorsky,cobham,mimics,ringed,portraiture,probabilistic,girolamo,intelligible,andalusian,jalal,athenaeum,eritrean,auxiliaries,pittsburg,devolution,sangam,isolating,anglers,cronulla,annihilated,kidderminster,synthesize,popularised,theophilus,bandstand,innumerable,chagrin,retroactively,weser,multiples,birdlife,goryeo,pawnee,grosser,grappling,tactile,ahmadinejad,turboprop,erdogan,matchday,proletarian,adhering,complements,austronesian,adverts,luminaries,archeology,impressionism,conifer,sodomy,interracial,platoons,lessen,postings,pejorative,registrations,cookery,persecutions,microbes,audits,idiosyncratic,subsp,suspensions,restricts,colouring,ratify,instrumentals,nucleotides,sulla,posits,bibliotheque,diameters,oceanography,instigation,subsumed,submachine,acceptor,legation,borrows,sedge,discriminated,loaves,insurers,highgate,detectable,abandons,kilns,sportscaster,harwich,iterations,preakness,arduous,tensile,prabhu,shortwave,philologist,shareholding,vegetative,complexities,councilors,distinctively,revitalize,automaton,amassing,montreux,khanh,surabaya,nurnberg,pernambuco,cuisines,charterhouse,firsts,tercera,inhabitant,homophobia,naturalism,einar,powerplant,coruna,entertainments,whedon,rajputs,raton,democracies,arunachal,oeuvre,wallonia,jeddah,trolleybuses,evangelism,vosges,kiowa,minimise,encirclement,undertakes,emigrant,beacons,deepened,grammars,publius,preeminent,seyyed,repechage,crafting,headingley,osteopathic,lithography,hotly,bligh,inshore,betrothed,olympians,formula_31,dissociation,trivandrum,arran,petrovic,stettin,disembarked,simplification,bronzes,philo,acrobatic,jonsson,conjectured,supercharged,kanto,detects,cheeses,correlates,harmonics,lifecycle,sudamericana,reservists,decayed,elitserien,parametric,113th,dusky,hogarth,modulo,symbiotic,monopolies,discontinuation,converges,southerners,tucuman,eclipses,enclaves,emits,famicom,caricatures,artistically,levelled,mussels,erecting,mouthparts,cunard,octaves,crucible,guardia,unusable,lagrangian,droughts,ephemeral,pashto,canis,tapering,sasebo,silurian,metallurgical,outscored,evolves,reissues,sedentary,homotopy,greyhawk,reagents,inheriting,onshore,tilting,rebuffed,reusable,naturalists,basingstoke,insofar,offensives,dravidian,curators,planks,rajan,isoforms,flagstaff,preside,globular,egalitarian,linkages,biographers,goalscorers,molybdenum,centralised,nordland,jurists,ellesmere,rosberg,hideyoshi,restructure,biases,borrower,scathing,redress,tunnelling,workflow,magnates,mahendra,dissenters,plethora,transcriptions,handicrafts,keyword,xi'an,petrograd,unser,prokofiev,90deg,madan,bataan,maronite,kearny,carmarthen,termini,consulates,disallowed,rockville,bowery,fanzine,docklands,bests,prohibitions,yeltsin,selassie,naturalization,realisation,dispensary,tribeca,abdulaziz,pocahontas,stagnation,pamplona,cuneiform,propagating,subsurface,christgau,epithelium,schwerin,lynching,routledge,hanseatic,upanishad,glebe,yugoslavian,complicity,endowments,girona,mynetworktv,entomology,plinth,ba'ath,supercup,torus,akkadian,salted,englewood,commandery,belgaum,prefixed,colorless,dartford,enthroned,caesarea,nominative,sandown,safeguards,hulled,formula_32,leamington,dieppe,spearhead,generalizations,demarcation,llanelli,masque,brickwork,recounting,sufism,strikingly,petrochemical,onslow,monologues,emigrating,anderlecht,sturt,hossein,sakhalin,subduction,novices,deptford,zanjan,airstrikes,coalfield,reintroduction,timbaland,hornby,messianic,stinging,universalist,situational,radiocarbon,strongman,rowling,saloons,traffickers,overran,fribourg,cambrai,gravesend,discretionary,finitely,archetype,assessor,pilipinas,exhumed,invocation,interacted,digitized,timisoara,smelter,teton,sexism,precepts,srinagar,pilsudski,carmelite,hanau,scoreline,hernando,trekking,blogging,fanbase,wielded,vesicles,nationalization,banja,rafts,motoring,luang,takeda,girder,stimulates,histone,sunda,nanoparticles,attains,jumpers,catalogued,alluding,pontus,ancients,examiners,shinkansen,ribbentrop,reimbursement,pharmacological,ramat,stringed,imposes,cheaply,transplanted,taiping,mizoram,looms,wallabies,sideman,kootenay,encased,sportsnet,revolutionized,tangier,benthic,runic,pakistanis,heatseekers,shyam,mishnah,presbyterians,stadt,sutras,straddles,zoroastrian,infer,fueling,gymnasts,ofcom,gunfight,journeyman,tracklist,oshawa,ps500,pa'in,mackinac,xiongnu,mississippian,breckinridge,freemason,bight,autoroute,liberalization,distantly,thrillers,solomons,presumptive,romanization,anecdotal,bohemians,unpaved,milder,concurred,spinners,alphabets,strenuous,rivieres,kerrang,mistreatment,dismounted,intensively,carlist,dancehall,shunting,pluralism,trafficked,brokered,bonaventure,bromide,neckar,designates,malian,reverses,sotheby,sorghum,serine,environmentalists,languedoc,consulship,metering,bankstown,handlers,militiamen,conforming,regularity,pondicherry,armin,capsized,consejo,capitalists,drogheda,granular,purged,acadians,endocrine,intramural,elicit,terns,orientations,miklos,omitting,apocryphal,slapstick,brecon,pliocene,affords,typography,emigre,tsarist,tomasz,beset,nishi,necessitating,encyclical,roleplaying,journeyed,inflow,sprints,progressives,novosibirsk,cameroonian,ephesus,speckled,kinshasa,freiherr,burnaby,dalmatian,torrential,rigor,renegades,bhakti,nurburgring,cosimo,convincingly,reverting,visayas,lewisham,charlottetown,charadriiformesfamily,transferable,jodhpur,converters,deepening,camshaft,underdeveloped,protease,polonia,uterine,quantify,tobruk,dealerships,narasimha,fortran,inactivity,1780s,victors,categorised,naxos,workstation,skink,sardinian,chalice,precede,dammed,sondheim,phineas,tutored,sourcing,uncompromising,placer,tyneside,courtiers,proclaims,pharmacies,hyogo,booksellers,sengoku,kursk,spectrometer,countywide,wielkopolski,bobsleigh,shetty,llywelyn,consistory,heretics,guinean,cliches,individualism,monolithic,imams,usability,bursa,deliberations,railings,torchwood,inconsistency,balearic,stabilizer,demonstrator,facet,radioactivity,outboard,educates,d'oyly,heretical,handover,jurisdictional,shockwave,hispaniola,conceptually,routers,unaffiliated,trentino,formula_33,cypriots,intervenes,neuchatel,formulating,maggiore,delisted,alcohols,thessaly,potable,estimator,suborder,fluency,mimicry,clergymen,infrastructures,rivals.com,baroda,subplot,majlis,plano,clinching,connotation,carinae,savile,intercultural,transcriptional,sandstones,ailerons,annotations,impresario,heinkel,scriptural,intermodal,astrological,ribbed,northeastward,posited,boers,utilise,kalmar,phylum,breakwater,skype,textured,guideline,azeri,rimini,massed,subsidence,anomalous,wolfsburg,polyphonic,accrediting,vodacom,kirov,captaining,kelantan,logie,fervent,eamon,taper,bundeswehr,disproportionately,divination,slobodan,pundits,hispano,kinetics,reunites,makati,ceasing,statistician,amending,chiltern,eparchy,riverine,melanoma,narragansett,pagans,raged,toppled,breaching,zadar,holby,dacian,ochre,velodrome,disparities,amphoe,sedans,webpage,williamsport,lachlan,groton,baring,swastika,heliport,unwillingness,razorbacks,exhibitors,foodstuffs,impacting,tithe,appendages,dermot,subtypes,nurseries,balinese,simulating,stary,remakes,mundi,chautauqua,geologically,stockade,hakka,dilute,kalimantan,pahang,overlapped,fredericton,baha'u'llah,jahangir,damping,benefactors,shomali,triumphal,cieszyn,paradigms,shielded,reggaeton,maharishi,zambian,shearing,golestan,mirroring,partitioning,flyover,songbook,incandescent,merrimack,huguenots,sangeet,vulnerabilities,trademarked,drydock,tantric,honoris,queenstown,labelling,iterative,enlists,statesmen,anglicans,herge,qinghai,burgundian,islami,delineated,zhuge,aggregated,banknote,qatari,suitably,tapestries,asymptotic,charleroi,majorities,pyramidellidae,leanings,climactic,tahir,ramsar,suppressor,revisionist,trawler,ernakulam,penicillium,categorization,slits,entitlement,collegium,earths,benefice,pinochet,puritans,loudspeaker,stockhausen,eurocup,roskilde,alois,jaroslav,rhondda,boutiques,vigor,neurotransmitter,ansar,malden,ferdinando,sported,relented,intercession,camberwell,wettest,thunderbolts,positional,oriel,cloverleaf,penalized,shoshone,rajkumar,completeness,sharjah,chromosomal,belgians,woolen,ultrasonic,sequentially,boleyn,mordella,microsystems,initiator,elachista,mineralogy,rhododendron,integrals,compostela,hamza,sawmills,stadio,berlioz,maidens,stonework,yachting,tappeh,myocardial,laborer,workstations,costumed,nicaea,lanark,roundtable,mashhad,nablus,algonquian,stuyvesant,sarkar,heroines,diwan,laments,intonation,intrigues,almaty,feuded,grandes,algarve,rehabilitate,macrophages,cruciate,dismayed,heuristic,eliezer,kozhikode,covalent,finalised,dimorphism,yaroslavl,overtaking,leverkusen,middlebury,feeders,brookings,speculates,insoluble,lodgings,jozsef,cysteine,shenyang,habilitation,spurious,brainchild,mtdna,comique,albedo,recife,partick,broadening,shahi,orientated,himalaya,swabia,palme,mennonites,spokeswoman,conscripts,sepulchre,chartres,eurozone,scaffold,invertebrate,parishad,bagan,heian,watercolors,basse,supercomputer,commences,tarragona,plainfield,arthurian,functor,identically,murex,chronicling,pressings,burrowing,histoire,guayaquil,goalkeeping,differentiable,warburg,machining,aeneas,kanawha,holocene,ramesses,reprisal,qingdao,avatars,turkestan,cantatas,besieging,repudiated,teamsters,equipping,hydride,ahmadiyya,euston,bottleneck,computations,terengganu,kalinga,stela,rediscovery,'this,azhar,stylised,karelia,polyethylene,kansai,motorised,lounges,normalization,calculators,1700s,goalkeepers,unfolded,commissary,cubism,vignettes,multiverse,heaters,briton,sparingly,childcare,thorium,plock,riksdag,eunuchs,catalysis,limassol,perce,uncensored,whitlam,ulmus,unites,mesopotamian,refraction,biodiesel,forza,fulda,unseated,mountbatten,shahrak,selenium,osijek,mimicking,antimicrobial,axons,simulcasting,donizetti,swabian,sportsmen,hafiz,neared,heraclius,locates,evaded,subcarpathian,bhubaneswar,negeri,jagannath,thaksin,aydin,oromo,lateran,goldsmiths,multiculturalism,cilia,mihai,evangelists,lorient,qajar,polygons,vinod,mechanised,anglophone,prefabricated,mosses,supervillain,airliners,biofuels,iodide,innovators,valais,wilberforce,logarithm,intelligentsia,dissipation,sanctioning,duchies,aymara,porches,simulators,mostar,telepathic,coaxial,caithness,burghs,fourths,stratification,joaquim,scribes,meteorites,monarchist,germination,vries,desiring,replenishment,istria,winemaking,tammany,troupes,hetman,lanceolate,pelagic,triptych,primeira,scant,outbound,hyphae,denser,bentham,basie,normale,executes,ladislaus,kontinental,herat,cruiserweight,activision,customization,manoeuvres,inglewood,northwood,waveform,investiture,inpatient,alignments,kiryat,rabat,archimedes,ustad,monsanto,archetypal,kirkby,sikhism,correspondingly,catskill,overlaid,petrels,widowers,unicameral,federalists,metalcore,gamerankings,mussel,formula_34,lymphocytes,cystic,southgate,vestiges,immortals,kalam,strove,amazons,pocono,sociologists,sopwith,adheres,laurens,caregivers,inspecting,transylvanian,rebroadcast,rhenish,miserables,pyrams,blois,newtonian,carapace,redshirt,gotland,nazir,unilever,distortions,linebackers,federalism,mombasa,lumen,bernoulli,favouring,aligarh,denounce,steamboats,dnieper,stratigraphic,synths,bernese,umass,icebreaker,guanajuato,heisenberg,boldly,diodes,ladakh,dogmatic,scriptwriter,maritimes,battlestar,symposia,adaptable,toluca,bhavan,nanking,ieyasu,picardy,soybean,adalbert,brompton,deutsches,brezhnev,glandular,laotian,hispanicized,ibadan,personification,dalit,yamuna,regio,dispensed,yamagata,zweibrucken,revising,fandom,stances,participle,flavours,khitan,vertebral,crores,mayaguez,dispensation,guntur,undefined,harpercollins,unionism,meena,leveling,philippa,refractory,telstra,judea,attenuation,pylons,elaboration,elegy,edging,gracillariidae,residencies,absentia,reflexive,deportations,dichotomy,stoves,sanremo,shimon,menachem,corneal,conifers,mordellidae,facsimile,diagnoses,cowper,citta,viticulture,divisive,riverview,foals,mystics,polyhedron,plazas,airspeed,redgrave,motherland,impede,multiplicity,barrichello,airships,pharmacists,harvester,clays,payloads,differentiating,popularize,caesars,tunneling,stagnant,circadian,indemnity,sensibilities,musicology,prefects,serfs,metra,lillehammer,carmarthenshire,kiosks,welland,barbican,alkyl,tillandsia,gatherers,asociacion,showings,bharati,brandywine,subversion,scalable,pfizer,dawla,barium,dardanelles,nsdap,konig,ayutthaya,hodgkin,sedimentation,completions,purchasers,sponsorships,maximizing,banked,taoism,minot,enrolls,fructose,aspired,capuchin,outages,artois,carrollton,totality,osceola,pawtucket,fontainebleau,converged,queretaro,competencies,botha,allotments,sheaf,shastri,obliquely,banding,catharines,outwardly,monchengladbach,driest,contemplative,cassini,ranga,pundit,kenilworth,tiananmen,disulfide,formula_35,townlands,codice_3,looping,caravans,rachmaninoff,segmentation,fluorine,anglicised,gnostic,dessau,discern,reconfigured,altrincham,rebounding,battlecruiser,ramblers,1770s,convective,triomphe,miyagi,mourners,instagram,aloft,breastfeeding,courtyards,folkestone,changsha,kumamoto,saarland,grayish,provisionally,appomattox,uncial,classicism,mahindra,elapsed,supremes,monophyletic,cautioned,formula_36,noblewoman,kernels,sucre,swaps,bengaluru,grenfell,epicenter,rockhampton,worshipful,licentiate,metaphorical,malankara,amputated,wattle,palawan,tankobon,nobunaga,polyhedra,transduction,jilin,syrians,affinities,fluently,emanating,anglicized,sportscar,botanists,altona,dravida,chorley,allocations,kunming,luanda,premiering,outlived,mesoamerica,lingual,dissipating,impairments,attenborough,balustrade,emulator,bakhsh,cladding,increments,ascents,workington,qal'eh,winless,categorical,petrel,emphasise,dormer,toros,hijackers,telescopic,solidly,jankovic,cession,gurus,madoff,newry,subsystems,northside,talib,englishmen,farnese,holographic,electives,argonne,scrivener,predated,brugge,nauvoo,catalyses,soared,siddeley,graphically,powerlifting,funicular,sungai,coercive,fusing,uncertainties,locos,acetic,diverge,wedgwood,dressings,tiebreaker,didactic,vyacheslav,acreage,interplanetary,battlecruisers,sunbury,alkaloids,hairpin,automata,wielkie,interdiction,plugins,monkees,nudibranch,esporte,approximations,disabling,powering,characterisation,ecologically,martinsville,termen,perpetuated,lufthansa,ascendancy,motherboard,bolshoi,athanasius,prunus,dilution,invests,nonzero,mendocino,charan,banque,shaheed,counterculture,unita,voivode,hospitalization,vapour,supermarine,resistor,steppes,osnabruck,intermediates,benzodiazepines,sunnyside,privatized,geopolitical,ponta,beersheba,kievan,embody,theoretic,sangh,cartographer,blige,rotors,thruway,battlefields,discernible,demobilized,broodmare,colouration,sagas,policymakers,serialization,augmentation,hoare,frankfurter,transnistria,kinases,detachable,generational,converging,antiaircraft,khaki,bimonthly,coadjutor,arkhangelsk,kannur,buffers,livonian,northwich,enveloped,cysts,yokozuna,herne,beeching,enron,virginian,woollen,excepting,competitively,outtakes,recombinant,hillcrest,clearances,pathe,cumbersome,brasov,u.s.a,likud,christiania,cruciform,hierarchies,wandsworth,lupin,resins,voiceover,sitar,electrochemical,mediacorp,typhus,grenadiers,hepatic,pompeii,weightlifter,bosniak,oxidoreductase,undersecretary,rescuers,ranji,seleucid,analysing,exegesis,tenancy,toure,kristiansand,110th,carillon,minesweepers,poitou,acceded,palladian,redevelop,naismith,rifled,proletariat,shojo,hackensack,harvests,endpoint,kuban,rosenborg,stonehenge,authorisation,jacobean,revocation,compatriots,colliding,undetermined,okayama,acknowledgment,angelou,fresnel,chahar,ethereal,mg/kg,emmet,mobilised,unfavourable,cultura,characterizing,parsonage,skeptics,expressways,rabaul,medea,guardsmen,visakhapatnam,caddo,homophobic,elmwood,encircling,coexistence,contending,seljuk,mycologist,infertility,moliere,insolvent,covenants,underpass,holme,landesliga,workplaces,delinquency,methamphetamine,contrived,tableau,tithes,overlying,usurped,contingents,spares,oligocene,molde,beatification,mordechai,balloting,pampanga,navigators,flowered,debutant,codec,orogeny,newsletters,solon,ambivalent,ubisoft,archdeaconry,harpers,kirkus,jabal,castings,kazhagam,sylhet,yuwen,barnstaple,amidships,causative,isuzu,watchtower,granules,canaveral,remuneration,insurer,payout,horizonte,integrative,attributing,kiwis,skanderbeg,asymmetry,gannett,urbanism,disassembled,unaltered,precluded,melodifestivalen,ascends,plugin,gurkha,bisons,stakeholder,industrialisation,abbotsford,sextet,bustling,uptempo,slavia,choreographers,midwives,haram,javed,gazetteer,subsection,natively,weighting,lysine,meera,redbridge,muchmusic,abruzzo,adjoins,unsustainable,foresters,kbit/s,cosmopterigidae,secularism,poetics,causality,phonograph,estudiantes,ceausescu,universitario,adjoint,applicability,gastropods,nagaland,kentish,mechelen,atalanta,woodpeckers,lombards,gatineau,romansh,avraham,acetylcholine,perturbation,galois,wenceslaus,fuzhou,meandering,dendritic,sacristy,accented,katha,therapeutics,perceives,unskilled,greenhouses,analogues,chaldean,timbre,sloped,volodymyr,sadiq,maghreb,monogram,rearguard,caucuses,mures,metabolite,uyezd,determinism,theosophical,corbet,gaels,disruptions,bicameral,ribosomal,wolseley,clarksville,watersheds,tarsi,radon,milanese,discontinuous,aristotelian,whistleblower,representational,hashim,modestly,localised,atrial,hazara,ravana,troyes,appointees,rubus,morningside,amity,aberdare,ganglia,wests,zbigniew,aerobatic,depopulated,corsican,introspective,twinning,hardtop,shallower,cataract,mesolithic,emblematic,graced,lubrication,republicanism,voronezh,bastions,meissen,irkutsk,oboes,hokkien,sprites,tenet,individualist,capitulated,oakville,dysentery,orientalist,hillsides,keywords,elicited,incised,lagging,apoel,lengthening,attractiveness,marauders,sportswriter,decentralization,boltzmann,contradicts,draftsman,precipitate,solihull,norske,consorts,hauptmann,riflemen,adventists,syndromes,demolishing,customize,continuo,peripherals,seamlessly,linguistically,bhushan,orphanages,paraul,lessened,devanagari,quarto,responders,patronymic,riemannian,altoona,canonization,honouring,geodetic,exemplifies,republica,enzymatic,porters,fairmount,pampa,sufferers,kamchatka,conjugated,coachella,uthman,repositories,copious,headteacher,awami,phoneme,homomorphism,franconian,moorland,davos,quantified,kamloops,quarks,mayoralty,weald,peacekeepers,valerian,particulate,insiders,perthshire,caches,guimaraes,piped,grenadines,kosciuszko,trombonist,artemisia,covariance,intertidal,soybeans,beatified,ellipse,fruiting,deafness,dnipropetrovsk,accrued,zealous,mandala,causation,junius,kilowatt,bakeries,montpelier,airdrie,rectified,bungalows,toleration,debian,pylon,trotskyist,posteriorly,two-and-a-half,herbivorous,islamists,poetical,donne,wodehouse,frome,allium,assimilate,phonemic,minaret,unprofitable,darpa,untenable,leaflet,bitcoin,zahir,thresholds,argentino,jacopo,bespoke,stratified,wellbeing,shiite,basaltic,timberwolves,secrete,taunts,marathons,isomers,carre,consecrators,penobscot,pitcairn,sakha,crosstown,inclusions,impassable,fenders,indre,uscgc,jordi,retinue,logarithmic,pilgrimages,railcar,cashel,blackrock,macroscopic,aligning,tabla,trestle,certify,ronson,palps,dissolves,thickened,silicate,taman,walsingham,hausa,lowestoft,rondo,oleksandr,cuyahoga,retardation,countering,cricketing,holborn,identifiers,hells,geophysics,infighting,sculpting,balaji,webbed,irradiation,runestone,trusses,oriya,sojourn,forfeiture,colonize,exclaimed,eucharistic,lackluster,glazing,northridge,gutenberg,stipulates,macroeconomic,priori,outermost,annular,udinese,insulating,headliner,godel,polytope,megalithic,salix,sharapova,derided,muskegon,braintree,plateaus,confers,autocratic,isomer,interstitial,stamping,omits,kirtland,hatchery,evidences,intifada,111th,podgorica,capua,motivating,nuneaton,jakub,korsakov,amitabh,mundial,monrovia,gluten,predictor,marshalling,d'orleans,levers,touchscreen,brantford,fricative,banishment,descendent,antagonism,ludovico,loudspeakers,formula_37,livelihoods,manassas,steamships,dewsbury,uppermost,humayun,lures,pinnacles,dependents,lecce,clumps,observatories,paleozoic,dedicating,samiti,draughtsman,gauls,incite,infringing,nepean,pythagorean,convents,triumvirate,seigneur,gaiman,vagrant,fossa,byproduct,serrated,renfrewshire,sheltering,achaemenid,dukedom,catchers,sampdoria,platelet,bielefeld,fluctuating,phenomenology,strikeout,ethnology,prospectors,woodworking,tatra,wildfires,meditations,agrippa,fortescue,qureshi,wojciech,methyltransferase,accusative,saatchi,amerindian,volcanism,zeeland,toyama,vladimirovich,allege,polygram,redox,budgeted,advisories,nematode,chipset,starscream,tonbridge,hardening,shales,accompanist,paraded,phonographic,whitefish,sportive,audiobook,kalisz,hibernation,latif,duels,ps200,coxeter,nayak,safeguarding,cantabria,minesweeping,zeiss,dunams,catholicos,sawtooth,ontological,nicobar,bridgend,unclassified,intrinsically,hanoverian,rabbitohs,kenseth,alcalde,northumbrian,raritan,septuagint,presse,sevres,origen,dandenong,peachtree,intersected,impeded,usages,hippodrome,novara,trajectories,customarily,yardage,inflected,yanow,kalan,taverns,liguria,librettist,intermarriage,1760s,courant,gambier,infanta,ptolemaic,ukulele,haganah,sceptical,manchukuo,plexus,implantation,hilal,intersex,efficiencies,arbroath,hagerstown,adelphi,diario,marais,matti,lifes,coining,modalities,divya,bletchley,conserving,ivorian,mithridates,generative,strikeforce,laymen,toponymy,pogrom,satya,meticulously,agios,dufferin,yaakov,fortnightly,cargoes,deterrence,prefrontal,przemysl,mitterrand,commemorations,chatsworth,gurdwara,abuja,chakraborty,badajoz,geometries,artiste,diatonic,ganglion,presides,marymount,nanak,cytokines,feudalism,storks,rowers,widens,politico,evangelicals,assailants,pittsfield,allowable,bijapur,telenovelas,dichomeris,glenelg,herbivores,keita,inked,radom,fundraisers,constantius,boheme,portability,komnenos,crystallography,derrida,moderates,tavistock,fateh,spacex,disjoint,bristles,commercialized,interwoven,empirically,regius,bulacan,newsday,showa,radicalism,yarrow,pleura,sayed,structuring,cotes,reminiscences,acetyl,edicts,escalators,aomori,encapsulated,legacies,bunbury,placings,fearsome,postscript,powerfully,keighley,hildesheim,amicus,crevices,deserters,benelux,aurangabad,freeware,ioannis,carpathians,chirac,seceded,prepaid,landlocked,naturalised,yanukovych,soundscan,blotch,phenotypic,determinants,twente,dictatorial,giessen,composes,recherche,pathophysiology,inventories,ayurveda,elevating,gravestone,degeneres,vilayet,popularizing,spartanburg,bloemfontein,previewed,renunciation,genotype,ogilvy,tracery,blacklisted,emissaries,diploid,disclosures,tupolev,shinjuku,antecedents,pennine,braganza,bhattacharya,countable,spectroscopic,ingolstadt,theseus,corroborated,compounding,thrombosis,extremadura,medallions,hasanabad,lambton,perpetuity,glycol,besancon,palaiologos,pandey,caicos,antecedent,stratum,laserdisc,novitiate,crowdfunding,palatal,sorceress,dassault,toughness,celle,cezanne,vientiane,tioga,hander,crossbar,gisborne,cursor,inspectorate,serif,praia,sphingidae,nameplate,psalter,ivanovic,sitka,equalised,mutineers,sergius,outgrowth,creationism,haredi,rhizomes,predominate,undertakings,vulgate,hydrothermal,abbeville,geodesic,kampung,physiotherapy,unauthorised,asteraceae,conservationist,minoan,supersport,mohammadabad,cranbrook,mentorship,legitimately,marshland,datuk,louvain,potawatomi,carnivores,levies,lyell,hymnal,regionals,tinto,shikoku,conformal,wanganui,beira,lleida,standstill,deloitte,formula_40,corbusier,chancellery,mixtapes,airtime,muhlenberg,formula_39,bracts,thrashers,prodigious,gironde,chickamauga,uyghurs,substitutions,pescara,batangas,gregarious,gijon,paleo,mathura,pumas,proportionally,hawkesbury,yucca,kristiania,funimation,fluted,eloquence,mohun,aftermarket,chroniclers,futurist,nonconformist,branko,mannerisms,lesnar,opengl,altos,retainers,ashfield,shelbourne,sulaiman,divisie,gwent,locarno,lieder,minkowski,bivalve,redeployed,cartography,seaway,bookings,decays,ostend,antiquaries,pathogenesis,formula_38,chrysalis,esperance,valli,motogp,homelands,bridged,bloor,ghazal,vulgaris,baekje,prospector,calculates,debtors,hesperiidae,titian,returner,landgrave,frontenac,kelowna,pregame,castelo,caius,canoeist,watercolours,winterthur,superintendents,dissonance,dubstep,adorn,matic,salih,hillel,swordsman,flavoured,emitter,assays,monongahela,deeded,brazzaville,sufferings,babylonia,fecal,umbria,astrologer,gentrification,frescos,phasing,zielona,ecozone,candido,manoj,quadrilateral,gyula,falsetto,prewar,puntland,infinitive,contraceptive,bakhtiari,ohrid,socialization,tailplane,evoking,havelock,macapagal,plundering,104th,keynesian,templars,phrasing,morphologically,czestochowa,humorously,catawba,burgas,chiswick,ellipsoid,kodansha,inwards,gautama,katanga,orthopaedic,heilongjiang,sieges,outsourced,subterminal,vijayawada,hares,oration,leitrim,ravines,manawatu,cryogenic,tracklisting,about.com,ambedkar,degenerated,hastened,venturing,lobbyists,shekhar,typefaces,northcote,rugen,'good,ornithology,asexual,hemispheres,unsupported,glyphs,spoleto,epigenetic,musicianship,donington,diogo,kangxi,bisected,polymorphism,megawatt,salta,embossed,cheetahs,cruzeiro,unhcr,aristide,rayleigh,maturing,indonesians,noire,llano,ffffff,camus,purges,annales,convair,apostasy,algol,phage,apaches,marketers,aldehyde,pompidou,kharkov,forgeries,praetorian,divested,retrospectively,gornji,scutellum,bitumen,pausanias,magnification,imitations,nyasaland,geographers,floodlights,athlone,hippolyte,expositions,clarinetist,razak,neutrinos,rotax,sheykh,plush,interconnect,andalus,cladogram,rudyard,resonator,granby,blackfriars,placido,windscreen,sahel,minamoto,haida,cations,emden,blackheath,thematically,blacklist,pawel,disseminating,academical,undamaged,raytheon,harsher,powhatan,ramachandran,saddles,paderborn,capping,zahra,prospecting,glycine,chromatin,profane,banska,helmand,okinawan,dislocation,oscillators,insectivorous,foyle,gilgit,autonomic,tuareg,sluice,pollinated,multiplexed,granary,narcissus,ranchi,staines,nitra,goalscoring,midwifery,pensioners,algorithmic,meetinghouse,biblioteca,besar,narva,angkor,predate,lohan,cyclical,detainee,occipital,eventing,faisalabad,dartmoor,kublai,courtly,resigns,radii,megachilidae,cartels,shortfall,xhosa,unregistered,benchmarks,dystopian,bulkhead,ponsonby,jovanovic,accumulates,papuan,bhutanese,intuitively,gotaland,headliners,recursion,dejan,novellas,diphthongs,imbued,withstood,analgesic,amplify,powertrain,programing,maidan,alstom,affirms,eradicated,summerslam,videogame,molla,severing,foundered,gallium,atmospheres,desalination,shmuel,howmeh,catolica,bossier,reconstructing,isolates,lyase,tweets,unconnected,tidewater,divisible,cohorts,orebro,presov,furnishing,folklorist,simplifying,centrale,notations,factorization,monarchies,deepen,macomb,facilitation,hennepin,declassified,redrawn,microprocessors,preliminaries,enlarging,timeframe,deutschen,shipbuilders,patiala,ferrous,aquariums,genealogies,vieux,unrecognized,bridgwater,tetrahedral,thule,resignations,gondwana,registries,agder,dataset,felled,parva,analyzer,worsen,coleraine,columella,blockaded,polytechnique,reassembled,reentry,narvik,greys,nigra,knockouts,bofors,gniezno,slotted,hamasaki,ferrers,conferring,thirdly,domestication,photojournalist,universality,preclude,ponting,halved,thereupon,photosynthetic,ostrava,mismatch,pangasinan,intermediaries,abolitionists,transited,headings,ustase,radiological,interconnection,dabrowa,invariants,honorius,preferentially,chantilly,marysville,dialectical,antioquia,abstained,gogol,dirichlet,muricidae,symmetries,reproduces,brazos,fatwa,bacillus,ketone,paribas,chowk,multiplicative,dermatitis,mamluks,devotes,adenosine,newbery,meditative,minefields,inflection,oxfam,conwy,bystrica,imprints,pandavas,infinitesimal,conurbation,amphetamine,reestablish,furth,edessa,injustices,frankston,serjeant,4x200,khazar,sihanouk,longchamp,stags,pogroms,coups,upperparts,endpoints,infringed,nuanced,summing,humorist,pacification,ciaran,jamaat,anteriorly,roddick,springboks,faceted,hypoxia,rigorously,cleves,fatimid,ayurvedic,tabled,ratna,senhora,maricopa,seibu,gauguin,holomorphic,campgrounds,amboy,coordinators,ponderosa,casemates,ouachita,nanaimo,mindoro,zealander,rimsky,cluny,tomaszow,meghalaya,caetano,tilak,roussillon,landtag,gravitation,dystrophy,cephalopods,trombones,glens,killarney,denominated,anthropogenic,pssas,roubaix,carcasses,montmorency,neotropical,communicative,rabindranath,ordinated,separable,overriding,surged,sagebrush,conciliation,codice_4,durrani,phosphatase,qadir,votive,revitalized,taiyuan,tyrannosaurus,graze,slovaks,nematodes,environmentalism,blockhouse,illiteracy,schengen,ecotourism,alternation,conic,wields,hounslow,blackfoot,kwame,ambulatory,volhynia,hordaland,croton,piedras,rohit,drava,conceptualized,birla,illustrative,gurgaon,barisal,tutsi,dezong,nasional,polje,chanson,clarinets,krasnoyarsk,aleksandrovich,cosmonaut,d'este,palliative,midseason,silencing,wardens,durer,girders,salamanders,torrington,supersonics,lauda,farid,circumnavigation,embankments,funnels,bajnoksag,lorries,cappadocia,jains,warringah,retirees,burgesses,equalization,cusco,ganesan,algal,amazonian,lineups,allocating,conquerors,usurper,mnemonic,predating,brahmaputra,ahmadabad,maidenhead,numismatic,subregion,encamped,reciprocating,freebsd,irgun,tortoises,governorates,zionists,airfoil,collated,ajmer,fiennes,etymological,polemic,chadian,clerestory,nordiques,fluctuated,calvados,oxidizing,trailhead,massena,quarrels,dordogne,tirunelveli,pyruvate,pulsed,athabasca,sylar,appointee,serer,japonica,andronikos,conferencing,nicolaus,chemin,ascertained,incited,woodbine,helices,hospitalised,emplacements,to/from,orchestre,tyrannical,pannonia,methodism,pop/rock,shibuya,berbers,despot,seaward,westpac,separator,perpignan,alamein,judeo,publicize,quantization,ethniki,gracilis,menlo,offside,oscillating,unregulated,succumbing,finnmark,metrical,suleyman,raith,sovereigns,bundesstrasse,kartli,fiduciary,darshan,foramen,curler,concubines,calvinism,larouche,bukhara,sophomores,mohanlal,lutheranism,monomer,eamonn,'black,uncontested,immersive,tutorials,beachhead,bindings,permeable,postulates,comite,transformative,indiscriminate,hofstra,associacao,amarna,dermatology,lapland,aosta,babur,unambiguous,formatting,schoolboys,gwangju,superconducting,replayed,adherent,aureus,compressors,forcible,spitsbergen,boulevards,budgeting,nossa,annandale,perumal,interregnum,sassoon,kwajalein,greenbrier,caldas,triangulation,flavius,increment,shakhtar,nullified,pinfall,nomen,microfinance,depreciation,cubist,steeper,splendour,gruppe,everyman,chasers,campaigners,bridle,modality,percussive,darkly,capes,velar,picton,triennial,factional,padang,toponym,betterment,norepinephrine,112th,estuarine,diemen,warehousing,morphism,ideologically,pairings,immunization,crassus,exporters,sefer,flocked,bulbous,deseret,booms,calcite,bohol,elven,groot,pulau,citigroup,wyeth,modernizing,layering,pastiche,complies,printmaker,condenser,theropod,cassino,oxyrhynchus,akademie,trainings,lowercase,coxae,parte,chetniks,pentagonal,keselowski,monocoque,morsi,reticulum,meiosis,clapboard,recoveries,tinge,an/fps,revista,sidon,livre,epidermis,conglomerates,kampong,congruent,harlequins,tergum,simplifies,epidemiological,underwriting,tcp/ip,exclusivity,multidimensional,mysql,columbine,ecologist,hayat,sicilies,levees,handset,aesop,usenet,pacquiao,archiving,alexandrian,compensatory,broadsheet,annotation,bahamian,d'affaires,interludes,phraya,shamans,marmara,customizable,immortalized,ambushes,chlorophyll,diesels,emulsion,rheumatoid,voluminous,screenwriters,tailoring,sedis,runcorn,democratization,bushehr,anacostia,constanta,antiquary,sixtus,radiate,advaita,antimony,acumen,barristers,reichsbahn,ronstadt,symbolist,pasig,cursive,secessionist,afrikaner,munnetra,inversely,adsorption,syllabic,moltke,idioms,midline,olimpico,diphosphate,cautions,radziwill,mobilisation,copelatus,trawlers,unicron,bhaskar,financiers,minimalism,derailment,marxists,oireachtas,abdicate,eigenvalue,zafar,vytautas,ganguly,chelyabinsk,telluride,subordination,ferried,dived,vendee,pictish,dimitrov,expiry,carnation,cayley,magnitudes,lismore,gretna,sandwiched,unmasked,sandomierz,swarthmore,tetra,nanyang,pevsner,dehradun,mormonism,rashi,complying,seaplanes,ningbo,cooperates,strathcona,mornington,mestizo,yulia,edgbaston,palisade,ethno,polytopes,espirito,tymoshenko,pronunciations,paradoxical,taichung,chipmunks,erhard,maximise,accretion,kanda,`abdu'l,narrowest,umpiring,mycenaean,divisor,geneticist,ceredigion,barque,hobbyists,equates,auxerre,spinose,cheil,sweetwater,guano,carboxylic,archiv,tannery,cormorant,agonists,fundacion,anbar,tunku,hindrance,meerut,concordat,secunderabad,kachin,achievable,murfreesboro,comprehensively,forges,broadest,synchronised,speciation,scapa,aliyev,conmebol,tirelessly,subjugated,pillaged,udaipur,defensively,lakhs,stateless,haasan,headlamps,patterning,podiums,polyphony,mcmurdo,mujer,vocally,storeyed,mucosa,multivariate,scopus,minimizes,formalised,certiorari,bourges,populate,overhanging,gaiety,unreserved,borromeo,woolworths,isotopic,bashar,purify,vertebra,medan,juxtaposition,earthwork,elongation,chaudhary,schematic,piast,steeped,nanotubes,fouls,achaea,legionnaires,abdur,qmjhl,embraer,hardback,centerville,ilocos,slovan,whitehorse,mauritian,moulding,mapuche,donned,provisioning,gazprom,jonesboro,audley,lightest,calyx,coldwater,trigonometric,petroglyphs,psychoanalyst,congregate,zambezi,fissure,supervises,bexley,etobicoke,wairarapa,tectonics,emphasises,formula_41,debugging,linfield,spatially,ionizing,ungulates,orinoco,clades,erlangen,news/talk,vols.,ceara,yakovlev,finsbury,entanglement,fieldhouse,graphene,intensifying,grigory,keyong,zacatecas,ninian,allgemeine,keswick,societa,snorri,femininity,najib,monoclonal,guyanese,postulate,huntly,abbeys,machinist,yunus,emphasising,ishaq,urmia,bremerton,pretenders,lumiere,thoroughfares,chikara,dramatized,metathorax,taiko,transcendence,wycliffe,retrieves,umpired,steuben,racehorses,taylors,kuznetsov,montezuma,precambrian,canopies,gaozong,propodeum,disestablished,retroactive,shoreham,rhizome,doubleheader,clinician,diwali,quartzite,shabaab,agassiz,despatched,stormwater,luxemburg,callao,universidade,courland,skane,glyph,dormers,witwatersrand,curacy,qualcomm,nansen,entablature,lauper,hausdorff,lusaka,ruthenian,360deg,cityscape,douai,vaishnava,spars,vaulting,rationalist,gygax,sequestration,typology,pollinates,accelerators,leben,colonials,cenotaph,imparted,carthaginians,equaled,rostrum,gobind,bodhisattva,oberst,bicycling,arabi,sangre,biophysics,hainaut,vernal,lunenburg,apportioned,finches,lajos,nenad,repackaged,zayed,nikephoros,r.e.m,swaminarayan,gestalt,unplaced,crags,grohl,sialkot,unsaturated,gwinnett,linemen,forays,palakkad,writs,instrumentalists,aircrews,badged,terrapins,180deg,oneness,commissariat,changi,pupation,circumscribed,contador,isotropic,administrated,fiefs,nimes,intrusions,minoru,geschichte,nadph,tainan,changchun,carbondale,frisia,swapo,evesham,hawai'i,encyclopedic,transporters,dysplasia,formula_42,onsite,jindal,guetta,judgements,narbonne,permissions,paleogene,rationalism,vilna,isometric,subtracted,chattahoochee,lamina,missa,greville,pervez,lattices,persistently,crystallization,timbered,hawaiians,fouling,interrelated,masood,ripening,stasi,gamal,visigothic,warlike,cybernetics,tanjung,forfar,cybernetic,karelian,brooklands,belfort,greifswald,campeche,inexplicably,refereeing,understory,uninterested,prius,collegiately,sefid,sarsfield,categorize,biannual,elsevier,eisteddfod,declension,autonoma,procuring,misrepresentation,novelization,bibliographic,shamanism,vestments,potash,eastleigh,ionized,turan,lavishly,scilly,balanchine,importers,parlance,'that,kanyakumari,synods,mieszko,crossovers,serfdom,conformational,legislated,exclave,heathland,sadar,differentiates,propositional,konstantinos,photoshop,manche,vellore,appalachia,orestes,taiga,exchanger,grozny,invalidated,baffin,spezia,staunchly,eisenach,robustness,virtuosity,ciphers,inlets,bolagh,understandings,bosniaks,parser,typhoons,sinan,luzerne,webcomic,subtraction,jhelum,businessweek,ceske,refrained,firebox,mitigated,helmholtz,dilip,eslamabad,metalwork,lucan,apportionment,provident,gdynia,schooners,casement,danse,hajjiabad,benazir,buttress,anthracite,newsreel,wollaston,dispatching,cadastral,riverboat,provincetown,nantwich,missal,irreverent,juxtaposed,darya,ennobled,electropop,stereoscopic,maneuverability,laban,luhansk,udine,collectibles,haulage,holyrood,materially,supercharger,gorizia,shkoder,townhouses,pilate,layoffs,folkloric,dialectic,exuberant,matures,malla,ceuta,citizenry,crewed,couplet,stopover,transposition,tradesmen,antioxidant,amines,utterance,grahame,landless,isere,diction,appellant,satirist,urbino,intertoto,subiaco,antonescu,nehemiah,ubiquitin,emcee,stourbridge,fencers,103rd,wranglers,monteverdi,watertight,expounded,xiamen,manmohan,pirie,threefold,antidepressant,sheboygan,grieg,cancerous,diverging,bernini,polychrome,fundamentalism,bihari,critiqued,cholas,villers,tendulkar,dafydd,vastra,fringed,evangelization,episcopalian,maliki,sana'a,ashburton,trianon,allegany,heptathlon,insufficiently,panelists,pharrell,hexham,amharic,fertilized,plumes,cistern,stratigraphy,akershus,catalans,karoo,rupee,minuteman,quantification,wigmore,leutnant,metanotum,weeknights,iridescent,extrasolar,brechin,deuterium,kuching,lyricism,astrakhan,brookhaven,euphorbia,hradec,bhagat,vardar,aylmer,positron,amygdala,speculators,unaccompanied,debrecen,slurry,windhoek,disaffected,rapporteur,mellitus,blockers,fronds,yatra,sportsperson,precession,physiologist,weeknight,pidgin,pharma,condemns,standardize,zetian,tibor,glycoprotein,emporia,cormorants,amalie,accesses,leonhard,denbighshire,roald,116th,will.i.am,symbiosis,privatised,meanders,chemnitz,jabalpur,shing,secede,ludvig,krajina,homegrown,snippets,sasanian,euripides,peder,cimarron,streaked,graubunden,kilimanjaro,mbeki,middleware,flensburg,bukovina,lindwall,marsalis,profited,abkhaz,polis,camouflaged,amyloid,morgantown,ovoid,bodleian,morte,quashed,gamelan,juventud,natchitoches,storyboard,freeview,enumeration,cielo,preludes,bulawayo,1600s,olympiads,multicast,faunal,asura,reinforces,puranas,ziegfeld,handicraft,seamount,kheil,noche,hallmarks,dermal,colorectal,encircle,hessen,umbilicus,sunnis,leste,unwin,disclosing,superfund,montmartre,refuelling,subprime,kolhapur,etiology,bismuth,laissez,vibrational,mazar,alcoa,rumsfeld,recurve,ticonderoga,lionsgate,onlookers,homesteads,filesystem,barometric,kingswood,biofuel,belleza,moshav,occidentalis,asymptomatic,northeasterly,leveson,huygens,numan,kingsway,primogeniture,toyotomi,yazoo,limpets,greenbelt,booed,concurrence,dihedral,ventrites,raipur,sibiu,plotters,kitab,109th,trackbed,skilful,berthed,effendi,fairing,sephardi,mikhailovich,lockyer,wadham,invertible,paperbacks,alphabetic,deuteronomy,constitutive,leathery,greyhounds,estoril,beechcraft,poblacion,cossidae,excreted,flamingos,singha,olmec,neurotransmitters,ascoli,nkrumah,forerunners,dualism,disenchanted,benefitted,centrum,undesignated,noida,o'donoghue,collages,egrets,egmont,wuppertal,cleave,montgomerie,pseudomonas,srinivasa,lymphatic,stadia,resold,minima,evacuees,consumerism,ronde,biochemist,automorphism,hollows,smuts,improvisations,vespasian,bream,pimlico,eglin,colne,melancholic,berhad,ousting,saale,notaulices,ouest,hunslet,tiberias,abdomina,ramsgate,stanislas,donbass,pontefract,sucrose,halts,drammen,chelm,l'arc,taming,trolleys,konin,incertae,licensees,scythian,giorgos,dative,tanglewood,farmlands,o'keeffe,caesium,romsdal,amstrad,corte,oglethorpe,huntingdonshire,magnetization,adapts,zamosc,shooto,cuttack,centrepiece,storehouse,winehouse,morbidity,woodcuts,ryazan,buddleja,buoyant,bodmin,estero,austral,verifiable,periyar,christendom,curtail,shura,kaifeng,cotswold,invariance,seafaring,gorica,androgen,usman,seabird,forecourt,pekka,juridical,audacious,yasser,cacti,qianlong,polemical,d'amore,espanyol,distrito,cartographers,pacifism,serpents,backa,nucleophilic,overturning,duplicates,marksman,oriente,vuitton,oberleutnant,gielgud,gesta,swinburne,transfiguration,1750s,retaken,celje,fredrikstad,asuka,cropping,mansard,donates,blacksmiths,vijayanagara,anuradhapura,germinate,betis,foreshore,jalandhar,bayonets,devaluation,frazione,ablaze,abidjan,approvals,homeostasis,corollary,auden,superfast,redcliffe,luxembourgish,datum,geraldton,printings,ludhiana,honoree,synchrotron,invercargill,hurriedly,108th,three-and-a-half,colonist,bexar,limousin,bessemer,ossetian,nunataks,buddhas,rebuked,thais,tilburg,verdicts,interleukin,unproven,dordrecht,solent,acclamation,muammar,dahomey,operettas,4x400,arrears,negotiators,whitehaven,apparitions,armoury,psychoactive,worshipers,sculptured,elphinstone,airshow,kjell,o'callaghan,shrank,professorships,predominance,subhash,coulomb,sekolah,retrofitted,samos,overthrowing,vibrato,resistors,palearctic,datasets,doordarshan,subcutaneous,compiles,immorality,patchwork,trinidadian,glycogen,pronged,zohar,visigoths,freres,akram,justo,agora,intakes,craiova,playwriting,bukhari,militarism,iwate,petitioners,harun,wisla,inefficiency,vendome,ledges,schopenhauer,kashi,entombed,assesses,tenn.,noumea,baguio,carex,o'donovan,filings,hillsdale,conjectures,blotches,annuals,lindisfarne,negated,vivek,angouleme,trincomalee,cofactor,verkhovna,backfield,twofold,automaker,rudra,freighters,darul,gharana,busway,formula_43,plattsburgh,portuguesa,showrunner,roadmap,valenciennes,erdos,biafra,spiritualism,transactional,modifies,carne,107th,cocos,gcses,tiverton,radiotherapy,meadowlands,gunma,srebrenica,foxtel,authenticated,enslavement,classicist,klaipeda,minstrels,searchable,infantrymen,incitement,shiga,nadp+,urals,guilders,banquets,exteriors,counterattacks,visualized,diacritics,patrimony,svensson,transepts,prizren,telegraphy,najaf,emblazoned,coupes,effluent,ragam,omani,greensburg,taino,flintshire,cd/dvd,lobbies,narrating,cacao,seafarers,bicolor,collaboratively,suraj,floodlit,sacral,puppetry,tlingit,malwa,login,motionless,thien,overseers,vihar,golem,specializations,bathhouse,priming,overdubs,winningest,archetypes,uniao,acland,creamery,slovakian,lithographs,maryborough,confidently,excavating,stillborn,ramallah,audiencia,alava,ternary,hermits,rostam,bauxite,gawain,lothair,captions,gulfstream,timelines,receded,mediating,petain,bastia,rudbar,bidders,disclaimer,shrews,tailings,trilobites,yuriy,jamil,demotion,gynecology,rajinikanth,madrigals,ghazni,flycatchers,vitebsk,bizet,computationally,kashgar,refinements,frankford,heralds,europe/africa,levante,disordered,sandringham,queues,ransacked,trebizond,verdes,comedie,primitives,figurine,organists,culminate,gosport,coagulation,ferrying,hoyas,polyurethane,prohibitive,midfielders,ligase,progesterone,defectors,sweetened,backcountry,diodorus,waterside,nieuport,khwaja,jurong,decried,gorkha,ismaili,300th,octahedral,kindergartens,paseo,codification,notifications,disregarding,risque,reconquista,shortland,atolls,texarkana,perceval,d'etudes,kanal,herbicides,tikva,nuova,gatherer,dissented,soweto,dexterity,enver,bacharach,placekicker,carnivals,automate,maynooth,symplectic,chetnik,militaire,upanishads,distributive,strafing,championing,moiety,miliband,blackadder,enforceable,maung,dimer,stadtbahn,diverges,obstructions,coleophoridae,disposals,shamrocks,aural,banca,bahru,coxed,grierson,vanadium,watermill,radiative,ecoregions,berets,hariri,bicarbonate,evacuations,mallee,nairn,rushden,loggia,slupsk,satisfactorily,milliseconds,cariboo,reine,cyclo,pigmentation,postmodernism,aqueducts,vasari,bourgogne,dilemmas,liquefied,fluminense,alloa,ibaraki,tenements,kumasi,humerus,raghu,labours,putsch,soundcloud,bodybuilder,rakyat,domitian,pesaro,translocation,sembilan,homeric,enforcers,tombstones,lectureship,rotorua,salamis,nikolaos,inferences,superfortress,lithgow,surmised,undercard,tarnow,barisan,stingrays,federacion,coldstream,haverford,ornithological,heerenveen,eleazar,jyoti,murali,bamako,riverbed,subsidised,theban,conspicuously,vistas,conservatorium,madrasa,kingfishers,arnulf,credential,syndicalist,sheathed,discontinuity,prisms,tsushima,coastlines,escapees,vitis,optimizing,megapixel,overground,embattled,halide,sprinters,buoys,mpumalanga,peculiarities,106th,roamed,menezes,macao,prelates,papyri,freemen,dissertations,irishmen,pooled,sverre,reconquest,conveyance,subjectivity,asturian,circassian,formula_45,comdr,thickets,unstressed,monro,passively,harmonium,moveable,dinar,carlsson,elysees,chairing,b'nai,confusingly,kaoru,convolution,godolphin,facilitator,saxophones,eelam,jebel,copulation,anions,livres,licensure,pontypridd,arakan,controllable,alessandria,propelling,stellenbosch,tiber,wolka,liberators,yarns,d'azur,tsinghua,semnan,amhara,ablation,melies,tonality,historique,beeston,kahne,intricately,sonoran,robespierre,gyrus,boycotts,defaulted,infill,maranhao,emigres,framingham,paraiba,wilhelmshaven,tritium,skyway,labial,supplementation,possessor,underserved,motets,maldivian,marrakech,quays,wikimedia,turbojet,demobilization,petrarch,encroaching,sloops,masted,karbala,corvallis,agribusiness,seaford,stenosis,hieronymus,irani,superdraft,baronies,cortisol,notability,veena,pontic,cyclin,archeologists,newham,culled,concurring,aeolian,manorial,shouldered,fords,philanthropists,105th,siddharth,gotthard,halim,rajshahi,jurchen,detritus,practicable,earthenware,discarding,travelogue,neuromuscular,elkhart,raeder,zygmunt,metastasis,internees,102nd,vigour,upmarket,summarizing,subjunctive,offsets,elizabethtown,udupi,pardubice,repeaters,instituting,archaea,substandard,technische,linga,anatomist,flourishes,velika,tenochtitlan,evangelistic,fitchburg,springbok,cascading,hydrostatic,avars,occasioned,filipina,perceiving,shimbun,africanus,consternation,tsing,optically,beitar,45deg,abutments,roseville,monomers,huelva,lotteries,hypothalamus,internationalist,electromechanical,hummingbirds,fibreglass,salaried,dramatists,uncovers,invokes,earners,excretion,gelding,ancien,aeronautica,haverhill,stour,ittihad,abramoff,yakov,ayodhya,accelerates,industrially,aeroplanes,deleterious,dwelt,belvoir,harpalus,atpase,maluku,alasdair,proportionality,taran,epistemological,interferometer,polypeptide,adjudged,villager,metastatic,marshalls,madhavan,archduchess,weizmann,kalgoorlie,balan,predefined,sessile,sagaing,brevity,insecticide,psychosocial,africana,steelworks,aether,aquifers,belem,mineiro,almagro,radiators,cenozoic,solute,turbocharger,invicta,guested,buccaneer,idolatry,unmatched,paducah,sinestro,dispossessed,conforms,responsiveness,cyanobacteria,flautist,procurator,complementing,semifinalist,rechargeable,permafrost,cytokine,refuges,boomed,gelderland,franchised,jinan,burnie,doubtless,randomness,colspan=12,angra,ginebra,famers,nuestro,declarative,roughness,lauenburg,motile,rekha,issuer,piney,interceptors,napoca,gipsy,formulaic,formula_44,viswanathan,ebrahim,thessalonica,galeria,muskogee,unsold,html5,taito,mobutu,icann,carnarvon,fairtrade,morphisms,upsilon,nozzles,fabius,meander,murugan,strontium,episcopacy,sandinista,parasol,attenuated,bhima,primeval,panay,ordinator,negara,osteoporosis,glossop,ebook,paradoxically,grevillea,modoc,equating,phonetically,legumes,covariant,dorje,quatre,bruxelles,pyroclastic,shipbuilder,zhaozong,obscuring,sveriges,tremolo,extensible,barrack,multnomah,hakon,chaharmahal,parsing,volumetric,astrophysical,glottal,combinatorics,freestanding,encoder,paralysed,cavalrymen,taboos,heilbronn,orientalis,lockport,marvels,ozawa,dispositions,waders,incurring,saltire,modulate,papilio,phenol,intermedia,rappahannock,plasmid,fortify,phenotypes,transiting,correspondences,leaguer,larnaca,incompatibility,mcenroe,deeming,endeavoured,aboriginals,helmed,salar,arginine,werke,ferrand,expropriated,delimited,couplets,phoenicians,petioles,ouster,anschluss,protectionist,plessis,urchins,orquesta,castleton,juniata,bittorrent,fulani,donji,mykola,rosemont,chandos,scepticism,signer,chalukya,wicketkeeper,coquitlam,programmatic,o'brian,carteret,urology,steelhead,paleocene,konkan,bettered,venkatesh,surfacing,longitudinally,centurions,popularization,yazid,douro,widths,premios,leonards,gristmill,fallujah,arezzo,leftists,ecliptic,glycerol,inaction,disenfranchised,acrimonious,depositing,parashah,cockatoo,marechal,bolzano,chios,cablevision,impartiality,pouches,thickly,equities,bentinck,emotive,boson,ashdown,conquistadors,parsi,conservationists,reductive,newlands,centerline,ornithologists,waveguide,nicene,philological,hemel,setanta,masala,aphids,convening,casco,matrilineal,chalcedon,orthographic,hythe,replete,damming,bolivarian,admixture,embarks,borderlands,conformed,nagarjuna,blenny,chaitanya,suwon,shigeru,tatarstan,lingayen,rejoins,grodno,merovingian,hardwicke,puducherry,prototyping,laxmi,upheavals,headquarter,pollinators,bromine,transom,plantagenet,arbuthnot,chidambaram,woburn,osamu,panelling,coauthored,zhongshu,hyaline,omissions,aspergillus,offensively,electrolytic,woodcut,sodom,intensities,clydebank,piotrkow,supplementing,quipped,focke,harbinger,positivism,parklands,wolfenbuttel,cauca,tryptophan,taunus,curragh,tsonga,remand,obscura,ashikaga,eltham,forelimbs,analogs,trnava,observances,kailash,antithesis,ayumi,abyssinia,dorsally,tralee,pursuers,misadventures,padova,perot,mahadev,tarim,granth,licenced,compania,patuxent,baronial,korda,cochabamba,codices,karna,memorialized,semaphore,playlists,mandibular,halal,sivaji,scherzinger,stralsund,foundries,ribosome,mindfulness,nikolayevich,paraphyletic,newsreader,catalyze,ioannina,thalamus,gbit/s,paymaster,sarab,500th,replenished,gamepro,cracow,formula_46,gascony,reburied,lessing,easement,transposed,meurthe,satires,proviso,balthasar,unbound,cuckoos,durbar,louisbourg,cowes,wholesalers,manet,narita,xiaoping,mohamad,illusory,cathal,reuptake,alkaloid,tahrir,mmorpg,underlies,anglicanism,repton,aharon,exogenous,buchenwald,indigent,odostomia,milled,santorum,toungoo,nevsky,steyr,urbanisation,darkseid,subsonic,canaanite,akiva,eglise,dentition,mediators,cirencester,peloponnesian,malmesbury,durres,oerlikon,tabulated,saens,canaria,ischemic,esterhazy,ringling,centralization,walthamstow,nalanda,lignite,takht,leninism,expiring,circe,phytoplankton,promulgation,integrable,breeches,aalto,menominee,borgo,scythians,skrull,galleon,reinvestment,raglan,reachable,liberec,airframes,electrolysis,geospatial,rubiaceae,interdependence,symmetrically,simulcasts,keenly,mauna,adipose,zaidi,fairport,vestibular,actuators,monochromatic,literatures,congestive,sacramental,atholl,skytrain,tycho,tunings,jamia,catharina,modifier,methuen,tapings,infiltrating,colima,grafting,tauranga,halides,pontificate,phonetics,koper,hafez,grooved,kintetsu,extrajudicial,linkoping,cyberpunk,repetitions,laurentian,parnu,bretton,darko,sverdlovsk,foreshadowed,akhenaten,rehnquist,gosford,coverts,pragmatism,broadleaf,ethiopians,instated,mediates,sodra,opulent,descriptor,enugu,shimla,leesburg,officership,giffard,refectory,lusitania,cybermen,fiume,corus,tydfil,lawrenceville,ocala,leviticus,burghers,ataxia,richthofen,amicably,acoustical,watling,inquired,tiempo,multiracial,parallelism,trenchard,tokyopop,germanium,usisl,philharmonia,shapur,jacobites,latinized,sophocles,remittances,o'farrell,adder,dimitrios,peshwa,dimitar,orlov,outstretched,musume,satish,dimensionless,serialised,baptisms,pagasa,antiviral,1740s,quine,arapaho,bombardments,stratosphere,ophthalmic,injunctions,carbonated,nonviolence,asante,creoles,sybra,boilermakers,abington,bipartite,permissive,cardinality,anheuser,carcinogenic,hohenlohe,surinam,szeged,infanticide,generically,floorball,'white,automakers,cerebellar,homozygous,remoteness,effortlessly,allude,'great,headmasters,minting,manchurian,kinabalu,wemyss,seditious,widgets,marbled,almshouses,bards,subgenres,tetsuya,faulting,kickboxer,gaulish,hoseyn,malton,fluvial,questionnaires,mondale,downplayed,traditionalists,vercelli,sumatran,landfills,gamesradar,exerts,franciszek,unlawfully,huesca,diderot,libertarians,professorial,laane,piecemeal,conidae,taiji,curatorial,perturbations,abstractions,szlachta,watercraft,mullah,zoroastrianism,segmental,khabarovsk,rectors,affordability,scuola,diffused,stena,cyclonic,workpiece,romford,'little,jhansi,stalag,zhongshan,skipton,maracaibo,bernadotte,thanet,groening,waterville,encloses,sahrawi,nuffield,moorings,chantry,annenberg,islay,marchers,tenses,wahid,siegen,furstenberg,basques,resuscitation,seminarians,tympanum,gentiles,vegetarianism,tufted,venkata,fantastical,pterophoridae,machined,superposition,glabrous,kaveri,chicane,executors,phyllonorycter,bidirectional,jasta,undertones,touristic,majapahit,navratilova,unpopularity,barbadian,tinian,webcast,hurdler,rigidly,jarrah,staphylococcus,igniting,irrawaddy,stabilised,airstrike,ragas,wakayama,energetically,ekstraklasa,minibus,largemouth,cultivators,leveraging,waitangi,carnaval,weaves,turntables,heydrich,sextus,excavate,govind,ignaz,pedagogue,uriah,borrowings,gemstones,infractions,mycobacterium,batavian,massing,praetor,subalpine,massoud,passers,geostationary,jalil,trainsets,barbus,impair,budejovice,denbigh,pertain,historicity,fortaleza,nederlandse,lamenting,masterchef,doubs,gemara,conductance,ploiesti,cetaceans,courthouses,bhagavad,mihailovic,occlusion,bremerhaven,bulwark,morava,kaine,drapery,maputo,conquistador,kaduna,famagusta,first-past-the-post,erudite,galton,undated,tangential,filho,dismembered,dashes,criterium,darwen,metabolized,blurring,everard,randwick,mohave,impurity,acuity,ansbach,chievo,surcharge,plantain,algoma,porosity,zirconium,selva,sevenoaks,venizelos,gwynne,golgi,imparting,separatism,courtesan,idiopathic,gravestones,hydroelectricity,babar,orford,purposeful,acutely,shard,ridgewood,viterbo,manohar,expropriation,placenames,brevis,cosine,unranked,richfield,newnham,recoverable,flightless,dispersing,clearfield,abu'l,stranraer,kempe,streamlining,goswami,epidermal,pieta,conciliatory,distilleries,electrophoresis,bonne,tiago,curiosities,candidature,picnicking,perihelion,lintel,povoa,gullies,configure,excision,facies,signers,1730s,insufficiency,semiotics,streatham,deactivation,entomological,skippers,albacete,parodying,escherichia,honorees,singaporeans,counterterrorism,tiruchirappalli,omnivorous,metropole,globalisation,athol,unbounded,codice_5,landforms,classifier,farmhouses,reaffirming,reparation,yomiuri,technologists,mitte,medica,viewable,steampunk,konya,kshatriya,repelling,edgewater,lamiinae,devas,potteries,llandaff,engendered,submits,virulence,uplifted,educationist,metropolitans,frontrunner,dunstable,forecastle,frets,methodius,exmouth,linnean,bouchet,repulsion,computable,equalling,liceo,tephritidae,agave,hydrological,azarenka,fairground,l'homme,enforces,xinhua,cinematographers,cooperstown,sa'id,paiute,christianization,tempos,chippenham,insulator,kotor,stereotyped,dello,cours,hisham,d'souza,eliminations,supercars,passau,rebrand,natures,coote,persephone,rededicated,cleaved,plenum,blistering,indiscriminately,cleese,safed,recursively,compacted,revues,hydration,shillong,echelons,garhwal,pedimented,grower,zwolle,wildflower,annexing,methionine,petah,valens,famitsu,petiole,specialities,nestorian,shahin,tokaido,shearwater,barberini,kinsmen,experimenter,alumnae,cloisters,alumina,pritzker,hardiness,soundgarden,julich,ps300,watercourse,cementing,wordplay,olivet,demesne,chasseurs,amide,zapotec,gaozu,porphyry,absorbers,indium,analogies,devotions,engravers,limestones,catapulted,surry,brickworks,gotra,rodham,landline,paleontologists,shankara,islip,raucous,trollope,arpad,embarkation,morphemes,recites,picardie,nakhchivan,tolerances,formula_47,khorramabad,nichiren,adrianople,kirkuk,assemblages,collider,bikaner,bushfires,roofline,coverings,reredos,bibliotheca,mantras,accentuated,commedia,rashtriya,fluctuation,serhiy,referential,fittipaldi,vesicle,geeta,iraklis,immediacy,chulalongkorn,hunsruck,bingen,dreadnoughts,stonemason,meenakshi,lebesgue,undergrowth,baltistan,paradoxes,parlement,articled,tiflis,dixieland,meriden,tejano,underdogs,barnstable,exemplify,venter,tropes,wielka,kankakee,iskandar,zilina,pharyngeal,spotify,materialised,picts,atlantique,theodoric,prepositions,paramilitaries,pinellas,attlee,actuated,piedmontese,grayling,thucydides,multifaceted,unedited,autonomously,universelle,utricularia,mooted,preto,incubated,underlie,brasenose,nootka,bushland,sensu,benzodiazepine,esteghlal,seagoing,amenhotep,azusa,sappers,culpeper,smokeless,thoroughbreds,dargah,gorda,alumna,mankato,zdroj,deleting,culvert,formula_49,punting,wushu,hindering,immunoglobulin,standardisation,birger,oilfield,quadrangular,ulama,recruiters,netanya,1630s,communaute,istituto,maciej,pathan,meher,vikas,characterizations,playmaker,interagency,intercepts,assembles,horthy,introspection,narada,matra,testes,radnicki,estonians,csiro,instar,mitford,adrenergic,crewmembers,haaretz,wasatch,lisburn,rangefinder,ordre,condensate,reforestation,corregidor,spvgg,modulator,mannerist,faulted,aspires,maktoum,squarepants,aethelred,piezoelectric,mulatto,dacre,progressions,jagiellonian,norge,samaria,sukhoi,effingham,coxless,hermetic,humanists,centrality,litters,stirlingshire,beaconsfield,sundanese,geometrically,caretakers,habitually,bandra,pashtuns,bradenton,arequipa,laminar,brickyard,hitchin,sustains,shipboard,ploughing,trechus,wheelers,bracketed,ilyushin,subotica,d'hondt,reappearance,bridgestone,intermarried,fulfilment,aphasia,birkbeck,transformational,strathmore,hornbill,millstone,lacan,voids,solothurn,gymnasiums,laconia,viaducts,peduncle,teachta,edgware,shinty,supernovae,wilfried,exclaim,parthia,mithun,flashpoint,moksha,cumbia,metternich,avalanches,militancy,motorist,rivadavia,chancellorsville,federals,gendered,bounding,footy,gauri,caliphs,lingam,watchmaker,unrecorded,riverina,unmodified,seafloor,droit,pfalz,chrysostom,gigabit,overlordship,besiege,espn2,oswestry,anachronistic,ballymena,reactivation,duchovny,ghani,abacetus,duller,legio,watercourses,nord-pas-de-calais,leiber,optometry,swarms,installer,sancti,adverbs,iheartmedia,meiningen,zeljko,kakheti,notional,circuses,patrilineal,acrobatics,infrastructural,sheva,oregonian,adjudication,aamir,wloclawek,overfishing,obstructive,subtracting,aurobindo,archeologist,newgate,'cause,secularization,tehsils,abscess,fingal,janacek,elkhorn,trims,kraftwerk,mandating,irregulars,faintly,congregationalist,sveti,kasai,mishaps,kennebec,provincially,durkheim,scotties,aicte,rapperswil,imphal,surrenders,morphs,nineveh,hoxha,cotabato,thuringian,metalworking,retold,shogakukan,anthers,proteasome,tippeligaen,disengagement,mockumentary,palatial,erupts,flume,corrientes,masthead,jaroslaw,rereleased,bharti,labors,distilling,tusks,varzim,refounded,enniskillen,melkite,semifinalists,vadodara,bermudian,capstone,grasse,origination,populus,alesi,arrondissements,semigroup,verein,opossum,messrs.,portadown,bulbul,tirupati,mulhouse,tetrahedron,roethlisberger,nonverbal,connexion,warangal,deprecated,gneiss,octet,vukovar,hesketh,chambre,despatch,claes,kargil,hideo,gravelly,tyndale,aquileia,tuners,defensible,tutte,theotokos,constructivist,ouvrage,dukla,polisario,monasticism,proscribed,commutation,testers,nipissing,codon,mesto,olivine,concomitant,exoskeleton,purports,coromandel,eyalet,dissension,hippocrates,purebred,yaounde,composting,oecophoridae,procopius,o'day,angiogenesis,sheerness,intelligencer,articular,felixstowe,aegon,endocrinology,trabzon,licinius,pagodas,zooplankton,hooghly,satie,drifters,sarthe,mercian,neuilly,tumours,canal+,scheldt,inclinations,counteroffensive,roadrunners,tuzla,shoreditch,surigao,predicates,carnot,algeciras,militaries,generalize,bulkheads,gawler,pollutant,celta,rundgren,microrna,gewog,olimpija,placental,lubelski,roxburgh,discerned,verano,kikuchi,musicale,l'enfant,ferocity,dimorphic,antigonus,erzurum,prebendary,recitative,discworld,cyrenaica,stigmella,totnes,sutta,pachuca,ulsan,downton,landshut,castellan,pleural,siedlce,siecle,catamaran,cottbus,utilises,trophic,freeholders,holyhead,u.s.s,chansons,responder,waziristan,suzuka,birding,shogi,asker,acetone,beautification,cytotoxic,dixit,hunterdon,cobblestone,formula_48,kossuth,devizes,sokoto,interlaced,shuttered,kilowatts,assiniboine,isaak,salto,alderney,sugarloaf,franchising,aggressiveness,toponyms,plaintext,antimatter,henin,equidistant,salivary,bilingualism,mountings,obligate,extirpated,irenaeus,misused,pastoralists,aftab,immigrating,warping,tyrolean,seaforth,teesside,soundwave,oligarchy,stelae,pairwise,iupac,tezuka,posht,orchestrations,landmass,ironstone,gallia,hjalmar,carmelites,strafford,elmhurst,palladio,fragility,teleplay,gruffudd,karoly,yerba,potok,espoo,inductance,macaque,nonprofits,pareto,rock'n'roll,spiritualist,shadowed,skateboarder,utterances,generality,congruence,prostrate,deterred,yellowknife,albarn,maldon,battlements,mohsen,insecticides,khulna,avellino,menstruation,glutathione,springdale,parlophone,confraternity,korps,countrywide,bosphorus,preexisting,damodar,astride,alexandrovich,sprinting,crystallized,botev,leaching,interstates,veers,angevin,undaunted,yevgeni,nishapur,northerners,alkmaar,bethnal,grocers,sepia,tornus,exemplar,trobe,charcot,gyeonggi,larne,tournai,lorain,voided,genji,enactments,maxilla,adiabatic,eifel,nazim,transducer,thelonious,pyrite,deportiva,dialectal,bengt,rosettes,labem,sergeyevich,synoptic,conservator,statuette,biweekly,adhesives,bifurcation,rajapaksa,mammootty,republique,yusef,waseda,marshfield,yekaterinburg,minnelli,fundy,fenian,matchups,dungannon,supremacist,panelled,drenthe,iyengar,fibula,narmada,homeport,oceanside,precept,antibacterial,altarpieces,swath,ospreys,lillooet,legnica,lossless,formula_50,galvatron,iorga,stormont,rsfsr,loggers,kutno,phenomenological,medallists,cuatro,soissons,homeopathy,bituminous,injures,syndicates,typesetting,displacements,dethroned,makassar,lucchese,abergavenny,targu,alborz,akb48,boldface,gastronomy,sacra,amenity,accumulator,myrtaceae,cornices,mourinho,denunciation,oxbow,diddley,aargau,arbitrage,bedchamber,gruffydd,zamindar,klagenfurt,caernarfon,slowdown,stansted,abrasion,tamaki,suetonius,dukakis,individualistic,ventrally,hotham,perestroika,ketones,fertilisation,sobriquet,couplings,renderings,misidentified,rundfunk,sarcastically,braniff,concours,dismissals,elegantly,modifiers,crediting,combos,crucially,seafront,lieut,ischemia,manchus,derivations,proteases,aristophanes,adenauer,porting,hezekiah,sante,trulli,hornblower,foreshadowing,ypsilanti,dharwad,khani,hohenstaufen,distillers,cosmodrome,intracranial,turki,salesian,gorzow,jihlava,yushchenko,leichhardt,venables,cassia,eurogamer,airtel,curative,bestsellers,timeform,sortied,grandview,massillon,ceding,pilbara,chillicothe,heredity,elblag,rogaland,ronne,millennial,batley,overuse,bharata,fille,campbelltown,abeyance,counterclockwise,250cc,neurodegenerative,consigned,electromagnetism,sunnah,saheb,exons,coxswain,gleaned,bassoons,worksop,prismatic,immigrate,pickets,takeo,bobsledder,stosur,fujimori,merchantmen,stiftung,forli,endorses,taskforce,thermally,atman,gurps,floodplains,enthalpy,extrinsic,setubal,kennesaw,grandis,scalability,durations,showrooms,prithvi,outro,overruns,andalucia,amanita,abitur,hipper,mozambican,sustainment,arsene,chesham,palaeolithic,reportage,criminality,knowsley,haploid,atacama,shueisha,ridgefield,astern,getafe,lineal,timorese,restyled,hollies,agincourt,unter,justly,tannins,mataram,industrialised,tarnovo,mumtaz,mustapha,stretton,synthetase,condita,allround,putra,stjepan,troughs,aechmea,specialisation,wearable,kadokawa,uralic,aeros,messiaen,existentialism,jeweller,effigies,gametes,fjordane,cochlear,interdependent,demonstrative,unstructured,emplacement,famines,spindles,amplitudes,actuator,tantalum,psilocybe,apnea,monogatari,expulsions,seleucus,tsuen,hospitaller,kronstadt,eclipsing,olympiakos,clann,canadensis,inverter,helio,egyptologist,squamous,resonate,munir,histology,torbay,khans,jcpenney,veterinarians,aintree,microscopes,colonised,reflectors,phosphorylated,pristimantis,tulare,corvinus,multiplexing,midweek,demosthenes,transjordan,ecija,tengku,vlachs,anamorphic,counterweight,radnor,trinitarian,armidale,maugham,njsiaa,futurism,stairways,avicenna,montebello,bridgetown,wenatchee,lyonnais,amass,surinamese,streptococcus,m*a*s*h,hydrogenation,frazioni,proscenium,kalat,pennsylvanian,huracan,tallying,kralove,nucleolar,phrygian,seaports,hyacinthe,ignace,donning,instalment,regnal,fonds,prawn,carell,folktales,goaltending,bracknell,vmware,patriarchy,mitsui,kragujevac,pythagoras,soult,thapa,disproved,suwalki,secures,somoza,l'ecole,divizia,chroma,herders,technologist,deduces,maasai,rampur,paraphrase,raimi,imaged,magsaysay,ivano,turmeric,formula_51,subcommittees,axillary,ionosphere,organically,indented,refurbishing,pequot,violinists,bearn,colle,contralto,silverton,mechanization,etruscans,wittelsbach,pasir,redshirted,marrakesh,scarp,plein,wafers,qareh,teotihuacan,frobenius,sinensis,rehoboth,bundaberg,newbridge,hydrodynamic,traore,abubakar,adjusts,storytellers,dynamos,verbandsliga,concertmaster,exxonmobil,appreciable,sieradz,marchioness,chaplaincy,rechristened,cunxu,overpopulation,apolitical,sequencer,beaked,nemanja,binaries,intendant,absorber,filamentous,indebtedness,nusra,nashik,reprises,psychedelia,abwehr,ligurian,isoform,resistive,pillaging,mahathir,reformatory,lusatia,allerton,ajaccio,tepals,maturin,njcaa,abyssinian,objector,fissures,sinuous,ecclesiastic,dalits,caching,deckers,phosphates,wurlitzer,navigated,trofeo,berea,purefoods,solway,unlockable,grammys,kostroma,vocalizations,basilan,rebuke,abbasi,douala,helsingborg,ambon,bakar,runestones,cenel,tomislav,pigmented,northgate,excised,seconda,kirke,determinations,dedicates,vilas,pueblos,reversion,unexploded,overprinted,ekiti,deauville,masato,anaesthesia,endoplasmic,transponders,aguascalientes,hindley,celluloid,affording,bayeux,piaget,rickshaws,eishockey,camarines,zamalek,undersides,hardwoods,hermitian,mutinied,monotone,blackmails,affixes,jpmorgan,habermas,mitrovica,paleontological,polystyrene,thana,manas,conformist,turbofan,decomposes,logano,castration,metamorphoses,patroness,herbicide,mikolaj,rapprochement,macroeconomics,barranquilla,matsudaira,lintels,femina,hijab,spotsylvania,morpheme,bitola,baluchistan,kurukshetra,otway,extrusion,waukesha,menswear,helder,trung,bingley,protester,boars,overhang,differentials,exarchate,hejaz,kumara,unjustified,timings,sharpness,nuovo,taisho,sundar,etc..,jehan,unquestionably,muscovy,daltrey,canute,paneled,amedeo,metroplex,elaborates,telus,tetrapods,dragonflies,epithets,saffir,parthenon,lucrezia,refitting,pentateuch,hanshin,montparnasse,lumberjacks,sanhedrin,erectile,odors,greenstone,resurgent,leszek,amory,substituents,prototypical,viewfinder,monck,universiteit,joffre,revives,chatillon,seedling,scherzo,manukau,ashdod,gympie,homolog,stalwarts,ruinous,weibo,tochigi,wallenberg,gayatri,munda,satyagraha,storefronts,heterogeneity,tollway,sportswriters,binocular,gendarmes,ladysmith,tikal,ortsgemeinde,ja'far,osmotic,linlithgow,bramley,telecoms,pugin,repose,rupaul,sieur,meniscus,garmisch,reintroduce,400th,shoten,poniatowski,drome,kazakhstani,changeover,astronautics,husserl,herzl,hypertext,katakana,polybius,antananarivo,seong,breguet,reliquary,utada,aggregating,liangshan,sivan,tonawanda,audiobooks,shankill,coulee,phenolic,brockton,bookmakers,handsets,boaters,wylde,commonality,mappings,silhouettes,pennines,maurya,pratchett,singularities,eschewed,pretensions,vitreous,ibero,totalitarianism,poulenc,lingered,directx,seasoning,deputation,interdict,illyria,feedstock,counterbalance,muzik,buganda,parachuted,violist,homogeneity,comix,fjords,corsairs,punted,verandahs,equilateral,laoghaire,magyars,117th,alesund,televoting,mayotte,eateries,refurbish,nswrl,yukio,caragiale,zetas,dispel,codecs,inoperable,outperformed,rejuvenation,elstree,modernise,contributory,pictou,tewkesbury,chechens,ashina,psionic,refutation,medico,overdubbed,nebulae,sandefjord,personages,eccellenza,businessperson,placename,abenaki,perryville,threshing,reshaped,arecibo,burslem,colspan=3|turnout,rebadged,lumia,erinsborough,interactivity,bitmap,indefatigable,theosophy,excitatory,gleizes,edsel,bermondsey,korce,saarinen,wazir,diyarbakir,cofounder,liberalisation,onsen,nighthawks,siting,retirements,semyon,d'histoire,114th,redditch,venetia,praha,'round,valdosta,hieroglyphic,postmedial,edirne,miscellany,savona,cockpits,minimization,coupler,jacksonian,appeasement,argentines,saurashtra,arkwright,hesiod,folios,fitzalan,publica,rivaled,civitas,beermen,constructivism,ribeira,zeitschrift,solanum,todos,deformities,chilliwack,verdean,meagre,bishoprics,gujrat,yangzhou,reentered,inboard,mythologies,virtus,unsurprisingly,rusticated,museu,symbolise,proportionate,thesaban,symbian,aeneid,mitotic,veliki,compressive,cisterns,abies,winemaker,massenet,bertolt,ahmednagar,triplemania,armorial,administracion,tenures,smokehouse,hashtag,fuerza,regattas,gennady,kanazawa,mahmudabad,crustal,asaph,valentinian,ilaiyaraaja,honeyeater,trapezoidal,cooperatively,unambiguously,mastodon,inhospitable,harnesses,riverton,renewables,djurgardens,haitians,airings,humanoids,boatswain,shijiazhuang,faints,veera,punjabis,steepest,narain,karlovy,serre,sulcus,collectives,1500m,arion,subarctic,liberally,apollonius,ostia,droplet,headstones,norra,robusta,maquis,veronese,imola,primers,luminance,escadrille,mizuki,irreconcilable,stalybridge,temur,paraffin,stuccoed,parthians,counsels,fundamentalists,vivendi,polymath,sugababes,mikko,yonne,fermions,vestfold,pastoralist,kigali,unseeded,glarus,cusps,amasya,northwesterly,minorca,astragalus,verney,trevelyan,antipathy,wollstonecraft,bivalves,boulez,royle,divisao,quranic,bareilly,coronal,deviates,lulea,erectus,petronas,chandan,proxies,aeroflot,postsynaptic,memoriam,moyne,gounod,kuznetsova,pallava,ordinating,reigate,'first,lewisburg,exploitative,danby,academica,bailiwick,brahe,injective,stipulations,aeschylus,computes,gulden,hydroxylase,liveries,somalis,underpinnings,muscovite,kongsberg,domus,overlain,shareware,variegated,jalalabad,agence,ciphertext,insectivores,dengeki,menuhin,cladistic,baerum,betrothal,tokushima,wavelet,expansionist,pottsville,siyuan,prerequisites,carpi,nemzeti,nazar,trialled,eliminator,irrorated,homeward,redwoods,undeterred,strayed,lutyens,multicellular,aurelian,notated,lordships,alsatian,idents,foggia,garros,chalukyas,lillestrom,podlaski,pessimism,hsien,demilitarized,whitewashed,willesden,kirkcaldy,sanctorum,lamia,relaying,escondido,paediatric,contemplates,demarcated,bluestone,betula,penarol,capitalise,kreuznach,kenora,115th,hold'em,reichswehr,vaucluse,m.i.a,windings,boys/girls,cajon,hisar,predictably,flemington,ysgol,mimicked,clivina,grahamstown,ionia,glyndebourne,patrese,aquaria,sleaford,dayal,sportscenter,malappuram,m.b.a.,manoa,carbines,solvable,designator,ramanujan,linearity,academicians,sayid,lancastrian,factorial,strindberg,vashem,delos,comyn,condensing,superdome,merited,kabaddi,intransitive,bideford,neuroimaging,duopoly,scorecards,ziggler,heriot,boyars,virology,marblehead,microtubules,westphalian,anticipates,hingham,searchers,harpist,rapides,morricone,convalescent,mises,nitride,metrorail,matterhorn,bicol,drivetrain,marketer,snippet,winemakers,muban,scavengers,halberstadt,herkimer,peten,laborious,stora,montgomeryshire,booklist,shamir,herault,eurostar,anhydrous,spacewalk,ecclesia,calliostoma,highschool,d'oro,suffusion,imparts,overlords,tagus,rectifier,counterinsurgency,ministered,eilean,milecastle,contre,micromollusk,okhotsk,bartoli,matroid,hasidim,thirunal,terme,tarlac,lashkar,presque,thameslink,flyby,troopship,renouncing,fatih,messrs,vexillum,bagration,magnetite,bornholm,androgynous,vehement,tourette,philosophic,gianfranco,tuileries,codice_6,radially,flexion,hants,reprocessing,setae,burne,palaeographically,infantryman,shorebirds,tamarind,moderna,threading,militaristic,crohn,norrkoping,125cc,stadtholder,troms,klezmer,alphanumeric,brome,emmanuelle,tiwari,alchemical,formula_52,onassis,bleriot,bipedal,colourless,hermeneutics,hosni,precipitating,turnstiles,hallucinogenic,panhellenic,wyandotte,elucidated,chita,ehime,generalised,hydrophilic,biota,niobium,rnzaf,gandhara,longueuil,logics,sheeting,bielsko,cuvier,kagyu,trefoil,docent,pancrase,stalinism,postures,encephalopathy,monckton,imbalances,epochs,leaguers,anzio,diminishes,pataki,nitrite,amuro,nabil,maybach,l'aquila,babbler,bacolod,thutmose,evora,gaudi,breakage,recur,preservative,60deg,mendip,functionaries,columnar,maccabiah,chert,verden,bromsgrove,clijsters,dengue,pastorate,phuoc,principia,viareggio,kharagpur,scharnhorst,anyang,bosons,l'art,criticises,ennio,semarang,brownian,mirabilis,asperger,calibers,typographical,cartooning,minos,disembark,supranational,undescribed,etymologically,alappuzha,vilhelm,lanao,pakenham,bhagavata,rakoczi,clearings,astrologers,manitowoc,bunuel,acetylene,scheduler,defamatory,trabzonspor,leaded,scioto,pentathlete,abrahamic,minigames,aldehydes,peerages,legionary,1640s,masterworks,loudness,bryansk,likeable,genocidal,vegetated,towpath,declination,pyrrhus,divinely,vocations,rosebery,associazione,loaders,biswas,oeste,tilings,xianzong,bhojpuri,annuities,relatedness,idolator,psers,constriction,chuvash,choristers,hanafi,fielders,grammarian,orpheum,asylums,millbrook,gyatso,geldof,stabilise,tableaux,diarist,kalahari,panini,cowdenbeath,melanin,4x100m,resonances,pinar,atherosclerosis,sheringham,castlereagh,aoyama,larks,pantograph,protrude,natak,gustafsson,moribund,cerevisiae,cleanly,polymeric,holkar,cosmonauts,underpinning,lithosphere,firuzabad,languished,mingled,citrate,spadina,lavas,daejeon,fibrillation,porgy,pineville,ps1000,cobbled,emamzadeh,mukhtar,dampers,indelible,salonika,nanoscale,treblinka,eilat,purporting,fluctuate,mesic,hagiography,cutscenes,fondation,barrens,comically,accrue,ibrox,makerere,defections,'there,hollandia,skene,grosseto,reddit,objectors,inoculation,rowdies,playfair,calligrapher,namor,sibenik,abbottabad,propellants,hydraulically,chloroplasts,tablelands,tecnico,schist,klasse,shirvan,bashkortostan,bullfighting,north/south,polski,hanns,woodblock,kilmore,ejecta,ignacy,nanchang,danubian,commendations,snohomish,samaritans,argumentation,vasconcelos,hedgehogs,vajrayana,barents,kulkarni,kumbakonam,identifications,hillingdon,weirs,nayanar,beauvoir,messe,divisors,atlantiques,broods,affluence,tegucigalpa,unsuited,autodesk,akash,princeps,culprits,kingstown,unassuming,goole,visayan,asceticism,blagojevich,irises,paphos,unsound,maurier,pontchartrain,desertification,sinfonietta,latins,especial,limpet,valerenga,glial,brainstem,mitral,parables,sauropod,judean,iskcon,sarcoma,venlo,justifications,zhuhai,blavatsky,alleviated,usafe,steppenwolf,inversions,janko,chagall,secretory,basildon,saguenay,pergamon,hemispherical,harmonized,reloading,franjo,domaine,extravagance,relativism,metamorphosed,labuan,baloncesto,gmail,byproducts,calvinists,counterattacked,vitus,bubonic,120th,strachey,ritually,brookwood,selectable,savinja,incontinence,meltwater,jinja,1720s,brahmi,morgenthau,sheaves,sleeved,stratovolcano,wielki,utilisation,avoca,fluxus,panzergrenadier,philately,deflation,podlaska,prerogatives,kuroda,theophile,zhongzong,gascoyne,magus,takao,arundell,fylde,merdeka,prithviraj,venkateswara,liepaja,daigo,dreamland,reflux,sunnyvale,coalfields,seacrest,soldering,flexor,structuralism,alnwick,outweighed,unaired,mangeshkar,batons,glaad,banshees,irradiated,organelles,biathlete,cabling,chairlift,lollapalooza,newsnight,capacitive,succumbs,flatly,miramichi,burwood,comedienne,charteris,biotic,workspace,aficionados,sokolka,chatelet,o'shaughnessy,prosthesis,neoliberal,refloated,oppland,hatchlings,econometrics,loess,thieu,androids,appalachians,jenin,pterostichinae,downsized,foils,chipsets,stencil,danza,narrate,maginot,yemenite,bisects,crustacean,prescriptive,melodious,alleviation,empowers,hansson,autodromo,obasanjo,osmosis,daugava,rheumatism,moraes,leucine,etymologies,chepstow,delaunay,bramall,bajaj,flavoring,approximates,marsupials,incisive,microcomputer,tactically,waals,wilno,fisichella,ursus,hindmarsh,mazarin,lomza,xenophobia,lawlessness,annecy,wingers,gornja,gnaeus,superieur,tlaxcala,clasps,symbolises,slats,rightist,effector,blighted,permanence,divan,progenitors,kunsthalle,anointing,excelling,coenzyme,indoctrination,dnipro,landholdings,adriaan,liturgies,cartan,ethmia,attributions,sanctus,trichy,chronicon,tancred,affinis,kampuchea,gantry,pontypool,membered,distrusted,fissile,dairies,hyposmocoma,craigie,adarsh,martinsburg,taxiway,30deg,geraint,vellum,bencher,khatami,formula_53,zemun,teruel,endeavored,palmares,pavements,u.s..,internationalization,satirized,carers,attainable,wraparound,muang,parkersburg,extinctions,birkenfeld,wildstorm,payers,cohabitation,unitas,culloden,capitalizing,clwyd,daoist,campinas,emmylou,orchidaceae,halakha,orientales,fealty,domnall,chiefdom,nigerians,ladislav,dniester,avowed,ergonomics,newsmagazine,kitsch,cantilevered,benchmarking,remarriage,alekhine,coldfield,taupo,almirante,substations,apprenticeships,seljuq,levelling,eponym,symbolising,salyut,opioids,underscore,ethnologue,mohegan,marikina,libro,bassano,parse,semantically,disjointed,dugdale,padraig,tulsi,modulating,xfinity,headlands,mstislav,earthworms,bourchier,lgbtq,embellishments,pennants,rowntree,betel,motet,mulla,catenary,washoe,mordaunt,dorking,colmar,girardeau,glentoran,grammatically,samad,recreations,technion,staccato,mikoyan,spoilers,lyndhurst,victimization,chertsey,belafonte,tondo,tonsberg,narrators,subcultures,malformations,edina,augmenting,attests,euphemia,cabriolet,disguising,1650s,navarrese,demoralized,cardiomyopathy,welwyn,wallachian,smoothness,planktonic,voles,issuers,sardasht,survivability,cuauhtemoc,thetis,extruded,signet,raghavan,lombok,eliyahu,crankcase,dissonant,stolberg,trencin,desktops,bursary,collectivization,charlottenburg,triathlete,curvilinear,involuntarily,mired,wausau,invades,sundaram,deletions,bootstrap,abellio,axiomatic,noguchi,setups,malawian,visalia,materialist,kartuzy,wenzong,plotline,yeshivas,parganas,tunica,citric,conspecific,idlib,superlative,reoccupied,blagoevgrad,masterton,immunological,hatta,courbet,vortices,swallowtail,delves,haridwar,diptera,boneh,bahawalpur,angering,mardin,equipments,deployable,guanine,normality,rimmed,artisanal,boxset,chandrasekhar,jools,chenar,tanakh,carcassonne,belatedly,millville,anorthosis,reintegration,velde,surfactant,kanaan,busoni,glyphipterix,personas,fullness,rheims,tisza,stabilizers,bharathi,joost,spinola,mouldings,perching,esztergom,afzal,apostate,lustre,s.league,motorboat,monotheistic,armature,barat,asistencia,bloomsburg,hippocampal,fictionalised,defaults,broch,hexadecimal,lusignan,ryanair,boccaccio,breisgau,southbank,bskyb,adjoined,neurobiology,aforesaid,sadhu,langue,headship,wozniacki,hangings,regulus,prioritized,dynamism,allier,hannity,shimin,antoninus,gymnopilus,caledon,preponderance,melayu,electrodynamics,syncopated,ibises,krosno,mechanistic,morpeth,harbored,albini,monotheism,'real,hyperactivity,haveli,writer/director,minato,nimoy,caerphilly,chitral,amirabad,fanshawe,l'oreal,lorde,mukti,authoritarianism,valuing,spyware,hanbury,restarting,stato,embed,suiza,empiricism,stabilisation,stari,castlemaine,orbis,manufactory,mauritanian,shoji,taoyuan,prokaryotes,oromia,ambiguities,embodying,slims,frente,innovate,ojibwa,powdery,gaeltacht,argentinos,quatermass,detergents,fijians,adaptor,tokai,chileans,bulgars,oxidoreductases,bezirksliga,conceicao,myosin,nellore,500cc,supercomputers,approximating,glyndwr,polypropylene,haugesund,cockerell,tudman,ashbourne,hindemith,bloodlines,rigveda,etruria,romanos,steyn,oradea,deceleration,manhunter,laryngeal,fraudulently,janez,wendover,haplotype,janaki,naoki,belizean,mellencamp,cartographic,sadhana,tricolour,pseudoscience,satara,bytow,s.p.a.,jagdgeschwader,arcot,omagh,sverdrup,masterplan,surtees,apocrypha,ahvaz,d'amato,socratic,leumit,unnumbered,nandini,witold,marsupial,coalesced,interpolated,gimnasia,karadzic,keratin,mamoru,aldeburgh,speculator,escapement,irfan,kashyap,satyajit,haddington,solver,rothko,ashkelon,kickapoo,yeomen,superbly,bloodiest,greenlandic,lithic,autofocus,yardbirds,poona,keble,javan,sufis,expandable,tumblr,ursuline,swimwear,winwood,counsellors,aberrations,marginalised,befriending,workouts,predestination,varietal,siddhartha,dunkeld,judaic,esquimalt,shabab,ajith,telefonica,stargard,hoysala,radhakrishnan,sinusoidal,strada,hiragana,cebuano,monoid,independencia,floodwaters,mildura,mudflats,ottokar,translit,radix,wigner,philosophically,tephritid,synthesizing,castletown,installs,stirner,resettle,bushfire,choirmaster,kabbalistic,shirazi,lightship,rebus,colonizers,centrifuge,leonean,kristofferson,thymus,clackamas,ratnam,rothesay,municipally,centralia,thurrock,gulfport,bilinear,desirability,merite,psoriasis,macaw,erigeron,consignment,mudstone,distorting,karlheinz,ramen,tailwheel,vitor,reinsurance,edifices,superannuation,dormancy,contagion,cobden,rendezvoused,prokaryotic,deliberative,patricians,feigned,degrades,starlings,sopot,viticultural,beaverton,overflowed,convener,garlands,michiel,ternopil,naturelle,biplanes,bagot,gamespy,ventspils,disembodied,flattening,profesional,londoners,arusha,scapular,forestall,pyridine,ulema,eurodance,aruna,callus,periodontal,coetzee,immobilized,o'meara,maharani,katipunan,reactants,zainab,microgravity,saintes,britpop,carrefour,constrain,adversarial,firebirds,brahmo,kashima,simca,surety,surpluses,superconductivity,gipuzkoa,cumans,tocantins,obtainable,humberside,roosting,'king,formula_54,minelayer,bessel,sulayman,cycled,biomarkers,annealing,shusha,barda,cassation,djing,polemics,tuple,directorates,indomitable,obsolescence,wilhelmine,pembina,bojan,tambo,dioecious,pensioner,magnificat,1660s,estrellas,southeasterly,immunodeficiency,railhead,surreptitiously,codeine,encores,religiosity,tempera,camberley,efendi,boardings,malleable,hagia,input/output,lucasfilm,ujjain,polymorphisms,creationist,berners,mickiewicz,irvington,linkedin,endures,kinect,munition,apologetics,fairlie,predicated,reprinting,ethnographer,variances,levantine,mariinsky,jadid,jarrow,asia/oceania,trinamool,waveforms,bisexuality,preselection,pupae,buckethead,hieroglyph,lyricists,marionette,dunbartonshire,restorer,monarchical,pazar,kickoffs,cabildo,savannas,gliese,dench,spoonbills,novelette,diliman,hypersensitivity,authorising,montefiore,mladen,qu'appelle,theistic,maruti,laterite,conestoga,saare,californica,proboscis,carrickfergus,imprecise,hadassah,baghdadi,jolgeh,deshmukh,amusements,heliopolis,berle,adaptability,partenkirchen,separations,baikonur,cardamom,southeastward,southfield,muzaffar,adequacy,metropolitana,rajkot,kiyoshi,metrobus,evictions,reconciles,librarianship,upsurge,knightley,badakhshan,proliferated,spirituals,burghley,electroacoustic,professing,featurette,reformists,skylab,descriptors,oddity,greyfriars,injects,salmond,lanzhou,dauntless,subgenera,underpowered,transpose,mahinda,gatos,aerobatics,seaworld,blocs,waratahs,joris,giggs,perfusion,koszalin,mieczyslaw,ayyubid,ecologists,modernists,sant'angelo,quicktime,him/her,staves,sanyo,melaka,acrocercops,qigong,iterated,generalizes,recuperation,vihara,circassians,psychical,chavo,memoires,infiltrates,notaries,pelecaniformesfamily,strident,chivalric,pierrepont,alleviating,broadsides,centipede,b.tech,reinterpreted,sudetenland,hussite,covenanters,radhika,ironclads,gainsbourg,testis,penarth,plantar,azadegan,beano,espn.com,leominster,autobiographies,nbcuniversal,eliade,khamenei,montferrat,undistinguished,ethnological,wenlock,fricatives,polymorphic,biome,joule,sheaths,astrophysicist,salve,neoclassicism,lovat,downwind,belisarius,forma,usurpation,freie,depopulation,backbench,ascenso,'high,aagpbl,gdanski,zalman,mouvement,encapsulation,bolshevism,statny,voyageurs,hywel,vizcaya,mazra'eh,narthex,azerbaijanis,cerebrospinal,mauretania,fantail,clearinghouse,bolingbroke,pequeno,ansett,remixing,microtubule,wrens,jawahar,palembang,gambian,hillsong,fingerboard,repurposed,sundry,incipient,veolia,theologically,ulaanbaatar,atsushi,foundling,resistivity,myeloma,factbook,mazowiecka,diacritic,urumqi,clontarf,provokes,intelsat,professes,materialise,portobello,benedictines,panionios,introverted,reacquired,bridport,mammary,kripke,oratorios,vlore,stoning,woredas,unreported,antti,togolese,fanzines,heuristics,conservatories,carburetors,clitheroe,cofounded,formula_57,erupting,quinnipiac,bootle,ghostface,sittings,aspinall,sealift,transferase,boldklub,siskiyou,predominated,francophonie,ferruginous,castrum,neogene,sakya,madama,precipitous,'love,posix,bithynia,uttara,avestan,thrushes,seiji,memorably,septimius,libri,cibernetico,hyperinflation,dissuaded,cuddalore,peculiarity,vaslui,grojec,albumin,thurles,casks,fasteners,fluidity,buble,casals,terek,gnosticism,cognates,ulnar,radwanska,babylonians,majuro,oxidizer,excavators,rhythmically,liffey,gorakhpur,eurydice,underscored,arborea,lumumba,tuber,catholique,grama,galilei,scrope,centreville,jacobin,bequests,ardeche,polygamous,montauban,terai,weatherboard,readability,attainder,acraea,transversely,rivets,winterbottom,reassures,bacteriology,vriesea,chera,andesite,dedications,homogenous,reconquered,bandon,forrestal,ukiyo,gurdjieff,tethys,sparc,muscogee,grebes,belchatow,mansa,blantyre,palliser,sokolow,fibroblasts,exmoor,misaki,soundscapes,housatonic,middelburg,convenor,leyla,antipope,histidine,okeechobee,alkenes,sombre,alkene,rubik,macaques,calabar,trophee,pinchot,'free,frusciante,chemins,falaise,vasteras,gripped,schwarzenberg,cumann,kanchipuram,acoustically,silverbacks,fangio,inset,plympton,kuril,vaccinations,recep,theropods,axils,stavropol,encroached,apoptotic,papandreou,wailers,moonstone,assizes,micrometers,hornchurch,truncation,annapurna,egyptologists,rheumatic,promiscuity,satiric,fleche,caloptilia,anisotropy,quaternions,gruppo,viscounts,awardees,aftershocks,sigint,concordance,oblasts,gaumont,stent,commissars,kesteven,hydroxy,vijayanagar,belorussian,fabricius,watermark,tearfully,mamet,leukaemia,sorkh,milepost,tattooing,vosta,abbasids,uncompleted,hedong,woodwinds,extinguishing,malus,multiplexes,francoist,pathet,responsa,bassists,'most,postsecondary,ossory,grampian,saakashvili,alito,strasberg,impressionistic,volador,gelatinous,vignette,underwing,campanian,abbasabad,albertville,hopefuls,nieuwe,taxiways,reconvened,recumbent,pathologists,unionized,faversham,asymptotically,romulo,culling,donja,constricted,annesley,duomo,enschede,lovech,sharpshooter,lansky,dhamma,papillae,alanine,mowat,delius,wrest,mcluhan,podkarpackie,imitators,bilaspur,stunting,pommel,casemate,handicaps,nagas,testaments,hemings,necessitate,rearward,locative,cilla,klitschko,lindau,merion,consequential,antic,soong,copula,berthing,chevrons,rostral,sympathizer,budokan,ranulf,beria,stilt,replying,conflated,alcibiades,painstaking,yamanashi,calif.,arvid,ctesiphon,xizong,rajas,caxton,downbeat,resurfacing,rudders,miscegenation,deathmatch,foregoing,arthropod,attestation,karts,reapportionment,harnessing,eastlake,schola,dosing,postcolonial,imtiaz,formula_55,insulators,gunung,accumulations,pampas,llewelyn,bahnhof,cytosol,grosjean,teaneck,briarcliff,arsenio,canara,elaborating,passchendaele,searchlights,holywell,mohandas,preventable,gehry,mestizos,ustinov,cliched,'national,heidfeld,tertullian,jihadist,tourer,miletus,semicircle,outclassed,bouillon,cardinalate,clarifies,dakshina,bilayer,pandyan,unrwa,chandragupta,formula_56,portola,sukumaran,lactation,islamia,heikki,couplers,misappropriation,catshark,montt,ploughs,carib,stator,leaderboard,kenrick,dendrites,scape,tillamook,molesworth,mussorgsky,melanesia,restated,troon,glycoside,truckee,headwater,mashup,sectoral,gangwon,docudrama,skirting,psychopathology,dramatised,ostroleka,infestations,thabo,depolarization,wideroe,eisenbahn,thomond,kumaon,upendra,foreland,acronyms,yaqui,retaking,raphaelite,specie,dupage,villars,lucasarts,chloroplast,werribee,balsa,ascribe,havant,flava,khawaja,tyumen,subtract,interrogators,reshaping,buzzcocks,eesti,campanile,potemkin,apertures,snowboarder,registrars,handbooks,boyar,contaminant,depositors,proximate,jeunesse,zagora,pronouncements,mists,nihilism,deified,margraviate,pietersen,moderators,amalfi,adjectival,copepods,magnetosphere,pallets,clemenceau,castra,perforation,granitic,troilus,grzegorz,luthier,dockyards,antofagasta,ffestiniog,subroutine,afterword,waterwheel,druce,nitin,undifferentiated,emacs,readmitted,barneveld,tapers,hittites,infomercials,infirm,braathens,heligoland,carpark,geomagnetic,musculoskeletal,nigerien,machinima,harmonize,repealing,indecency,muskoka,verite,steubenville,suffixed,cytoskeleton,surpasses,harmonia,imereti,ventricles,heterozygous,envisions,otsego,ecoles,warrnambool,burgenland,seria,rawat,capistrano,welby,kirin,enrollments,caricom,dragonlance,schaffhausen,expanses,photojournalism,brienne,etude,referent,jamtland,schemas,xianbei,cleburne,bicester,maritima,shorelines,diagonals,bjelke,nonpublic,aliasing,m.f.a,ovals,maitreya,skirmishing,grothendieck,sukhothai,angiotensin,bridlington,durgapur,contras,gakuen,skagit,rabbinate,tsunamis,haphazard,tyldesley,microcontroller,discourages,hialeah,compressing,septimus,larvik,condoleezza,psilocybin,protectionism,songbirds,clandestinely,selectmen,wargame,cinemascope,khazars,agronomy,melzer,latifah,cherokees,recesses,assemblymen,basescu,banaras,bioavailability,subchannels,adenine,o'kelly,prabhakar,leonese,dimethyl,testimonials,geoffroy,oxidant,universiti,gheorghiu,bohdan,reversals,zamorin,herbivore,jarre,sebastiao,infanterie,dolmen,teddington,radomsko,spaceships,cuzco,recapitulation,mahoning,bainimarama,myelin,aykroyd,decals,tokelau,nalgonda,rajasthani,121st,quelled,tambov,illyrians,homilies,illuminations,hypertrophy,grodzisk,inundation,incapacity,equilibria,combats,elihu,steinitz,berengar,gowda,canwest,khosrau,maculata,houten,kandinsky,onside,leatherhead,heritable,belvidere,federative,chukchi,serling,eruptive,patan,entitlements,suffragette,evolutions,migrates,demobilisation,athleticism,trope,sarpsborg,kensal,translink,squamish,concertgebouw,energon,timestamp,competences,zalgiris,serviceman,codice_7,spoofing,assange,mahadevan,skien,suceava,augustan,revisionism,unconvincing,hollande,drina,gottlob,lippi,broglie,darkening,tilapia,eagerness,nacht,kolmogorov,photometric,leeuwarden,jrotc,haemorrhage,almanack,cavalli,repudiation,galactose,zwickau,cetinje,houbraken,heavyweights,gabonese,ordinals,noticias,museveni,steric,charaxes,amjad,resection,joinville,leczyca,anastasius,purbeck,subtribe,dalles,leadoff,monoamine,jettisoned,kaori,anthologized,alfreton,indic,bayezid,tottori,colonizing,assassinating,unchanging,eusebian,d'estaing,tsingtao,toshio,transferases,peronist,metrology,equus,mirpur,libertarianism,kovil,indole,'green,abstention,quantitatively,icebreakers,tribals,mainstays,dryandra,eyewear,nilgiri,chrysanthemum,inositol,frenetic,merchantman,hesar,physiotherapist,transceiver,dancefloor,rankine,neisse,marginalization,lengthen,unaided,rework,pageantry,savio,striated,funen,witton,illuminates,frass,hydrolases,akali,bistrita,copywriter,firings,handballer,tachinidae,dmytro,coalesce,neretva,menem,moraines,coatbridge,crossrail,spoofed,drosera,ripen,protour,kikuyu,boleslav,edwardes,troubadours,haplogroups,wrasse,educationalist,sroda,khaneh,dagbladet,apennines,neuroscientist,deplored,terje,maccabees,daventry,spaceport,lessening,ducats,singer/guitarist,chambersburg,yeong,configurable,ceremonially,unrelenting,caffe,graaf,denizens,kingsport,ingush,panhard,synthesised,tumulus,homeschooled,bozorg,idiomatic,thanhouser,queensway,radek,hippolytus,inking,banovina,peacocks,piaui,handsworth,pantomimes,abalone,thera,kurzweil,bandura,augustinians,bocelli,ferrol,jiroft,quadrature,contravention,saussure,rectification,agrippina,angelis,matanzas,nidaros,palestrina,latium,coriolis,clostridium,ordain,uttering,lanchester,proteolytic,ayacucho,merseburg,holbein,sambalpur,algebraically,inchon,ostfold,savoia,calatrava,lahiri,judgeship,ammonite,masaryk,meyerbeer,hemorrhagic,superspeedway,ningxia,panicles,encircles,khmelnytsky,profusion,esher,babol,inflationary,anhydride,gaspe,mossy,periodicity,nacion,meteorologists,mahjong,interventional,sarin,moult,enderby,modell,palgrave,warners,montcalm,siddha,functionalism,rilke,politicized,broadmoor,kunste,orden,brasileira,araneta,eroticism,colquhoun,mamba,blacktown,tubercle,seagrass,manoel,camphor,neoregelia,llandudno,annexe,enplanements,kamien,plovers,statisticians,iturbide,madrasah,nontrivial,publican,landholders,manama,uninhabitable,revivalist,trunkline,friendliness,gurudwara,rocketry,unido,tripos,besant,braque,evolutionarily,abkhazian,staffel,ratzinger,brockville,bohemond,intercut,djurgarden,utilitarianism,deploys,sastri,absolutism,subhas,asghar,fictions,sepinwall,proportionately,titleholders,thereon,foursquare,machinegun,knightsbridge,siauliai,aqaba,gearboxes,castaways,weakens,phallic,strzelce,buoyed,ruthenia,pharynx,intractable,neptunes,koine,leakey,netherlandish,preempted,vinay,terracing,instigating,alluvium,prosthetics,vorarlberg,politiques,joinery,reduplication,nebuchadnezzar,lenticular,banka,seaborne,pattinson,helpline,aleph,beckenham,californians,namgyal,franziska,aphid,branagh,transcribe,appropriateness,surakarta,takings,propagates,juraj,b0d3fb,brera,arrayed,tailback,falsehood,hazleton,prosody,egyptology,pinnate,tableware,ratan,camperdown,ethnologist,tabari,classifiers,biogas,126th,kabila,arbitron,apuestas,membranous,kincardine,oceana,glories,natick,populism,synonymy,ghalib,mobiles,motherboards,stationers,germinal,patronised,formula_58,gaborone,torts,jeezy,interleague,novaya,batticaloa,offshoots,wilbraham,filename,nswrfl,'well,trilobite,pythons,optimally,scientologists,rhesus,pilsen,backdrops,batang,unionville,hermanos,shrikes,fareham,outlawing,discontinuing,boisterous,shamokin,scanty,southwestward,exchangers,unexpired,mewar,h.m.s,saldanha,pawan,condorcet,turbidity,donau,indulgences,coincident,cliques,weeklies,bardhaman,violators,kenai,caspase,xperia,kunal,fistula,epistemic,cammell,nephi,disestablishment,rotator,germaniawerft,pyaar,chequered,jigme,perlis,anisotropic,popstars,kapil,appendices,berat,defecting,shacks,wrangel,panchayath,gorna,suckling,aerosols,sponheim,talal,borehole,encodings,enlai,subduing,agong,nadar,kitsap,syrmia,majumdar,pichilemu,charleville,embryology,booting,literati,abutting,basalts,jussi,repubblica,hertogenbosch,digitization,relents,hillfort,wiesenthal,kirche,bhagwan,bactrian,oases,phyla,neutralizing,helsing,ebooks,spearheading,margarine,'golden,phosphor,picea,stimulants,outliers,timescale,gynaecology,integrator,skyrocketed,bridgnorth,senecio,ramachandra,suffragist,arrowheads,aswan,inadvertent,microelectronics,118th,sofer,kubica,melanesian,tuanku,balkh,vyborg,crystallographic,initiators,metamorphism,ginzburg,looters,unimproved,finistere,newburyport,norges,immunities,franchisees,asterism,kortrijk,camorra,komsomol,fleurs,draughts,patagonian,voracious,artin,collaborationist,revolucion,revitalizing,xaver,purifying,antipsychotic,disjunct,pompeius,dreamwave,juvenal,beinn,adiyaman,antitank,allama,boletus,melanogaster,dumitru,caproni,aligns,athabaskan,stobart,phallus,veikkausliiga,hornsey,buffering,bourbons,dobruja,marga,borax,electrics,gangnam,motorcyclist,whidbey,draconian,lodger,galilean,sanctification,imitates,boldness,underboss,wheatland,cantabrian,terceira,maumee,redefining,uppercase,ostroda,characterise,universalism,equalized,syndicalism,haringey,masovia,deleuze,funkadelic,conceals,thuan,minsky,pluralistic,ludendorff,beekeeping,bonfires,endoscopic,abuts,prebend,jonkoping,amami,tribunes,yup'ik,awadh,gasification,pforzheim,reforma,antiwar,vaishnavism,maryville,inextricably,margrethe,empresa,neutrophils,sanctified,ponca,elachistidae,curiae,quartier,mannar,hyperplasia,wimax,busing,neologism,florins,underrepresented,digitised,nieuw,cooch,howards,frege,hughie,plied,swale,kapellmeister,vajpayee,quadrupled,aeronautique,dushanbe,custos,saltillo,kisan,tigray,manaus,epigrams,shamanic,peppered,frosts,promotion/relegation,concedes,zwingli,charentes,whangarei,hyung,spring/summer,sobre,eretz,initialization,sawai,ephemera,grandfathered,arnaldo,customised,permeated,parapets,growths,visegrad,estudios,altamont,provincia,apologises,stoppard,carburettor,rifts,kinematic,zhengzhou,eschatology,prakrit,folate,yvelines,scapula,stupas,rishon,reconfiguration,flutist,1680s,apostolate,proudhon,lakshman,articulating,stortford,faithfull,bitterns,upwelling,qur'anic,lidar,interferometry,waterlogged,koirala,ditton,wavefunction,fazal,babbage,antioxidants,lemberg,deadlocked,tolled,ramapo,mathematica,leiria,topologies,khali,photonic,balti,1080p,corrects,recommenced,polyglot,friezes,tiebreak,copacabana,cholmondeley,armband,abolishment,sheamus,buttes,glycolysis,cataloged,warrenton,sassari,kishan,foodservice,cryptanalysis,holmenkollen,cosplay,machi,yousuf,mangal,allying,fertiliser,otomi,charlevoix,metallurg,parisians,bottlenose,oakleigh,debug,cidade,accede,ligation,madhava,pillboxes,gatefold,aveyron,sorin,thirsk,immemorial,menelik,mehra,domingos,underpinned,fleshed,harshness,diphthong,crestwood,miskolc,dupri,pyrausta,muskingum,tuoba,prodi,incidences,waynesboro,marquesas,heydar,artesian,calinescu,nucleation,funders,covalently,compaction,derbies,seaters,sodor,tabular,amadou,peckinpah,o'halloran,zechariah,libyans,kartik,daihatsu,chandran,erzhu,heresies,superheated,yarder,dorde,tanjore,abusers,xuanwu,juniperus,moesia,trusteeship,birdwatching,beatz,moorcock,harbhajan,sanga,choreographic,photonics,boylston,amalgamate,prawns,electrifying,sarath,inaccurately,exclaims,powerpoint,chaining,cpusa,adulterous,saccharomyces,glogow,vfl/afl,syncretic,simla,persisting,functors,allosteric,euphorbiaceae,juryo,mlada,moana,gabala,thornycroft,kumanovo,ostrovsky,sitio,tutankhamun,sauropods,kardzhali,reinterpretation,sulpice,rosyth,originators,halesowen,delineation,asesoria,abatement,gardai,elytra,taillights,overlays,monsoons,sandpipers,ingmar,henrico,inaccuracy,irwell,arenabowl,elche,pressburg,signalman,interviewees,sinkhole,pendle,ecommerce,cellos,nebria,organometallic,surrealistic,propagandist,interlaken,canandaigua,aerials,coutinho,pascagoula,tonopah,letterkenny,gropius,carbons,hammocks,childe,polities,hosiery,donitz,suppresses,diaghilev,stroudsburg,bagram,pistoia,regenerating,unitarians,takeaway,offstage,vidin,glorification,bakunin,yavapai,lutzow,sabercats,witney,abrogated,gorlitz,validating,dodecahedron,stubbornly,telenor,glaxosmithkline,solapur,undesired,jellicoe,dramatization,four-and-a-half,seawall,waterpark,artaxerxes,vocalization,typographic,byung,sachsenhausen,shepparton,kissimmee,konnan,belsen,dhawan,khurd,mutagenesis,vejle,perrot,estradiol,formula_60,saros,chiloe,misiones,lamprey,terrains,speke,miasto,eigenvectors,haydock,reservist,corticosteroids,savitri,shinawatra,developmentally,yehudi,berates,janissaries,recapturing,rancheria,subplots,gresley,nikkatsu,oryol,cosmas,boavista,formula_59,playfully,subsections,commentated,kathakali,dorid,vilaine,seepage,hylidae,keiji,kazakhs,triphosphate,1620s,supersede,monarchists,falla,miyako,notching,bhumibol,polarizing,secularized,shingled,bronislaw,lockerbie,soleyman,bundesbahn,latakia,redoubts,boult,inwardly,invents,ondrej,minangkabau,newquay,permanente,alhaji,madhav,malini,ellice,bookmaker,mankiewicz,etihad,o'dea,interrogative,mikawa,wallsend,canisius,bluesy,vitruvius,noord,ratifying,mixtec,gujranwala,subprefecture,keelung,goiania,nyssa,shi'ite,semitone,ch'uan,computerised,pertuan,catapults,nepomuk,shruti,millstones,buskerud,acolytes,tredegar,sarum,armia,dell'arte,devises,custodians,upturned,gallaudet,disembarking,thrashed,sagrada,myeon,undeclared,qumran,gaiden,tepco,janesville,showground,condense,chalon,unstaffed,pasay,undemocratic,hauts,viridis,uninjured,escutcheon,gymkhana,petaling,hammam,dislocations,tallaght,rerum,shias,indios,guaranty,simplicial,benares,benediction,tajiri,prolifically,huawei,onerous,grantee,ferencvaros,otranto,carbonates,conceit,digipak,qadri,masterclasses,swamiji,cradock,plunket,helmsman,119th,salutes,tippecanoe,murshidabad,intelligibility,mittal,diversifying,bidar,asansol,crowdsourcing,rovere,karakoram,grindcore,skylights,tulagi,furrows,ligne,stuka,sumer,subgraph,amata,regionalist,bulkeley,teletext,glorify,readied,lexicographer,sabadell,predictability,quilmes,phenylalanine,bandaranaike,pyrmont,marksmen,quisling,viscountess,sociopolitical,afoul,pediments,swazi,martyrology,nullify,panagiotis,superconductors,veldenz,jujuy,l'isle,hematopoietic,shafi,subsea,hattiesburg,jyvaskyla,kebir,myeloid,landmine,derecho,amerindians,birkenau,scriabin,milhaud,mucosal,nikaya,freikorps,theoretician,proconsul,o'hanlon,clerked,bactria,houma,macular,topologically,shrubby,aryeh,ghazali,afferent,magalhaes,moduli,ashtabula,vidarbha,securitate,ludwigsburg,adoor,varun,shuja,khatun,chengde,bushels,lascelles,professionnelle,elfman,rangpur,unpowered,citytv,chojnice,quaternion,stokowski,aschaffenburg,commutes,subramaniam,methylene,satrap,gharb,namesakes,rathore,helier,gestational,heraklion,colliers,giannis,pastureland,evocation,krefeld,mahadeva,churchmen,egret,yilmaz,galeazzo,pudukkottai,artigas,generalitat,mudslides,frescoed,enfeoffed,aphorisms,melilla,montaigne,gauliga,parkdale,mauboy,linings,prema,sapir,xylophone,kushan,rockne,sequoyah,vasyl,rectilinear,vidyasagar,microcosm,san'a,carcinogen,thicknesses,aleut,farcical,moderating,detested,hegemonic,instalments,vauban,verwaltungsgemeinschaft,picayune,razorback,magellanic,moluccas,pankhurst,exportation,waldegrave,sufferer,bayswater,1up.com,rearmament,orangutans,varazdin,b.o.b,elucidate,harlingen,erudition,brankovic,lapis,slipway,urraca,shinde,unwell,elwes,euboea,colwyn,srivijaya,grandstands,hortons,generalleutnant,fluxes,peterhead,gandhian,reals,alauddin,maximized,fairhaven,endow,ciechanow,perforations,darters,panellist,manmade,litigants,exhibitor,tirol,caracalla,conformance,hotelier,stabaek,hearths,borac,frisians,ident,veliko,emulators,schoharie,uzbeks,samarra,prestwick,wadia,universita,tanah,bucculatrix,predominates,genotypes,denounces,roadsides,ganassi,keokuk,philatelist,tomic,ingots,conduits,samplers,abdus,johar,allegories,timaru,wolfpacks,secunda,smeaton,sportivo,inverting,contraindications,whisperer,moradabad,calamities,bakufu,soundscape,smallholders,nadeem,crossroad,xenophobic,zakir,nationalliga,glazes,retroflex,schwyz,moroder,rubra,quraysh,theodoros,endemol,infidels,km/hr,repositioned,portraitist,lluis,answerable,arges,mindedness,coarser,eyewall,teleported,scolds,uppland,vibraphone,ricoh,isenburg,bricklayer,cuttlefish,abstentions,communicable,cephalopod,stockyards,balto,kinston,armbar,bandini,elphaba,maxims,bedouins,sachsen,friedkin,tractate,pamir,ivanovo,mohini,kovalainen,nambiar,melvyn,orthonormal,matsuyama,cuernavaca,veloso,overstated,streamer,dravid,informers,analyte,sympathized,streetscape,gosta,thomasville,grigore,futuna,depleting,whelks,kiedis,armadale,earner,wynyard,dothan,animating,tridentine,sabri,immovable,rivoli,ariege,parley,clinker,circulates,junagadh,fraunhofer,congregants,180th,buducnost,formula_62,olmert,dedekind,karnak,bayernliga,mazes,sandpiper,ecclestone,yuvan,smallmouth,decolonization,lemmy,adjudicated,retiro,legia,benue,posit,acidification,wahab,taconic,floatplane,perchlorate,atria,wisbech,divestment,dallara,phrygia,palustris,cybersecurity,rebates,facie,mineralogical,substituent,proteges,fowey,mayenne,smoothbore,cherwell,schwarzschild,junin,murrumbidgee,smalltalk,d'orsay,emirati,calaveras,titusville,theremin,vikramaditya,wampanoag,burra,plaines,onegin,emboldened,whampoa,langa,soderbergh,arnaz,sowerby,arendal,godunov,pathanamthitta,damselfly,bestowing,eurosport,iconoclasm,outfitters,acquiesced,badawi,hypotension,ebbsfleet,annulus,sohrab,thenceforth,chagatai,necessitates,aulus,oddities,toynbee,uniontown,innervation,populaire,indivisible,rossellini,minuet,cyrene,gyeongju,chania,cichlids,harrods,1690s,plunges,abdullahi,gurkhas,homebuilt,sortable,bangui,rediff,incrementally,demetrios,medaille,sportif,svend,guttenberg,tubules,carthusian,pleiades,torii,hoppus,phenyl,hanno,conyngham,teschen,cronenberg,wordless,melatonin,distinctiveness,autos,freising,xuanzang,dunwich,satanism,sweyn,predrag,contractually,pavlovic,malaysians,micrometres,expertly,pannonian,abstaining,capensis,southwesterly,catchphrases,commercialize,frankivsk,normanton,hibernate,verso,deportees,dubliners,codice_8,condors,zagros,glosses,leadville,conscript,morrisons,usury,ossian,oulton,vaccinium,civet,ayman,codrington,hadron,nanometers,geochemistry,extractor,grigori,tyrrhenian,neocollyris,drooping,falsification,werft,courtauld,brigantine,orhan,chapultepec,supercopa,federalized,praga,havering,encampments,infallibility,sardis,pawar,undirected,reconstructionist,ardrossan,varuna,pastimes,archdiocesan,fledging,shenhua,molise,secondarily,stagnated,replicates,ciencias,duryodhana,marauding,ruislip,ilyich,intermixed,ravenswood,shimazu,mycorrhizal,icosahedral,consents,dunblane,follicular,pekin,suffield,muromachi,kinsale,gauche,businesspeople,thereto,watauga,exaltation,chelmno,gorse,proliferate,drainages,burdwan,kangra,transducers,inductor,duvalier,maguindanao,moslem,uncaf,givenchy,plantarum,liturgics,telegraphs,lukashenko,chenango,andante,novae,ironwood,faubourg,torme,chinensis,ambala,pietermaritzburg,virginians,landform,bottlenecks,o'driscoll,darbhanga,baptistery,ameer,needlework,naperville,auditoriums,mullingar,starrer,animatronic,topsoil,madura,cannock,vernet,santurce,catocala,ozeki,pontevedra,multichannel,sundsvall,strategists,medio,135th,halil,afridi,trelawny,caloric,ghraib,allendale,hameed,ludwigshafen,spurned,pavlo,palmar,strafed,catamarca,aveiro,harmonization,surah,predictors,solvay,mande,omnipresent,parenthesis,echolocation,equaling,experimenters,acyclic,lithographic,sepoys,katarzyna,sridevi,impoundment,khosrow,caesarean,nacogdoches,rockdale,lawmaker,caucasians,bahman,miyan,rubric,exuberance,bombastic,ductile,snowdonia,inlays,pinyon,anemones,hurries,hospitallers,tayyip,pulleys,treme,photovoltaics,testbed,polonium,ryszard,osgoode,profiting,ironwork,unsurpassed,nepticulidae,makai,lumbini,preclassic,clarksburg,egremont,videography,rehabilitating,ponty,sardonic,geotechnical,khurasan,solzhenitsyn,henna,phoenicia,rhyolite,chateaux,retorted,tomar,deflections,repressions,harborough,renan,brumbies,vandross,storia,vodou,clerkenwell,decking,universo,salon.com,imprisoning,sudwest,ghaziabad,subscribing,pisgah,sukhumi,econometric,clearest,pindar,yildirim,iulia,atlases,cements,remaster,dugouts,collapsible,resurrecting,batik,unreliability,thiers,conjunctions,colophon,marcher,placeholder,flagella,wolds,kibaki,viviparous,twelver,screenshots,aroostook,khadr,iconographic,itasca,jaume,basti,propounded,varro,be'er,jeevan,exacted,shrublands,creditable,brocade,boras,bittern,oneonta,attentional,herzliya,comprehensible,lakeville,discards,caxias,frankland,camerata,satoru,matlab,commutator,interprovincial,yorkville,benefices,nizami,edwardsville,amigaos,cannabinoid,indianola,amateurliga,pernicious,ubiquity,anarchic,novelties,precondition,zardari,symington,sargodha,headphone,thermopylae,mashonaland,zindagi,thalberg,loewe,surfactants,dobro,crocodilians,samhita,diatoms,haileybury,berwickshire,supercritical,sofie,snorna,slatina,intramolecular,agung,osteoarthritis,obstetric,teochew,vakhtang,connemara,deformations,diadem,ferruccio,mainichi,qualitatively,refrigerant,rerecorded,methylated,karmapa,krasinski,restatement,rouvas,cubitt,seacoast,schwarzkopf,homonymous,shipowner,thiamine,approachable,xiahou,160th,ecumenism,polistes,internazionali,fouad,berar,biogeography,texting,inadequately,'when,4kids,hymenoptera,emplaced,cognomen,bellefonte,supplant,michaelmas,uriel,tafsir,morazan,schweinfurt,chorister,ps400,nscaa,petipa,resolutely,ouagadougou,mascarene,supercell,konstanz,bagrat,harmonix,bergson,shrimps,resonators,veneta,camas,mynydd,rumford,generalmajor,khayyam,web.com,pappus,halfdan,tanana,suomen,yutaka,bibliographical,traian,silat,noailles,contrapuntal,agaricus,'special,minibuses,1670s,obadiah,deepa,rorschach,malolos,lymington,valuations,imperials,caballeros,ambroise,judicature,elegiac,sedaka,shewa,checksum,gosforth,legionaries,corneille,microregion,friedrichshafen,antonis,surnamed,mycelium,cantus,educations,topmost,outfitting,ivica,nankai,gouda,anthemic,iosif,supercontinent,antifungal,belarusians,mudaliar,mohawks,caversham,glaciated,basemen,stevan,clonmel,loughton,deventer,positivist,manipuri,tensors,panipat,changeup,impermeable,dubbo,elfsborg,maritimo,regimens,bikram,bromeliad,substratum,norodom,gaultier,queanbeyan,pompeo,redacted,eurocopter,mothballed,centaurs,borno,copra,bemidji,'home,sopron,neuquen,passo,cineplex,alexandrov,wysokie,mammoths,yossi,sarcophagi,congreve,petkovic,extraneous,waterbirds,slurs,indias,phaeton,discontented,prefaced,abhay,prescot,interoperable,nordisk,bicyclists,validly,sejong,litovsk,zanesville,kapitanleutnant,kerch,changeable,mcclatchy,celebi,attesting,maccoll,sepahan,wayans,veined,gaudens,markt,dansk,soane,quantized,petersham,forebears,nayarit,frenzied,queuing,bygone,viggo,ludwik,tanka,hanssen,brythonic,cornhill,primorsky,stockpiles,conceptualization,lampeter,hinsdale,mesoderm,bielsk,rosenheim,ultron,joffrey,stanwyck,khagan,tiraspol,pavelic,ascendant,empoli,metatarsal,descentralizado,masada,ligier,huseyin,ramadi,waratah,tampines,ruthenium,statoil,mladost,liger,grecian,multiparty,digraph,maglev,reconsideration,radiography,cartilaginous,taizu,wintered,anabaptist,peterhouse,shoghi,assessors,numerator,paulet,painstakingly,halakhic,rocroi,motorcycling,gimel,kryptonian,emmeline,cheeked,drawdown,lelouch,dacians,brahmana,reminiscence,disinfection,optimizations,golders,extensor,tsugaru,tolling,liman,gulzar,unconvinced,crataegus,oppositional,dvina,pyrolysis,mandan,alexius,prion,stressors,loomed,moated,dhivehi,recyclable,relict,nestlings,sarandon,kosovar,solvers,czeslaw,kenta,maneuverable,middens,berkhamsted,comilla,folkways,loxton,beziers,batumi,petrochemicals,optimised,sirjan,rabindra,musicality,rationalisation,drillers,subspaces,'live,bbwaa,outfielders,tsung,danske,vandalised,norristown,striae,kanata,gastroenterology,steadfastly,equalising,bootlegging,mannerheim,notodontidae,lagoa,commentating,peninsulas,chishti,seismology,modigliani,preceptor,canonically,awardee,boyaca,hsinchu,stiffened,nacelle,bogor,dryness,unobstructed,yaqub,scindia,peeters,irritant,ammonites,ferromagnetic,speechwriter,oxygenated,walesa,millais,canarian,faience,calvinistic,discriminant,rasht,inker,annexes,howth,allocates,conditionally,roused,regionalism,regionalbahn,functionary,nitrates,bicentenary,recreates,saboteurs,koshi,plasmids,thinned,124th,plainview,kardashian,neuville,victorians,radiates,127th,vieques,schoolmates,petru,tokusatsu,keying,sunaina,flamethrower,'bout,demersal,hosokawa,corelli,omniscient,o'doherty,niksic,reflectivity,transdev,cavour,metronome,temporally,gabba,nsaids,geert,mayport,hematite,boeotia,vaudreuil,torshavn,sailplane,mineralogist,eskisehir,practises,gallifrey,takumi,unease,slipstream,hedmark,paulinus,ailsa,wielkopolska,filmworks,adamantly,vinaya,facelifted,franchisee,augustana,toppling,velvety,crispa,stonington,histological,genealogist,tactician,tebow,betjeman,nyingma,overwinter,oberoi,rampal,overwinters,petaluma,lactarius,stanmore,balikpapan,vasant,inclines,laminate,munshi,sociedade,rabbah,septal,boyband,ingrained,faltering,inhumans,nhtsa,affix,l'ordre,kazuki,rossendale,mysims,latvians,slaveholders,basilicata,neuburg,assize,manzanillo,scrobipalpa,formula_61,belgique,pterosaurs,privateering,vaasa,veria,northport,pressurised,hobbyist,austerlitz,sahih,bhadra,siliguri,bistrica,bursaries,wynton,corot,lepidus,lully,libor,libera,olusegun,choline,mannerism,lymphocyte,chagos,duxbury,parasitism,ecowas,morotai,cancion,coniston,aggrieved,sputnikmusic,parle,ammonian,civilisations,malformation,cattaraugus,skyhawks,d'arc,demerara,bronfman,midwinter,piscataway,jogaila,threonine,matins,kohlberg,hubli,pentatonic,camillus,nigam,potro,unchained,chauvel,orangeville,cistercians,redeployment,xanthi,manju,carabinieri,pakeha,nikolaevich,kantakouzenos,sesquicentennial,gunships,symbolised,teramo,ballo,crusading,l'oeil,bharatpur,lazier,gabrovo,hysteresis,rothbard,chaumont,roundel,ma'mun,sudhir,queried,newts,shimane,presynaptic,playfield,taxonomists,sensitivities,freleng,burkinabe,orfeo,autovia,proselytizing,bhangra,pasok,jujutsu,heung,pivoting,hominid,commending,formula_64,epworth,christianized,oresund,hantuchova,rajputana,hilversum,masoretic,dayak,bakri,assen,magog,macromolecules,waheed,qaida,spassky,rumped,protrudes,preminger,misogyny,glencairn,salafi,lacunae,grilles,racemes,areva,alighieri,inari,epitomized,photoshoot,one-of-a-kind,tring,muralist,tincture,backwaters,weaned,yeasts,analytically,smaland,caltrans,vysocina,jamuna,mauthausen,175th,nouvelles,censoring,reggina,christology,gilad,amplifying,mehmood,johnsons,redirects,eastgate,sacrum,meteoric,riverbanks,guidebooks,ascribes,scoparia,iconoclastic,telegraphic,chine,merah,mistico,lectern,sheung,aethelstan,capablanca,anant,uspto,albatrosses,mymensingh,antiretroviral,clonal,coorg,vaillant,liquidator,gigas,yokai,eradicating,motorcyclists,waitakere,tandon,nears,montenegrins,250th,tatsuya,yassin,atheistic,syncretism,nahum,berisha,transcended,owensboro,lakshmana,abteilung,unadorned,nyack,overflows,harrisonburg,complainant,uematsu,frictional,worsens,sangguniang,abutment,bulwer,sarma,apollinaire,shippers,lycia,alentejo,porpoises,optus,trawling,augustow,blackwall,workbench,westmount,leaped,sikandar,conveniences,stornoway,culverts,zoroastrians,hristo,ansgar,assistive,reassert,fanned,compasses,delgada,maisons,arima,plonsk,verlaine,starstruck,rakhine,befell,spirally,wyclef,expend,colloquium,formula_63,albertus,bellarmine,handedness,holon,introns,movimiento,profitably,lohengrin,discoverers,awash,erste,pharisees,dwarka,oghuz,hashing,heterodox,uloom,vladikavkaz,linesman,rehired,nucleophile,germanicus,gulshan,songz,bayerische,paralympian,crumlin,enjoined,khanum,prahran,penitent,amersfoort,saranac,semisimple,vagrants,compositing,tualatin,oxalate,lavra,ironi,ilkeston,umpqua,calum,stretford,zakat,guelders,hydrazine,birkin,spurring,modularity,aspartate,sodermanland,hopital,bellary,legazpi,clasico,cadfael,hypersonic,volleys,pharmacokinetics,carotene,orientale,pausini,bataille,lunga,retailed,m.phil,mazowieckie,vijayan,rawal,sublimation,promissory,estimators,ploughed,conflagration,penda,segregationist,otley,amputee,coauthor,sopra,pellew,wreckers,tollywood,circumscription,permittivity,strabane,landward,articulates,beaverbrook,rutherglen,coterminous,whistleblowers,colloidal,surbiton,atlante,oswiecim,bhasa,lampooned,chanter,saarc,landkreis,tribulation,tolerates,daiichi,hatun,cowries,dyschirius,abercromby,attock,aldwych,inflows,absolutist,l'histoire,committeeman,vanbrugh,headstock,westbourne,appenzell,hoxton,oculus,westfalen,roundabouts,nickelback,trovatore,quenching,summarises,conservators,transmutation,talleyrand,barzani,unwillingly,axonal,'blue,opining,enveloping,fidesz,rafah,colborne,flickr,lozenge,dulcimer,ndebele,swaraj,oxidize,gonville,resonated,gilani,superiore,endeared,janakpur,shepperton,solidifying,memoranda,sochaux,kurnool,rewari,emirs,kooning,bruford,unavailability,kayseri,judicious,negating,pterosaur,cytosolic,chernihiv,variational,sabretooth,seawolves,devalued,nanded,adverb,volunteerism,sealers,nemours,smederevo,kashubian,bartin,animax,vicomte,polotsk,polder,archiepiscopal,acceptability,quidditch,tussock,seminaire,immolation,belge,coves,wellingborough,khaganate,mckellen,nayaka,brega,kabhi,pontoons,bascule,newsreels,injectors,cobol,weblog,diplo,biggar,wheatbelt,erythrocytes,pedra,showgrounds,bogdanovich,eclecticism,toluene,elegies,formalize,andromedae,airworthiness,springville,mainframes,overexpression,magadha,bijelo,emlyn,glutamine,accenture,uhuru,metairie,arabidopsis,patanjali,peruvians,berezovsky,accion,astrolabe,jayanti,earnestly,sausalito,recurved,1500s,ramla,incineration,galleons,laplacian,shiki,smethwick,isomerase,dordevic,janow,jeffersonville,internationalism,penciled,styrene,ashur,nucleoside,peristome,horsemanship,sedges,bachata,medes,kristallnacht,schneerson,reflectance,invalided,strutt,draupadi,destino,partridges,tejas,quadrennial,aurel,halych,ethnomusicology,autonomist,radyo,rifting,shi'ar,crvena,telefilm,zawahiri,plana,sultanates,theodorus,subcontractors,pavle,seneschal,teleports,chernivtsi,buccal,brattleboro,stankovic,safar,dunhuang,electrocution,chastised,ergonomic,midsomer,130th,zomba,nongovernmental,escapist,localize,xuzhou,kyrie,carinthian,karlovac,nisan,kramnik,pilipino,digitisation,khasi,andronicus,highwayman,maior,misspelling,sebastopol,socon,rhaetian,archimandrite,partway,positivity,otaku,dingoes,tarski,geopolitics,disciplinarian,zulfikar,kenzo,globose,electrophilic,modele,storekeeper,pohang,wheldon,washers,interconnecting,digraphs,intrastate,campy,helvetic,frontispiece,ferrocarril,anambra,petraeus,midrib,endometrial,dwarfism,mauryan,endocytosis,brigs,percussionists,furtherance,synergistic,apocynaceae,krona,berthier,circumvented,casal,siltstone,precast,ethnikos,realists,geodesy,zarzuela,greenback,tripathi,persevered,interments,neutralization,olbermann,departements,supercomputing,demobilised,cassavetes,dunder,ministering,veszprem,barbarism,'world,pieve,apologist,frentzen,sulfides,firewalls,pronotum,staatsoper,hachette,makhachkala,oberland,phonon,yoshihiro,instars,purnima,winslet,mutsu,ergative,sajid,nizamuddin,paraphrased,ardeidae,kodagu,monooxygenase,skirmishers,sportiva,o'byrne,mykolaiv,ophir,prieta,gyllenhaal,kantian,leche,copan,herero,ps250,gelsenkirchen,shalit,sammarinese,chetwynd,wftda,travertine,warta,sigmaringen,concerti,namespace,ostergotland,biomarker,universals,collegio,embarcadero,wimborne,fiddlers,likening,ransomed,stifled,unabated,kalakaua,khanty,gongs,goodrem,countermeasure,publicizing,geomorphology,swedenborg,undefended,catastrophes,diverts,storyboards,amesbury,contactless,placentia,festivity,authorise,terrane,thallium,stradivarius,antonine,consortia,estimations,consecrate,supergiant,belichick,pendants,butyl,groza,univac,afire,kavala,studi,teletoon,paucity,gonbad,koninklijke,128th,stoichiometric,multimodal,facundo,anatomic,melamine,creuse,altan,brigands,mcguinty,blomfield,tsvangirai,protrusion,lurgan,warminster,tenzin,russellville,discursive,definable,scotrail,lignin,reincorporated,o'dell,outperform,redland,multicolored,evaporates,dimitrie,limbic,patapsco,interlingua,surrogacy,cutty,potrero,masud,cahiers,jintao,ardashir,centaurus,plagiarized,minehead,musings,statuettes,logarithms,seaview,prohibitively,downforce,rivington,tomorrowland,microbiologist,ferric,morag,capsid,kucinich,clairvaux,demotic,seamanship,cicada,painterly,cromarty,carbonic,tupou,oconee,tehuantepec,typecast,anstruther,internalized,underwriters,tetrahedra,flagrant,quakes,pathologies,ulrik,nahal,tarquini,dongguan,parnassus,ryoko,senussi,seleucia,airasia,einer,sashes,d'amico,matriculating,arabesque,honved,biophysical,hardinge,kherson,mommsen,diels,icbms,reshape,brasiliensis,palmach,netaji,oblate,functionalities,grigor,blacksburg,recoilless,melanchthon,reales,astrodome,handcrafted,memes,theorizes,isma'il,aarti,pirin,maatschappij,stabilizes,honiara,ashbury,copts,rootes,defensed,queiroz,mantegna,galesburg,coraciiformesfamily,cabrillo,tokio,antipsychotics,kanon,173rd,apollonia,finial,lydian,hadamard,rangi,dowlatabad,monolingual,platformer,subclasses,chiranjeevi,mirabeau,newsgroup,idmanyurdu,kambojas,walkover,zamoyski,generalist,khedive,flanges,knowle,bande,157th,alleyn,reaffirm,pininfarina,zuckerberg,hakodate,131st,aditi,bellinzona,vaulter,planking,boscombe,colombians,lysis,toppers,metered,nahyan,queensryche,minho,nagercoil,firebrand,foundress,bycatch,mendota,freeform,antena,capitalisation,martinus,overijssel,purists,interventionist,zgierz,burgundians,hippolyta,trompe,umatilla,moroccans,dictionnaire,hydrography,changers,chota,rimouski,aniline,bylaw,grandnephew,neamt,lemnos,connoisseurs,tractive,rearrangements,fetishism,finnic,apalachicola,landowning,calligraphic,circumpolar,mansfeld,legible,orientalism,tannhauser,blamey,maximization,noinclude,blackbirds,angara,ostersund,pancreatitis,glabra,acleris,juried,jungian,triumphantly,singlet,plasmas,synesthesia,yellowhead,unleashes,choiseul,quanzhong,brookville,kaskaskia,igcse,skatepark,jatin,jewellers,scaritinae,techcrunch,tellurium,lachaise,azuma,codeshare,dimensionality,unidirectional,scolaire,macdill,camshafts,unassisted,verband,kahlo,eliya,prelature,chiefdoms,saddleback,sockers,iommi,coloratura,llangollen,biosciences,harshest,maithili,k'iche,plical,multifunctional,andreu,tuskers,confounding,sambre,quarterdeck,ascetics,berdych,transversal,tuolumne,sagami,petrobras,brecker,menxia,instilling,stipulating,korra,oscillate,deadpan,v/line,pyrotechnic,stoneware,prelims,intracoastal,retraining,ilija,berwyn,encrypt,achievers,zulfiqar,glycoproteins,khatib,farmsteads,occultist,saman,fionn,derulo,khilji,obrenovic,argosy,toowong,dementieva,sociocultural,iconostasis,craigslist,festschrift,taifa,intercalated,tanjong,penticton,sharad,marxian,extrapolation,guises,wettin,prabang,exclaiming,kosta,famas,conakry,wanderings,'aliabad,macleay,exoplanet,bancorp,besiegers,surmounting,checkerboard,rajab,vliet,tarek,operable,wargaming,haldimand,fukuyama,uesugi,aggregations,erbil,brachiopods,tokyu,anglais,unfavorably,ujpest,escorial,armagnac,nagara,funafuti,ridgeline,cocking,o'gorman,compactness,retardant,krajowa,barua,coking,bestows,thampi,chicagoland,variably,o'loughlin,minnows,schwa,shaukat,polycarbonate,chlorinated,godalming,gramercy,delved,banqueting,enlil,sarada,prasanna,domhnall,decadal,regressive,lipoprotein,collectable,surendra,zaporizhia,cycliste,suchet,offsetting,formula_65,pudong,d'arte,blyton,quonset,osmania,tientsin,manorama,proteomics,bille,jalpaiguri,pertwee,barnegat,inventiveness,gollancz,euthanized,henricus,shortfalls,wuxia,chlorides,cerrado,polyvinyl,folktale,straddled,bioengineering,eschewing,greendale,recharged,olave,ceylonese,autocephalous,peacebuilding,wrights,guyed,rosamund,abitibi,bannockburn,gerontology,scutari,souness,seagram,codice_9,'open,xhtml,taguig,purposed,darbar,orthopedics,unpopulated,kisumu,tarrytown,feodor,polyhedral,monadnock,gottorp,priam,redesigning,gasworks,elfin,urquiza,homologation,filipovic,bohun,manningham,gornik,soundness,shorea,lanus,gelder,darke,sandgate,criticality,paranaense,153rd,vieja,lithograph,trapezoid,tiebreakers,convalescence,yan'an,actuaries,balad,altimeter,thermoelectric,trailblazer,previn,tenryu,ancaster,endoscopy,nicolet,discloses,fracking,plaine,salado,americanism,placards,absurdist,propylene,breccia,jirga,documenta,ismailis,161st,brentano,dallas/fort,embellishment,calipers,subscribes,mahavidyalaya,wednesbury,barnstormers,miwok,schembechler,minigame,unterberger,dopaminergic,inacio,nizamabad,overridden,monotype,cavernous,stichting,sassafras,sotho,argentinean,myrrh,rapidity,flatts,gowrie,dejected,kasaragod,cyprinidae,interlinked,arcseconds,degeneracy,infamously,incubate,substructure,trigeminal,sectarianism,marshlands,hooliganism,hurlers,isolationist,urania,burrard,switchover,lecco,wilts,interrogator,strived,ballooning,volterra,raciborz,relegating,gilding,cybele,dolomites,parachutist,lochaber,orators,raeburn,backend,benaud,rallycross,facings,banga,nuclides,defencemen,futurity,emitters,yadkin,eudonia,zambales,manasseh,sirte,meshes,peculiarly,mcminnville,roundly,boban,decrypt,icelanders,sanam,chelan,jovian,grudgingly,penalised,subscript,gambrinus,poaceae,infringements,maleficent,runciman,148th,supersymmetry,granites,liskeard,eliciting,involution,hallstatt,kitzbuhel,shankly,sandhills,inefficiencies,yishuv,psychotropic,nightjars,wavell,sangamon,vaikundar,choshu,retrospectives,pitesti,gigantea,hashemi,bosna,gakuin,siochana,arrangers,baronetcies,narayani,temecula,creston,koscierzyna,autochthonous,wyandot,anniston,igreja,mobilise,buzau,dunster,musselburgh,wenzhou,khattak,detoxification,decarboxylase,manlius,campbells,coleoptera,copyist,sympathisers,suisun,eminescu,defensor,transshipment,thurgau,somerton,fluctuates,ambika,weierstrass,lukow,giambattista,volcanics,romanticized,innovated,matabeleland,scotiabank,garwolin,purine,d'auvergne,borderland,maozhen,pricewaterhousecoopers,testator,pallium,scout.com,mv/pi,nazca,curacies,upjohn,sarasvati,monegasque,ketrzyn,malory,spikelets,biomechanics,haciendas,rapped,dwarfed,stews,nijinsky,subjection,matsu,perceptible,schwarzburg,midsection,entertains,circuitous,epiphytic,wonsan,alpini,bluefield,sloths,transportable,braunfels,dictum,szczecinek,jukka,wielun,wejherowo,hucknall,grameen,duodenum,ribose,deshpande,shahar,nexstar,injurious,dereham,lithographer,dhoni,structuralist,progreso,deschutes,christus,pulteney,quoins,yitzchak,gyeongsang,breviary,makkah,chiyoda,jutting,vineland,angiosperms,necrotic,novelisation,redistribute,tirumala,140th,featureless,mafic,rivaling,toyline,2/1st,martius,saalfeld,monthan,texian,kathak,melodramas,mithila,regierungsbezirk,509th,fermenting,schoolmate,virtuosic,briain,kokoda,heliocentric,handpicked,kilwinning,sonically,dinars,kasim,parkways,bogdanov,luxembourgian,halland,avesta,bardic,daugavpils,excavator,qwest,frustrate,physiographic,majoris,'ndrangheta,unrestrained,firmness,montalban,abundances,preservationists,adare,executioners,guardsman,bonnaroo,neglects,nazrul,pro12,hoorn,abercorn,refuting,kabud,cationic,parapsychology,troposphere,venezuelans,malignancy,khoja,unhindered,accordionist,medak,visby,ejercito,laparoscopic,dinas,umayyads,valmiki,o'dowd,saplings,stranding,incisions,illusionist,avocets,buccleuch,amazonia,fourfold,turboprops,roosts,priscus,turnstile,areal,certifies,pocklington,spoofs,viseu,commonalities,dabrowka,annam,homesteaders,daredevils,mondrian,negotiates,fiestas,perennials,maximizes,lubavitch,ravindra,scrapers,finials,kintyre,violas,snoqualmie,wilders,openbsd,mlawa,peritoneal,devarajan,congke,leszno,mercurial,fakir,joannes,bognor,overloading,unbuilt,gurung,scuttle,temperaments,bautzen,jardim,tradesman,visitations,barbet,sagamore,graaff,forecasters,wilsons,assis,l'air,shariah,sochaczew,russa,dirge,biliary,neuve,heartbreakers,strathearn,jacobian,overgrazing,edrich,anticline,parathyroid,petula,lepanto,decius,channelled,parvathi,puppeteers,communicators,francorchamps,kahane,longus,panjang,intron,traite,xxvii,matsuri,amrit,katyn,disheartened,cacak,omonia,alexandrine,partaking,wrangling,adjuvant,haskovo,tendrils,greensand,lammermoor,otherworld,volusia,stabling,one-and-a-half,bresson,zapatista,eotvos,ps150,webisodes,stepchildren,microarray,braganca,quanta,dolne,superoxide,bellona,delineate,ratha,lindenwood,bruhl,cingulate,tallies,bickerton,helgi,bevin,takoma,tsukuba,statuses,changeling,alister,bytom,dibrugarh,magnesia,duplicating,outlier,abated,goncalo,strelitz,shikai,mardan,musculature,ascomycota,springhill,tumuli,gabaa,odenwald,reformatted,autocracy,theresienstadt,suplex,chattopadhyay,mencken,congratulatory,weatherfield,systema,solemnity,projekt,quanzhou,kreuzberg,postbellum,nobuo,mediaworks,finisterre,matchplay,bangladeshis,kothen,oocyte,hovered,aromas,afshar,browed,teases,chorlton,arshad,cesaro,backbencher,iquique,vulcans,padmini,unabridged,cyclase,despotic,kirilenko,achaean,queensberry,debre,octahedron,iphigenia,curbing,karimnagar,sagarmatha,smelters,surrealists,sanada,shrestha,turridae,leasehold,jiedushi,eurythmics,appropriating,correze,thimphu,amery,musicomh,cyborgs,sandwell,pushcart,retorts,ameliorate,deteriorates,stojanovic,spline,entrenchments,bourse,chancellorship,pasolini,lendl,personage,reformulated,pubescens,loiret,metalurh,reinvention,nonhuman,eilema,tarsal,complutense,magne,broadview,metrodome,outtake,stouffville,seinen,bataillon,phosphoric,ostensible,opatow,aristides,beefheart,glorifying,banten,romsey,seamounts,fushimi,prophylaxis,sibylla,ranjith,goslar,balustrades,georgiev,caird,lafitte,peano,canso,bankura,halfpenny,segregate,caisson,bizerte,jamshedpur,euromaidan,philosophie,ridged,cheerfully,reclassification,aemilius,visionaries,samoans,wokingham,chemung,wolof,unbranched,cinerea,bhosle,ourense,immortalised,cornerstones,sourcebook,khufu,archimedean,universitatea,intermolecular,fiscally,suffices,metacomet,adjudicator,stablemate,specks,glace,inowroclaw,patristic,muharram,agitating,ashot,neurologic,didcot,gamla,ilves,putouts,siraj,laski,coaling,diarmuid,ratnagiri,rotulorum,liquefaction,morbihan,harel,aftershock,gruiformesfamily,bonnier,falconiformesfamily,adorns,wikis,maastrichtian,stauffenberg,bishopsgate,fakhr,sevenfold,ponders,quantifying,castiel,opacity,depredations,lenten,gravitated,o'mahony,modulates,inuktitut,paston,kayfabe,vagus,legalised,balked,arianism,tendering,sivas,birthdate,awlaki,khvajeh,shahab,samtgemeinde,bridgeton,amalgamations,biogenesis,recharging,tsukasa,mythbusters,chamfered,enthronement,freelancers,maharana,constantia,sutil,messines,monkton,okanogan,reinvigorated,apoplexy,tanahashi,neues,valiants,harappan,russes,carding,volkoff,funchal,statehouse,imitative,intrepidity,mellotron,samaras,turkana,besting,longitudes,exarch,diarrhoea,transcending,zvonareva,darna,ramblin,disconnection,137th,refocused,diarmait,agricole,ba'athist,turenne,contrabass,communis,daviess,fatimids,frosinone,fittingly,polyphyletic,qanat,theocratic,preclinical,abacha,toorak,marketplaces,conidia,seiya,contraindicated,retford,bundesautobahn,rebuilds,climatology,seaworthy,starfighter,qamar,categoria,malai,hellinsia,newstead,airworthy,catenin,avonmouth,arrhythmias,ayyavazhi,downgrade,ashburnham,ejector,kinematics,petworth,rspca,filmation,accipitridae,chhatrapati,g/mol,bacau,agama,ringtone,yudhoyono,orchestrator,arbitrators,138th,powerplants,cumbernauld,alderley,misamis,hawai`i,cuando,meistriliiga,jermyn,alans,pedigrees,ottavio,approbation,omnium,purulia,prioress,rheinland,lymphoid,lutsk,oscilloscope,ballina,iliac,motorbikes,modernising,uffizi,phylloxera,kalevala,bengalis,amravati,syntheses,interviewers,inflectional,outflank,maryhill,unhurt,profiler,nacelles,heseltine,personalised,guarda,herpetologist,airpark,pigot,margaretha,dinos,peleliu,breakbeat,kastamonu,shaivism,delamere,kingsville,epigram,khlong,phospholipids,journeying,lietuvos,congregated,deviance,celebes,subsoil,stroma,kvitova,lubricating,layoff,alagoas,olafur,doron,interuniversity,raycom,agonopterix,uzice,nanna,springvale,raimundo,wrested,pupal,talat,skinheads,vestige,unpainted,handan,odawara,ammar,attendee,lapped,myotis,gusty,ciconiiformesfamily,traversal,subfield,vitaphone,prensa,hasidism,inwood,carstairs,kropotkin,turgenev,dobra,remittance,purim,tannin,adige,tabulation,lethality,pacha,micronesian,dhruva,defensemen,tibeto,siculus,radioisotope,sodertalje,phitsanulok,euphonium,oxytocin,overhangs,skinks,fabrica,reinterred,emulates,bioscience,paragliding,raekwon,perigee,plausibility,frolunda,erroll,aznar,vyasa,albinus,trevally,confederacion,terse,sixtieth,1530s,kendriya,skateboarders,frontieres,muawiyah,easements,shehu,conservatively,keystones,kasem,brutalist,peekskill,cowry,orcas,syllabary,paltz,elisabetta,denticles,hampering,dolni,eidos,aarau,lermontov,yankton,shahbaz,barrages,kongsvinger,reestablishment,acetyltransferase,zulia,mrnas,slingsby,eucalypt,efficacious,weybridge,gradation,cinematheque,malthus,bampton,coexisted,cisse,hamdi,cupertino,saumarez,chionodes,libertine,formers,sakharov,pseudonymous,vol.1,mcduck,gopalakrishnan,amberley,jorhat,grandmasters,rudiments,dwindle,param,bukidnon,menander,americanus,multipliers,pulawy,homoerotic,pillbox,cd+dvd,epigraph,aleksandrow,extrapolated,horseshoes,contemporain,angiography,hasselt,shawinigan,memorization,legitimized,cyclades,outsold,rodolphe,kelis,powerball,dijkstra,analyzers,incompressible,sambar,orangeburg,osten,reauthorization,adamawa,sphagnum,hypermarket,millipedes,zoroaster,madea,ossuary,murrayfield,pronominal,gautham,resellers,ethers,quarrelled,dolna,stragglers,asami,tangut,passos,educacion,sharaf,texel,berio,bethpage,bezalel,marfa,noronha,36ers,genteel,avram,shilton,compensates,sweetener,reinstalled,disables,noether,1590s,balakrishnan,kotaro,northallerton,cataclysm,gholam,cancellara,schiphol,commends,longinus,albinism,gemayel,hamamatsu,volos,islamism,sidereal,pecuniary,diggings,townsquare,neosho,lushan,chittoor,akhil,disputation,desiccation,cambodians,thwarting,deliberated,ellipsis,bahini,susumu,separators,kohneh,plebeians,kultur,ogaden,pissarro,trypeta,latur,liaodong,vetting,datong,sohail,alchemists,lengthwise,unevenly,masterly,microcontrollers,occupier,deviating,farringdon,baccalaureat,theocracy,chebyshev,archivists,jayaram,ineffectiveness,scandinavians,jacobins,encomienda,nambu,g/cm3,catesby,paavo,heeded,rhodium,idealised,10deg,infective,mecyclothorax,halevy,sheared,minbari,audax,lusatian,rebuffs,hitfix,fastener,subjugate,tarun,binet,compuserve,synthesiser,keisuke,amalric,ligatures,tadashi,ignazio,abramovich,groundnut,otomo,maeve,mortlake,ostrogoths,antillean,todor,recto,millimetre,espousing,inaugurate,paracetamol,galvanic,harpalinae,jedrzejow,reassessment,langlands,civita,mikan,stikine,bijar,imamate,istana,kaiserliche,erastus,federale,cytosine,expansionism,hommes,norrland,smriti,snapdragon,gulab,taleb,lossy,khattab,urbanised,sesto,rekord,diffuser,desam,morganatic,silting,pacts,extender,beauharnais,purley,bouches,halfpipe,discontinuities,houthi,farmville,animism,horni,saadi,interpretative,blockades,symeon,biogeographic,transcaucasian,jetties,landrieu,astrocytes,conjunto,stumpings,weevils,geysers,redux,arching,romanus,tazeh,marcellinus,casein,opava,misrata,anare,sattar,declarer,dreux,oporto,venta,vallis,icosahedron,cortona,lachine,mohammedan,sandnes,zynga,clarin,diomedes,tsuyoshi,pribram,gulbarga,chartist,superettan,boscawen,altus,subang,gating,epistolary,vizianagaram,ogdensburg,panna,thyssen,tarkovsky,dzogchen,biograph,seremban,unscientific,nightjar,legco,deism,n.w.a,sudha,siskel,sassou,flintlock,jovial,montbeliard,pallida,formula_66,tranquillity,nisei,adornment,'people,yamhill,hockeyallsvenskan,adopters,appian,lowicz,haplotypes,succinctly,starogard,presidencies,kheyrabad,sobibor,kinesiology,cowichan,militum,cromwellian,leiningen,ps1.5,concourses,dalarna,goldfield,brzeg,faeces,aquarii,matchless,harvesters,181st,numismatics,korfball,sectioned,transpires,facultative,brandishing,kieron,forages,menai,glutinous,debarge,heathfield,1580s,malang,photoelectric,froome,semiotic,alwar,grammophon,chiaroscuro,mentalist,maramures,flacco,liquors,aleutians,marvell,sutlej,patnaik,qassam,flintoff,bayfield,haeckel,sueno,avicii,exoplanets,hoshi,annibale,vojislav,honeycombs,celebrant,rendsburg,veblen,quails,141st,carronades,savar,narrations,jeeva,ontologies,hedonistic,marinette,godot,munna,bessarabian,outrigger,thame,gravels,hoshino,falsifying,stereochemistry,nacionalista,medially,radula,ejecting,conservatorio,odile,ceiba,jaina,essonne,isometry,allophones,recidivism,iveco,ganda,grammarians,jagan,signposted,uncompressed,facilitators,constancy,ditko,propulsive,impaling,interbank,botolph,amlaib,intergroup,sorbus,cheka,debye,praca,adorning,presbyteries,dormition,strategos,qarase,pentecostals,beehives,hashemite,goldust,euronext,egress,arpanet,soames,jurchens,slovenska,copse,kazim,appraisals,marischal,mineola,sharada,caricaturist,sturluson,galba,faizabad,overwintering,grete,uyezds,didsbury,libreville,ablett,microstructure,anadolu,belenenses,elocution,cloaks,timeslots,halden,rashidun,displaces,sympatric,germanus,tuples,ceska,equalize,disassembly,krautrock,babangida,memel,deild,gopala,hematology,underclass,sangli,wawrinka,assur,toshack,refrains,nicotinic,bhagalpur,badami,racetracks,pocatello,walgreens,nazarbayev,occultation,spinnaker,geneon,josias,hydrolyzed,dzong,corregimiento,waistcoat,thermoplastic,soldered,anticancer,lactobacillus,shafi'i,carabus,adjournment,schlumberger,triceratops,despotate,mendicant,krishnamurti,bahasa,earthworm,lavoisier,noetherian,kalki,fervently,bhawan,saanich,coquille,gannet,motagua,kennels,mineralization,fitzherbert,svein,bifurcated,hairdressing,felis,abounded,dimers,fervour,hebdo,bluffton,aetna,corydon,clevedon,carneiro,subjectively,deutz,gastropoda,overshot,concatenation,varman,carolla,maharshi,mujib,inelastic,riverhead,initialized,safavids,rohini,caguas,bulges,fotbollforbund,hefei,spithead,westville,maronites,lytham,americo,gediminas,stephanus,chalcolithic,hijra,gnu/linux,predilection,rulership,sterility,haidar,scarlatti,saprissa,sviatoslav,pointedly,sunroof,guarantor,thevar,airstrips,pultusk,sture,129th,divinities,daizong,dolichoderus,cobourg,maoists,swordsmanship,uprated,bohme,tashi,largs,chandi,bluebeard,householders,richardsonian,drepanidae,antigonish,elbasan,occultism,marca,hypergeometric,oirat,stiglitz,ignites,dzungar,miquelon,pritam,d'automne,ulidiid,niamey,vallecano,fondo,billiton,incumbencies,raceme,chambery,cadell,barenaked,kagame,summerside,haussmann,hatshepsut,apothecaries,criollo,feint,nasals,timurid,feltham,plotinus,oxygenation,marginata,officinalis,salat,participations,ising,downe,izumo,unguided,pretence,coursed,haruna,viscountcy,mainstage,justicia,powiat,takara,capitoline,implacable,farben,stopford,cosmopterix,tuberous,kronecker,galatians,kweli,dogmas,exhorted,trebinje,skanda,newlyn,ablative,basidia,bhiwani,encroachments,stranglers,regrouping,tubal,shoestring,wawel,anionic,mesenchymal,creationists,pyrophosphate,moshi,despotism,powerbook,fatehpur,rupiah,segre,ternate,jessore,b.i.g,shevardnadze,abounds,gliwice,densest,memoria,suborbital,vietcong,ratepayers,karunanidhi,toolbar,descents,rhymney,exhortation,zahedan,carcinomas,hyperbaric,botvinnik,billets,neuropsychological,tigranes,hoards,chater,biennially,thistles,scotus,wataru,flotillas,hungama,monopolistic,payouts,vetch,generalissimo,caries,naumburg,piran,blizzards,escalates,reactant,shinya,theorize,rizzoli,transitway,ecclesiae,streptomyces,cantal,nisibis,superconductor,unworkable,thallus,roehampton,scheckter,viceroys,makuuchi,ilkley,superseding,takuya,klodzko,borbon,raspberries,operand,w.a.k.o,sarabande,factionalism,egalitarianism,temasek,torbat,unscripted,jorma,westerner,perfective,vrije,underlain,goldfrapp,blaenau,jomon,barthes,drivetime,bassa,bannock,umaga,fengxiang,zulus,sreenivasan,farces,codice_10,freeholder,poddebice,imperialists,deregulated,wingtip,o'hagan,pillared,overtone,hofstadter,149th,kitano,saybrook,standardizing,aldgate,staveley,o'flaherty,hundredths,steerable,soltan,empted,cruyff,intramuros,taluks,cotonou,marae,karur,figueres,barwon,lucullus,niobe,zemlya,lathes,homeported,chaux,amyotrophic,opines,exemplars,bhamo,homomorphisms,gauleiter,ladin,mafiosi,airdrieonians,b/soul,decal,transcaucasia,solti,defecation,deaconess,numidia,sampradaya,normalised,wingless,schwaben,alnus,cinerama,yakutsk,ketchikan,orvieto,unearned,monferrato,rotem,aacsb,loong,decoders,skerries,cardiothoracic,repositioning,pimpernel,yohannan,tenebrionoidea,nargis,nouvel,costliest,interdenominational,noize,redirecting,zither,morcha,radiometric,frequenting,irtysh,gbagbo,chakri,litvinenko,infotainment,ravensbruck,harith,corbels,maegashira,jousting,natan,novus,falcao,minis,railed,decile,rauma,ramaswamy,cavitation,paranaque,berchtesgaden,reanimated,schomberg,polysaccharides,exclusionary,cleon,anurag,ravaging,dhanush,mitchells,granule,contemptuous,keisei,rolleston,atlantean,yorkist,daraa,wapping,micrometer,keeneland,comparably,baranja,oranje,schlafli,yogic,dinajpur,unimpressive,masashi,recreativo,alemannic,petersfield,naoko,vasudeva,autosport,rajat,marella,busko,wethersfield,ssris,soulcalibur,kobani,wildland,rookery,hoffenheim,kauri,aliphatic,balaclava,ferrite,publicise,victorias,theism,quimper,chapbook,functionalist,roadbed,ulyanovsk,cupen,purpurea,calthorpe,teofilo,mousavi,cochlea,linotype,detmold,ellerslie,gakkai,telkom,southsea,subcontractor,inguinal,philatelists,zeebrugge,piave,trochidae,dempo,spoilt,saharanpur,mihrab,parasympathetic,barbarous,chartering,antiqua,katsina,bugis,categorizes,altstadt,kandyan,pambansa,overpasses,miters,assimilating,finlandia,uneconomic,am/fm,harpsichordist,dresdner,luminescence,authentically,overpowers,magmatic,cliftonville,oilfields,skirted,berthe,cuman,oakham,frelimo,glockenspiel,confection,saxophonists,piaseczno,multilevel,antipater,levying,maltreatment,velho,opoczno,harburg,pedophilia,unfunded,palettes,plasterwork,breve,dharmendra,auchinleck,nonesuch,blackmun,libretti,rabbani,145th,hasselbeck,kinnock,malate,vanden,cloverdale,ashgabat,nares,radians,steelworkers,sabor,possums,catterick,hemispheric,ostra,outpaced,dungeness,almshouse,penryn,texians,1000m,franchitti,incumbency,texcoco,newar,tramcars,toroidal,meitetsu,spellbound,agronomist,vinifera,riata,bunko,pinas,ba'al,github,vasilyevich,obsolescent,geodesics,ancestries,tujue,capitalised,unassigned,throng,unpaired,psychometric,skegness,exothermic,buffered,kristiansund,tongued,berenger,basho,alitalia,prolongation,archaeologically,fractionation,cyprinid,echinoderms,agriculturally,justiciar,sonam,ilium,baits,danceable,grazer,ardahan,grassed,preemption,glassworks,hasina,ugric,umbra,wahhabi,vannes,tinnitus,capitaine,tikrit,lisieux,scree,hormuz,despenser,jagiellon,maisonneuve,gandaki,santarem,basilicas,lancing,landskrona,weilburg,fireside,elysian,isleworth,krishnamurthy,filton,cynon,tecmo,subcostal,scalars,triglycerides,hyperplane,farmingdale,unione,meydan,pilings,mercosur,reactivate,akiba,fecundity,jatra,natsume,zarqawi,preta,masao,presbyter,oakenfold,rhodri,ferran,ruizong,cloyne,nelvana,epiphanius,borde,scutes,strictures,troughton,whitestone,sholom,toyah,shingon,kutuzov,abelard,passant,lipno,cafeterias,residuals,anabaptists,paratransit,criollos,pleven,radiata,destabilizing,hadiths,bazaars,mannose,taiyo,crookes,welbeck,baoding,archelaus,nguesso,alberni,wingtips,herts,viasat,lankans,evreux,wigram,fassbinder,ryuichi,storting,reducible,olesnica,znojmo,hyannis,theophanes,flatiron,mustering,rajahmundry,kadir,wayang,prome,lethargy,zubin,illegality,conall,dramedy,beerbohm,hipparchus,ziarat,ryuji,shugo,glenorchy,microarchitecture,morne,lewinsky,cauvery,battenberg,hyksos,wayanad,hamilcar,buhari,brazo,bratianu,solms,aksaray,elamite,chilcotin,bloodstock,sagara,dolny,reunified,umlaut,proteaceae,camborne,calabrian,dhanbad,vaxjo,cookware,potez,rediffusion,semitones,lamentations,allgau,guernica,suntory,pleated,stationing,urgell,gannets,bertelsmann,entryway,raphitomidae,acetaldehyde,nephrology,categorizing,beiyang,permeate,tourney,geosciences,khana,masayuki,crucis,universitaria,slaskie,khaimah,finno,advani,astonishingly,tubulin,vampiric,jeolla,sociale,cleethorpes,badri,muridae,suzong,debater,decimation,kenyans,mutualism,pontifex,middlemen,insee,halevi,lamentation,psychopathy,brassey,wenders,kavya,parabellum,prolactin,inescapable,apses,malignancies,rinzai,stigmatized,menahem,comox,ateliers,welshpool,setif,centimetre,truthfulness,downfield,drusus,woden,glycosylation,emanated,agulhas,dalkeith,jazira,nucky,unifil,jobim,operon,oryzomys,heroically,seances,supernumerary,backhouse,hashanah,tatler,imago,invert,hayato,clockmaker,kingsmill,swiecie,analogously,golconda,poste,tacitly,decentralised,ge'ez,diplomatically,fossiliferous,linseed,mahavira,pedestals,archpriest,byelection,domiciled,jeffersonian,bombus,winegrowing,waukegan,uncultivated,haverfordwest,saumur,communally,disbursed,cleeve,zeljeznicar,speciosa,vacationers,sigur,vaishali,zlatko,iftikhar,cropland,transkei,incompleteness,bohra,subantarctic,slieve,physiologic,similis,klerk,replanted,'right,chafee,reproducible,bayburt,regicide,muzaffarpur,plurals,hanyu,orthologs,diouf,assailed,kamui,tarik,dodecanese,gorne,on/off,179th,shimoga,granaries,carlists,valar,tripolitania,sherds,simmern,dissociated,isambard,polytechnical,yuvraj,brabazon,antisense,pubmed,glans,minutely,masaaki,raghavendra,savoury,podcasting,tachi,bienville,gongsun,ridgely,deform,yuichi,binders,canna,carcetti,llobregat,implored,berri,njegos,intermingled,offload,athenry,motherhouse,corpora,kakinada,dannebrog,imperio,prefaces,musicologists,aerospatiale,shirai,nagapattinam,servius,cristoforo,pomfret,reviled,entebbe,stane,east/west,thermometers,matriarchal,siglo,bodil,legionnaire,ze'ev,theorizing,sangeetha,horticulturist,uncountable,lookalike,anoxic,ionospheric,genealogists,chicopee,imprinting,popish,crematoria,diamondback,cyathea,hanzhong,cameramen,halogaland,naklo,waclaw,storehouses,flexed,comuni,frits,glauca,nilgiris,compresses,nainital,continuations,albay,hypoxic,samajwadi,dunkerque,nanticoke,sarwar,interchanged,jubal,corba,jalgaon,derleth,deathstroke,magny,vinnytsia,hyphenated,rimfire,sawan,boehner,disrepute,normalize,aromanian,dualistic,approximant,chama,karimabad,barnacles,sanok,stipends,dyfed,rijksmuseum,reverberation,suncorp,fungicides,reverie,spectrograph,stereophonic,niazi,ordos,alcan,karaite,lautrec,tableland,lamellar,rieti,langmuir,russula,webern,tweaks,hawick,southerner,morphy,naturalisation,enantiomer,michinoku,barbettes,relieves,carburettors,redruth,oblates,vocabularies,mogilev,bagmati,galium,reasserted,extolled,symon,eurosceptic,inflections,tirtha,recompense,oruro,roping,gouverneur,pared,yayoi,watermills,retooled,leukocytes,jubilant,mazhar,nicolau,manheim,touraine,bedser,hambledon,kohat,powerhouses,tlemcen,reuven,sympathetically,afrikaners,interes,handcrafts,etcher,baddeley,wodonga,amaury,155th,vulgarity,pompadour,automorphisms,1540s,oppositions,prekmurje,deryni,fortifying,arcuate,mahila,bocage,uther,nozze,slashes,atlantica,hadid,rhizomatous,azeris,'with,osmena,lewisville,innervated,bandmaster,outcropping,parallelogram,dominicana,twang,ingushetia,extensional,ladino,sastry,zinoviev,relatable,nobilis,cbeebies,hitless,eulima,sporangia,synge,longlisted,criminalized,penitential,weyden,tubule,volyn,priestesses,glenbrook,kibbutzim,windshaft,canadair,falange,zsolt,bonheur,meine,archangels,safeguarded,jamaicans,malarial,teasers,badging,merseyrail,operands,pulsars,gauchos,biotin,bambara,necaxa,egmond,tillage,coppi,anxiolytic,preah,mausoleums,plautus,feroz,debunked,187th,belediyespor,mujibur,wantage,carboxyl,chettiar,murnau,vagueness,racemic,backstretch,courtland,municipio,palpatine,dezful,hyperbola,sreekumar,chalons,altay,arapahoe,tudors,sapieha,quilon,burdensome,kanya,xxviii,recension,generis,siphuncle,repressor,bitrate,mandals,midhurst,dioxin,democratique,upholds,rodez,cinematographic,epoque,jinping,rabelais,zhytomyr,glenview,rebooted,khalidi,reticulata,122nd,monnaie,passersby,ghazals,europaea,lippmann,earthbound,tadic,andorran,artvin,angelicum,banksy,epicentre,resemblances,shuttled,rathaus,bernt,stonemasons,balochi,siang,tynemouth,cygni,biosynthetic,precipitates,sharecroppers,d'annunzio,softbank,shiji,apeldoorn,polycyclic,wenceslas,wuchang,samnites,tamarack,silmarillion,madinah,palaeontology,kirchberg,sculpin,rohtak,aquabats,oviparous,thynne,caney,blimps,minimalistic,whatcom,palatalization,bardstown,direct3d,paramagnetic,kamboja,khash,globemaster,lengua,matej,chernigov,swanage,arsenals,cascadia,cundinamarca,tusculum,leavers,organics,warplanes,'three,exertions,arminius,gandharva,inquires,comercio,kuopio,chabahar,plotlines,mersenne,anquetil,paralytic,buckminster,ambit,acrolophus,quantifiers,clacton,ciliary,ansaldo,fergana,egoism,thracians,chicoutimi,northbrook,analgesia,brotherhoods,hunza,adriaen,fluoridation,snowfalls,soundboard,fangoria,cannibalistic,orthogonius,chukotka,dindigul,manzoni,chainz,macromedia,beltline,muruga,schistura,provable,litex,initio,pneumoniae,infosys,cerium,boonton,cannonballs,d'une,solvency,mandurah,houthis,dolmens,apologists,radioisotopes,blaxploitation,poroshenko,stawell,coosa,maximilien,tempelhof,espouse,declaratory,hambro,xalapa,outmoded,mihiel,benefitting,desirous,archeparchy,repopulated,telescoping,captor,mackaye,disparaged,ramanathan,crowne,tumbled,technetium,silted,chedi,nievre,hyeon,cartoonish,interlock,infocom,rediff.com,dioramas,timekeeping,concertina,kutaisi,cesky,lubomirski,unapologetic,epigraphic,stalactites,sneha,biofilm,falconry,miraflores,catena,'outstanding,prospekt,apotheosis,o'odham,pacemakers,arabica,gandhinagar,reminisces,iroquoian,ornette,tilling,neoliberalism,chameleons,pandava,prefontaine,haiyan,gneisenau,utama,bando,reconstitution,azaria,canola,paratroops,ayckbourn,manistee,stourton,manifestos,lympne,denouement,tractatus,rakim,bellflower,nanometer,sassanids,turlough,presbyterianism,varmland,20deg,phool,nyerere,almohad,manipal,vlaanderen,quickness,removals,makow,circumflex,eatery,morane,fondazione,alkylation,unenforceable,galliano,silkworm,junior/senior,abducts,phlox,konskie,lofoten,buuren,glyphosate,faired,naturae,cobbles,taher,skrulls,dostoevsky,walkout,wagnerian,orbited,methodically,denzil,sarat,extraterritorial,kohima,d'armor,brinsley,rostropovich,fengtian,comitatus,aravind,moche,wrangell,giscard,vantaa,viljandi,hakoah,seabees,muscatine,ballade,camanachd,sothern,mullioned,durad,margraves,maven,arete,chandni,garifuna,142nd,reading/literature,thickest,intensifies,trygve,khaldun,perinatal,asana,powerline,acetylation,nureyev,omiya,montesquieu,riverwalk,marly,correlating,intermountain,bulgar,hammerheads,underscores,wiretapping,quatrain,ruisseau,newsagent,tuticorin,polygyny,hemsworth,partisanship,banna,istrian,evaporator".split(","),
114528 female_names: "mary,patricia,linda,barbara,elizabeth,jennifer,maria,susan,margaret,dorothy,lisa,nancy,karen,betty,helen,sandra,donna,carol,ruth,sharon,michelle,laura,sarah,kimberly,deborah,jessica,shirley,cynthia,angela,melissa,brenda,amy,anna,rebecca,virginia,kathleen,pamela,martha,debra,amanda,stephanie,carolyn,christine,marie,janet,catherine,frances,ann,joyce,diane,alice,julie,heather,teresa,doris,gloria,evelyn,jean,cheryl,mildred,katherine,joan,ashley,judith,rose,janice,kelly,nicole,judy,christina,kathy,theresa,beverly,denise,tammy,irene,jane,lori,rachel,marilyn,andrea,kathryn,louise,sara,anne,jacqueline,wanda,bonnie,julia,ruby,lois,tina,phyllis,norma,paula,diana,annie,lillian,emily,robin,peggy,crystal,gladys,rita,dawn,connie,florence,tracy,edna,tiffany,carmen,rosa,cindy,grace,wendy,victoria,edith,kim,sherry,sylvia,josephine,thelma,shannon,sheila,ethel,ellen,elaine,marjorie,carrie,charlotte,monica,esther,pauline,emma,juanita,anita,rhonda,hazel,amber,eva,debbie,april,leslie,clara,lucille,jamie,joanne,eleanor,valerie,danielle,megan,alicia,suzanne,michele,gail,bertha,darlene,veronica,jill,erin,geraldine,lauren,cathy,joann,lorraine,lynn,sally,regina,erica,beatrice,dolores,bernice,audrey,yvonne,annette,marion,dana,stacy,ana,renee,ida,vivian,roberta,holly,brittany,melanie,loretta,yolanda,jeanette,laurie,katie,kristen,vanessa,alma,sue,elsie,beth,jeanne,vicki,carla,tara,rosemary,eileen,terri,gertrude,lucy,tonya,ella,stacey,wilma,gina,kristin,jessie,natalie,agnes,vera,charlene,bessie,delores,melinda,pearl,arlene,maureen,colleen,allison,tamara,joy,georgia,constance,lillie,claudia,jackie,marcia,tanya,nellie,minnie,marlene,heidi,glenda,lydia,viola,courtney,marian,stella,caroline,dora,vickie,mattie,maxine,irma,mabel,marsha,myrtle,lena,christy,deanna,patsy,hilda,gwendolyn,jennie,nora,margie,nina,cassandra,leah,penny,kay,priscilla,naomi,carole,olga,billie,dianne,tracey,leona,jenny,felicia,sonia,miriam,velma,becky,bobbie,violet,kristina,toni,misty,mae,shelly,daisy,ramona,sherri,erika,katrina,claire,lindsey,lindsay,geneva,guadalupe,belinda,margarita,sheryl,cora,faye,ada,sabrina,isabel,marguerite,hattie,harriet,molly,cecilia,kristi,brandi,blanche,sandy,rosie,joanna,iris,eunice,angie,inez,lynda,madeline,amelia,alberta,genevieve,monique,jodi,janie,kayla,sonya,jan,kristine,candace,fannie,maryann,opal,alison,yvette,melody,luz,susie,olivia,flora,shelley,kristy,mamie,lula,lola,verna,beulah,antoinette,candice,juana,jeannette,pam,kelli,whitney,bridget,karla,celia,latoya,patty,shelia,gayle,della,vicky,lynne,sheri,marianne,kara,jacquelyn,erma,blanca,myra,leticia,pat,krista,roxanne,angelica,robyn,adrienne,rosalie,alexandra,brooke,bethany,sadie,bernadette,traci,jody,kendra,nichole,rachael,mable,ernestine,muriel,marcella,elena,krystal,angelina,nadine,kari,estelle,dianna,paulette,lora,mona,doreen,rosemarie,desiree,antonia,janis,betsy,christie,freda,meredith,lynette,teri,cristina,eula,leigh,meghan,sophia,eloise,rochelle,gretchen,cecelia,raquel,henrietta,alyssa,jana,gwen,jenna,tricia,laverne,olive,tasha,silvia,elvira,delia,kate,patti,lorena,kellie,sonja,lila,lana,darla,mindy,essie,mandy,lorene,elsa,josefina,jeannie,miranda,dixie,lucia,marta,faith,lela,johanna,shari,camille,tami,shawna,elisa,ebony,melba,ora,nettie,tabitha,ollie,winifred,kristie,alisha,aimee,rena,myrna,marla,tammie,latasha,bonita,patrice,ronda,sherrie,addie,francine,deloris,stacie,adriana,cheri,abigail,celeste,jewel,cara,adele,rebekah,lucinda,dorthy,effie,trina,reba,sallie,aurora,lenora,etta,lottie,kerri,trisha,nikki,estella,francisca,josie,tracie,marissa,karin,brittney,janelle,lourdes,laurel,helene,fern,elva,corinne,kelsey,ina,bettie,elisabeth,aida,caitlin,ingrid,iva,eugenia,christa,goldie,maude,jenifer,therese,dena,lorna,janette,latonya,candy,consuelo,tamika,rosetta,debora,cherie,polly,dina,jewell,fay,jillian,dorothea,nell,trudy,esperanza,patrica,kimberley,shanna,helena,cleo,stefanie,rosario,ola,janine,mollie,lupe,alisa,lou,maribel,susanne,bette,susana,elise,cecile,isabelle,lesley,jocelyn,paige,joni,rachelle,leola,daphne,alta,ester,petra,graciela,imogene,jolene,keisha,lacey,glenna,gabriela,keri,ursula,lizzie,kirsten,shana,adeline,mayra,jayne,jaclyn,gracie,sondra,carmela,marisa,rosalind,charity,tonia,beatriz,marisol,clarice,jeanine,sheena,angeline,frieda,lily,shauna,millie,claudette,cathleen,angelia,gabrielle,autumn,katharine,jodie,staci,lea,christi,justine,elma,luella,margret,dominique,socorro,martina,margo,mavis,callie,bobbi,maritza,lucile,leanne,jeannine,deana,aileen,lorie,ladonna,willa,manuela,gale,selma,dolly,sybil,abby,ivy,dee,winnie,marcy,luisa,jeri,magdalena,ofelia,meagan,audra,matilda,leila,cornelia,bianca,simone,bettye,randi,virgie,latisha,barbra,georgina,eliza,leann,bridgette,rhoda,haley,adela,nola,bernadine,flossie,ila,greta,ruthie,nelda,minerva,lilly,terrie,letha,hilary,estela,valarie,brianna,rosalyn,earline,catalina,ava,mia,clarissa,lidia,corrine,alexandria,concepcion,tia,sharron,rae,dona,ericka,jami,elnora,chandra,lenore,neva,marylou,melisa,tabatha,serena,avis,allie,sofia,jeanie,odessa,nannie,harriett,loraine,penelope,milagros,emilia,benita,allyson,ashlee,tania,esmeralda,eve,pearlie,zelma,malinda,noreen,tameka,saundra,hillary,amie,althea,rosalinda,lilia,alana,clare,alejandra,elinor,lorrie,jerri,darcy,earnestine,carmella,noemi,marcie,liza,annabelle,louisa,earlene,mallory,carlene,nita,selena,tanisha,katy,julianne,lakisha,edwina,maricela,margery,kenya,dollie,roxie,roslyn,kathrine,nanette,charmaine,lavonne,ilene,tammi,suzette,corine,kaye,chrystal,lina,deanne,lilian,juliana,aline,luann,kasey,maryanne,evangeline,colette,melva,lawanda,yesenia,nadia,madge,kathie,ophelia,valeria,nona,mitzi,mari,georgette,claudine,fran,alissa,roseann,lakeisha,susanna,reva,deidre,chasity,sheree,elvia,alyce,deirdre,gena,briana,araceli,katelyn,rosanne,wendi,tessa,berta,marva,imelda,marietta,marci,leonor,arline,sasha,madelyn,janna,juliette,deena,aurelia,josefa,augusta,liliana,lessie,amalia,savannah,anastasia,vilma,natalia,rosella,lynnette,corina,alfreda,leanna,amparo,coleen,tamra,aisha,wilda,karyn,maura,mai,evangelina,rosanna,hallie,erna,enid,mariana,lacy,juliet,jacklyn,freida,madeleine,mara,cathryn,lelia,casandra,bridgett,angelita,jannie,dionne,annmarie,katina,beryl,millicent,katheryn,diann,carissa,maryellen,liz,lauri,helga,gilda,rhea,marquita,hollie,tisha,tamera,angelique,francesca,kaitlin,lolita,florine,rowena,reyna,twila,fanny,janell,ines,concetta,bertie,alba,brigitte,alyson,vonda,pansy,elba,noelle,letitia,deann,brandie,louella,leta,felecia,sharlene,lesa,beverley,isabella,herminia,terra,celina,tori,octavia,jade,denice,germaine,michell,cortney,nelly,doretha,deidra,monika,lashonda,judi,chelsey,antionette,margot,adelaide,leeann,elisha,dessie,libby,kathi,gayla,latanya,mina,mellisa,kimberlee,jasmin,renae,zelda,elda,justina,gussie,emilie,camilla,abbie,rocio,kaitlyn,edythe,ashleigh,selina,lakesha,geri,allene,pamala,michaela,dayna,caryn,rosalia,jacquline,rebeca,marybeth,krystle,iola,dottie,belle,griselda,ernestina,elida,adrianne,demetria,delma,jaqueline,arleen,virgina,retha,fatima,tillie,eleanore,cari,treva,wilhelmina,rosalee,maurine,latrice,jena,taryn,elia,debby,maudie,jeanna,delilah,catrina,shonda,hortencia,theodora,teresita,robbin,danette,delphine,brianne,nilda,danna,cindi,bess,iona,winona,vida,rosita,marianna,racheal,guillermina,eloisa,celestine,caren,malissa,lona,chantel,shellie,marisela,leora,agatha,soledad,migdalia,ivette,christen,athena,janel,veda,pattie,tessie,tera,marilynn,lucretia,karrie,dinah,daniela,alecia,adelina,vernice,shiela,portia,merry,lashawn,dara,tawana,verda,alene,zella,sandi,rafaela,maya,kira,candida,alvina,suzan,shayla,lettie,samatha,oralia,matilde,larissa,vesta,renita,delois,shanda,phillis,lorri,erlinda,cathrine,barb,isabell,ione,gisela,roxanna,mayme,kisha,ellie,mellissa,dorris,dalia,bella,annetta,zoila,reta,reina,lauretta,kylie,christal,pilar,charla,elissa,tiffani,tana,paulina,leota,breanna,jayme,carmel,vernell,tomasa,mandi,dominga,santa,melodie,lura,alexa,tamela,mirna,kerrie,venus,felicita,cristy,carmelita,berniece,annemarie,tiara,roseanne,missy,cori,roxana,pricilla,kristal,jung,elyse,haydee,aletha,bettina,marge,gillian,filomena,zenaida,harriette,caridad,vada,aretha,pearline,marjory,marcela,flor,evette,elouise,alina,damaris,catharine,belva,nakia,marlena,luanne,lorine,karon,dorene,danita,brenna,tatiana,louann,julianna,andria,philomena,lucila,leonora,dovie,romona,mimi,jacquelin,gaye,tonja,misti,chastity,stacia,roxann,micaela,velda,marlys,johnna,aura,ivonne,hayley,nicki,majorie,herlinda,yadira,perla,gregoria,antonette,shelli,mozelle,mariah,joelle,cordelia,josette,chiquita,trista,laquita,georgiana,candi,shanon,hildegard,stephany,magda,karol,gabriella,tiana,roma,richelle,oleta,jacque,idella,alaina,suzanna,jovita,tosha,nereida,marlyn,kyla,delfina,tena,stephenie,sabina,nathalie,marcelle,gertie,darleen,thea,sharonda,shantel,belen,venessa,rosalina,genoveva,clementine,rosalba,renate,renata,georgianna,floy,dorcas,ariana,tyra,theda,mariam,juli,jesica,vikki,verla,roselyn,melvina,jannette,ginny,debrah,corrie,violeta,myrtis,latricia,collette,charleen,anissa,viviana,twyla,nedra,latonia,hellen,fabiola,annamarie,adell,sharyn,chantal,niki,maud,lizette,lindy,kesha,jeana,danelle,charline,chanel,valorie,dortha,cristal,sunny,leone,leilani,gerri,debi,andra,keshia,eulalia,easter,dulce,natividad,linnie,kami,georgie,catina,brook,alda,winnifred,sharla,ruthann,meaghan,magdalene,lissette,adelaida,venita,trena,shirlene,shameka,elizebeth,dian,shanta,latosha,carlotta,windy,rosina,mariann,leisa,jonnie,dawna,cathie,astrid,laureen,janeen,holli,fawn,vickey,teressa,shante,rubye,marcelina,chanda,terese,scarlett,marnie,lulu,lisette,jeniffer,elenor,dorinda,donita,carman,bernita,altagracia,aleta,adrianna,zoraida,lyndsey,janina,starla,phylis,phuong,kyra,charisse,blanch,sanjuanita,rona,nanci,marilee,maranda,brigette,sanjuana,marita,kassandra,joycelyn,felipa,chelsie,bonny,mireya,lorenza,kyong,ileana,candelaria,sherie,lucie,leatrice,lakeshia,gerda,edie,bambi,marylin,lavon,hortense,garnet,evie,tressa,shayna,lavina,kyung,jeanetta,sherrill,shara,phyliss,mittie,anabel,alesia,thuy,tawanda,joanie,tiffanie,lashanda,karissa,enriqueta,daria,daniella,corinna,alanna,abbey,roxane,roseanna,magnolia,lida,joellen,coral,carleen,tresa,peggie,novella,nila,maybelle,jenelle,carina,nova,melina,marquerite,margarette,josephina,evonne,cinthia,albina,toya,tawnya,sherita,myriam,lizabeth,lise,keely,jenni,giselle,cheryle,ardith,ardis,alesha,adriane,shaina,linnea,karolyn,felisha,dori,darci,artie,armida,zola,xiomara,vergie,shamika,nena,nannette,maxie,lovie,jeane,jaimie,inge,farrah,elaina,caitlyn,felicitas,cherly,caryl,yolonda,yasmin,teena,prudence,pennie,nydia,mackenzie,orpha,marvel,lizbeth,laurette,jerrie,hermelinda,carolee,tierra,mirian,meta,melony,kori,jennette,jamila,yoshiko,susannah,salina,rhiannon,joleen,cristine,ashton,aracely,tomeka,shalonda,marti,lacie,kala,jada,ilse,hailey,brittani,zona,syble,sherryl,nidia,marlo,kandice,kandi,alycia,ronna,norene,mercy,ingeborg,giovanna,gemma,christel,audry,zora,vita,trish,stephaine,shirlee,shanika,melonie,mazie,jazmin,inga,hettie,geralyn,fonda,estrella,adella,sarita,rina,milissa,maribeth,golda,evon,ethelyn,enedina,cherise,chana,velva,tawanna,sade,mirta,karie,jacinta,elna,davina,cierra,ashlie,albertha,tanesha,nelle,mindi,lorinda,larue,florene,demetra,dedra,ciara,chantelle,ashly,suzy,rosalva,noelia,lyda,leatha,krystyna,kristan,karri,darline,darcie,cinda,cherrie,awilda,almeda,rolanda,lanette,jerilyn,gisele,evalyn,cyndi,cleta,carin,zina,zena,velia,tanika,charissa,talia,margarete,lavonda,kaylee,kathlene,jonna,irena,ilona,idalia,candis,candance,brandee,anitra,alida,sigrid,nicolette,maryjo,linette,hedwig,christiana,alexia,tressie,modesta,lupita,lita,gladis,evelia,davida,cherri,cecily,ashely,annabel,agustina,wanita,shirly,rosaura,hulda,yetta,verona,thomasina,sibyl,shannan,mechelle,leandra,lani,kylee,kandy,jolynn,ferne,eboni,corene,alysia,zula,nada,moira,lyndsay,lorretta,jammie,hortensia,gaynell,adria,vina,vicenta,tangela,stephine,norine,nella,liana,leslee,kimberely,iliana,glory,felica,emogene,elfriede,eden,eartha,carma,ocie,lennie,kiara,jacalyn,carlota,arielle,otilia,kirstin,kacey,johnetta,joetta,jeraldine,jaunita,elana,dorthea,cami,amada,adelia,vernita,tamar,siobhan,renea,rashida,ouida,nilsa,meryl,kristyn,julieta,danica,breanne,aurea,anglea,sherron,odette,malia,lorelei,leesa,kenna,kathlyn,fiona,charlette,suzie,shantell,sabra,racquel,myong,mira,martine,lucienne,lavada,juliann,elvera,delphia,christiane,charolette,carri,asha,angella,paola,ninfa,leda,stefani,shanell,palma,machelle,lissa,kecia,kathryne,karlene,julissa,jettie,jenniffer,corrina,carolann,alena,rosaria,myrtice,marylee,liane,kenyatta,judie,janey,elmira,eldora,denna,cristi,cathi,zaida,vonnie,viva,vernie,rosaline,mariela,luciana,lesli,karan,felice,deneen,adina,wynona,tarsha,sheron,shanita,shani,shandra,randa,pinkie,nelida,marilou,lyla,laurene,laci,janene,dorotha,daniele,dani,carolynn,carlyn,berenice,ayesha,anneliese,alethea,thersa,tamiko,rufina,oliva,mozell,marylyn,kristian,kathyrn,kasandra,kandace,janae,domenica,debbra,dannielle,chun,arcelia,zenobia,sharen,sharee,lavinia,kacie,jackeline,huong,felisa,emelia,eleanora,cythia,cristin,claribel,anastacia,zulma,zandra,yoko,tenisha,susann,sherilyn,shay,shawanda,romana,mathilda,linsey,keiko,joana,isela,gretta,georgetta,eugenie,desirae,delora,corazon,antonina,anika,willene,tracee,tamatha,nichelle,mickie,maegan,luana,lanita,kelsie,edelmira,bree,afton,teodora,tamie,shena,linh,keli,kaci,danyelle,arlette,albertine,adelle,tiffiny,simona,nicolasa,nichol,nakisha,maira,loreen,kizzy,fallon,christene,bobbye,ying,vincenza,tanja,rubie,roni,queenie,margarett,kimberli,irmgard,idell,hilma,evelina,esta,emilee,dennise,dania,carie,risa,rikki,particia,masako,luvenia,loree,loni,lien,gigi,florencia,denita,billye,tomika,sharita,rana,nikole,neoma,margarite,madalyn,lucina,laila,kali,jenette,gabriele,evelyne,elenora,clementina,alejandrina,zulema,violette,vannessa,thresa,retta,patience,noella,nickie,jonell,chaya,camelia,bethel,anya,suzann,mila,lilla,laverna,keesha,kattie,georgene,eveline,estell,elizbeth,vivienne,vallie,trudie,stephane,magaly,madie,kenyetta,karren,janetta,hermine,drucilla,debbi,celestina,candie,britni,beckie,amina,zita,yolande,vivien,vernetta,trudi,pearle,patrina,ossie,nicolle,loyce,letty,katharina,joselyn,jonelle,jenell,iesha,heide,florinda,florentina,elodia,dorine,brunilda,brigid,ashli,ardella,twana,tarah,shavon,serina,rayna,ramonita,margurite,lucrecia,kourtney,kati,jesenia,crista,ayana,alica,alia,vinnie,suellen,romelia,rachell,olympia,michiko,kathaleen,jolie,jessi,janessa,hana,elease,carletta,britany,shona,salome,rosamond,regena,raina,ngoc,nelia,louvenia,lesia,latrina,laticia,larhonda,jina,jacki,emmy,deeann,coretta,arnetta,thalia,shanice,neta,mikki,micki,lonna,leana,lashunda,kiley,joye,jacqulyn,ignacia,hyun,hiroko,henriette,elayne,delinda,dahlia,coreen,consuela,conchita,babette,ayanna,anette,albertina,shawnee,shaneka,quiana,pamelia,merri,merlene,margit,kiesha,kiera,kaylene,jodee,jenise,erlene,emmie,dalila,daisey,casie,belia,babara,versie,vanesa,shelba,shawnda,nikia,naoma,marna,margeret,madaline,lawana,kindra,jutta,jazmine,janett,hannelore,glendora,gertrud,garnett,freeda,frederica,florance,flavia,carline,beverlee,anjanette,valda,tamala,shonna,sarina,oneida,merilyn,marleen,lurline,lenna,katherin,jeni,gracia,glady,farah,enola,dominque,devona,delana,cecila,caprice,alysha,alethia,vena,theresia,tawny,shakira,samara,sachiko,rachele,pamella,marni,mariel,maren,malisa,ligia,lera,latoria,larae,kimber,kathern,karey,jennefer,janeth,halina,fredia,delisa,debroah,ciera,angelika,andree,altha,vivan,terresa,tanna,sudie,signe,salena,ronni,rebbecca,myrtie,malika,maida,leonarda,kayleigh,ethyl,ellyn,dayle,cammie,brittni,birgit,avelina,asuncion,arianna,akiko,venice,tyesha,tonie,tiesha,takisha,steffanie,sindy,meghann,manda,macie,kellye,kellee,joslyn,inger,indira,glinda,glennis,fernanda,faustina,eneida,elicia,digna,dell,arletta,willia,tammara,tabetha,sherrell,sari,rebbeca,pauletta,natosha,nakita,mammie,kenisha,kazuko,kassie,earlean,daphine,corliss,clotilde,carolyne,bernetta,augustina,audrea,annis,annabell,tennille,tamica,selene,rosana,regenia,qiana,markita,macy,leeanne,laurine,jessenia,janita,georgine,genie,emiko,elvie,deandra,dagmar,corie,collen,cherish,romaine,porsha,pearlene,micheline,merna,margorie,margaretta,lore,jenine,hermina,fredericka,elke,drusilla,dorathy,dione,celena,brigida,allegra,tamekia,synthia,sook,slyvia,rosann,reatha,raye,marquetta,margart,ling,layla,kymberly,kiana,kayleen,katlyn,karmen,joella,emelda,eleni,detra,clemmie,cheryll,chantell,cathey,arnita,arla,angle,angelic,alyse,zofia,thomasine,tennie,sherly,sherley,sharyl,remedios,petrina,nickole,myung,myrle,mozella,louanne,lisha,latia,krysta,julienne,jeanene,jacqualine,isaura,gwenda,earleen,cleopatra,carlie,audie,antonietta,alise,verdell,tomoko,thao,talisha,shemika,savanna,santina,rosia,raeann,odilia,nana,minna,magan,lynelle,karma,joeann,ivana,inell,ilana,gudrun,dreama,crissy,chante,carmelina,arvilla,annamae,alvera,aleida,yanira,vanda,tianna,stefania,shira,nicol,nancie,monserrate,melynda,melany,lovella,laure,kacy,jacquelynn,hyon,gertha,eliana,christena,christeen,charise,caterina,carley,candyce,arlena,ammie,willette,vanita,tuyet,syreeta,penney,nyla,maryam,marya,magen,ludie,loma,livia,lanell,kimberlie,julee,donetta,diedra,denisha,deane,dawne,clarine,cherryl,bronwyn,alla,valery,tonda,sueann,soraya,shoshana,shela,sharleen,shanelle,nerissa,meridith,mellie,maye,maple,magaret,lili,leonila,leonie,leeanna,lavonia,lavera,kristel,kathey,kathe,jann,ilda,hildred,hildegarde,genia,fumiko,evelin,ermelinda,elly,dung,doloris,dionna,danae,berneice,annice,alix,verena,verdie,shawnna,shawana,shaunna,rozella,randee,ranae,milagro,lynell,luise,loida,lisbeth,karleen,junita,jona,isis,hyacinth,hedy,gwenn,ethelene,erline,donya,domonique,delicia,dannette,cicely,branda,blythe,bethann,ashlyn,annalee,alline,yuko,vella,trang,towanda,tesha,sherlyn,narcisa,miguelina,meri,maybell,marlana,marguerita,madlyn,lory,loriann,leonore,leighann,laurice,latesha,laronda,katrice,kasie,kaley,jadwiga,glennie,gearldine,francina,epifania,dyan,dorie,diedre,denese,demetrice,delena,cristie,cleora,catarina,carisa,barbera,almeta,trula,tereasa,solange,sheilah,shavonne,sanora,rochell,mathilde,margareta,maia,lynsey,lawanna,launa,kena,keena,katia,glynda,gaylene,elvina,elanor,danuta,danika,cristen,cordie,coletta,clarita,carmon,brynn,azucena,aundrea,angele,verlie,verlene,tamesha,silvana,sebrina,samira,reda,raylene,penni,norah,noma,mireille,melissia,maryalice,laraine,kimbery,karyl,karine,jolanda,johana,jesusa,jaleesa,jacquelyne,iluminada,hilaria,hanh,gennie,francie,floretta,exie,edda,drema,delpha,barbar,assunta,ardell,annalisa,alisia,yukiko,yolando,wonda,waltraud,veta,temeka,tameika,shirleen,shenita,piedad,ozella,mirtha,marilu,kimiko,juliane,jenice,janay,jacquiline,hilde,elois,echo,devorah,chau,brinda,betsey,arminda,aracelis,apryl,annett,alishia,veola,usha,toshiko,theola,tashia,talitha,shery,renetta,reiko,rasheeda,obdulia,mika,melaine,meggan,marlen,marget,marceline,mana,magdalen,librada,lezlie,latashia,lasandra,kelle,isidra,inocencia,gwyn,francoise,erminia,erinn,dimple,devora,criselda,armanda,arie,ariane,angelena,aliza,adriene,adaline,xochitl,twanna,tomiko,tamisha,taisha,susy,rutha,rhona,noriko,natashia,merrie,marinda,mariko,margert,loris,lizzette,leisha,kaila,joannie,jerrica,jene,jannet,janee,jacinda,herta,elenore,doretta,delaine,daniell,claudie,britta,apolonia,amberly,alease,yuri,waneta,tomi,sharri,sandie,roselle,reynalda,raguel,phylicia,patria,olimpia,odelia,mitzie,minda,mignon,mica,mendy,marivel,maile,lynetta,lavette,lauryn,latrisha,lakiesha,kiersten,kary,josphine,jolyn,jetta,janise,jacquie,ivelisse,glynis,gianna,gaynelle,danyell,danille,dacia,coralee,cher,ceola,arianne,aleshia,yung,williemae,trinh,thora,sherika,shemeka,shaunda,roseline,ricki,melda,mallie,lavonna,latina,laquanda,lala,lachelle,klara,kandis,johna,jeanmarie,jaye,grayce,gertude,emerita,ebonie,clorinda,ching,chery,carola,breann,blossom,bernardine,becki,arletha,argelia,alita,yulanda,yessenia,tobi,tasia,sylvie,shirl,shirely,shella,shantelle,sacha,rebecka,providencia,paulene,misha,miki,marline,marica,lorita,latoyia,lasonya,kerstin,kenda,keitha,kathrin,jaymie,gricelda,ginette,eryn,elina,elfrieda,danyel,cheree,chanelle,barrie,aurore,annamaria,alleen,ailene,aide,yasmine,vashti,treasa,tiffaney,sheryll,sharie,shanae,raisa,neda,mitsuko,mirella,milda,maryanna,maragret,mabelle,luetta,lorina,letisha,latarsha,lanelle,lajuana,krissy,karly,karena,jessika,jerica,jeanelle,jalisa,jacelyn,izola,euna,etha,domitila,dominica,daina,creola,carli,camie,brittny,ashanti,anisha,aleen,adah,yasuko,valrie,tona,tinisha,terisa,taneka,simonne,shalanda,serita,ressie,refugia,olene,margherita,mandie,maire,lyndia,luci,lorriane,loreta,leonia,lavona,lashawnda,lakia,kyoko,krystina,krysten,kenia,kelsi,jeanice,isobel,georgiann,genny,felicidad,eilene,deloise,deedee,conception,clora,cherilyn,calandra,armandina,anisa,tiera,theressa,stephania,sima,shyla,shonta,shera,shaquita,shala,rossana,nohemi,nery,moriah,melita,melida,melani,marylynn,marisha,mariette,malorie,madelene,ludivina,loria,lorette,loralee,lianne,lavenia,laurinda,lashon,kimi,keila,katelynn,jone,joane,jayna,janella,hertha,francene,elinore,despina,delsie,deedra,clemencia,carolin,bulah,brittanie,blondell,bibi,beaulah,beata,annita,agripina,virgen,valene,twanda,tommye,tarra,tari,tammera,shakia,sadye,ruthanne,rochel,rivka,pura,nenita,natisha,ming,merrilee,melodee,marvis,lucilla,leena,laveta,larita,lanie,keren,ileen,georgeann,genna,frida,eufemia,emely,edyth,deonna,deadra,darlena,chanell,cathern,cassondra,cassaundra,bernarda,berna,arlinda,anamaria,vertie,valeri,torri,stasia,sherise,sherill,sanda,ruthe,rosy,robbi,ranee,quyen,pearly,palmira,onita,nisha,niesha,nida,merlyn,mayola,marylouise,marth,margene,madelaine,londa,leontine,leoma,leia,lauralee,lanora,lakita,kiyoko,keturah,katelin,kareen,jonie,johnette,jenee,jeanett,izetta,hiedi,heike,hassie,giuseppina,georgann,fidela,fernande,elwanda,ellamae,eliz,dusti,dotty,cyndy,coralie,celesta,alverta,xenia,wava,vanetta,torrie,tashina,tandy,tambra,tama,stepanie,shila,shaunta,sharan,shaniqua,shae,setsuko,serafina,sandee,rosamaria,priscila,olinda,nadene,muoi,michelina,mercedez,maryrose,marcene,magali,mafalda,lannie,kayce,karoline,kamilah,kamala,justa,joline,jennine,jacquetta,iraida,georgeanna,franchesca,emeline,elane,ehtel,earlie,dulcie,dalene,classie,chere,charis,caroyln,carmina,carita,bethanie,ayako,arica,alysa,alessandra,akilah,adrien,zetta,youlanda,yelena,yahaira,xuan,wendolyn,tijuana,terina,teresia,suzi,sherell,shavonda,shaunte,sharda,shakita,sena,ryann,rubi,riva,reginia,rachal,parthenia,pamula,monnie,monet,michaele,melia,malka,maisha,lisandra,lekisha,lean,lakendra,krystin,kortney,kizzie,kittie,kera,kendal,kemberly,kanisha,julene,jule,johanne,jamee,halley,gidget,fredricka,fleta,fatimah,eusebia,elza,eleonore,dorthey,doria,donella,dinorah,delorse,claretha,christinia,charlyn,bong,belkis,azzie,andera,aiko,adena,yajaira,vania,ulrike,toshia,tifany,stefany,shizue,shenika,shawanna,sharolyn,sharilyn,shaquana,shantay,rozanne,roselee,remona,reanna,raelene,phung,petronila,natacha,nancey,myrl,miyoko,miesha,merideth,marvella,marquitta,marhta,marchelle,lizeth,libbie,lahoma,ladawn,kina,katheleen,katharyn,karisa,kaleigh,junie,julieann,johnsie,janean,jaimee,jackqueline,hisako,herma,helaine,gwyneth,gita,eustolia,emelina,elin,edris,donnette,donnetta,dierdre,denae,darcel,clarisa,cinderella,chia,charlesetta,charita,celsa,cassy,cassi,carlee,bruna,brittaney,brande,billi,antonetta,angla,angelyn,analisa,alane,wenona,wendie,veronique,vannesa,tobie,tempie,sumiko,sulema,somer,sheba,sharice,shanel,shalon,rosio,roselia,renay,rema,reena,ozie,oretha,oralee,ngan,nakesha,milly,marybelle,margrett,maragaret,manie,lurlene,lillia,lieselotte,lavelle,lashaunda,lakeesha,kaycee,kalyn,joya,joette,jenae,janiece,illa,grisel,glayds,genevie,gala,fredda,eleonor,debera,deandrea,corrinne,cordia,contessa,colene,cleotilde,chantay,cecille,beatris,azalee,arlean,ardath,anjelica,anja,alfredia,aleisha,zada,yuonne,xiao,willodean,vennie,vanna,tyisha,tova,torie,tonisha,tilda,tien,sirena,sherril,shanti,shan,senaida,samella,robbyn,renda,reita,phebe,paulita,nobuko,nguyet,neomi,mikaela,melania,maximina,marg,maisie,lynna,lilli,lashaun,lakenya,lael,kirstie,kathline,kasha,karlyn,karima,jovan,josefine,jennell,jacqui,jackelyn,hien,grazyna,florrie,floria,eleonora,dwana,dorla,delmy,deja,dede,dann,crysta,clelia,claris,chieko,cherlyn,cherelle,charmain,chara,cammy,arnette,ardelle,annika,amiee,amee,allena,yvone,yuki,yoshie,yevette,yael,willetta,voncile,venetta,tula,tonette,timika,temika,telma,teisha,taren,stacee,shawnta,saturnina,ricarda,pasty,onie,nubia,marielle,mariella,marianela,mardell,luanna,loise,lisabeth,lindsy,lilliana,lilliam,lelah,leigha,leanora,kristeen,khalilah,keeley,kandra,junko,joaquina,jerlene,jani,jamika,hsiu,hermila,genevive,evia,eugena,emmaline,elfreda,elene,donette,delcie,deeanna,darcey,clarinda,cira,chae,celinda,catheryn,casimira,carmelia,camellia,breana,bobette,bernardina,bebe,basilia,arlyne,amal,alayna,zonia,zenia,yuriko,yaeko,wynell,willena,vernia,tora,terrilyn,terica,tenesha,tawna,tajuana,taina,stephnie,sona,sina,shondra,shizuko,sherlene,sherice,sharika,rossie,rosena,rima,rheba,renna,natalya,nancee,melodi,meda,matha,marketta,maricruz,marcelene,malvina,luba,louetta,leida,lecia,lauran,lashawna,laine,khadijah,katerine,kasi,kallie,julietta,jesusita,jestine,jessia,jeffie,janyce,isadora,georgianne,fidelia,evita,eura,eulah,estefana,elsy,eladia,dodie,denisse,deloras,delila,daysi,crystle,concha,claretta,charlsie,charlena,carylon,bettyann,asley,ashlea,amira,agueda,agnus,yuette,vinita,victorina,tynisha,treena,toccara,tish,thomasena,tegan,soila,shenna,sharmaine,shantae,shandi,saran,sarai,sana,rosette,rolande,regine,otelia,olevia,nicholle,necole,naida,myrta,myesha,mitsue,minta,mertie,margy,mahalia,madalene,loura,lorean,lesha,leonida,lenita,lavone,lashell,lashandra,lamonica,kimbra,katherina,karry,kanesha,jong,jeneva,jaquelyn,gilma,ghislaine,gertrudis,fransisca,fermina,ettie,etsuko,ellan,elidia,edra,dorethea,doreatha,denyse,deetta,daine,cyrstal,corrin,cayla,carlita,camila,burma,bula,buena,barabara,avril,alaine,zana,wilhemina,wanetta,verline,vasiliki,tonita,tisa,teofila,tayna,taunya,tandra,takako,sunni,suanne,sixta,sharell,seema,rosenda,robena,raymonde,pamila,ozell,neida,mistie,micha,merissa,maurita,maryln,maryetta,marcell,malena,makeda,lovetta,lourie,lorrine,lorilee,laurena,lashay,larraine,laree,lacresha,kristle,keva,keira,karole,joie,jinny,jeannetta,jama,heidy,gilberte,gema,faviola,evelynn,enda,elli,ellena,divina,dagny,collene,codi,cindie,chassidy,chasidy,catrice,catherina,cassey,caroll,carlena,candra,calista,bryanna,britteny,beula,bari,audrie,audria,ardelia,annelle,angila,alona,allyn".split(","),
114529 surnames: "smith,johnson,williams,jones,brown,davis,miller,wilson,moore,taylor,anderson,jackson,white,harris,martin,thompson,garcia,martinez,robinson,clark,rodriguez,lewis,lee,walker,hall,allen,young,hernandez,king,wright,lopez,hill,green,adams,baker,gonzalez,nelson,carter,mitchell,perez,roberts,turner,phillips,campbell,parker,evans,edwards,collins,stewart,sanchez,morris,rogers,reed,cook,morgan,bell,murphy,bailey,rivera,cooper,richardson,cox,howard,ward,torres,peterson,gray,ramirez,watson,brooks,sanders,price,bennett,wood,barnes,ross,henderson,coleman,jenkins,perry,powell,long,patterson,hughes,flores,washington,butler,simmons,foster,gonzales,bryant,alexander,griffin,diaz,hayes,myers,ford,hamilton,graham,sullivan,wallace,woods,cole,west,owens,reynolds,fisher,ellis,harrison,gibson,mcdonald,cruz,marshall,ortiz,gomez,murray,freeman,wells,webb,simpson,stevens,tucker,porter,hicks,crawford,boyd,mason,morales,kennedy,warren,dixon,ramos,reyes,burns,gordon,shaw,holmes,rice,robertson,hunt,black,daniels,palmer,mills,nichols,grant,knight,ferguson,stone,hawkins,dunn,perkins,hudson,spencer,gardner,stephens,payne,pierce,berry,matthews,arnold,wagner,willis,watkins,olson,carroll,duncan,snyder,hart,cunningham,lane,andrews,ruiz,harper,fox,riley,armstrong,carpenter,weaver,greene,elliott,chavez,sims,peters,kelley,franklin,lawson,fields,gutierrez,schmidt,carr,vasquez,castillo,wheeler,chapman,montgomery,richards,williamson,johnston,banks,meyer,bishop,mccoy,howell,alvarez,morrison,hansen,fernandez,garza,harvey,burton,nguyen,jacobs,reid,fuller,lynch,garrett,romero,welch,larson,frazier,burke,hanson,mendoza,moreno,bowman,medina,fowler,brewer,hoffman,carlson,silva,pearson,holland,fleming,jensen,vargas,byrd,davidson,hopkins,herrera,wade,soto,walters,neal,caldwell,lowe,jennings,barnett,graves,jimenez,horton,shelton,barrett,obrien,castro,sutton,mckinney,lucas,miles,rodriquez,chambers,holt,lambert,fletcher,watts,bates,hale,rhodes,pena,beck,newman,haynes,mcdaniel,mendez,bush,vaughn,parks,dawson,santiago,norris,hardy,steele,curry,powers,schultz,barker,guzman,page,munoz,ball,keller,chandler,weber,walsh,lyons,ramsey,wolfe,schneider,mullins,benson,sharp,bowen,barber,cummings,hines,baldwin,griffith,valdez,hubbard,salazar,reeves,warner,stevenson,burgess,santos,tate,cross,garner,mann,mack,moss,thornton,mcgee,farmer,delgado,aguilar,vega,glover,manning,cohen,harmon,rodgers,robbins,newton,blair,higgins,ingram,reese,cannon,strickland,townsend,potter,goodwin,walton,rowe,hampton,ortega,patton,swanson,goodman,maldonado,yates,becker,erickson,hodges,rios,conner,adkins,webster,malone,hammond,flowers,cobb,moody,quinn,pope,osborne,mccarthy,guerrero,estrada,sandoval,gibbs,gross,fitzgerald,stokes,doyle,saunders,wise,colon,gill,alvarado,greer,padilla,waters,nunez,ballard,schwartz,mcbride,houston,christensen,klein,pratt,briggs,parsons,mclaughlin,zimmerman,buchanan,moran,copeland,pittman,brady,mccormick,holloway,brock,poole,logan,bass,marsh,drake,wong,jefferson,morton,abbott,sparks,norton,huff,massey,figueroa,carson,bowers,roberson,barton,tran,lamb,harrington,boone,cortez,clarke,mathis,singleton,wilkins,cain,underwood,hogan,mckenzie,collier,luna,phelps,mcguire,bridges,wilkerson,nash,summers,atkins,wilcox,pitts,conley,marquez,burnett,cochran,chase,davenport,hood,gates,ayala,sawyer,vazquez,dickerson,hodge,acosta,flynn,espinoza,nicholson,monroe,wolf,morrow,whitaker,oconnor,skinner,ware,molina,kirby,huffman,gilmore,dominguez,oneal,lang,combs,kramer,hancock,gallagher,gaines,shaffer,wiggins,mathews,mcclain,fischer,wall,melton,hensley,bond,dyer,grimes,contreras,wyatt,baxter,snow,mosley,shepherd,larsen,hoover,beasley,petersen,whitehead,meyers,garrison,shields,horn,savage,olsen,schroeder,hartman,woodard,mueller,kemp,deleon,booth,patel,calhoun,wiley,eaton,cline,navarro,harrell,humphrey,parrish,duran,hutchinson,hess,dorsey,bullock,robles,beard,dalton,avila,rich,blackwell,johns,blankenship,trevino,salinas,campos,pruitt,callahan,montoya,hardin,guerra,mcdowell,stafford,gallegos,henson,wilkinson,booker,merritt,atkinson,orr,decker,hobbs,tanner,knox,pacheco,stephenson,glass,rojas,serrano,marks,hickman,sweeney,strong,mcclure,conway,roth,maynard,farrell,lowery,hurst,nixon,weiss,trujillo,ellison,sloan,juarez,winters,mclean,boyer,villarreal,mccall,gentry,carrillo,ayers,lara,sexton,pace,hull,leblanc,browning,velasquez,leach,chang,sellers,herring,noble,foley,bartlett,mercado,landry,durham,walls,barr,mckee,bauer,rivers,bradshaw,pugh,velez,rush,estes,dodson,morse,sheppard,weeks,camacho,bean,barron,livingston,middleton,spears,branch,blevins,chen,kerr,mcconnell,hatfield,harding,solis,frost,giles,blackburn,pennington,woodward,finley,mcintosh,koch,mccullough,blanchard,rivas,brennan,mejia,kane,benton,buckley,valentine,maddox,russo,mcknight,buck,moon,mcmillan,crosby,berg,dotson,mays,roach,chan,richmond,meadows,faulkner,oneill,knapp,kline,ochoa,jacobson,gay,hendricks,horne,shepard,hebert,cardenas,mcintyre,waller,holman,donaldson,cantu,morin,gillespie,fuentes,tillman,bentley,peck,key,salas,rollins,gamble,dickson,santana,cabrera,cervantes,howe,hinton,hurley,spence,zamora,yang,mcneil,suarez,petty,gould,mcfarland,sampson,carver,bray,macdonald,stout,hester,melendez,dillon,farley,hopper,galloway,potts,joyner,stein,aguirre,osborn,mercer,bender,franco,rowland,sykes,pickett,sears,mayo,dunlap,hayden,wilder,mckay,coffey,mccarty,ewing,cooley,vaughan,bonner,cotton,holder,stark,ferrell,cantrell,fulton,lott,calderon,pollard,hooper,burch,mullen,fry,riddle,levy,duke,odonnell,britt,daugherty,berger,dillard,alston,frye,riggs,chaney,odom,duffy,fitzpatrick,valenzuela,mayer,alford,mcpherson,acevedo,barrera,cote,reilly,compton,mooney,mcgowan,craft,clemons,wynn,nielsen,baird,stanton,snider,rosales,bright,witt,hays,holden,rutledge,kinney,clements,castaneda,slater,hahn,burks,delaney,pate,lancaster,sharpe,whitfield,talley,macias,burris,ratliff,mccray,madden,kaufman,beach,goff,cash,bolton,mcfadden,levine,byers,kirkland,kidd,workman,carney,mcleod,holcomb,finch,sosa,haney,franks,sargent,nieves,downs,rasmussen,bird,hewitt,foreman,valencia,oneil,delacruz,vinson,dejesus,hyde,forbes,gilliam,guthrie,wooten,huber,barlow,boyle,mcmahon,buckner,rocha,puckett,langley,knowles,cooke,velazquez,whitley,vang,shea,rouse,hartley,mayfield,elder,rankin,hanna,cowan,lucero,arroyo,slaughter,haas,oconnell,minor,boucher,archer,boggs,dougherty,andersen,newell,crowe,wang,friedman,bland,swain,holley,pearce,childs,yarbrough,galvan,proctor,meeks,lozano,mora,rangel,bacon,villanueva,schaefer,rosado,helms,boyce,goss,stinson,ibarra,hutchins,covington,crowley,hatcher,mackey,bunch,womack,polk,dodd,childress,childers,villa,springer,mahoney,dailey,belcher,lockhart,griggs,costa,brandt,walden,moser,tatum,mccann,akers,lutz,pryor,orozco,mcallister,lugo,davies,shoemaker,rutherford,newsome,magee,chamberlain,blanton,simms,godfrey,flanagan,crum,cordova,escobar,downing,sinclair,donahue,krueger,mcginnis,gore,farris,webber,corbett,andrade,starr,lyon,yoder,hastings,mcgrath,spivey,krause,harden,crabtree,kirkpatrick,arrington,ritter,mcghee,bolden,maloney,gagnon,dunbar,ponce,pike,mayes,beatty,mobley,kimball,butts,montes,eldridge,braun,hamm,gibbons,moyer,manley,herron,plummer,elmore,cramer,rucker,pierson,fontenot,rubio,goldstein,elkins,wills,novak,hickey,worley,gorman,katz,dickinson,broussard,woodruff,crow,britton,nance,lehman,bingham,zuniga,whaley,shafer,coffman,steward,delarosa,neely,mata,davila,mccabe,kessler,hinkle,welsh,pagan,goldberg,goins,crouch,cuevas,quinones,mcdermott,hendrickson,samuels,denton,bergeron,ivey,locke,haines,snell,hoskins,byrne,arias,corbin,beltran,chappell,downey,dooley,tuttle,couch,payton,mcelroy,crockett,groves,cartwright,dickey,mcgill,dubois,muniz,tolbert,dempsey,cisneros,sewell,latham,vigil,tapia,rainey,norwood,stroud,meade,tipton,kuhn,hilliard,bonilla,teague,gunn,greenwood,correa,reece,pineda,phipps,frey,kaiser,ames,gunter,schmitt,milligan,espinosa,bowden,vickers,lowry,pritchard,costello,piper,mcclellan,lovell,sheehan,hatch,dobson,singh,jeffries,hollingsworth,sorensen,meza,fink,donnelly,burrell,tomlinson,colbert,billings,ritchie,helton,sutherland,peoples,mcqueen,thomason,givens,crocker,vogel,robison,dunham,coker,swartz,keys,ladner,richter,hargrove,edmonds,brantley,albright,murdock,boswell,muller,quintero,padgett,kenney,daly,connolly,inman,quintana,lund,barnard,villegas,simons,huggins,tidwell,sanderson,bullard,mcclendon,duarte,draper,marrero,dwyer,abrams,stover,goode,fraser,crews,bernal,godwin,conklin,mcneal,baca,esparza,crowder,bower,brewster,mcneill,rodrigues,leal,coates,raines,mccain,mccord,miner,holbrook,swift,dukes,carlisle,aldridge,ackerman,starks,ricks,holliday,ferris,hairston,sheffield,lange,fountain,doss,betts,kaplan,carmichael,bloom,ruffin,penn,kern,bowles,sizemore,larkin,dupree,seals,metcalf,hutchison,henley,farr,mccauley,hankins,gustafson,curran,waddell,ramey,cates,pollock,cummins,messer,heller,funk,cornett,palacios,galindo,cano,hathaway,pham,enriquez,salgado,pelletier,painter,wiseman,blount,feliciano,houser,doherty,mead,mcgraw,swan,capps,blanco,blackmon,thomson,mcmanus,burkett,gleason,dickens,cormier,voss,rushing,rosenberg,hurd,dumas,benitez,arellano,marin,caudill,bragg,jaramillo,huerta,gipson,colvin,biggs,vela,platt,cassidy,tompkins,mccollum,dolan,daley,crump,sneed,kilgore,grove,grimm,davison,brunson,prater,marcum,devine,dodge,stratton,rosas,choi,tripp,ledbetter,hightower,feldman,epps,yeager,posey,scruggs,cope,stubbs,richey,overton,trotter,sprague,cordero,butcher,stiles,burgos,woodson,horner,bassett,purcell,haskins,akins,ziegler,spaulding,hadley,grubbs,sumner,murillo,zavala,shook,lockwood,driscoll,dahl,thorpe,redmond,putnam,mcwilliams,mcrae,romano,joiner,sadler,hedrick,hager,hagen,fitch,coulter,thacker,mansfield,langston,guidry,ferreira,corley,conn,rossi,lackey,baez,saenz,mcnamara,mcmullen,mckenna,mcdonough,link,engel,browne,roper,peacock,eubanks,drummond,stringer,pritchett,parham,mims,landers,grayson,schafer,egan,timmons,ohara,keen,hamlin,finn,cortes,mcnair,nadeau,moseley,michaud,rosen,oakes,kurtz,jeffers,calloway,beal,bautista,winn,suggs,stern,stapleton,lyles,laird,montano,dawkins,hagan,goldman,bryson,barajas,lovett,segura,metz,lockett,langford,hinson,eastman,hooks,smallwood,shapiro,crowell,whalen,triplett,chatman,aldrich,cahill,youngblood,ybarra,stallings,sheets,reeder,connelly,bateman,abernathy,winkler,wilkes,masters,hackett,granger,gillis,schmitz,sapp,napier,souza,lanier,gomes,weir,otero,ledford,burroughs,babcock,ventura,siegel,dugan,bledsoe,atwood,wray,varner,spangler,anaya,staley,kraft,fournier,belanger,wolff,thorne,bynum,burnette,boykin,swenson,purvis,pina,khan,duvall,darby,xiong,kauffman,healy,engle,benoit,valle,steiner,spicer,shaver,randle,lundy,chin,calvert,staton,neff,kearney,darden,oakley,medeiros,mccracken,crenshaw,perdue,dill,whittaker,tobin,washburn,hogue,goodrich,easley,bravo,dennison,shipley,kerns,jorgensen,crain,villalobos,maurer,longoria,keene,coon,witherspoon,staples,pettit,kincaid,eason,madrid,echols,lusk,stahl,currie,thayer,shultz,mcnally,seay,maher,gagne,barrow,nava,moreland,honeycutt,hearn,diggs,caron,whitten,westbrook,stovall,ragland,munson,meier,looney,kimble,jolly,hobson,goddard,culver,burr,presley,negron,connell,tovar,huddleston,ashby,salter,root,pendleton,oleary,nickerson,myrick,judd,jacobsen,bain,adair,starnes,matos,busby,herndon,hanley,bellamy,doty,bartley,yazzie,rowell,parson,gifford,cullen,christiansen,benavides,barnhart,talbot,mock,crandall,connors,bonds,whitt,gage,bergman,arredondo,addison,lujan,dowdy,jernigan,huynh,bouchard,dutton,rhoades,ouellette,kiser,herrington,hare,blackman,babb,allred,rudd,paulson,ogden,koenig,geiger,begay,parra,lassiter,hawk,esposito,waldron,ransom,prather,chacon,vick,sands,roark,parr,mayberry,greenberg,coley,bruner,whitman,skaggs,shipman,leary,hutton,romo,medrano,ladd,kruse,askew,schulz,alfaro,tabor,mohr,gallo,bermudez,pereira,bliss,reaves,flint,comer,woodall,naquin,guevara,delong,carrier,pickens,tilley,schaffer,knutson,fenton,doran,vogt,vann,prescott,mclain,landis,corcoran,zapata,hyatt,hemphill,faulk,dove,boudreaux,aragon,whitlock,trejo,tackett,shearer,saldana,hanks,mckinnon,koehler,bourgeois,keyes,goodson,foote,lunsford,goldsmith,flood,winslow,sams,reagan,mccloud,hough,esquivel,naylor,loomis,coronado,ludwig,braswell,bearden,huang,fagan,ezell,edmondson,cronin,nunn,lemon,guillory,grier,dubose,traylor,ryder,dobbins,coyle,aponte,whitmore,smalls,rowan,malloy,cardona,braxton,borden,humphries,carrasco,ruff,metzger,huntley,hinojosa,finney,madsen,ernst,dozier,burkhart,bowser,peralta,daigle,whittington,sorenson,saucedo,roche,redding,fugate,avalos,waite,lind,huston,hawthorne,hamby,boyles,boles,regan,faust,crook,beam,barger,hinds,gallardo,willoughby,willingham,eckert,busch,zepeda,worthington,tinsley,hoff,hawley,carmona,varela,rector,newcomb,kinsey,dube,whatley,ragsdale,bernstein,becerra,yost,mattson,felder,cheek,handy,grossman,gauthier,escobedo,braden,beckman,mott,hillman,flaherty,dykes,stockton,stearns,lofton,coats,cavazos,beavers,barrios,tang,mosher,cardwell,coles,burnham,weller,lemons,beebe,aguilera,parnell,harman,couture,alley,schumacher,redd,dobbs,blum,blalock,merchant,ennis,denson,cottrell,brannon,bagley,aviles,watt,sousa,rosenthal,rooney,dietz,blank,paquette,mcclelland,duff,velasco,lentz,grubb,burrows,barbour,ulrich,shockley,rader,beyer,mixon,layton,altman,weathers,stoner,squires,shipp,priest,lipscomb,cutler,caballero,zimmer,willett,thurston,storey,medley,epperson,shah,mcmillian,baggett,torrez,hirsch,dent,poirier,peachey,farrar,creech,barth,trimble,dupre,albrecht,sample,lawler,crisp,conroy,wetzel,nesbitt,murry,jameson,wilhelm,patten,minton,matson,kimbrough,guinn,croft,toth,pulliam,nugent,newby,littlejohn,dias,canales,bernier,baron,singletary,renteria,pruett,mchugh,mabry,landrum,brower,stoddard,cagle,stjohn,scales,kohler,kellogg,hopson,gant,tharp,gann,zeigler,pringle,hammons,fairchild,deaton,chavis,carnes,rowley,matlock,kearns,irizarry,carrington,starkey,lopes,jarrell,craven,baum,littlefield,linn,humphreys,etheridge,cuellar,chastain,bundy,speer,skelton,quiroz,pyle,portillo,ponder,moulton,machado,killian,hutson,hitchcock,dowling,cloud,burdick,spann,pedersen,levin,leggett,hayward,dietrich,beaulieu,barksdale,wakefield,snowden,briscoe,bowie,berman,ogle,mcgregor,laughlin,helm,burden,wheatley,schreiber,pressley,parris,alaniz,agee,swann,snodgrass,schuster,radford,monk,mattingly,harp,girard,cheney,yancey,wagoner,ridley,lombardo,hudgins,gaskins,duckworth,coburn,willey,prado,newberry,magana,hammonds,elam,whipple,slade,serna,ojeda,liles,dorman,diehl,upton,reardon,michaels,goetz,eller,bauman,baer,layne,hummel,brenner,amaya,adamson,ornelas,dowell,cloutier,castellanos,wellman,saylor,orourke,moya,montalvo,kilpatrick,durbin,shell,oldham,kang,garvin,foss,branham,bartholomew,templeton,maguire,holton,rider,monahan,mccormack,beaty,anders,streeter,nieto,nielson,moffett,lankford,keating,heck,gatlin,delatorre,callaway,adcock,worrell,unger,robinette,nowak,jeter,brunner,steen,parrott,overstreet,nobles,montanez,clevenger,brinkley,trahan,quarles,pickering,pederson,jansen,grantham,gilchrist,crespo,aiken,schell,schaeffer,lorenz,leyva,harms,dyson,wallis,pease,leavitt,cheng,cavanaugh,batts,warden,seaman,rockwell,quezada,paxton,linder,houck,fontaine,durant,caruso,adler,pimentel,mize,lytle,cleary,cason,acker,switzer,isaacs,higginbotham,waterman,vandyke,stamper,sisk,shuler,riddick,mcmahan,levesque,hatton,bronson,bollinger,arnett,okeefe,gerber,gannon,farnsworth,baughman,silverman,satterfield,mccrary,kowalski,grigsby,greco,cabral,trout,rinehart,mahon,linton,gooden,curley,baugh,wyman,weiner,schwab,schuler,morrissey,mahan,bunn,thrasher,spear,waggoner,qualls,purdy,mcwhorter,mauldin,gilman,perryman,newsom,menard,martino,graf,billingsley,artis,simpkins,salisbury,quintanilla,gilliland,fraley,foust,crouse,scarborough,grissom,fultz,marlow,markham,madrigal,lawton,barfield,whiting,varney,schwarz,gooch,arce,wheat,truong,poulin,hurtado,selby,gaither,fortner,culpepper,coughlin,brinson,boudreau,bales,stepp,holm,schilling,morrell,kahn,heaton,gamez,causey,turpin,shanks,schrader,meek,isom,hardison,carranza,yanez,scroggins,schofield,runyon,ratcliff,murrell,moeller,irby,currier,butterfield,ralston,pullen,pinson,estep,carbone,hawks,ellington,casillas,spurlock,sikes,motley,mccartney,kruger,isbell,houle,burk,tomlin,quigley,neumann,lovelace,fennell,cheatham,bustamante,skidmore,hidalgo,forman,culp,bowens,betancourt,aquino,robb,milner,martel,gresham,wiles,ricketts,dowd,collazo,bostic,blakely,sherrod,kenyon,gandy,ebert,deloach,allard,sauer,robins,olivares,gillette,chestnut,bourque,paine,hite,hauser,devore,crawley,chapa,talbert,poindexter,meador,mcduffie,mattox,kraus,harkins,choate,wren,sledge,sanborn,kinder,geary,cornwell,barclay,abney,seward,rhoads,howland,fortier,benner,vines,tubbs,troutman,rapp,mccurdy,deluca,westmoreland,havens,guajardo,clary,seal,meehan,herzog,guillen,ashcraft,waugh,renner,milam,elrod,churchill,breaux,bolin,asher,windham,tirado,pemberton,nolen,noland,knott,emmons,cornish,christenson,brownlee,barbee,waldrop,pitt,olvera,lombardi,gruber,gaffney,eggleston,banda,archuleta,slone,prewitt,pfeiffer,nettles,mena,mcadams,henning,gardiner,cromwell,chisholm,burleson,vest,oglesby,mccarter,lumpkin,wofford,vanhorn,thorn,teel,swafford,stclair,stanfield,ocampo,herrmann,hannon,arsenault,roush,mcalister,hiatt,gunderson,forsythe,duggan,delvalle,cintron,wilks,weinstein,uribe,rizzo,noyes,mclendon,gurley,bethea,winstead,maples,guyton,giordano,alderman,valdes,polanco,pappas,lively,grogan,griffiths,bobo,arevalo,whitson,sowell,rendon,fernandes,farrow,benavidez,ayres,alicea,stump,smalley,seitz,schulte,gilley,gallant,canfield,wolford,omalley,mcnutt,mcnulty,mcgovern,hardman,harbin,cowart,chavarria,brink,beckett,bagwell,armstead,anglin,abreu,reynoso,krebs,jett,hoffmann,greenfield,forte,burney,broome,sisson,trammell,partridge,mace,lomax,lemieux,gossett,frantz,fogle,cooney,broughton,pence,paulsen,muncy,mcarthur,hollins,beauchamp,withers,osorio,mulligan,hoyle,dockery,cockrell,begley,amador,roby,rains,lindquist,gentile,everhart,bohannon,wylie,sommers,purnell,fortin,dunning,breeden,vail,phelan,phan,marx,cosby,colburn,boling,biddle,ledesma,gaddis,denney,chow,bueno,berrios,wicker,tolliver,thibodeaux,nagle,lavoie,fisk,crist,barbosa,reedy,locklear,kolb,himes,behrens,beckwith,weems,wahl,shorter,shackelford,rees,muse,cerda,valadez,thibodeau,saavedra,ridgeway,reiter,mchenry,majors,lachance,keaton,ferrara,clemens,blocker,applegate,needham,mojica,kuykendall,hamel,escamilla,doughty,burchett,ainsworth,vidal,upchurch,thigpen,strauss,spruill,sowers,riggins,ricker,mccombs,harlow,buffington,sotelo,olivas,negrete,morey,macon,logsdon,lapointe,bigelow,bello,westfall,stubblefield,lindley,hein,hawes,farrington,breen,birch,wilde,steed,sepulveda,reinhardt,proffitt,minter,messina,mcnabb,maier,keeler,gamboa,donohue,basham,shinn,crooks,cota,borders,bills,bachman,tisdale,tavares,schmid,pickard,gulley,fonseca,delossantos,condon,batista,wicks,wadsworth,martell,littleton,ison,haag,folsom,brumfield,broyles,brito,mireles,mcdonnell,leclair,hamblin,gough,fanning,binder,winfield,whitworth,soriano,palumbo,newkirk,mangum,hutcherson,comstock,carlin,beall,bair,wendt,watters,walling,putman,otoole,morley,mares,lemus,keener,hundley,dial,damico,billups,strother,mcfarlane,lamm,eaves,crutcher,caraballo,canty,atwell,taft,siler,rust,rawls,rawlings,prieto,mcneely,mcafee,hulsey,hackney,galvez,escalante,delagarza,crider,bandy,wilbanks,stowe,steinberg,renfro,masterson,massie,lanham,haskell,hamrick,dehart,burdette,branson,bourne,babin,aleman,worthy,tibbs,smoot,slack,paradis,mull,luce,houghton,gantt,furman,danner,christianson,burge,ashford,arndt,almeida,stallworth,shade,searcy,sager,noonan,mclemore,mcintire,maxey,lavigne,jobe,ferrer,falk,coffin,byrnes,aranda,apodaca,stamps,rounds,peek,olmstead,lewandowski,kaminski,dunaway,bruns,brackett,amato,reich,mcclung,lacroix,koontz,herrick,hardesty,flanders,cousins,cato,cade,vickery,shank,nagel,dupuis,croteau,cotter,stuckey,stine,porterfield,pauley,moffitt,knudsen,hardwick,goforth,dupont,blunt,barrows,barnhill,shull,rash,loftis,lemay,kitchens,horvath,grenier,fuchs,fairbanks,culbertson,calkins,burnside,beattie,ashworth,albertson,wertz,vaught,vallejo,turk,tuck,tijerina,sage,peterman,marroquin,marr,lantz,hoang,demarco,cone,berube,barnette,wharton,stinnett,slocum,scanlon,sander,pinto,mancuso,lima,headley,epstein,counts,clarkson,carnahan,boren,arteaga,adame,zook,whittle,whitehurst,wenzel,saxton,reddick,puente,handley,haggerty,earley,devlin,chaffin,cady,acuna,solano,sigler,pollack,pendergrass,ostrander,janes,francois,crutchfield,chamberlin,brubaker,baptiste,willson,reis,neeley,mullin,mercier,lira,layman,keeling,higdon,espinal,chapin,warfield,toledo,pulido,peebles,nagy,montague,mello,lear,jaeger,hogg,graff,furr,soliz,poore,mendenhall,mclaurin,maestas,gable,barraza,tillery,snead,pond,neill,mcculloch,mccorkle,lightfoot,hutchings,holloman,harness,dorn,bock,zielinski,turley,treadwell,stpierre,starling,somers,oswald,merrick,easterling,bivens,truitt,poston,parry,ontiveros,olivarez,moreau,medlin,lenz,knowlton,fairley,cobbs,chisolm,bannister,woodworth,toler,ocasio,noriega,neuman,moye,milburn,mcclanahan,lilley,hanes,flannery,dellinger,danielson,conti,blodgett,beers,weatherford,strain,karr,hitt,denham,custer,coble,clough,casteel,bolduc,batchelor,ammons,whitlow,tierney,staten,sibley,seifert,schubert,salcedo,mattison,laney,haggard,grooms,dees,cromer,cooks,colson,caswell,zarate,swisher,shin,ragan,pridgen,mcvey,matheny,lafleur,franz,ferraro,dugger,whiteside,rigsby,mcmurray,lehmann,jacoby,hildebrand,hendrick,headrick,goad,fincher,drury,borges,archibald,albers,woodcock,trapp,soares,seaton,monson,luckett,lindberg,kopp,keeton,healey,garvey,gaddy,fain,burchfield,wentworth,strand,stack,spooner,saucier,ricci,plunkett,pannell,ness,leger,freitas,fong,elizondo,duval,beaudoin,urbina,rickard,partin,mcgrew,mcclintock,ledoux,forsyth,faison,devries,bertrand,wasson,tilton,scarbrough,leung,irvine,garber,denning,corral,colley,castleberry,bowlin,bogan,beale,baines,trice,rayburn,parkinson,nunes,mcmillen,leahy,kimmel,higgs,fulmer,carden,bedford,taggart,spearman,prichard,morrill,koonce,heinz,hedges,guenther,grice,findley,dover,creighton,boothe,bayer,arreola,vitale,valles,raney,osgood,hanlon,burley,bounds,worden,weatherly,vetter,tanaka,stiltner,nevarez,mosby,montero,melancon,harter,hamer,goble,gladden,gist,ginn,akin,zaragoza,tarver,sammons,royster,oreilly,muir,morehead,luster,kingsley,kelso,grisham,glynn,baumann,alves,yount,tamayo,paterson,oates,menendez,longo,hargis,gillen,desantis,conover,breedlove,sumpter,scherer,rupp,reichert,heredia,creel,cohn,clemmons,casas,bickford,belton,bach,williford,whitcomb,tennant,sutter,stull,mccallum,langlois,keel,keegan,dangelo,dancy,damron,clapp,clanton,bankston,oliveira,mintz,mcinnis,martens,mabe,laster,jolley,hildreth,hefner,glaser,duckett,demers,brockman,blais,alcorn,agnew,toliver,tice,seeley,najera,musser,mcfall,laplante,galvin,fajardo,doan,coyne,copley,clawson,cheung,barone,wynne,woodley,tremblay,stoll,sparrow,sparkman,schweitzer,sasser,samples,roney,legg,heim,farias,colwell,christman,bratcher,winchester,upshaw,southerland,sorrell,sells,mccloskey,martindale,luttrell,loveless,lovejoy,linares,latimer,embry,coombs,bratton,bostick,venable,tuggle,toro,staggs,sandlin,jefferies,heckman,griffis,crayton,clem,browder,thorton,sturgill,sprouse,royer,rousseau,ridenour,pogue,perales,peeples,metzler,mesa,mccutcheon,mcbee,hornsby,heffner,corrigan,armijo,plante,peyton,paredes,macklin,hussey,hodgson,granados,frias,becnel,batten,almanza,turney,teal,sturgeon,meeker,mcdaniels,limon,keeney,hutto,holguin,gorham,fishman,fierro,blanchette,rodrigue,reddy,osburn,oden,lerma,kirkwood,keefer,haugen,hammett,chalmers,brinkman,baumgartner,zhang,valerio,tellez,steffen,shumate,sauls,ripley,kemper,guffey,evers,craddock,carvalho,blaylock,banuelos,balderas,wheaton,turnbull,shuman,pointer,mosier,mccue,ligon,kozlowski,johansen,ingle,herr,briones,snipes,rickman,pipkin,pantoja,orosco,moniz,lawless,kunkel,hibbard,galarza,enos,bussey,schott,salcido,perreault,mcdougal,mccool,haight,garris,easton,conyers,atherton,wimberly,utley,spellman,smithson,slagle,ritchey,rand,petit,osullivan,oaks,nutt,mcvay,mccreary,mayhew,knoll,jewett,harwood,cardoza,ashe,arriaga,zeller,wirth,whitmire,stauffer,rountree,redden,mccaffrey,martz,larose,langdon,humes,gaskin,faber,devito,cass,almond,wingfield,wingate,villareal,tyner,smothers,severson,reno,pennell,maupin,leighton,janssen,hassell,hallman,halcomb,folse,fitzsimmons,fahey,cranford,bolen,battles,battaglia,wooldridge,trask,rosser,regalado,mcewen,keefe,fuqua,echevarria,caro,boynton,andrus,viera,vanmeter,taber,spradlin,seibert,provost,prentice,oliphant,laporte,hwang,hatchett,hass,greiner,freedman,covert,chilton,byars,wiese,venegas,swank,shrader,roberge,mullis,mortensen,mccune,marlowe,kirchner,keck,isaacson,hostetler,halverson,gunther,griswold,fenner,durden,blackwood,ahrens,sawyers,savoy,nabors,mcswain,mackay,lavender,lash,labbe,jessup,fullerton,cruse,crittenden,correia,centeno,caudle,canady,callender,alarcon,ahern,winfrey,tribble,salley,roden,musgrove,minnick,fortenberry,carrion,bunting,batiste,whited,underhill,stillwell,rauch,pippin,perrin,messenger,mancini,lister,kinard,hartmann,fleck,wilt,treadway,thornhill,spalding,rafferty,pitre,patino,ordonez,linkous,kelleher,homan,galbraith,feeney,curtin,coward,camarillo,buss,bunnell,bolt,beeler,autry,alcala,witte,wentz,stidham,shively,nunley,meacham,martins,lemke,lefebvre,hynes,horowitz,hoppe,holcombe,dunne,derr,cochrane,brittain,bedard,beauregard,torrence,strunk,soria,simonson,shumaker,scoggins,oconner,moriarty,kuntz,ives,hutcheson,horan,hales,garmon,fitts,bohn,atchison,wisniewski,vanwinkle,sturm,sallee,prosser,moen,lundberg,kunz,kohl,keane,jorgenson,jaynes,funderburk,freed,durr,creamer,cosgrove,batson,vanhoose,thomsen,teeter,smyth,redmon,orellana,maness,heflin,goulet,frick,forney,bunker,asbury,aguiar,talbott,southard,mowery,mears,lemmon,krieger,hickson,elston,duong,delgadillo,dayton,dasilva,conaway,catron,bruton,bradbury,bordelon,bivins,bittner,bergstrom,beals,abell,whelan,tejada,pulley,pino,norfleet,nealy,maes,loper,gatewood,frierson,freund,finnegan,cupp,covey,catalano,boehm,bader,yoon,walston,tenney,sipes,rawlins,medlock,mccaskill,mccallister,marcotte,maclean,hughey,henke,harwell,gladney,gilson,chism,caskey,brandenburg,baylor,villasenor,veal,thatcher,stegall,petrie,nowlin,navarrete,lombard,loftin,lemaster,kroll,kovach,kimbrell,kidwell,hershberger,fulcher,cantwell,bustos,boland,bobbitt,binkley,wester,weis,verdin,tong,tiller,sisco,sharkey,seymore,rosenbaum,rohr,quinonez,pinkston,malley,logue,lessard,lerner,lebron,krauss,klinger,halstead,haller,getz,burrow,alger,shores,pfeifer,perron,nelms,munn,mcmaster,mckenney,manns,knudson,hutchens,huskey,goebel,flagg,cushman,click,castellano,carder,bumgarner,wampler,spinks,robson,neel,mcreynolds,mathias,maas,loera,jenson,florez,coons,buckingham,brogan,berryman,wilmoth,wilhite,thrash,shephard,seidel,schulze,roldan,pettis,obryan,maki,mackie,hatley,frazer,fiore,chesser,bottoms,bisson,benefield,allman,wilke,trudeau,timm,shifflett,mundy,milliken,mayers,leake,kohn,huntington,horsley,hermann,guerin,fryer,frizzell,foret,flemming,fife,criswell,carbajal,bozeman,boisvert,angulo,wallen,tapp,silvers,ramsay,oshea,orta,moll,mckeever,mcgehee,linville,kiefer,ketchum,howerton,groce,gass,fusco,corbitt,betz,bartels,amaral,aiello,weddle,sperry,seiler,runyan,raley,overby,osteen,olds,mckeown,matney,lauer,lattimore,hindman,hartwell,fredrickson,fredericks,espino,clegg,carswell,cambell,burkholder,woodbury,welker,totten,thornburg,theriault,stitt,stamm,stackhouse,scholl,saxon,rife,razo,quinlan,pinkerton,olivo,nesmith,nall,mattos,lafferty,justus,giron,geer,fielder,drayton,dortch,conners,conger,boatwright,billiot,barden,armenta,tibbetts,steadman,slattery,rinaldi,raynor,pinckney,pettigrew,milne,matteson,halsey,gonsalves,fellows,durand,desimone,cowley,cowles,brill,barham,barela,barba,ashmore,withrow,valenti,tejeda,spriggs,sayre,salerno,peltier,peel,merriman,matheson,lowman,lindstrom,hyland,giroux,earls,dugas,dabney,collado,briseno,baxley,whyte,wenger,vanover,vanburen,thiel,schindler,schiller,rigby,pomeroy,passmore,marble,manzo,mahaffey,lindgren,laflamme,greathouse,fite,calabrese,bayne,yamamoto,wick,townes,thames,reinhart,peeler,naranjo,montez,mcdade,mast,markley,marchand,leeper,kellum,hudgens,hennessey,hadden,gainey,coppola,borrego,bolling,beane,ault,slaton,pape,null,mulkey,lightner,langer,hillard,ethridge,enright,derosa,baskin,weinberg,turman,somerville,pardo,noll,lashley,ingraham,hiller,hendon,glaze,cothran,cooksey,conte,carrico,abner,wooley,swope,summerlin,sturgis,sturdivant,stott,spurgeon,spillman,speight,roussel,popp,nutter,mckeon,mazza,magnuson,lanning,kozak,jankowski,heyward,forster,corwin,callaghan,bays,wortham,usher,theriot,sayers,sabo,poling,loya,lieberman,laroche,labelle,howes,harr,garay,fogarty,everson,durkin,dominquez,chaves,chambliss,witcher,vieira,vandiver,terrill,stoker,schreiner,moorman,liddell,lawhorn,krug,irons,hylton,hollenbeck,herrin,hembree,goolsby,goodin,gilmer,foltz,dinkins,daughtry,caban,brim,briley,bilodeau,wyant,vergara,tallent,swearingen,stroup,scribner,quillen,pitman,mccants,maxfield,martinson,holtz,flournoy,brookins,brody,baumgardner,straub,sills,roybal,roundtree,oswalt,mcgriff,mcdougall,mccleary,maggard,gragg,gooding,godinez,doolittle,donato,cowell,cassell,bracken,appel,zambrano,reuter,perea,nakamura,monaghan,mickens,mcclinton,mcclary,marler,kish,judkins,gilbreath,freese,flanigan,felts,erdmann,dodds,chew,brownell,boatright,barreto,slayton,sandberg,saldivar,pettway,odum,narvaez,moultrie,montemayor,merrell,lees,keyser,hoke,hardaway,hannan,gilbertson,fogg,dumont,deberry,coggins,buxton,bucher,broadnax,beeson,araujo,appleton,amundson,aguayo,ackley,yocum,worsham,shivers,sanches,sacco,robey,rhoden,pender,ochs,mccurry,madera,luong,knotts,jackman,heinrich,hargrave,gault,comeaux,chitwood,caraway,boettcher,bernhardt,barrientos,zink,wickham,whiteman,thorp,stillman,settles,schoonover,roque,riddell,pilcher,phifer,novotny,macleod,hardee,haase,grider,doucette,clausen,bevins,beamon,badillo,tolley,tindall,soule,snook,seale,pinkney,pellegrino,nowell,nemeth,mondragon,mclane,lundgren,ingalls,hudspeth,hixson,gearhart,furlong,downes,dibble,deyoung,cornejo,camara,brookshire,boyette,wolcott,surratt,sellars,segal,salyer,reeve,rausch,labonte,haro,gower,freeland,fawcett,eads,driggers,donley,collett,bromley,boatman,ballinger,baldridge,volz,trombley,stonge,shanahan,rivard,rhyne,pedroza,matias,jamieson,hedgepeth,hartnett,estevez,eskridge,denman,chiu,chinn,catlett,carmack,buie,bechtel,beardsley,bard,ballou,ulmer,skeen,robledo,rincon,reitz,piazza,munger,moten,mcmichael,loftus,ledet,kersey,groff,fowlkes,crumpton,clouse,bettis,villagomez,timmerman,strom,santoro,roddy,penrod,musselman,macpherson,leboeuf,harless,haddad,guido,golding,fulkerson,fannin,dulaney,dowdell,cottle,ceja,cate,bosley,benge,albritton,voigt,trowbridge,soileau,seely,rohde,pearsall,paulk,orth,nason,mota,mcmullin,marquardt,madigan,hoag,gillum,gabbard,fenwick,danforth,cushing,cress,creed,cazares,bettencourt,barringer,baber,stansberry,schramm,rutter,rivero,oquendo,necaise,mouton,montenegro,miley,mcgough,marra,macmillan,lamontagne,jasso,horst,hetrick,heilman,gaytan,gall,fortney,dingle,desjardins,dabbs,burbank,brigham,breland,beaman,arriola,yarborough,wallin,toscano,stowers,reiss,pichardo,orton,michels,mcnamee,mccrory,leatherman,kell,keister,horning,hargett,guay,ferro,deboer,dagostino,carper,blanks,beaudry,towle,tafoya,stricklin,strader,soper,sonnier,sigmon,schenk,saddler,pedigo,mendes,lunn,lohr,lahr,kingsbury,jarman,hume,holliman,hofmann,haworth,harrelson,hambrick,flick,edmunds,dacosta,crossman,colston,chaplin,carrell,budd,weiler,waits,valentino,trantham,tarr,solorio,roebuck,powe,plank,pettus,pagano,mink,luker,leathers,joslin,hartzell,gambrell,cepeda,carty,caputo,brewington,bedell,ballew,applewhite,warnock,walz,urena,tudor,reel,pigg,parton,mickelson,meagher,mclellan,mcculley,mandel,leech,lavallee,kraemer,kling,kipp,kehoe,hochstetler,harriman,gregoire,grabowski,gosselin,gammon,fancher,edens,desai,brannan,armendariz,woolsey,whitehouse,whetstone,ussery,towne,testa,tallman,studer,strait,steinmetz,sorrells,sauceda,rolfe,paddock,mitchem,mcginn,mccrea,lovato,hazen,gilpin,gaynor,fike,devoe,delrio,curiel,burkhardt,bode,backus,zinn,watanabe,wachter,vanpelt,turnage,shaner,schroder,sato,riordan,quimby,portis,natale,mckoy,mccown,kilmer,hotchkiss,hesse,halbert,gwinn,godsey,delisle,chrisman,canter,arbogast,angell,acree,yancy,woolley,wesson,weatherspoon,trainor,stockman,spiller,sipe,rooks,reavis,propst,porras,neilson,mullens,loucks,llewellyn,kumar,koester,klingensmith,kirsch,kester,honaker,hodson,hennessy,helmick,garrity,garibay,drain,casarez,callis,botello,aycock,avant,wingard,wayman,tully,theisen,szymanski,stansbury,segovia,rainwater,preece,pirtle,padron,mincey,mckelvey,mathes,larrabee,kornegay,klug,ingersoll,hecht,germain,eggers,dykstra,deering,decoteau,deason,dearing,cofield,carrigan,bonham,bahr,aucoin,appleby,almonte,yager,womble,wimmer,weimer,vanderpool,stancil,sprinkle,romine,remington,pfaff,peckham,olivera,meraz,maze,lathrop,koehn,hazelton,halvorson,hallock,haddock,ducharme,dehaven,caruthers,brehm,bosworth,bost,bias,beeman,basile,bane,aikens,wold,walther,tabb,suber,strawn,stocker,shirey,schlosser,riedel,rembert,reimer,pyles,peele,merriweather,letourneau,latta,kidder,hixon,hillis,hight,herbst,henriquez,haygood,hamill,gabel,fritts,eubank,dawes,correll,bushey,buchholz,brotherton,botts,barnwell,auger,atchley,westphal,veilleux,ulloa,stutzman,shriver,ryals,pilkington,moyers,marrs,mangrum,maddux,lockard,laing,kuhl,harney,hammock,hamlett,felker,doerr,depriest,carrasquillo,carothers,bogle,bischoff,bergen,albanese,wyckoff,vermillion,vansickle,thibault,tetreault,stickney,shoemake,ruggiero,rawson,racine,philpot,paschal,mcelhaney,mathison,legrand,lapierre,kwan,kremer,jiles,hilbert,geyer,faircloth,ehlers,egbert,desrosiers,dalrymple,cotten,cashman,cadena,boardman,alcaraz,wyrick,therrien,tankersley,strickler,puryear,plourde,pattison,pardue,mcginty,mcevoy,landreth,kuhns,koon,hewett,giddens,emerick,eades,deangelis,cosme,ceballos,birdsong,benham,bemis,armour,anguiano,welborn,tsosie,storms,shoup,sessoms,samaniego,rood,rojo,rhinehart,raby,northcutt,myer,munguia,morehouse,mcdevitt,mallett,lozada,lemoine,kuehn,hallett,grim,gillard,gaylor,garman,gallaher,feaster,faris,darrow,dardar,coney,carreon,braithwaite,boylan,boyett,bixler,bigham,benford,barragan,barnum,zuber,wyche,westcott,vining,stoltzfus,simonds,shupe,sabin,ruble,rittenhouse,richman,perrone,mulholland,millan,lomeli,kite,jemison,hulett,holler,hickerson,herold,hazelwood,griffen,gause,forde,eisenberg,dilworth,charron,chaisson,bristow,breunig,brace,boutwell,bentz,belk,bayless,batchelder,baran,baeza,zimmermann,weathersby,volk,toole,theis,tedesco,searle,schenck,satterwhite,ruelas,rankins,partida,nesbit,morel,menchaca,levasseur,kaylor,johnstone,hulse,hollar,hersey,harrigan,harbison,guyer,gish,giese,gerlach,geller,geisler,falcone,elwell,doucet,deese,darr,corder,chafin,byler,bussell,burdett,brasher,bowe,bellinger,bastian,barner,alleyne,wilborn,weil,wegner,tatro,spitzer,smithers,schoen,resendez,parisi,overman,obrian,mudd,mahler,maggio,lindner,lalonde,lacasse,laboy,killion,kahl,jessen,jamerson,houk,henshaw,gustin,graber,durst,duenas,davey,cundiff,conlon,colunga,coakley,chiles,capers,buell,bricker,bissonnette,bartz,bagby,zayas,volpe,treece,toombs,thom,terrazas,swinney,skiles,silveira,shouse,senn,ramage,moua,langham,kyles,holston,hoagland,herd,feller,denison,carraway,burford,bickel,ambriz,abercrombie,yamada,weidner,waddle,verduzco,thurmond,swindle,schrock,sanabria,rosenberger,probst,peabody,olinger,nazario,mccafferty,mcbroom,mcabee,mazur,matherne,mapes,leverett,killingsworth,heisler,griego,gosnell,frankel,franke,ferrante,fenn,ehrlich,christopherso,chasse,caton,brunelle,bloomfield,babbitt,azevedo,abramson,ables,abeyta,youmans,wozniak,wainwright,stowell,smitherman,samuelson,runge,rothman,rosenfeld,peake,owings,olmos,munro,moreira,leatherwood,larkins,krantz,kovacs,kizer,kindred,karnes,jaffe,hubbell,hosey,hauck,goodell,erdman,dvorak,doane,cureton,cofer,buehler,bierman,berndt,banta,abdullah,warwick,waltz,turcotte,torrey,stith,seger,sachs,quesada,pinder,peppers,pascual,paschall,parkhurst,ozuna,oster,nicholls,lheureux,lavalley,kimura,jablonski,haun,gourley,gilligan,croy,cotto,cargill,burwell,burgett,buckman,booher,adorno,wrenn,whittemore,urias,szabo,sayles,saiz,rutland,rael,pharr,pelkey,ogrady,nickell,musick,moats,mather,massa,kirschner,kieffer,kellar,hendershot,gott,godoy,gadson,furtado,fiedler,erskine,dutcher,dever,daggett,chevalier,brake,ballesteros,amerson,wingo,waldon,trott,silvey,showers,schlegel,ritz,pepin,pelayo,parsley,palermo,moorehead,mchale,lett,kocher,kilburn,iglesias,humble,hulbert,huckaby,hartford,hardiman,gurney,grigg,grasso,goings,fillmore,farber,depew,dandrea,cowen,covarrubias,burrus,bracy,ardoin,thompkins,standley,radcliffe,pohl,persaud,parenteau,pabon,newson,newhouse,napolitano,mulcahy,malave,keim,hooten,hernandes,heffernan,hearne,greenleaf,glick,fuhrman,fetter,faria,dishman,dickenson,crites,criss,clapper,chenault,castor,casto,bugg,bove,bonney,anderton,allgood,alderson,woodman,warrick,toomey,tooley,tarrant,summerville,stebbins,sokol,searles,schutz,schumann,scheer,remillard,raper,proulx,palmore,monroy,messier,melo,melanson,mashburn,manzano,lussier,jenks,huneycutt,hartwig,grimsley,fulk,fielding,fidler,engstrom,eldred,dantzler,crandell,calder,brumley,breton,brann,bramlett,boykins,bianco,bancroft,almaraz,alcantar,whitmer,whitener,welton,vineyard,rahn,paquin,mizell,mcmillin,mckean,marston,maciel,lundquist,liggins,lampkin,kranz,koski,kirkham,jiminez,hazzard,harrod,graziano,grammer,gendron,garrido,fordham,englert,dryden,demoss,deluna,crabb,comeau,brummett,blume,benally,wessel,vanbuskirk,thorson,stumpf,stockwell,reams,radtke,rackley,pelton,niemi,newland,nelsen,morrissette,miramontes,mcginley,mccluskey,marchant,luevano,lampe,lail,jeffcoat,infante,hinman,gaona,eady,desmarais,decosta,dansby,cisco,choe,breckenridge,bostwick,borg,bianchi,alberts,wilkie,whorton,vargo,tait,soucy,schuman,ousley,mumford,lippert,leath,lavergne,laliberte,kirksey,kenner,johnsen,izzo,hiles,gullett,greenwell,gaspar,galbreath,gaitan,ericson,delapaz,croom,cottingham,clift,bushnell,bice,beason,arrowood,waring,voorhees,truax,shreve,shockey,schatz,sandifer,rubino,rozier,roseberry,pieper,peden,nester,nave,murphey,malinowski,macgregor,lafrance,kunkle,kirkman,hipp,hasty,haddix,gervais,gerdes,gamache,fouts,fitzwater,dillingham,deming,deanda,cedeno,cannady,burson,bouldin,arceneaux,woodhouse,whitford,wescott,welty,weigel,torgerson,toms,surber,sunderland,sterner,setzer,riojas,pumphrey,puga,metts,mcgarry,mccandless,magill,lupo,loveland,llamas,leclerc,koons,kahler,huss,holbert,heintz,haupt,grimmett,gaskill,ellingson,dorr,dingess,deweese,desilva,crossley,cordeiro,converse,conde,caldera,cairns,burmeister,burkhalter,brawner,bott,youngs,vierra,valladares,shrum,shropshire,sevilla,rusk,rodarte,pedraza,nino,merino,mcminn,markle,mapp,lajoie,koerner,kittrell,kato,hyder,hollifield,heiser,hazlett,greenwald,fant,eldredge,dreher,delafuente,cravens,claypool,beecher,aronson,alanis,worthen,wojcik,winger,whitacre,valverde,valdivia,troupe,thrower,swindell,suttles,stroman,spires,slate,shealy,sarver,sartin,sadowski,rondeau,rolon,rascon,priddy,paulino,nolte,munroe,molloy,mciver,lykins,loggins,lenoir,klotz,kempf,hupp,hollowell,hollander,haynie,harkness,harker,gottlieb,frith,eddins,driskell,doggett,densmore,charette,cassady,byrum,burcham,buggs,benn,whitted,warrington,vandusen,vaillancourt,steger,siebert,scofield,quirk,purser,plumb,orcutt,nordstrom,mosely,michalski,mcphail,mcdavid,mccraw,marchese,mannino,lefevre,largent,lanza,kress,isham,hunsaker,hoch,hildebrandt,guarino,grijalva,graybill,fick,ewell,ewald,cusick,crumley,coston,cathcart,carruthers,bullington,bowes,blain,blackford,barboza,yingling,wert,weiland,varga,silverstein,sievers,shuster,shumway,runnels,rumsey,renfroe,provencher,polley,mohler,middlebrooks,kutz,koster,groth,glidden,fazio,deen,chipman,chenoweth,champlin,cedillo,carrero,carmody,buckles,brien,boutin,bosch,berkowitz,altamirano,wilfong,wiegand,waites,truesdale,toussaint,tobey,tedder,steelman,sirois,schnell,robichaud,richburg,plumley,pizarro,piercy,ortego,oberg,neace,mertz,mcnew,matta,lapp,lair,kibler,howlett,hollister,hofer,hatten,hagler,falgoust,engelhardt,eberle,dombrowski,dinsmore,daye,casares,braud,balch,autrey,wendel,tyndall,strobel,stoltz,spinelli,serrato,reber,rathbone,palomino,nickels,mayle,mathers,mach,loeffler,littrell,levinson,leong,lemire,lejeune,lazo,lasley,koller,kennard,hoelscher,hintz,hagerman,greaves,fore,eudy,engler,corrales,cordes,brunet,bidwell,bennet,tyrrell,tharpe,swinton,stribling,southworth,sisneros,savoie,samons,ruvalcaba,ries,ramer,omara,mosqueda,millar,mcpeak,macomber,luckey,litton,lehr,lavin,hubbs,hoard,hibbs,hagans,futrell,exum,evenson,culler,carbaugh,callen,brashear,bloomer,blakeney,bigler,addington,woodford,unruh,tolentino,sumrall,stgermain,smock,sherer,rayner,pooler,oquinn,nero,mcglothlin,linden,kowal,kerrigan,ibrahim,harvell,hanrahan,goodall,geist,fussell,fung,ferebee,eley,eggert,dorsett,dingman,destefano,colucci,clemmer,burnell,brumbaugh,boddie,berryhill,avelar,alcantara,winder,winchell,vandenberg,trotman,thurber,thibeault,stlouis,stilwell,sperling,shattuck,sarmiento,ruppert,rumph,renaud,randazzo,rademacher,quiles,pearman,palomo,mercurio,lowrey,lindeman,lawlor,larosa,lander,labrecque,hovis,holifield,henninger,hawkes,hartfield,hann,hague,genovese,garrick,fudge,frink,eddings,dinh,cribbs,calvillo,bunton,brodeur,bolding,blanding,agosto,zahn,wiener,trussell,tello,teixeira,speck,sharma,shanklin,sealy,scanlan,santamaria,roundy,robichaux,ringer,rigney,prevost,polson,nord,moxley,medford,mccaslin,mcardle,macarthur,lewin,lasher,ketcham,keiser,heine,hackworth,grose,grizzle,gillman,gartner,frazee,fleury,edson,edmonson,derry,cronk,conant,burress,burgin,broom,brockington,bolick,boger,birchfield,billington,baily,bahena,armbruster,anson,yoho,wilcher,tinney,timberlake,thielen,sutphin,stultz,sikora,serra,schulman,scheffler,santillan,rego,preciado,pinkham,mickle,lomas,lizotte,lent,kellerman,keil,johanson,hernadez,hartsfield,haber,gorski,farkas,eberhardt,duquette,delano,cropper,cozart,cockerham,chamblee,cartagena,cahoon,buzzell,brister,brewton,blackshear,benfield,aston,ashburn,arruda,wetmore,weise,vaccaro,tucci,sudduth,stromberg,stoops,showalter,shears,runion,rowden,rosenblum,riffle,renfrow,peres,obryant,leftwich,lark,landeros,kistler,killough,kerley,kastner,hoggard,hartung,guertin,govan,gatling,gailey,fullmer,fulford,flatt,esquibel,endicott,edmiston,edelstein,dufresne,dressler,dickman,chee,busse,bonnett,berard,yoshida,velarde,veach,vanhouten,vachon,tolson,tolman,tennyson,stites,soler,shutt,ruggles,rhone,pegues,neese,muro,moncrief,mefford,mcphee,mcmorris,mceachern,mcclurg,mansour,mader,leija,lecompte,lafountain,labrie,jaquez,heald,hash,hartle,gainer,frisby,farina,eidson,edgerton,dyke,durrett,duhon,cuomo,cobos,cervantez,bybee,brockway,borowski,binion,beery,arguello,amaro,acton,yuen,winton,wigfall,weekley,vidrine,vannoy,tardiff,shoop,shilling,schick,safford,prendergast,pilgrim,pellerin,osuna,nissen,nalley,moller,messner,messick,merrifield,mcguinness,matherly,marcano,mahone,lemos,lebrun,jara,hoffer,herren,hecker,haws,haug,gwin,gober,gilliard,fredette,favela,echeverria,downer,donofrio,desrochers,crozier,corson,bechtold,argueta,aparicio,zamudio,westover,westerman,utter,troyer,thies,tapley,slavin,shirk,sandler,roop,rimmer,raymer,radcliff,otten,moorer,millet,mckibben,mccutchen,mcavoy,mcadoo,mayorga,mastin,martineau,marek,madore,leflore,kroeger,kennon,jimerson,hostetter,hornback,hendley,hance,guardado,granado,gowen,goodale,flinn,fleetwood,fitz,durkee,duprey,dipietro,dilley,clyburn,brawley,beckley,arana,weatherby,vollmer,vestal,tunnell,trigg,tingle,takahashi,sweatt,storer,snapp,shiver,rooker,rathbun,poisson,perrine,perri,parmer,parke,pare,papa,palmieri,midkiff,mecham,mccomas,mcalpine,lovelady,lillard,lally,knopp,kile,kiger,haile,gupta,goldsberry,gilreath,fulks,friesen,franzen,flack,findlay,ferland,dreyer,dore,dennard,deckard,debose,crim,coulombe,chancey,cantor,branton,bissell,barns,woolard,witham,wasserman,spiegel,shoffner,scholz,ruch,rossman,petry,palacio,paez,neary,mortenson,millsap,miele,menke,mckim,mcanally,martines,lemley,larochelle,klaus,klatt,kaufmann,kapp,helmer,hedge,halloran,glisson,frechette,fontana,eagan,distefano,danley,creekmore,chartier,chaffee,carillo,burg,bolinger,berkley,benz,basso,bash,zelaya,woodring,witkowski,wilmot,wilkens,wieland,verdugo,urquhart,tsai,timms,swiger,swaim,sussman,pires,molnar,mcatee,lowder,loos,linker,landes,kingery,hufford,higa,hendren,hammack,hamann,gillam,gerhardt,edelman,delk,deans,curl,constantine,cleaver,claar,casiano,carruth,carlyle,brophy,bolanos,bibbs,bessette,beggs,baugher,bartel,averill,andresen,amin,adames,valente,turnbow,swink,sublett,stroh,stringfellow,ridgway,pugliese,poteat,ohare,neubauer,murchison,mingo,lemmons,kwon,kellam,kean,jarmon,hyden,hudak,hollinger,henkel,hemingway,hasson,hansel,halter,haire,ginsberg,gillispie,fogel,flory,etter,elledge,eckman,deas,currin,crafton,coomer,colter,claxton,bulter,braddock,bowyer,binns,bellows,baskerville,barros,ansley,woolf,wight,waldman,wadley,tull,trull,tesch,stouffer,stadler,slay,shubert,sedillo,santacruz,reinke,poynter,neri,neale,mowry,moralez,monger,mitchum,merryman,manion,macdougall,litchfield,levitt,lepage,lasalle,khoury,kavanagh,karns,ivie,huebner,hodgkins,halpin,garica,eversole,dutra,dunagan,duffey,dillman,dillion,deville,dearborn,damato,courson,coulson,burdine,bousquet,bonin,bish,atencio,westbrooks,wages,vaca,toner,tillis,swett,struble,stanfill,solorzano,slusher,sipple,silvas,shults,schexnayder,saez,rodas,rager,pulver,penton,paniagua,meneses,mcfarlin,mcauley,matz,maloy,magruder,lohman,landa,lacombe,jaimes,holzer,holst,heil,hackler,grundy,gilkey,farnham,durfee,dunton,dunston,duda,dews,craver,corriveau,conwell,colella,chambless,bremer,boutte,bourassa,blaisdell,backman,babineaux,audette,alleman,towner,taveras,tarango,sullins,suiter,stallard,solberg,schlueter,poulos,pimental,owsley,okelley,moffatt,metcalfe,meekins,medellin,mcglynn,mccowan,marriott,marable,lennox,lamoureux,koss,kerby,karp,isenberg,howze,hockenberry,highsmith,hallmark,gusman,greeley,giddings,gaudet,gallup,fleenor,eicher,edington,dimaggio,dement,demello,decastro,bushman,brundage,brooker,bourg,blackstock,bergmann,beaton,banister,argo,appling,wortman,watterson,villalpando,tillotson,tighe,sundberg,sternberg,stamey,shipe,seeger,scarberry,sattler,sain,rothstein,poteet,plowman,pettiford,penland,partain,pankey,oyler,ogletree,ogburn,moton,merkel,lucier,lakey,kratz,kinser,kershaw,josephson,imhoff,hendry,hammon,frisbie,frawley,fraga,forester,eskew,emmert,drennan,doyon,dandridge,cawley,carvajal,bracey,belisle,batey,ahner,wysocki,weiser,veliz,tincher,sansone,sankey,sandstrom,rohrer,risner,pridemore,pfeffer,persinger,peery,oubre,nowicki,musgrave,murdoch,mullinax,mccary,mathieu,livengood,kyser,klink,kimes,kellner,kavanaugh,kasten,imes,hoey,hinshaw,hake,gurule,grube,grillo,geter,gatto,garver,garretson,farwell,eiland,dunford,decarlo,corso,colman,collard,cleghorn,chasteen,cavender,carlile,calvo,byerly,brogdon,broadwater,breault,bono,bergin,behr,ballenger,amick,tamez,stiffler,steinke,simmon,shankle,schaller,salmons,sackett,saad,rideout,ratcliffe,ranson,plascencia,petterson,olszewski,olney,olguin,nilsson,nevels,morelli,montiel,monge,michaelson,mertens,mcchesney,mcalpin,mathewson,loudermilk,lineberry,liggett,kinlaw,kight,jost,hereford,hardeman,halpern,halliday,hafer,gaul,friel,freitag,forsberg,evangelista,doering,dicarlo,dendy,delp,deguzman,dameron,curtiss,cosper,cauthen,bradberry,bouton,bonnell,bixby,bieber,beveridge,bedwell,barhorst,bannon,baltazar,baier,ayotte,attaway,arenas,abrego,turgeon,tunstall,thaxton,tenorio,stotts,sthilaire,shedd,seabolt,scalf,salyers,ruhl,rowlett,robinett,pfister,perlman,pepe,parkman,nunnally,norvell,napper,modlin,mckellar,mcclean,mascarenas,leibowitz,ledezma,kuhlman,kobayashi,hunley,holmquist,hinkley,hazard,hartsell,gribble,gravely,fifield,eliason,doak,crossland,carleton,bridgeman,bojorquez,boggess,auten,woosley,whiteley,wexler,twomey,tullis,townley,standridge,santoyo,rueda,riendeau,revell,pless,ottinger,nigro,nickles,mulvey,menefee,mcshane,mcloughlin,mckinzie,markey,lockridge,lipsey,knisley,knepper,kitts,kiel,jinks,hathcock,godin,gallego,fikes,fecteau,estabrook,ellinger,dunlop,dudek,countryman,chauvin,chatham,bullins,brownfield,boughton,bloodworth,bibb,baucom,barbieri,aubin,armitage,alessi,absher,abbate,zito,woolery,wiggs,wacker,tynes,tolle,telles,tarter,swarey,strode,stockdale,stalnaker,spina,schiff,saari,risley,rameriz,rakes,pettaway,penner,paulus,palladino,omeara,montelongo,melnick,mehta,mcgary,mccourt,mccollough,marchetti,manzanares,lowther,leiva,lauderdale,lafontaine,kowalczyk,knighton,joubert,jaworski,huth,hurdle,housley,hackman,gulick,gordy,gilstrap,gehrke,gebhart,gaudette,foxworth,endres,dunkle,cimino,caddell,brauer,braley,bodine,blackmore,belden,backer,ayer,andress,wisner,vuong,valliere,twigg,tavarez,strahan,steib,staub,sowder,seiber,schutt,scharf,schade,rodriques,risinger,renshaw,rahman,presnell,piatt,nieman,nevins,mcilwain,mcgaha,mccully,mccomb,massengale,macedo,lesher,kearse,jauregui,husted,hudnall,holmberg,hertel,hardie,glidewell,frausto,fassett,dalessandro,dahlgren,corum,constantino,conlin,colquitt,colombo,claycomb,cardin,buller,boney,bocanegra,biggers,benedetto,araiza,andino,albin,zorn,werth,weisman,walley,vanegas,ulibarri,towe,tedford,teasley,suttle,steffens,stcyr,squire,singley,sifuentes,shuck,schram,sass,rieger,ridenhour,rickert,richerson,rayborn,rabe,raab,pendley,pastore,ordway,moynihan,mellott,mckissick,mcgann,mccready,mauney,marrufo,lenhart,lazar,lafave,keele,kautz,jardine,jahnke,jacobo,hord,hardcastle,hageman,giglio,gehring,fortson,duque,duplessis,dicken,derosier,deitz,dalessio,cram,castleman,candelario,callison,caceres,bozarth,biles,bejarano,bashaw,avina,armentrout,alverez,acord,waterhouse,vereen,vanlandingham,strawser,shotwell,severance,seltzer,schoonmaker,schock,schaub,schaffner,roeder,rodrigez,riffe,rasberry,rancourt,railey,quade,pursley,prouty,perdomo,oxley,osterman,nickens,murphree,mounts,merida,maus,mattern,masse,martinelli,mangan,lutes,ludwick,loney,laureano,lasater,knighten,kissinger,kimsey,kessinger,honea,hollingshead,hockett,heyer,heron,gurrola,gove,glasscock,gillett,galan,featherstone,eckhardt,duron,dunson,dasher,culbreth,cowden,cowans,claypoole,churchwell,chabot,caviness,cater,caston,callan,byington,burkey,boden,beckford,atwater,archambault,alvey,alsup,whisenant,weese,voyles,verret,tsang,tessier,sweitzer,sherwin,shaughnessy,revis,remy,prine,philpott,peavy,paynter,parmenter,ovalle,offutt,nightingale,newlin,nakano,myatt,muth,mohan,mcmillon,mccarley,mccaleb,maxson,marinelli,maley,liston,letendre,kain,huntsman,hirst,hagerty,gulledge,greenway,grajeda,gorton,goines,gittens,frederickson,fanelli,embree,eichelberger,dunkin,dixson,dillow,defelice,chumley,burleigh,borkowski,binette,biggerstaff,berglund,beller,audet,arbuckle,allain,alfano,youngman,wittman,weintraub,vanzant,vaden,twitty,stollings,standifer,sines,shope,scalise,saville,posada,pisano,otte,nolasco,mier,merkle,mendiola,melcher,mejias,mcmurry,mccalla,markowitz,manis,mallette,macfarlane,lough,looper,landin,kittle,kinsella,kinnard,hobart,helman,hellman,hartsock,halford,hage,gordan,glasser,gayton,gattis,gastelum,gaspard,frisch,fitzhugh,eckstein,eberly,dowden,despain,crumpler,crotty,cornelison,chouinard,chamness,catlin,cann,bumgardner,budde,branum,bradfield,braddy,borst,birdwell,bazan,banas,bade,arango,ahearn,addis,zumwalt,wurth,wilk,widener,wagstaff,urrutia,terwilliger,tart,steinman,staats,sloat,rives,riggle,revels,reichard,prickett,poff,pitzer,petro,pell,northrup,nicks,moline,mielke,maynor,mallon,magness,lingle,lindell,lieb,lesko,lebeau,lammers,lafond,kiernan,ketron,jurado,holmgren,hilburn,hayashi,hashimoto,harbaugh,guillot,gard,froehlich,feinberg,falco,dufour,drees,doney,diep,delao,daves,dail,crowson,coss,congdon,carner,camarena,butterworth,burlingame,bouffard,bloch,bilyeu,barta,bakke,baillargeon,avent,aquilar,zeringue,yarber,wolfson,vogler,voelker,truss,troxell,thrift,strouse,spielman,sistrunk,sevigny,schuller,schaaf,ruffner,routh,roseman,ricciardi,peraza,pegram,overturf,olander,odaniel,millner,melchor,maroney,machuca,macaluso,livesay,layfield,laskowski,kwiatkowski,kilby,hovey,heywood,hayman,havard,harville,haigh,hagood,grieco,glassman,gebhardt,fleischer,fann,elson,eccles,cunha,crumb,blakley,bardwell,abshire,woodham,wines,welter,wargo,varnado,tutt,traynor,swaney,stricker,stoffel,stambaugh,sickler,shackleford,selman,seaver,sansom,sanmiguel,royston,rourke,rockett,rioux,puleo,pitchford,nardi,mulvaney,middaugh,malek,leos,lathan,kujawa,kimbro,killebrew,houlihan,hinckley,herod,hepler,hamner,hammel,hallowell,gonsalez,gingerich,gambill,funkhouser,fricke,fewell,falkner,endsley,dulin,drennen,deaver,dambrosio,chadwell,castanon,burkes,brune,brisco,brinker,bowker,boldt,berner,beaumont,beaird,bazemore,barrick,albano,younts,wunderlich,weidman,vanness,toland,theobald,stickler,steiger,stanger,spies,spector,sollars,smedley,seibel,scoville,saito,rummel,rowles,rouleau,roos,rogan,roemer,ream,raya,purkey,priester,perreira,penick,paulin,parkins,overcash,oleson,neves,muldrow,minard,midgett,michalak,melgar,mcentire,mcauliffe,marte,lydon,lindholm,leyba,langevin,lagasse,lafayette,kesler,kelton,kaminsky,jaggers,humbert,huck,howarth,hinrichs,higley,gupton,guimond,gravois,giguere,fretwell,fontes,feeley,faucher,eichhorn,ecker,earp,dole,dinger,derryberry,demars,deel,copenhaver,collinsworth,colangelo,cloyd,claiborne,caulfield,carlsen,calzada,caffey,broadus,brenneman,bouie,bodnar,blaney,blanc,beltz,behling,barahona,yockey,winkle,windom,wimer,villatoro,trexler,teran,taliaferro,sydnor,swinson,snelling,smtih,simonton,simoneaux,simoneau,sherrer,seavey,scheel,rushton,rupe,ruano,rippy,reiner,reiff,rabinowitz,quach,penley,odle,nock,minnich,mckown,mccarver,mcandrew,longley,laux,lamothe,lafreniere,kropp,krick,kates,jepson,huie,howse,howie,henriques,haydon,haught,hatter,hartzog,harkey,grimaldo,goshorn,gormley,gluck,gilroy,gillenwater,giffin,fluker,feder,eyre,eshelman,eakins,detwiler,delrosario,davisson,catalan,canning,calton,brammer,botelho,blakney,bartell,averett,askins,aker,witmer,winkelman,widmer,whittier,weitzel,wardell,wagers,ullman,tupper,tingley,tilghman,talton,simard,seda,scheller,sala,rundell,rost,ribeiro,rabideau,primm,pinon,peart,ostrom,ober,nystrom,nussbaum,naughton,murr,moorhead,monti,monteiro,melson,meissner,mclin,mcgruder,marotta,makowski,majewski,madewell,lunt,lukens,leininger,lebel,lakin,kepler,jaques,hunnicutt,hungerford,hoopes,hertz,heins,halliburton,grosso,gravitt,glasper,gallman,gallaway,funke,fulbright,falgout,eakin,dostie,dorado,dewberry,derose,cutshall,crampton,costanzo,colletti,cloninger,claytor,chiang,campagna,burd,brokaw,broaddus,bretz,brainard,binford,bilbrey,alpert,aitken,ahlers,zajac,woolfolk,witten,windle,wayland,tramel,tittle,talavera,suter,straley,specht,sommerville,soloman,skeens,sigman,sibert,shavers,schuck,schmit,sartain,sabol,rosenblatt,rollo,rashid,rabb,polston,nyberg,northrop,navarra,muldoon,mikesell,mcdougald,mcburney,mariscal,lozier,lingerfelt,legere,latour,lagunas,lacour,kurth,killen,kiely,kayser,kahle,isley,huertas,hower,hinz,haugh,gumm,galicia,fortunato,flake,dunleavy,duggins,doby,digiovanni,devaney,deltoro,cribb,corpuz,coronel,coen,charbonneau,caine,burchette,blakey,blakemore,bergquist,beene,beaudette,bayles,ballance,bakker,bailes,asberry,arwood,zucker,willman,whitesell,wald,walcott,vancleave,trump,strasser,simas,shick,schleicher,schaal,saleh,rotz,resnick,rainer,partee,ollis,oller,oday,noles,munday,mong,millican,merwin,mazzola,mansell,magallanes,llanes,lewellen,lepore,kisner,keesee,jeanlouis,ingham,hornbeck,hawn,hartz,harber,haffner,gutshall,guth,grays,gowan,finlay,finkelstein,eyler,enloe,dungan,diez,dearman,cull,crosson,chronister,cassity,campion,callihan,butz,breazeale,blumenthal,berkey,batty,batton,arvizu,alderete,aldana,albaugh,abernethy,wolter,wille,tweed,tollefson,thomasson,teter,testerman,sproul,spates,southwick,soukup,skelly,senter,sealey,sawicki,sargeant,rossiter,rosemond,repp,pifer,ormsby,nickelson,naumann,morabito,monzon,millsaps,millen,mcelrath,marcoux,mantooth,madson,macneil,mackinnon,louque,leister,lampley,kushner,krouse,kirwan,jessee,janson,jahn,jacquez,islas,hutt,holladay,hillyer,hepburn,hensel,harrold,gingrich,geis,gales,fults,finnell,ferri,featherston,epley,ebersole,eames,dunigan,drye,dismuke,devaughn,delorenzo,damiano,confer,collum,clower,clow,claussen,clack,caylor,cawthon,casias,carreno,bluhm,bingaman,bewley,belew,beckner,auld,amey,wolfenbarger,wilkey,wicklund,waltman,villalba,valero,valdovinos,ullrich,tyus,twyman,trost,tardif,tanguay,stripling,steinbach,shumpert,sasaki,sappington,sandusky,reinhold,reinert,quijano,placencia,pinkard,phinney,perrotta,pernell,parrett,oxendine,owensby,orman,nuno,mori,mcroberts,mcneese,mckamey,mccullum,markel,mardis,maines,lueck,lubin,lefler,leffler,larios,labarbera,kershner,josey,jeanbaptiste,izaguirre,hermosillo,haviland,hartshorn,hafner,ginter,getty,franck,fiske,dufrene,doody,davie,dangerfield,dahlberg,cuthbertson,crone,coffelt,chidester,chesson,cauley,caudell,cantara,campo,caines,bullis,bucci,brochu,bogard,bickerstaff,benning,arzola,antonelli,adkinson,zellers,wulf,worsley,woolridge,whitton,westerfield,walczak,vassar,truett,trueblood,trawick,townsley,topping,tobar,telford,steverson,stagg,sitton,sill,sergent,schoenfeld,sarabia,rutkowski,rubenstein,rigdon,prentiss,pomerleau,plumlee,philbrick,patnode,oloughlin,obregon,nuss,morell,mikell,mele,mcinerney,mcguigan,mcbrayer,lollar,kuehl,kinzer,kamp,joplin,jacobi,howells,holstein,hedden,hassler,harty,halle,greig,gouge,goodrum,gerhart,geier,geddes,gast,forehand,ferree,fendley,feltner,esqueda,encarnacion,eichler,egger,edmundson,eatmon,doud,donohoe,donelson,dilorenzo,digiacomo,diggins,delozier,dejong,danford,crippen,coppage,cogswell,clardy,cioffi,cabe,brunette,bresnahan,blomquist,blackstone,biller,bevis,bevan,bethune,benbow,baty,basinger,balcom,andes,aman,aguero,adkisson,yandell,wilds,whisenhunt,weigand,weeden,voight,villar,trottier,tillett,suazo,setser,scurry,schuh,schreck,schauer,samora,roane,rinker,reimers,ratchford,popovich,parkin,natal,melville,mcbryde,magdaleno,loehr,lockman,lingo,leduc,larocca,lamere,laclair,krall,korte,koger,jalbert,hughs,higbee,henton,heaney,haith,gump,greeson,goodloe,gholston,gasper,gagliardi,fregoso,farthing,fabrizio,ensor,elswick,elgin,eklund,eaddy,drouin,dorton,dizon,derouen,deherrera,davy,dampier,cullum,culley,cowgill,cardoso,cardinale,brodsky,broadbent,brimmer,briceno,branscum,bolyard,boley,bennington,beadle,baur,ballentine,azure,aultman,arciniega,aguila,aceves,yepez,woodrum,wethington,weissman,veloz,trusty,troup,trammel,tarpley,stivers,steck,sprayberry,spraggins,spitler,spiers,sohn,seagraves,schiffman,rudnick,rizo,riccio,rennie,quackenbush,puma,plott,pearcy,parada,paiz,munford,moskowitz,mease,mcnary,mccusker,lozoya,longmire,loesch,lasky,kuhlmann,krieg,koziol,kowalewski,konrad,kindle,jowers,jolin,jaco,horgan,hine,hileman,hepner,heise,heady,hawkinson,hannigan,haberman,guilford,grimaldi,garton,gagliano,fruge,follett,fiscus,ferretti,ebner,easterday,eanes,dirks,dimarco,depalma,deforest,cruce,craighead,christner,candler,cadwell,burchell,buettner,brinton,brazier,brannen,brame,bova,bomar,blakeslee,belknap,bangs,balzer,athey,armes,alvis,alverson,alvardo,yeung,wheelock,westlund,wessels,volkman,threadgill,thelen,tague,symons,swinford,sturtevant,straka,stier,stagner,segarra,seawright,rutan,roux,ringler,riker,ramsdell,quattlebaum,purifoy,poulson,permenter,peloquin,pasley,pagel,osman,obannon,nygaard,newcomer,munos,motta,meadors,mcquiston,mcniel,mcmann,mccrae,mayne,matte,legault,lechner,kucera,krohn,kratzer,koopman,jeske,horrocks,hock,hibbler,hesson,hersh,harvin,halvorsen,griner,grindle,gladstone,garofalo,frampton,forbis,eddington,diorio,dingus,dewar,desalvo,curcio,creasy,cortese,cordoba,connally,cluff,cascio,capuano,canaday,calabro,bussard,brayton,borja,bigley,arnone,arguelles,acuff,zamarripa,wooton,widner,wideman,threatt,thiele,templin,teeters,synder,swint,swick,sturges,stogner,stedman,spratt,siegfried,shetler,scull,savino,sather,rothwell,rook,rone,rhee,quevedo,privett,pouliot,poche,pickel,petrillo,pellegrini,peaslee,partlow,otey,nunnery,morelock,morello,meunier,messinger,mckie,mccubbin,mccarron,lerch,lavine,laverty,lariviere,lamkin,kugler,krol,kissel,keeter,hubble,hickox,hetzel,hayner,hagy,hadlock,groh,gottschalk,goodsell,gassaway,garrard,galligan,firth,fenderson,feinstein,etienne,engleman,emrick,ellender,drews,doiron,degraw,deegan,dart,crissman,corr,cookson,coil,cleaves,charest,chapple,chaparro,castano,carpio,byer,bufford,bridgewater,bridgers,brandes,borrero,bonanno,aube,ancheta,abarca,abad,wooster,wimbush,willhite,willams,wigley,weisberg,wardlaw,vigue,vanhook,unknow,torre,tasker,tarbox,strachan,slover,shamblin,semple,schuyler,schrimsher,sayer,salzman,rubalcava,riles,reneau,reichel,rayfield,rabon,pyatt,prindle,poss,polito,plemmons,pesce,perrault,pereyra,ostrowski,nilsen,niemeyer,munsey,mundell,moncada,miceli,meader,mcmasters,mckeehan,matsumoto,marron,marden,lizarraga,lingenfelter,lewallen,langan,lamanna,kovac,kinsler,kephart,keown,kass,kammerer,jeffreys,hysell,hosmer,hardnett,hanner,guyette,greening,glazer,ginder,fromm,fluellen,finkle,fessler,essary,eisele,duren,dittmer,crochet,cosentino,cogan,coelho,cavin,carrizales,campuzano,brough,bopp,bookman,bobb,blouin,beesley,battista,bascom,bakken,badgett,arneson,anselmo,albino,ahumada,woodyard,wolters,wireman,willison,warman,waldrup,vowell,vantassel,twombly,toomer,tennison,teets,tedeschi,swanner,stutz,stelly,sheehy,schermerhorn,scala,sandidge,salters,salo,saechao,roseboro,rolle,ressler,renz,renn,redford,raposa,rainbolt,pelfrey,orndorff,oney,nolin,nimmons,nardone,myhre,morman,menjivar,mcglone,mccammon,maxon,marciano,manus,lowrance,lorenzen,lonergan,lollis,littles,lindahl,lamas,lach,kuster,krawczyk,knuth,knecht,kirkendall,keitt,keever,kantor,jarboe,hoye,houchens,holter,holsinger,hickok,helwig,helgeson,hassett,harner,hamman,hames,hadfield,goree,goldfarb,gaughan,gaudreau,gantz,gallion,frady,foti,flesher,ferrin,faught,engram,donegan,desouza,degroot,cutright,crowl,criner,coan,clinkscales,chewning,chavira,catchings,carlock,bulger,buenrostro,bramblett,brack,boulware,bookout,bitner,birt,baranowski,baisden,allmon,acklin,yoakum,wilbourn,whisler,weinberger,washer,vasques,vanzandt,vanatta,troxler,tomes,tindle,tims,throckmorton,thach,stpeter,stlaurent,stenson,spry,spitz,songer,snavely,shroyer,shortridge,shenk,sevier,seabrook,scrivner,saltzman,rosenberry,rockwood,robeson,roan,reiser,ramires,raber,posner,popham,piotrowski,pinard,peterkin,pelham,peiffer,peay,nadler,musso,millett,mestas,mcgowen,marques,marasco,manriquez,manos,mair,lipps,leiker,krumm,knorr,kinslow,kessel,kendricks,kelm,irick,ickes,hurlburt,horta,hoekstra,heuer,helmuth,heatherly,hampson,hagar,haga,greenlaw,grau,godbey,gingras,gillies,gibb,gayden,gauvin,garrow,fontanez,florio,finke,fasano,ezzell,ewers,eveland,eckenrode,duclos,drumm,dimmick,delancey,defazio,dashiell,cusack,crowther,crigger,cray,coolidge,coldiron,cleland,chalfant,cassel,camire,cabrales,broomfield,brittingham,brisson,brickey,braziel,brazell,bragdon,boulanger,boman,bohannan,beem,barre,azar,ashbaugh,armistead,almazan,adamski,zendejas,winburn,willaims,wilhoit,westberry,wentzel,wendling,visser,vanscoy,vankirk,vallee,tweedy,thornberry,sweeny,spradling,spano,smelser,shim,sechrist,schall,scaife,rugg,rothrock,roesler,riehl,ridings,render,ransdell,radke,pinero,petree,pendergast,peluso,pecoraro,pascoe,panek,oshiro,navarrette,murguia,moores,moberg,michaelis,mcwhirter,mcsweeney,mcquade,mccay,mauk,mariani,marceau,mandeville,maeda,lunde,ludlow,loeb,lindo,linderman,leveille,leith,larock,lambrecht,kulp,kinsley,kimberlin,kesterson,hoyos,helfrich,hanke,grisby,goyette,gouveia,glazier,gile,gerena,gelinas,gasaway,funches,fujimoto,flynt,fenske,fellers,fehr,eslinger,escalera,enciso,duley,dittman,dineen,diller,devault,collings,clymer,clowers,chavers,charland,castorena,castello,camargo,bunce,bullen,boyes,borchers,borchardt,birnbaum,birdsall,billman,benites,bankhead,ange,ammerman,adkison,winegar,wickman,warr,warnke,villeneuve,veasey,vassallo,vannatta,vadnais,twilley,towery,tomblin,tippett,theiss,talkington,talamantes,swart,swanger,streit,stines,stabler,spurling,sobel,sine,simmers,shippy,shiflett,shearin,sauter,sanderlin,rusch,runkle,ruckman,rorie,roesch,richert,rehm,randel,ragin,quesenberry,puentes,plyler,plotkin,paugh,oshaughnessy,ohalloran,norsworthy,niemann,nader,moorefield,mooneyham,modica,miyamoto,mickel,mebane,mckinnie,mazurek,mancilla,lukas,lovins,loughlin,lotz,lindsley,liddle,levan,lederman,leclaire,lasseter,lapoint,lamoreaux,lafollette,kubiak,kirtley,keffer,kaczmarek,housman,hiers,hibbert,herrod,hegarty,hathorn,greenhaw,grafton,govea,futch,furst,franko,forcier,foran,flickinger,fairfield,eure,emrich,embrey,edgington,ecklund,eckard,durante,deyo,delvecchio,dade,currey,creswell,cottrill,casavant,cartier,cargile,capel,cammack,calfee,burse,burruss,brust,brousseau,bridwell,braaten,borkholder,bloomquist,bjork,bartelt,amburgey,yeary,whitefield,vinyard,vanvalkenburg,twitchell,timmins,tapper,stringham,starcher,spotts,slaugh,simonsen,sheffer,sequeira,rosati,rhymes,quint,pollak,peirce,patillo,parkerson,paiva,nilson,nevin,narcisse,mitton,merriam,merced,meiners,mckain,mcelveen,mcbeth,marsden,marez,manke,mahurin,mabrey,luper,krull,hunsicker,hornbuckle,holtzclaw,hinnant,heston,hering,hemenway,hegwood,hearns,halterman,guiterrez,grote,granillo,grainger,glasco,gilder,garren,garlock,garey,fryar,fredricks,fraizer,foshee,ferrel,felty,everitt,evens,esser,elkin,eberhart,durso,duguay,driskill,doster,dewall,deveau,demps,demaio,delreal,deleo,darrah,cumberbatch,culberson,cranmer,cordle,colgan,chesley,cavallo,castellon,castelli,carreras,carnell,carlucci,bontrager,blumberg,blasingame,becton,artrip,andujar,alkire,alder,zukowski,zuckerman,wroblewski,wrigley,woodside,wigginton,westman,westgate,werts,washam,wardlow,walser,waiters,tadlock,stringfield,stimpson,stickley,standish,spurlin,spindler,speller,spaeth,sotomayor,sluder,shryock,shepardson,shatley,scannell,santistevan,rosner,resto,reinhard,rathburn,prisco,poulsen,pinney,phares,pennock,pastrana,oviedo,ostler,nauman,mulford,moise,moberly,mirabal,metoyer,metheny,mentzer,meldrum,mcinturff,mcelyea,mcdougle,massaro,lumpkins,loveday,lofgren,lirette,lesperance,lefkowitz,ledger,lauzon,lachapelle,klassen,keough,kempton,kaelin,jeffords,hsieh,hoyer,horwitz,hoeft,hennig,haskin,gourdine,golightly,girouard,fulgham,fritsch,freer,frasher,foulk,firestone,fiorentino,fedor,ensley,englehart,eells,dunphy,donahoe,dileo,dibenedetto,dabrowski,crick,coonrod,conder,coddington,chunn,chaput,cerna,carreiro,calahan,braggs,bourdon,bollman,bittle,bauder,barreras,aubuchon,anzalone,adamo,zerbe,willcox,westberg,weikel,waymire,vroman,vinci,vallejos,truesdell,troutt,trotta,tollison,toles,tichenor,symonds,surles,strayer,stgeorge,sroka,sorrentino,solares,snelson,silvestri,sikorski,shawver,schumaker,schorr,schooley,scates,satterlee,satchell,rymer,roselli,robitaille,riegel,regis,reames,provenzano,priestley,plaisance,pettey,palomares,nowakowski,monette,minyard,mclamb,mchone,mccarroll,masson,magoon,maddy,lundin,licata,leonhardt,landwehr,kircher,kinch,karpinski,johannsen,hussain,houghtaling,hoskinson,hollaway,holeman,hobgood,hiebert,goggin,geissler,gadbois,gabaldon,fleshman,flannigan,fairman,eilers,dycus,dunmire,duffield,dowler,deloatch,dehaan,deemer,clayborn,christofferso,chilson,chesney,chatfield,carron,canale,brigman,branstetter,bosse,borton,bonar,biron,barroso,arispe,zacharias,zabel,yaeger,woolford,whetzel,weakley,veatch,vandeusen,tufts,troxel,troche,traver,townsel,talarico,swilley,sterrett,stenger,speakman,sowards,sours,souders,souder,soles,sobers,snoddy,smither,shute,shoaf,shahan,schuetz,scaggs,santini,rosson,rolen,robidoux,rentas,recio,pixley,pawlowski,pawlak,paull,overbey,orear,oliveri,oldenburg,nutting,naugle,mossman,misner,milazzo,michelson,mcentee,mccullar,mccree,mcaleer,mazzone,mandell,manahan,malott,maisonet,mailloux,lumley,lowrie,louviere,lipinski,lindemann,leppert,leasure,labarge,kubik,knisely,knepp,kenworthy,kennelly,kelch,kanter,houchin,hosley,hosler,hollon,holleman,heitman,haggins,gwaltney,goulding,gorden,geraci,gathers,frison,feagin,falconer,espada,erving,erikson,eisenhauer,ebeling,durgin,dowdle,dinwiddie,delcastillo,dedrick,crimmins,covell,cournoyer,coria,cohan,cataldo,carpentier,canas,campa,brode,brashears,blaser,bicknell,bednar,barwick,ascencio,althoff,almodovar,alamo,zirkle,zabala,wolverton,winebrenner,wetherell,westlake,wegener,weddington,tuten,trosclair,tressler,theroux,teske,swinehart,swensen,sundquist,southall,socha,sizer,silverberg,shortt,shimizu,sherrard,shaeffer,scheid,scheetz,saravia,sanner,rubinstein,rozell,romer,rheaume,reisinger,randles,pullum,petrella,payan,nordin,norcross,nicoletti,nicholes,newbold,nakagawa,monteith,milstead,milliner,mellen,mccardle,liptak,leitch,latimore,larrison,landau,laborde,koval,izquierdo,hymel,hoskin,holte,hoefer,hayworth,hausman,harrill,harrel,hardt,gully,groover,grinnell,greenspan,graver,grandberry,gorrell,goldenberg,goguen,gilleland,fuson,feldmann,everly,dyess,dunnigan,downie,dolby,deatherage,cosey,cheever,celaya,caver,cashion,caplinger,cansler,byrge,bruder,breuer,breslin,brazelton,botkin,bonneau,bondurant,bohanan,bogue,bodner,boatner,blatt,bickley,belliveau,beiler,beier,beckstead,bachmann,atkin,altizer,alloway,allaire,albro,abron,zellmer,yetter,yelverton,wiens,whidden,viramontes,vanwormer,tarantino,tanksley,sumlin,strauch,strang,stice,spahn,sosebee,sigala,shrout,seamon,schrum,schneck,schantz,ruddy,romig,roehl,renninger,reding,polak,pohlman,pasillas,oldfield,oldaker,ohanlon,ogilvie,norberg,nolette,neufeld,nellis,mummert,mulvihill,mullaney,monteleone,mendonca,meisner,mcmullan,mccluney,mattis,massengill,manfredi,luedtke,lounsbury,liberatore,lamphere,laforge,jourdan,iorio,iniguez,ikeda,hubler,hodgdon,hocking,heacock,haslam,haralson,hanshaw,hannum,hallam,haden,garnes,garces,gammage,gambino,finkel,faucett,ehrhardt,eggen,dusek,durrant,dubay,dones,depasquale,delucia,degraff,decamp,davalos,cullins,conard,clouser,clontz,cifuentes,chappel,chaffins,celis,carwile,byram,bruggeman,bressler,brathwaite,brasfield,bradburn,boose,bodie,blosser,bertsch,bernardi,bernabe,bengtson,barrette,astorga,alday,albee,abrahamson,yarnell,wiltse,wiebe,waguespack,vasser,upham,turek,traxler,torain,tomaszewski,tinnin,tiner,tindell,styron,stahlman,staab,skiba,sheperd,seidl,secor,schutte,sanfilippo,ruder,rondon,rearick,procter,prochaska,pettengill,pauly,neilsen,nally,mullenax,morano,meads,mcnaughton,mcmurtry,mcmath,mckinsey,matthes,massenburg,marlar,margolis,malin,magallon,mackin,lovette,loughran,loring,longstreet,loiselle,lenihan,kunze,koepke,kerwin,kalinowski,kagan,innis,innes,holtzman,heinemann,harshman,haider,haack,grondin,grissett,greenawalt,goudy,goodlett,goldston,gokey,gardea,galaviz,gafford,gabrielson,furlow,fritch,fordyce,folger,elizalde,ehlert,eckhoff,eccleston,ealey,dubin,diemer,deschamps,delapena,decicco,debolt,cullinan,crittendon,crase,cossey,coppock,coots,colyer,cluck,chamberland,burkhead,bumpus,buchan,borman,birkholz,berardi,benda,behnke,barter,amezquita,wotring,wirtz,wingert,wiesner,whitesides,weyant,wainscott,venezia,varnell,tussey,thurlow,tabares,stiver,stell,starke,stanhope,stanek,sisler,sinnott,siciliano,shehan,selph,seager,scurlock,scranton,santucci,santangelo,saltsman,rogge,rettig,renwick,reidy,reider,redfield,premo,parente,paolucci,palmquist,ohler,netherton,mutchler,morita,mistretta,minnis,middendorf,menzel,mendosa,mendelson,meaux,mcspadden,mcquaid,mcnatt,manigault,maney,mager,lukes,lopresti,liriano,letson,lechuga,lazenby,lauria,larimore,krupp,krupa,kopec,kinchen,kifer,kerney,kerner,kennison,kegley,karcher,justis,johson,jellison,janke,huskins,holzman,hinojos,hefley,hatmaker,harte,halloway,hallenbeck,goodwyn,glaspie,geise,fullwood,fryman,frakes,fraire,farrer,enlow,engen,ellzey,eckles,earles,dunkley,drinkard,dreiling,draeger,dinardo,dills,desroches,desantiago,curlee,crumbley,critchlow,coury,courtright,coffield,cleek,charpentier,cardone,caples,cantin,buntin,bugbee,brinkerhoff,brackin,bourland,blassingame,beacham,banning,auguste,andreasen,amann,almon,alejo,adelman,abston,yerger,wymer,woodberry,windley,whiteaker,westfield,weibel,wanner,waldrep,villani,vanarsdale,utterback,updike,triggs,topete,tolar,tigner,thoms,tauber,tarvin,tally,swiney,sweatman,studebaker,stennett,starrett,stannard,stalvey,sonnenberg,smithey,sieber,sickles,shinault,segars,sanger,salmeron,rothe,rizzi,restrepo,ralls,ragusa,quiroga,papenfuss,oropeza,okane,mudge,mozingo,molinaro,mcvicker,mcgarvey,mcfalls,mccraney,matus,magers,llanos,livermore,linehan,leitner,laymon,lawing,lacourse,kwong,kollar,kneeland,kennett,kellett,kangas,janzen,hutter,huling,hofmeister,hewes,harjo,habib,guice,grullon,greggs,grayer,granier,grable,gowdy,giannini,getchell,gartman,garnica,ganey,gallimore,fetters,fergerson,farlow,fagundes,exley,esteves,enders,edenfield,easterwood,drakeford,dipasquale,desousa,deshields,deeter,dedmon,debord,daughtery,cutts,courtemanche,coursey,copple,coomes,collis,cogburn,clopton,choquette,chaidez,castrejon,calhoon,burbach,bulloch,buchman,bruhn,bohon,blough,baynes,barstow,zeman,zackery,yardley,yamashita,wulff,wilken,wiliams,wickersham,wible,whipkey,wedgeworth,walmsley,walkup,vreeland,verrill,umana,traub,swingle,summey,stroupe,stockstill,steffey,stefanski,statler,stapp,speights,solari,soderberg,shunk,shorey,shewmaker,sheilds,schiffer,schank,schaff,sagers,rochon,riser,rickett,reale,raglin,polen,plata,pitcock,percival,palen,orona,oberle,nocera,navas,nault,mullings,montejano,monreal,minick,middlebrook,meece,mcmillion,mccullen,mauck,marshburn,maillet,mahaney,magner,maclin,lucey,litteral,lippincott,leite,leaks,lamarre,jurgens,jerkins,jager,hurwitz,hughley,hotaling,horstman,hohman,hocker,hively,hipps,hessler,hermanson,hepworth,helland,hedlund,harkless,haigler,gutierez,grindstaff,glantz,giardina,gerken,gadsden,finnerty,farnum,encinas,drakes,dennie,cutlip,curtsinger,couto,cortinas,corby,chiasson,carle,carballo,brindle,borum,bober,blagg,berthiaume,beahm,batres,basnight,backes,axtell,atterberry,alvares,alegria,woodell,wojciechowski,winfree,winbush,wiest,wesner,wamsley,wakeman,verner,truex,trafton,toman,thorsen,theus,tellier,tallant,szeto,strope,stills,simkins,shuey,shaul,servin,serio,serafin,salguero,ryerson,rudder,ruark,rother,rohrbaugh,rohrbach,rohan,rogerson,risher,reeser,pryce,prokop,prins,priebe,prejean,pinheiro,petrone,petri,penson,pearlman,parikh,natoli,murakami,mullikin,mullane,motes,morningstar,mcveigh,mcgrady,mcgaughey,mccurley,marchan,manske,lusby,linde,likens,licon,leroux,lemaire,legette,laskey,laprade,laplant,kolar,kittredge,kinley,kerber,kanagy,jetton,janik,ippolito,inouye,hunsinger,howley,howery,horrell,holthaus,hiner,hilson,hilderbrand,hartzler,harnish,harada,hansford,halligan,hagedorn,gwynn,gudino,greenstein,greear,gracey,goudeau,goodner,ginsburg,gerth,gerner,fujii,frier,frenette,folmar,fleisher,fleischmann,fetzer,eisenman,earhart,dupuy,dunkelberger,drexler,dillinger,dilbeck,dewald,demby,deford,craine,chesnut,casady,carstens,carrick,carino,carignan,canchola,bushong,burman,buono,brownlow,broach,britten,brickhouse,boyden,boulton,borland,bohrer,blubaugh,bever,berggren,benevides,arocho,arends,amezcua,almendarez,zalewski,witzel,winkfield,wilhoite,vangundy,vanfleet,vanetten,vandergriff,urbanski,troiano,thibodaux,straus,stoneking,stjean,stillings,stange,speicher,speegle,smeltzer,slawson,simmonds,shuttleworth,serpa,senger,seidman,schweiger,schloss,schimmel,schechter,sayler,sabatini,ronan,rodiguez,riggleman,richins,reamer,prunty,porath,plunk,piland,philbrook,pettitt,perna,peralez,pascale,padula,oboyle,nivens,nickols,mundt,munden,montijo,mcmanis,mcgrane,mccrimmon,manzi,mangold,malick,mahar,maddock,losey,litten,leedy,leavell,ladue,krahn,kluge,junker,iversen,imler,hurtt,huizar,hubbert,howington,hollomon,holdren,hoisington,heiden,hauge,hartigan,gutirrez,griffie,greenhill,gratton,granata,gottfried,gertz,gautreaux,furry,furey,funderburg,flippen,fitzgibbon,drucker,donoghue,dildy,devers,detweiler,despres,denby,degeorge,cueto,cranston,courville,clukey,cirillo,chivers,caudillo,butera,bulluck,buckmaster,braunstein,bracamonte,bourdeau,bonnette".split(","),
114530 us_tv_and_film: "you,i,to,that,it,me,what,this,know,i'm,no,have,my,don't,just,not,do,be,your,we,it's,so,but,all,well,oh,about,right,you're,get,here,out,going,like,yeah,if,can,up,want,think,that's,now,go,him,how,got,did,why,see,come,good,really,look,will,okay,back,can't,mean,tell,i'll,hey,he's,could,didn't,yes,something,because,say,take,way,little,make,need,gonna,never,we're,too,she's,i've,sure,our,sorry,what's,let,thing,maybe,down,man,very,there's,should,anything,said,much,any,even,off,please,doing,thank,give,thought,help,talk,god,still,wait,find,nothing,again,things,let's,doesn't,call,told,great,better,ever,night,away,believe,feel,everything,you've,fine,last,keep,does,put,around,stop,they're,i'd,guy,isn't,always,listen,wanted,guys,huh,those,big,lot,happened,thanks,won't,trying,kind,wrong,talking,guess,care,bad,mom,remember,getting,we'll,together,dad,leave,understand,wouldn't,actually,hear,baby,nice,father,else,stay,done,wasn't,course,might,mind,every,enough,try,hell,came,someone,you'll,whole,yourself,idea,ask,must,coming,looking,woman,room,knew,tonight,real,son,hope,went,hmm,happy,pretty,saw,girl,sir,friend,already,saying,next,job,problem,minute,thinking,haven't,heard,honey,matter,myself,couldn't,exactly,having,probably,happen,we've,hurt,boy,dead,gotta,alone,excuse,start,kill,hard,you'd,today,car,ready,without,wants,hold,wanna,yet,seen,deal,once,gone,morning,supposed,friends,head,stuff,worry,live,truth,face,forget,true,cause,soon,knows,telling,wife,who's,chance,run,move,anyone,person,bye,somebody,heart,miss,making,meet,anyway,phone,reason,damn,lost,looks,bring,case,turn,wish,tomorrow,kids,trust,check,change,anymore,least,aren't,working,makes,taking,means,brother,hate,ago,says,beautiful,gave,fact,crazy,sit,afraid,important,rest,fun,kid,word,watch,glad,everyone,sister,minutes,everybody,bit,couple,whoa,either,mrs,feeling,daughter,wow,gets,asked,break,promise,door,close,hand,easy,question,tried,far,walk,needs,mine,killed,hospital,anybody,alright,wedding,shut,able,die,perfect,stand,comes,hit,waiting,dinner,funny,husband,almost,pay,answer,cool,eyes,news,child,shouldn't,yours,moment,sleep,read,where's,sounds,sonny,pick,sometimes,bed,date,plan,hours,lose,hands,serious,shit,behind,inside,ahead,week,wonderful,fight,past,cut,quite,he'll,sick,it'll,eat,nobody,goes,save,seems,finally,lives,worried,upset,carly,met,brought,seem,sort,safe,weren't,leaving,front,shot,loved,asking,running,clear,figure,hot,felt,parents,drink,absolutely,how's,daddy,sweet,alive,sense,meant,happens,bet,blood,ain't,kidding,lie,meeting,dear,seeing,sound,fault,ten,buy,hour,speak,lady,jen,thinks,christmas,outside,hang,possible,worse,mistake,ooh,handle,spend,totally,giving,here's,marriage,realize,unless,sex,send,needed,scared,picture,talked,ass,hundred,changed,completely,explain,certainly,sign,boys,relationship,loves,hair,lying,choice,anywhere,future,weird,luck,she'll,turned,touch,kiss,crane,questions,obviously,wonder,pain,calling,somewhere,throw,straight,cold,fast,words,food,none,drive,feelings,they'll,marry,drop,cannot,dream,protect,twenty,surprise,sweetheart,poor,looked,mad,except,gun,y'know,dance,takes,appreciate,especially,situation,besides,pull,hasn't,worth,sheridan,amazing,expect,swear,piece,busy,happening,movie,we'd,catch,perhaps,step,fall,watching,kept,darling,dog,honor,moving,till,admit,problems,murder,he'd,evil,definitely,feels,honest,eye,broke,missed,longer,dollars,tired,evening,starting,entire,trip,niles,suppose,calm,imagine,fair,caught,blame,sitting,favor,apartment,terrible,clean,learn,frasier,relax,accident,wake,prove,smart,message,missing,forgot,interested,table,nbsp,mouth,pregnant,ring,careful,shall,dude,ride,figured,wear,shoot,stick,follow,angry,write,stopped,ran,standing,forgive,jail,wearing,ladies,kinda,lunch,cristian,greenlee,gotten,hoping,phoebe,thousand,ridge,paper,tough,tape,count,boyfriend,proud,agree,birthday,they've,share,offer,hurry,feet,wondering,decision,ones,finish,voice,herself,would've,mess,deserve,evidence,cute,dress,interesting,hotel,enjoy,quiet,concerned,staying,beat,sweetie,mention,clothes,fell,neither,mmm,fix,respect,prison,attention,holding,calls,surprised,bar,keeping,gift,hadn't,putting,dark,owe,ice,helping,normal,aunt,lawyer,apart,plans,jax,girlfriend,floor,whether,everything's,box,judge,upstairs,sake,mommy,possibly,worst,acting,accept,blow,strange,saved,conversation,plane,mama,yesterday,lied,quick,lately,stuck,difference,store,she'd,bought,doubt,listening,walking,cops,deep,dangerous,buffy,sleeping,chloe,rafe,join,card,crime,gentlemen,willing,window,walked,guilty,likes,fighting,difficult,soul,joke,favorite,uncle,promised,bother,seriously,cell,knowing,broken,advice,somehow,paid,losing,push,helped,killing,boss,liked,innocent,rules,learned,thirty,risk,letting,speaking,ridiculous,afternoon,apologize,nervous,charge,patient,boat,how'd,hide,detective,planning,huge,breakfast,horrible,awful,pleasure,driving,hanging,picked,sell,quit,apparently,dying,notice,congratulations,visit,could've,c'mon,letter,decide,forward,fool,showed,smell,seemed,spell,memory,pictures,slow,seconds,hungry,hearing,kitchen,ma'am,should've,realized,kick,grab,discuss,fifty,reading,idiot,suddenly,agent,destroy,bucks,shoes,peace,arms,demon,livvie,consider,papers,incredible,witch,drunk,attorney,tells,knock,ways,gives,nose,skye,turns,keeps,jealous,drug,sooner,cares,plenty,extra,outta,weekend,matters,gosh,opportunity,impossible,waste,pretend,jump,eating,proof,slept,arrest,breathe,perfectly,warm,pulled,twice,easier,goin,dating,suit,romantic,drugs,comfortable,finds,checked,divorce,begin,ourselves,closer,ruin,smile,laugh,treat,fear,what'd,otherwise,excited,mail,hiding,stole,pacey,noticed,fired,excellent,bringing,bottom,note,sudden,bathroom,honestly,sing,foot,remind,charges,witness,finding,tree,dare,hardly,that'll,steal,silly,contact,teach,shop,plus,colonel,fresh,trial,invited,roll,reach,dirty,choose,emergency,dropped,butt,credit,obvious,locked,loving,nuts,agreed,prue,goodbye,condition,guard,fuckin,grow,cake,mood,crap,crying,belong,partner,trick,pressure,dressed,taste,neck,nurse,raise,lots,carry,whoever,drinking,they'd,breaking,file,lock,wine,spot,paying,assume,asleep,turning,viki,bedroom,shower,nikolas,camera,fill,reasons,forty,bigger,nope,breath,doctors,pants,freak,movies,folks,cream,wild,truly,desk,convince,client,threw,hurts,spending,answers,shirt,chair,rough,doin,sees,ought,empty,wind,aware,dealing,pack,tight,hurting,guest,arrested,salem,confused,surgery,expecting,deacon,unfortunately,goddamn,bottle,beyond,whenever,pool,opinion,starts,jerk,secrets,falling,necessary,barely,dancing,tests,copy,cousin,ahem,twelve,tess,skin,fifteen,speech,orders,complicated,nowhere,escape,biggest,restaurant,grateful,usual,burn,address,someplace,screw,everywhere,regret,goodness,mistakes,details,responsibility,suspect,corner,hero,dumb,terrific,whoo,hole,memories,o'clock,teeth,ruined,bite,stenbeck,liar,showing,cards,desperate,search,pathetic,spoke,scare,marah,afford,settle,stayed,checking,hired,heads,concern,blew,alcazar,champagne,connection,tickets,happiness,saving,kissing,hated,personally,suggest,prepared,onto,downstairs,ticket,it'd,loose,holy,duty,convinced,throwing,kissed,legs,loud,saturday,babies,where'd,warning,miracle,carrying,blind,ugly,shopping,hates,sight,bride,coat,clearly,celebrate,brilliant,wanting,forrester,lips,custody,screwed,buying,toast,thoughts,reality,lexie,attitude,advantage,grandfather,sami,grandma,someday,roof,marrying,powerful,grown,grandmother,fake,must've,ideas,exciting,familiar,bomb,bout,harmony,schedule,capable,practically,correct,clue,forgotten,appointment,deserves,threat,bloody,lonely,shame,jacket,hook,scary,investigation,invite,shooting,lesson,criminal,victim,funeral,considering,burning,strength,harder,sisters,pushed,shock,pushing,heat,chocolate,miserable,corinthos,nightmare,brings,zander,crash,chances,sending,recognize,healthy,boring,feed,engaged,headed,treated,knife,drag,badly,hire,paint,pardon,behavior,closet,warn,gorgeous,milk,survive,ends,dump,rent,remembered,thanksgiving,rain,revenge,prefer,spare,pray,disappeared,aside,statement,sometime,meat,fantastic,breathing,laughing,stood,affair,ours,depends,protecting,jury,brave,fingers,murdered,explanation,picking,blah,stronger,handsome,unbelievable,anytime,shake,oakdale,wherever,pulling,facts,waited,lousy,circumstances,disappointed,weak,trusted,license,nothin,trash,understanding,slip,sounded,awake,friendship,stomach,weapon,threatened,mystery,vegas,understood,basically,switch,frankly,cheap,lifetime,deny,clock,garbage,why'd,tear,ears,indeed,changing,singing,tiny,decent,avoid,messed,filled,touched,disappear,exact,pills,kicked,harm,fortune,pretending,insurance,fancy,drove,cared,belongs,nights,lorelai,lift,timing,guarantee,chest,woke,burned,watched,heading,selfish,drinks,doll,committed,elevator,freeze,noise,wasting,ceremony,uncomfortable,staring,files,bike,stress,permission,thrown,possibility,borrow,fabulous,doors,screaming,bone,xander,what're,meal,apology,anger,honeymoon,bail,parking,fixed,wash,stolen,sensitive,stealing,photo,chose,lets,comfort,worrying,pocket,mateo,bleeding,shoulder,ignore,talent,tied,garage,dies,demons,dumped,witches,rude,crack,bothering,radar,soft,meantime,gimme,kinds,fate,concentrate,throat,prom,messages,intend,ashamed,somethin,manage,guilt,interrupt,guts,tongue,shoe,basement,sentence,purse,glasses,cabin,universe,repeat,mirror,wound,travers,tall,engagement,therapy,emotional,jeez,decisions,soup,thrilled,stake,chef,moves,extremely,moments,expensive,counting,shots,kidnapped,cleaning,shift,plate,impressed,smells,trapped,aidan,knocked,charming,attractive,argue,puts,whip,embarrassed,package,hitting,bust,stairs,alarm,pure,nail,nerve,incredibly,walks,dirt,stamp,terribly,friendly,damned,jobs,suffering,disgusting,stopping,deliver,riding,helps,disaster,bars,crossed,trap,talks,eggs,chick,threatening,spoken,introduce,confession,embarrassing,bags,impression,gate,reputation,presents,chat,suffer,argument,talkin,crowd,homework,coincidence,cancel,pride,solve,hopefully,pounds,pine,mate,illegal,generous,outfit,maid,bath,punch,freaked,begging,recall,enjoying,prepare,wheel,defend,signs,painful,yourselves,maris,that'd,suspicious,cooking,button,warned,sixty,pity,yelling,awhile,confidence,offering,pleased,panic,hers,gettin,refuse,grandpa,testify,choices,cruel,mental,gentleman,coma,cutting,proteus,guests,expert,benefit,faces,jumped,toilet,sneak,halloween,privacy,smoking,reminds,twins,swing,solid,options,commitment,crush,ambulance,wallet,gang,eleven,option,laundry,assure,stays,skip,fail,discussion,clinic,betrayed,sticking,bored,mansion,soda,sheriff,suite,handled,busted,load,happier,studying,romance,procedure,commit,assignment,suicide,minds,swim,yell,llanview,chasing,proper,believes,humor,hopes,lawyers,giant,latest,escaped,parent,tricks,insist,dropping,cheer,medication,flesh,routine,sandwich,handed,false,beating,warrant,awfully,odds,treating,thin,suggesting,fever,sweat,silent,clever,sweater,mall,sharing,assuming,judgment,goodnight,divorced,surely,steps,confess,math,listened,comin,answered,vulnerable,bless,dreaming,chip,zero,pissed,nate,kills,tears,knees,chill,brains,unusual,packed,dreamed,cure,lookin,grave,cheating,breaks,locker,gifts,awkward,thursday,joking,reasonable,dozen,curse,quartermaine,millions,dessert,rolling,detail,alien,delicious,closing,vampires,wore,tail,secure,salad,murderer,spit,offense,dust,conscience,bread,answering,lame,invitation,grief,smiling,pregnancy,prisoner,delivery,guards,virus,shrink,freezing,wreck,massimo,wire,technically,blown,anxious,cave,holidays,cleared,wishes,caring,candles,bound,charm,pulse,jumping,jokes,boom,occasion,silence,nonsense,frightened,slipped,dimera,blowing,relationships,kidnapping,spin,tool,roxy,packing,blaming,wrap,obsessed,fruit,torture,personality,there'll,fairy,necessarily,seventy,print,motel,underwear,grams,exhausted,believing,freaking,carefully,trace,touching,messing,recovery,intention,consequences,belt,sacrifice,courage,enjoyed,attracted,remove,testimony,intense,heal,defending,unfair,relieved,loyal,slowly,buzz,alcohol,surprises,psychiatrist,plain,attic,who'd,uniform,terrified,cleaned,zach,threaten,fella,enemies,satisfied,imagination,hooked,headache,forgetting,counselor,andie,acted,badge,naturally,frozen,sakes,appropriate,trunk,dunno,costume,sixteen,impressive,kicking,junk,grabbed,understands,describe,clients,owns,affect,witnesses,starving,instincts,happily,discussing,deserved,strangers,surveillance,admire,questioning,dragged,barn,deeply,wrapped,wasted,tense,hoped,fellas,roommate,mortal,fascinating,stops,arrangements,agenda,literally,propose,honesty,underneath,sauce,promises,lecture,eighty,torn,shocked,backup,differently,ninety,deck,biological,pheebs,ease,creep,waitress,telephone,ripped,raising,scratch,rings,prints,thee,arguing,ephram,asks,oops,diner,annoying,taggert,sergeant,blast,towel,clown,habit,creature,bermuda,snap,react,paranoid,handling,eaten,therapist,comment,sink,reporter,nurses,beats,priority,interrupting,warehouse,loyalty,inspector,pleasant,excuses,threats,guessing,tend,praying,motive,unconscious,mysterious,unhappy,tone,switched,rappaport,sookie,neighbor,loaded,swore,piss,balance,toss,misery,thief,squeeze,lobby,goa'uld,geez,exercise,forth,booked,sandburg,poker,eighteen,d'you,bury,everyday,digging,creepy,wondered,liver,hmmm,magical,fits,discussed,moral,helpful,searching,flew,depressed,aisle,cris,amen,vows,neighbors,darn,cents,arrange,annulment,useless,adventure,resist,fourteen,celebrating,inch,debt,violent,sand,teal'c,celebration,reminded,phones,paperwork,emotions,stubborn,pound,tension,stroke,steady,overnight,chips,beef,suits,boxes,cassadine,collect,tragedy,spoil,realm,wipe,surgeon,stretch,stepped,nephew,neat,limo,confident,perspective,climb,punishment,finest,springfield,hint,furniture,blanket,twist,proceed,fries,worries,niece,gloves,soap,signature,disappoint,crawl,convicted,flip,counsel,doubts,crimes,accusing,shaking,remembering,hallway,halfway,bothered,madam,gather,cameras,blackmail,symptoms,rope,ordinary,imagined,cigarette,supportive,explosion,trauma,ouch,furious,cheat,avoiding,whew,thick,oooh,boarding,approve,urgent,shhh,misunderstanding,drawer,phony,interfere,catching,bargain,tragic,respond,punish,penthouse,thou,rach,ohhh,insult,bugs,beside,begged,absolute,strictly,socks,senses,sneaking,reward,polite,checks,tale,physically,instructions,fooled,blows,tabby,bitter,adorable,y'all,tested,suggestion,jewelry,alike,jacks,distracted,shelter,lessons,constable,circus,audition,tune,shoulders,mask,helpless,feeding,explains,sucked,robbery,objection,behave,valuable,shadows,courtroom,confusing,talented,smarter,mistaken,customer,bizarre,scaring,motherfucker,alert,vecchio,reverend,foolish,compliment,bastards,worker,wheelchair,protective,gentle,reverse,picnic,knee,cage,wives,wednesday,voices,toes,stink,scares,pour,cheated,slide,ruining,filling,exit,cottage,upside,proves,parked,diary,complaining,confessed,pipe,merely,massage,chop,spill,prayer,betray,waiter,scam,rats,fraud,brush,tables,sympathy,pill,filthy,seventeen,employee,bracelet,pays,fairly,deeper,arrive,tracking,spite,shed,recommend,oughta,nanny,menu,diet,corn,roses,patch,dime,devastated,subtle,bullets,beans,pile,confirm,strings,parade,borrowed,toys,straighten,steak,premonition,planted,honored,exam,convenient,traveling,laying,insisted,dish,aitoro,kindly,grandson,donor,temper,teenager,proven,mothers,denial,backwards,tent,swell,noon,happiest,drives,thinkin,spirits,potion,holes,fence,whatsoever,rehearsal,overheard,lemme,hostage,bench,tryin,taxi,shove,moron,impress,needle,intelligent,instant,disagree,stinks,rianna,recover,groom,gesture,constantly,bartender,suspects,sealed,legally,hears,dresses,sheet,psychic,teenage,knocking,judging,accidentally,waking,rumor,manners,homeless,hollow,desperately,tapes,referring,item,genoa,gear,majesty,cried,tons,spells,instinct,quote,motorcycle,convincing,fashioned,aids,accomplished,grip,bump,upsetting,needing,invisible,forgiveness,feds,compare,bothers,tooth,inviting,earn,compromise,cocktail,tramp,jabot,intimate,dignity,dealt,souls,informed,gods,dressing,cigarettes,alistair,leak,fond,corky,seduce,liquor,fingerprints,enchantment,butters,stuffed,stavros,emotionally,transplant,tips,oxygen,nicely,lunatic,drill,complain,announcement,unfortunate,slap,prayers,plug,opens,oath,o'neill,mutual,yacht,remembers,fried,extraordinary,bait,warton,sworn,stare,safely,reunion,burst,might've,dive,aboard,expose,buddies,trusting,booze,sweep,sore,scudder,properly,parole,ditch,canceled,speaks,glow,wears,thirsty,skull,ringing,dorm,dining,bend,unexpected,pancakes,harsh,flattered,ahhh,troubles,fights,favourite,eats,rage,undercover,spoiled,sloane,shine,destroying,deliberately,conspiracy,thoughtful,sandwiches,plates,nails,miracles,fridge,drank,contrary,beloved,allergic,washed,stalking,solved,sack,misses,forgiven,bent,maciver,involve,dragging,cooked,pointing,foul,dull,beneath,heels,faking,deaf,stunt,jealousy,hopeless,fears,cuts,scenario,necklace,crashed,accuse,restraining,homicide,helicopter,firing,safer,auction,videotape,tore,reservations,pops,appetite,wounds,vanquish,ironic,fathers,excitement,anyhow,tearing,sends,rape,laughed,belly,dealer,cooperate,accomplish,wakes,spotted,sorts,reservation,ashes,tastes,supposedly,loft,intentions,integrity,wished,towels,suspected,investigating,inappropriate,lipstick,lawn,compassion,cafeteria,scarf,precisely,obsession,loses,lighten,infection,granddaughter,explode,balcony,this'll,spying,publicity,depend,cracked,conscious,ally,absurd,vicious,invented,forbid,directions,defendant,bare,announce,screwing,salesman,robbed,leap,lakeview,insanity,reveal,possibilities,kidnap,gown,chairs,wishing,setup,punished,criminals,regrets,raped,quarters,lamp,dentist,anyways,anonymous,semester,risks,owes,lungs,explaining,delicate,tricked,eager,doomed,adoption,stab,sickness,scum,floating,envelope,vault,sorel,pretended,potatoes,plea,photograph,payback,misunderstood,kiddo,healing,cascade,capeside,stabbed,remarkable,brat,privilege,passionate,nerves,lawsuit,kidney,disturbed,cozy,tire,shirts,oven,ordering,delay,risky,monsters,honorable,grounded,closest,breakdown,bald,abandon,scar,collar,worthless,sucking,enormous,disturbing,disturb,distract,deals,conclusions,vodka,dishes,crawling,briefcase,wiped,whistle,sits,roast,rented,pigs,flirting,deposit,bottles,topic,riot,overreacting,logical,hostile,embarrass,casual,beacon,amusing,altar,claus,survival,skirt,shave,porch,ghosts,favors,drops,dizzy,chili,advise,strikes,rehab,photographer,peaceful,leery,heavens,fortunately,fooling,expectations,cigar,weakness,ranch,practicing,examine,cranes,bribe,sail,prescription,hush,fragile,forensics,expense,drugged,cows,bells,visitor,suitcase,sorta,scan,manticore,insecure,imagining,hardest,clerk,wrist,what'll,starters,silk,pump,pale,nicer,haul,flies,boot,thumb,there'd,how're,elders,quietly,pulls,idiots,erase,denying,ankle,amnesia,accepting,heartbeat,devane,confront,minus,legitimate,fixing,arrogant,tuna,supper,slightest,sins,sayin,recipe,pier,paternity,humiliating,genuine,snack,rational,minded,guessed,weddings,tumor,humiliated,aspirin,spray,picks,eyed,drowning,contacts,ritual,perfume,hiring,hating,docks,creatures,visions,thanking,thankful,sock,nineteen,fork,throws,teenagers,stressed,slice,rolls,plead,ladder,kicks,detectives,assured,tellin,shallow,responsibilities,repay,howdy,girlfriends,deadly,comforting,ceiling,verdict,insensitive,spilled,respected,messy,interrupted,halliwell,blond,bleed,wardrobe,takin,murders,backs,underestimate,justify,harmless,frustrated,fold,enzo,communicate,bugging,arson,whack,salary,rumors,obligation,liking,dearest,congratulate,vengeance,rack,puzzle,fires,courtesy,caller,blamed,tops,quiz,prep,curiosity,circles,barbecue,sunnydale,spinning,psychotic,cough,accusations,resent,laughs,freshman,envy,drown,bartlet,asses,sofa,poster,highness,dock,apologies,theirs,stat,stall,realizes,psych,mmmm,fools,understandable,treats,succeed,stir,relaxed,makin,gratitude,faithful,accent,witter,wandering,locate,inevitable,gretel,deed,crushed,controlling,smelled,robe,gossip,gambling,cosmetics,accidents,surprising,stiff,sincere,rushed,refrigerator,preparing,nightmares,mijo,ignoring,hunch,fireworks,drowned,brass,whispering,sophisticated,luggage,hike,explore,emotion,crashing,contacted,complications,shining,rolled,righteous,reconsider,goody,geek,frightening,ethics,creeps,courthouse,camping,affection,smythe,haircut,essay,baked,apologized,vibe,respects,receipt,mami,hats,destructive,adore,adopt,tracked,shorts,reminding,dough,creations,cabot,barrel,snuck,slight,reporters,pressing,magnificent,madame,lazy,glorious,fiancee,bits,visitation,sane,kindness,shoulda,rescued,mattress,lounge,lifted,importantly,glove,enterprises,disappointment,condo,beings,admitting,yelled,waving,spoon,screech,satisfaction,reads,nailed,worm,tick,resting,marvelous,fuss,cortlandt,chased,pockets,luckily,lilith,filing,conversations,consideration,consciousness,worlds,innocence,forehead,aggressive,trailer,slam,quitting,inform,delighted,daylight,danced,confidential,aunts,washing,tossed,spectra,marrow,lined,implying,hatred,grill,corpse,clues,sober,offended,morgue,infected,humanity,distraction,cart,wired,violation,promising,harassment,glue,d'angelo,cursed,brutal,warlocks,wagon,unpleasant,proving,priorities,mustn't,lease,flame,disappearance,depressing,thrill,sitter,ribs,flush,earrings,deadline,corporal,collapsed,update,snapped,smack,melt,figuring,delusional,coulda,burnt,tender,sperm,realise,pork,popped,interrogation,esteem,choosing,undo,pres,prayed,plague,manipulate,insulting,detention,delightful,coffeehouse,betrayal,apologizing,adjust,wrecked,wont,whipped,rides,reminder,monsieur,faint,bake,distress,correctly,complaint,blocked,tortured,risking,pointless,handing,dumping,cups,alibi,struggling,shiny,risked,mummy,mint,hose,hobby,fortunate,fleischman,fitting,curtain,counseling,rode,puppet,modeling,memo,irresponsible,humiliation,hiya,freakin,felony,choke,blackmailing,appreciated,tabloid,suspicion,recovering,pledge,panicked,nursery,louder,jeans,investigator,homecoming,frustrating,buys,busting,buff,sleeve,irony,dope,declare,autopsy,workin,torch,prick,limb,hysterical,goddamnit,fetch,dimension,crowded,clip,climbing,bonding,woah,trusts,negotiate,lethal,iced,fantasies,deeds,bore,babysitter,questioned,outrageous,kiriakis,insulted,grudge,driveway,deserted,definite,beep,wires,suggestions,searched,owed,lend,drunken,demanding,costanza,conviction,bumped,weigh,touches,tempted,shout,resolve,relate,poisoned,meals,invitations,haunted,bogus,autograph,affects,tolerate,stepping,spontaneous,sleeps,probation,manny,fist,spectacular,hostages,heroin,havin,habits,encouraging,consult,burgers,boyfriends,bailed,baggage,watches,troubled,torturing,teasing,sweetest,qualities,postpone,overwhelmed,malkovich,impulse,classy,charging,amazed,policeman,hypocrite,humiliate,hideous,d'ya,costumes,bluffing,betting,bein,bedtime,alcoholic,vegetable,tray,suspicions,spreading,splendid,shrimp,shouting,pressed,nooo,grieving,gladly,fling,eliminate,cereal,aaah,sonofabitch,paralyzed,lotta,locks,guaranteed,dummy,despise,dental,briefing,bluff,batteries,whatta,sounding,servants,presume,handwriting,fainted,dried,allright,acknowledge,whacked,toxic,reliable,quicker,overwhelming,lining,harassing,fatal,endless,dolls,convict,whatcha,unlikely,shutting,positively,overcome,goddam,essence,dose,diagnosis,cured,bully,ahold,yearbook,tempting,shelf,prosecution,pouring,possessed,greedy,wonders,thorough,spine,rath,psychiatric,meaningless,latte,jammed,ignored,fiance,evidently,contempt,compromised,cans,weekends,urge,theft,suing,shipment,scissors,responding,proposition,noises,matching,hormones,hail,grandchildren,gently,smashed,sexually,sentimental,nicest,manipulated,intern,handcuffs,framed,errands,entertaining,crib,carriage,barge,spends,slipping,seated,rubbing,rely,reject,recommendation,reckon,headaches,float,embrace,corners,whining,sweating,skipped,mountie,motives,listens,cristobel,cleaner,cheerleader,balsom,unnecessary,stunning,scent,quartermaines,pose,montega,loosen,info,hottest,haunt,gracious,forgiving,errand,cakes,blames,abortion,sketch,shifts,plotting,perimeter,pals,mere,mattered,lonigan,interference,eyewitness,enthusiasm,diapers,strongest,shaken,punched,portal,catches,backyard,terrorists,sabotage,organs,needy,cuff,civilization,woof,who'll,prank,obnoxious,mates,hereby,gabby,faked,cellar,whitelighter,void,strangle,sour,muffins,interfering,demonic,clearing,boutique,barrington,terrace,smoked,righty,quack,petey,pact,knot,ketchup,disappearing,cordy,uptight,ticking,terrifying,tease,swamp,secretly,rejection,reflection,realizing,rays,mentally,marone,doubted,deception,congressman,cheesy,toto,stalling,scoop,ribbon,immune,expects,destined,bets,bathing,appreciation,accomplice,wander,shoved,sewer,scroll,retire,lasts,fugitive,freezer,discount,cranky,crank,clearance,bodyguard,anxiety,accountant,whoops,volunteered,talents,stinking,remotely,garlic,decency,cord,beds,altogether,uniforms,tremendous,popping,outa,observe,lung,hangs,feelin,dudes,donation,disguise,curb,bites,antique,toothbrush,realistic,predict,landlord,hourglass,hesitate,consolation,babbling,tipped,stranded,smartest,repeating,puke,psst,paycheck,overreacted,macho,juvenile,grocery,freshen,disposal,cuffs,caffeine,vanished,unfinished,ripping,pinch,flattering,expenses,dinners,colleague,ciao,belthazor,attorneys,woulda,whereabouts,waitin,truce,tripped,tasted,steer,poisoning,manipulative,immature,husbands,heel,granddad,delivering,condoms,addict,trashed,raining,pasta,needles,leaning,detector,coolest,batch,appointments,almighty,vegetables,spark,perfection,pains,momma,mole,meow,hairs,getaway,cracking,compliments,behold,verge,tougher,timer,tapped,taped,specialty,snooping,shoots,rendezvous,pentagon,leverage,jeopardize,janitor,grandparents,forbidden,clueless,bidding,ungrateful,unacceptable,tutor,serum,scuse,pajamas,mouths,lure,irrational,doom,cries,beautifully,arresting,approaching,traitor,sympathetic,smug,smash,rental,prostitute,premonitions,jumps,inventory,darlin,committing,banging,asap,worms,violated,vent,traumatic,traced,sweaty,shaft,overboard,insight,healed,grasp,experiencing,crappy,crab,chunk,awww,stain,shack,reacted,pronounce,poured,moms,marriages,jabez,handful,flipped,fireplace,embarrassment,disappears,concussion,bruises,brakes,twisting,swept,summon,splitting,sloppy,settling,reschedule,notch,hooray,grabbing,exquisite,disrespect,thornhart,straw,slapped,shipped,shattered,ruthless,refill,payroll,numb,mourning,manly,hunk,entertain,drift,dreadful,doorstep,confirmation,chops,appreciates,vague,tires,stressful,stashed,stash,sensed,preoccupied,predictable,noticing,madly,gunshot,dozens,dork,confuse,cleaners,charade,chalk,cappuccino,bouquet,amulet,addiction,who've,warming,unlock,satisfy,sacrificed,relaxing,lone,blocking,blend,blankets,addicted,yuck,hunger,hamburger,greeting,greet,gravy,gram,dreamt,dice,caution,backpack,agreeing,whale,taller,supervisor,sacrifices,phew,ounce,irrelevant,gran,felon,favorites,farther,fade,erased,easiest,convenience,compassionate,cane,backstage,agony,adores,veins,tweek,thieves,surgical,strangely,stetson,recital,proposing,productive,meaningful,immunity,hassle,goddamned,frighten,dearly,cease,ambition,wage,unstable,salvage,richer,refusing,raging,pumping,pressuring,mortals,lowlife,intimidated,intentionally,inspire,forgave,devotion,despicable,deciding,dash,comfy,breach,bark,aaaah,switching,swallowed,stove,screamed,scars,russians,pounding,poof,pipes,pawn,legit,invest,farewell,curtains,civilized,caviar,boost,token,superstition,supernatural,sadness,recorder,psyched,motivated,microwave,hallelujah,fraternity,dryer,cocoa,chewing,acceptable,unbelievably,smiled,smelling,simpler,respectable,remarks,khasinau,indication,gutter,grabs,fulfill,flashlight,ellenor,blooded,blink,blessings,beware,uhhh,turf,swings,slips,shovel,shocking,puff,mirrors,locking,heartless,fras,childish,cardiac,utterly,tuscany,ticked,stunned,statesville,sadly,purely,kiddin,jerks,hitch,flirt,fare,equals,dismiss,christening,casket,c'mere,breakup,biting,antibiotics,accusation,abducted,witchcraft,thread,runnin,punching,paramedics,newest,murdering,masks,lawndale,initials,grampa,choking,charms,careless,bushes,buns,bummed,shred,saves,saddle,rethink,regards,precinct,persuade,meds,manipulating,llanfair,leash,hearted,guarantees,fucks,disgrace,deposition,bookstore,boil,vitals,veil,trespassing,sidewalk,sensible,punishing,overtime,optimistic,obsessing,notify,mornin,jeopardy,jaffa,injection,hilarious,desires,confide,cautious,yada,where're,vindictive,vial,teeny,stroll,sittin,scrub,rebuild,posters,ordeal,nuns,intimacy,inheritance,exploded,donate,distracting,despair,crackers,wildwind,virtue,thoroughly,tails,spicy,sketches,sights,sheer,shaving,seize,scarecrow,refreshing,prosecute,platter,napkin,misplaced,merchandise,loony,jinx,heroic,frankenstein,ambitious,syrup,solitary,resemblance,reacting,premature,lavery,flashes,cheque,awright,acquainted,wrapping,untie,salute,realised,priceless,partying,lightly,lifting,kasnoff,insisting,glowing,generator,explosives,cutie,confronted,buts,blouse,ballistic,antidote,analyze,allowance,adjourned,unto,understatement,tucked,touchy,subconscious,screws,sarge,roommates,rambaldi,offend,nerd,knives,irresistible,incapable,hostility,goddammit,fuse,frat,curfew,blackmailed,walkin,starve,sleigh,sarcastic,recess,rebound,pinned,parlor,outfits,livin,heartache,haired,fundraiser,doorman,discreet,dilucca,cracks,considerate,climbed,catering,apophis,zoey,urine,strung,stitches,sordid,sark,protector,phoned,pets,hostess,flaw,flavor,deveraux,consumed,confidentiality,bourbon,straightened,specials,spaghetti,prettier,powerless,playin,playground,paranoia,instantly,havoc,exaggerating,eavesdropping,doughnuts,diversion,deepest,cutest,comb,bela,behaving,anyplace,accessory,workout,translate,stuffing,speeding,slime,royalty,polls,marital,lurking,lottery,imaginary,greetings,fairwinds,elegant,elbow,credibility,credentials,claws,chopped,bridal,bedside,babysitting,witty,unforgivable,underworld,tempt,tabs,sophomore,selfless,secrecy,restless,okey,movin,metaphor,messes,meltdown,lecter,incoming,gasoline,diefenbaker,buckle,admired,adjustment,warmth,throats,seduced,queer,parenting,noses,luckiest,graveyard,gifted,footsteps,dimeras,cynical,wedded,verbal,unpredictable,tuned,stoop,slides,sinking,rigged,plumbing,lingerie,hankey,greed,everwood,elope,dresser,chauffeur,bulletin,bugged,bouncing,temptation,strangest,slammed,sarcasm,pending,packages,orderly,obsessive,murderers,meteor,inconvenience,glimpse,froze,execute,courageous,consulate,closes,bosses,bees,amends,wuss,wolfram,wacky,unemployed,testifying,syringe,stew,startled,sorrow,sleazy,shaky,screams,rsquo,remark,poke,nutty,mentioning,mend,inspiring,impulsive,housekeeper,foam,fingernails,conditioning,baking,whine,thug,starved,sniffing,sedative,programmed,picket,paged,hound,homosexual,homo,hips,forgets,flipping,flea,flatter,dwell,dumpster,choo,assignments,ants,vile,unreasonable,tossing,thanked,steals,souvenir,scratched,psychopath,outs,obstruction,obey,lump,insists,harass,gloat,filth,edgy,didn,coroner,confessing,bruise,betraying,bailing,appealing,adebisi,wrath,wandered,waist,vain,traps,stepfather,poking,obligated,heavenly,dilemma,crazed,contagious,coaster,cheering,bundle,vomit,thingy,speeches,robbing,raft,pumped,pillows,peep,packs,neglected,m'kay,loneliness,intrude,helluva,gardener,forresters,drooling,betcha,vase,supermarket,squat,spitting,rhyme,relieve,receipts,racket,pictured,pause,overdue,motivation,morgendorffer,kidnapper,insect,horns,feminine,eyeballs,dumps,disappointing,crock,convertible,claw,clamp,canned,cambias,bathtub,avanya,artery,weep,warmer,suspense,summoned,spiders,reiber,raving,pushy,postponed,ohhhh,noooo,mold,laughter,incompetent,hugging,groceries,drip,communicating,auntie,adios,wraps,wiser,willingly,weirdest,timmih,thinner,swelling,swat,steroids,sensitivity,scrape,rehearse,prophecy,ledge,justified,insults,hateful,handles,doorway,chatting,buyer,buckaroo,bedrooms,askin,ammo,tutoring,subpoena,scratching,privileges,pager,mart,intriguing,idiotic,grape,enlighten,corrupt,brunch,bridesmaid,barking,applause,acquaintance,wretched,superficial,soak,smoothly,sensing,restraint,posing,pleading,payoff,oprah,nemo,morals,loaf,jumpy,ignorant,herbal,hangin,germs,generosity,flashing,doughnut,clumsy,chocolates,captive,behaved,apologise,vanity,stumbled,preview,poisonous,perjury,parental,onboard,mugged,minding,linen,knots,interviewing,humour,grind,greasy,goons,drastic,coop,comparing,cocky,clearer,bruised,brag,bind,worthwhile,whoop,vanquishing,tabloids,sprung,spotlight,sentencing,racist,provoke,pining,overly,locket,imply,impatient,hovering,hotter,fest,endure,dots,doren,debts,crawled,chained,brit,breaths,weirdo,warmed,wand,troubling,tok'ra,strapped,soaked,skipping,scrambled,rattle,profound,musta,mocking,misunderstand,limousine,kacl,hustle,forensic,enthusiastic,duct,drawers,devastating,conquer,clarify,chores,cheerleaders,cheaper,callin,blushing,barging,abused,yoga,wrecking,wits,waffles,virginity,vibes,uninvited,unfaithful,teller,strangled,scheming,ropes,rescuing,rave,postcard,o'reily,morphine,lotion,lads,kidneys,judgement,itch,indefinitely,grenade,glamorous,genetically,freud,discretion,delusions,crate,competent,bakery,argh,ahhhh,wedge,wager,unfit,tripping,torment,superhero,stirring,spinal,sorority,seminar,scenery,rabble,pneumonia,perks,override,ooooh,mija,manslaughter,mailed,lime,lettuce,intimidate,guarded,grieve,grad,frustration,doorbell,chinatown,authentic,arraignment,annulled,allergies,wanta,verify,vegetarian,tighter,telegram,stalk,spared,shoo,satisfying,saddam,requesting,pens,overprotective,obstacles,notified,nasedo,grandchild,genuinely,flushed,fluids,floss,escaping,ditched,cramp,corny,bunk,bitten,billions,bankrupt,yikes,wrists,ultrasound,ultimatum,thirst,sniff,shakes,salsa,retrieve,reassuring,pumps,neurotic,negotiating,needn't,monitors,millionaire,lydecker,limp,incriminating,hatchet,gracias,gordie,fills,feeds,doubting,decaf,biopsy,whiz,voluntarily,ventilator,unpack,unload,toad,spooked,snitch,schillinger,reassure,persuasive,mystical,mysteries,matrimony,mails,jock,headline,explanations,dispatch,curly,cupid,condolences,comrade,cassadines,bulb,bragging,awaits,assaulted,ambush,adolescent,abort,yank,whit,vaguely,undermine,tying,swamped,stabbing,slippers,slash,sincerely,sigh,setback,secondly,rotting,precaution,pcpd,melting,liaison,hots,hooking,headlines,haha,ganz,fury,felicity,fangs,encouragement,earring,dreidel,dory,donut,dictate,decorating,cocktails,bumps,blueberry,believable,backfired,backfire,apron,adjusting,vous,vouch,vitamins,ummm,tattoos,slimy,sibling,shhhh,renting,peculiar,parasite,paddington,marries,mailbox,magically,lovebirds,knocks,informant,exits,drazen,distractions,disconnected,dinosaurs,dashwood,crooked,conveniently,wink,warped,underestimated,tacky,shoving,seizure,reset,pushes,opener,mornings,mash,invent,indulge,horribly,hallucinating,festive,eyebrows,enjoys,desperation,dealers,darkest,daph,boragora,belts,bagel,authorization,auditions,agitated,wishful,wimp,vanish,unbearable,tonic,suffice,suction,slaying,safest,rocking,relive,puttin,prettiest,noisy,newlyweds,nauseous,misguided,mildly,midst,liable,judgmental,indy,hunted,givin,fascinated,elephants,dislike,deluded,decorate,crummy,contractions,carve,bottled,bonded,bahamas,unavailable,twenties,trustworthy,surgeons,stupidity,skies,remorse,preferably,pies,nausea,napkins,mule,mourn,melted,mashed,inherit,greatness,golly,excused,dumbo,drifting,delirious,damaging,cubicle,compelled,comm,chooses,checkup,boredom,bandages,alarms,windshield,who're,whaddya,transparent,surprisingly,sunglasses,slit,roar,reade,prognosis,probe,pitiful,persistent,peas,nosy,nagging,morons,masterpiece,martinis,limbo,liars,irritating,inclined,hump,hoynes,fiasco,eatin,cubans,concentrating,colorful,clam,cider,brochure,barto,bargaining,wiggle,welcoming,weighing,vanquished,stains,sooo,snacks,smear,sire,resentment,psychologist,pint,overhear,morality,landingham,kisser,hoot,holling,handshake,grilled,formality,elevators,depths,confirms,boathouse,accidental,westbridge,wacko,ulterior,thugs,thighs,tangled,stirred,snag,sling,sleaze,rumour,ripe,remarried,puddle,pins,perceptive,miraculous,longing,lockup,librarian,impressions,immoral,hypothetically,guarding,gourmet,gabe,faxed,extortion,downright,digest,cranberry,bygones,buzzing,burying,bikes,weary,taping,takeout,sweeping,stepmother,stale,senor,seaborn,pros,pepperoni,newborn,ludicrous,injected,geeks,forged,faults,drue,dire,dief,desi,deceiving,caterer,calmed,budge,ankles,vending,typing,tribbiani,there're,squared,snowing,shades,sexist,rewrite,regretted,raises,picky,orphan,mural,misjudged,miscarriage,memorize,leaking,jitters,invade,interruption,illegally,handicapped,glitch,gittes,finer,distraught,dispose,dishonest,digs,dads,cruelty,circling,canceling,butterflies,belongings,barbrady,amusement,alias,zombies,where've,unborn,swearing,stables,squeezed,sensational,resisting,radioactive,questionable,privileged,portofino,owning,overlook,orson,oddly,interrogate,imperative,impeccable,hurtful,hors,heap,graders,glance,disgust,devious,destruct,crazier,countdown,chump,cheeseburger,burglar,berries,ballroom,assumptions,annoyed,allergy,admirer,admirable,activate,underpants,twit,tack,strokes,stool,sham,scrap,retarded,resourceful,remarkably,refresh,pressured,precautions,pointy,nightclub,mustache,maui,lace,hunh,hubby,flare,dont,dokey,dangerously,crushing,clinging,choked,chem,cheerleading,checkbook,cashmere,calmly,blush,believer,amazingly,alas,what've,toilets,tacos,stairwell,spirited,sewing,rubbed,punches,protects,nuisance,motherfuckers,mingle,kynaston,knack,kinkle,impose,gullible,godmother,funniest,friggin,folding,fashions,eater,dysfunctional,drool,dripping,ditto,cruising,criticize,conceive,clone,cedars,caliber,brighter,blinded,birthdays,banquet,anticipate,annoy,whim,whichever,volatile,veto,vested,shroud,rests,reindeer,quarantine,pleases,painless,orphans,orphanage,offence,obliged,negotiation,narcotics,mistletoe,meddling,manifest,lookit,lilah,intrigued,injustice,homicidal,gigantic,exposing,elves,disturbance,disastrous,depended,demented,correction,cooped,cheerful,buyers,brownies,beverage,basics,arvin,weighs,upsets,unethical,swollen,sweaters,stupidest,sensation,scalpel,props,prescribed,pompous,objections,mushrooms,mulwray,manipulation,lured,internship,insignificant,inmate,incentive,fulfilled,disagreement,crypt,cornered,copied,brightest,beethoven,attendant,amaze,yogurt,wyndemere,vocabulary,tulsa,tactic,stuffy,respirator,pretends,polygraph,pennies,ordinarily,olives,necks,morally,martyr,leftovers,joints,hopping,homey,hints,heartbroken,forge,florist,firsthand,fiend,dandy,crippled,corrected,conniving,conditioner,clears,chemo,bubbly,bladder,beeper,baptism,wiring,wench,weaknesses,volunteering,violating,unlocked,tummy,surrogate,subid,stray,startle,specifics,slowing,scoot,robbers,rightful,richest,qfxmjrie,puffs,pierced,pencils,paralysis,makeover,luncheon,linksynergy,jerky,jacuzzi,hitched,hangover,fracture,flock,firemen,disgusted,darned,clams,borrowing,banged,wildest,weirder,unauthorized,stunts,sleeves,sixties,shush,shalt,retro,quits,pegged,painfully,paging,omelet,memorized,lawfully,jackets,intercept,ingredient,grownup,glued,fulfilling,enchanted,delusion,daring,compelling,carton,bridesmaids,bribed,boiling,bathrooms,bandage,awaiting,assign,arrogance,antiques,ainsley,turkeys,trashing,stockings,stalked,stabilized,skates,sedated,robes,respecting,psyche,presumptuous,prejudice,paragraph,mocha,mints,mating,mantan,lorne,loads,listener,itinerary,hepatitis,heave,guesses,fading,examining,dumbest,dishwasher,deceive,cunning,cripple,convictions,confided,compulsive,compromising,burglary,bumpy,brainwashed,benes,arnie,affirmative,adrenaline,adamant,watchin,waitresses,transgenic,toughest,tainted,surround,stormed,spree,spilling,spectacle,soaking,shreds,sewers,severed,scarce,scamming,scalp,rewind,rehearsing,pretentious,potions,overrated,obstacle,nerds,meems,mcmurphy,maternity,maneuver,loathe,fertility,eloping,ecstatic,ecstasy,divorcing,dignan,costing,clubhouse,clocks,candid,bursting,breather,braces,bending,arsonist,adored,absorb,valiant,uphold,unarmed,topolsky,thrilling,thigh,terminate,sustain,spaceship,snore,sneeze,smuggling,salty,quaint,patronize,patio,morbid,mamma,kettle,joyous,invincible,interpret,insecurities,impulses,illusions,holed,exploit,drivin,defenseless,dedicate,cradle,coupon,countless,conjure,cardboard,booking,backseat,accomplishment,wordsworth,wisely,valet,vaccine,urges,unnatural,unlucky,truths,traumatized,tasting,swears,strawberries,steaks,stats,skank,seducing,secretive,scumbag,screwdriver,schedules,rooting,rightfully,rattled,qualifies,puppets,prospects,pronto,posse,polling,pedestal,palms,muddy,morty,microscope,merci,lecturing,inject,incriminate,hygiene,grapefruit,gazebo,funnier,cuter,bossy,booby,aides,zende,winthrop,warrants,valentines,undressed,underage,truthfully,tampered,suffers,speechless,sparkling,sidelines,shrek,railing,puberty,pesky,outrage,outdoors,motions,moods,lunches,litter,kidnappers,itching,intuition,imitation,humility,hassling,gallons,drugstore,dosage,disrupt,dipping,deranged,debating,cuckoo,cremated,craziness,cooperating,circumstantial,chimney,blinking,biscuits,admiring,weeping,triad,trashy,soothing,slumber,slayers,skirts,siren,shindig,sentiment,rosco,riddance,quaid,purity,proceeding,pretzels,panicking,mckechnie,lovin,leaked,intruding,impersonating,ignorance,hamburgers,footprints,fluke,fleas,festivities,fences,feisty,evacuate,emergencies,deceived,creeping,craziest,corpses,conned,coincidences,bounced,bodyguards,blasted,bitterness,baloney,ashtray,apocalypse,zillion,watergate,wallpaper,telesave,sympathize,sweeter,startin,spades,sodas,snowed,sleepover,signor,seein,retainer,restroom,rested,repercussions,reliving,reconcile,prevail,preaching,overreact,o'neil,noose,moustache,manicure,maids,landlady,hypothetical,hopped,homesick,hives,hesitation,herbs,hectic,heartbreak,haunting,gangs,frown,fingerprint,exhausting,everytime,disregard,cling,chevron,chaperone,blinding,bitty,beads,battling,badgering,anticipation,upstanding,unprofessional,unhealthy,turmoil,truthful,toothpaste,tippin,thoughtless,tagataya,shooters,senseless,rewarding,propane,preposterous,pigeons,pastry,overhearing,obscene,negotiable,loner,jogging,itchy,insinuating,insides,hospitality,hormone,hearst,forthcoming,fists,fifties,etiquette,endings,destroys,despises,deprived,cuddy,crust,cloak,circumstance,chewed,casserole,bidder,bearer,artoo,applaud,appalling,vowed,virgins,vigilante,undone,throttle,testosterone,tailor,symptom,swoop,suitcases,stomp,sticker,stakeout,spoiling,snatched,smoochy,smitten,shameless,restraints,researching,renew,refund,reclaim,raoul,puzzles,purposely,punks,prosecuted,plaid,picturing,pickin,parasites,mysteriously,multiply,mascara,jukebox,interruptions,gunfire,furnace,elbows,duplicate,drapes,deliberate,decoy,cryptic,coupla,condemn,complicate,colossal,clerks,clarity,brushed,banished,argon,alarmed,worships,versa,uncanny,technicality,sundae,stumble,stripping,shuts,schmuck,satin,saliva,robber,relentless,reconnect,recipes,rearrange,rainy,psychiatrists,policemen,plunge,plugged,patched,overload,o'malley,mindless,menus,lullaby,lotte,leavin,killin,karinsky,invalid,hides,grownups,griff,flaws,flashy,flaming,fettes,evicted,dread,degrassi,dealings,dangers,cushion,bowel,barged,abide,abandoning,wonderfully,wait'll,violate,suicidal,stayin,sorted,slamming,sketchy,shoplifting,raiser,quizmaster,prefers,needless,motherhood,momentarily,migraine,lifts,leukemia,leftover,keepin,hinks,hellhole,gowns,goodies,gallon,futures,entertained,eighties,conspiring,cheery,benign,apiece,adjustments,abusive,abduction,wiping,whipping,welles,unspeakable,unidentified,trivial,transcripts,textbook,supervise,superstitious,stricken,stimulating,spielberg,slices,shelves,scratches,sabotaged,retrieval,repressed,rejecting,quickie,ponies,peeking,outraged,o'connell,moping,moaning,mausoleum,licked,kovich,klutz,interrogating,interfered,insulin,infested,incompetence,hyper,horrified,handedly,gekko,fraid,fractured,examiner,eloped,disoriented,dashing,crashdown,courier,cockroach,chipped,brushing,bombed,bolts,baths,baptized,astronaut,assurance,anemia,abuela,abiding,withholding,weave,wearin,weaker,suffocating,straws,straightforward,stench,steamed,starboard,sideways,shrinks,shortcut,scram,roasted,roaming,riviera,respectfully,repulsive,psychiatry,provoked,penitentiary,painkillers,ninotchka,mitzvah,milligrams,midge,marshmallows,looky,lapse,kubelik,intellect,improvise,implant,goa'ulds,giddy,geniuses,fruitcake,footing,fightin,drinkin,doork,detour,cuddle,crashes,combo,colonnade,cheats,cetera,bailiff,auditioning,assed,amused,alienate,aiding,aching,unwanted,topless,tongues,tiniest,superiors,soften,sheldrake,rawley,raisins,presses,plaster,nessa,narrowed,minions,merciful,lawsuits,intimidating,infirmary,inconvenient,imposter,hugged,honoring,holdin,hades,godforsaken,fumes,forgery,foolproof,folder,flattery,fingertips,exterminator,explodes,eccentric,dodging,disguised,crave,constructive,concealed,compartment,chute,chinpokomon,bodily,astronauts,alimony,accustomed,abdominal,wrinkle,wallow,valium,untrue,uncover,trembling,treasures,torched,toenails,timed,termites,telly,taunting,taransky,talker,succubus,smarts,sliding,sighting,semen,seizures,scarred,savvy,sauna,saddest,sacrificing,rubbish,riled,ratted,rationally,provenance,phonse,perky,pedal,overdose,nasal,nanites,mushy,movers,missus,midterm,merits,melodramatic,manure,knitting,invading,interpol,incapacitated,hotline,hauling,gunpoint,grail,ganza,framing,flannel,faded,eavesdrop,desserts,calories,breathtaking,bleak,blacked,batter,aggravated,yanked,wigand,whoah,unwind,undoubtedly,unattractive,twitch,trimester,torrance,timetable,taxpayers,strained,stared,slapping,sincerity,siding,shenanigans,shacking,sappy,samaritan,poorer,politely,paste,oysters,overruled,nightcap,mosquito,millimeter,merrier,manhood,lucked,kilos,ignition,hauled,harmed,goodwill,freshmen,fenmore,fasten,farce,exploding,erratic,drunks,ditching,d'artagnan,cramped,contacting,closets,clientele,chimp,bargained,arranging,anesthesia,amuse,altering,afternoons,accountable,abetting,wolek,waved,uneasy,toddy,tattooed,spauldings,sliced,sirens,schibetta,scatter,rinse,remedy,redemption,pleasures,optimism,oblige,mmmmm,masked,malicious,mailing,kosher,kiddies,judas,isolate,insecurity,incidentally,heals,headlights,growl,grilling,glazed,flunk,floats,fiery,fairness,exercising,excellency,disclosure,cupboard,counterfeit,condescending,conclusive,clicked,cleans,cholesterol,cashed,broccoli,brats,blueprints,blindfold,billing,attach,appalled,alrighty,wynant,unsolved,unreliable,toots,tighten,sweatshirt,steinbrenner,steamy,spouse,sonogram,slots,sleepless,shines,retaliate,rephrase,redeem,rambling,quilt,quarrel,prying,proverbial,priced,prescribe,prepped,pranks,possessive,plaintiff,pediatrics,overlooked,outcast,nightgown,mumbo,mediocre,mademoiselle,lunchtime,lifesaver,leaned,lambs,interns,hounding,hellmouth,hahaha,goner,ghoul,gardening,frenzy,foyer,extras,exaggerate,everlasting,enlightened,dialed,devote,deceitful,d'oeuvres,cosmetic,contaminated,conspired,conning,cavern,carving,butting,boiled,blurry,babysit,ascension,aaaaah,wildly,whoopee,whiny,weiskopf,walkie,vultures,vacations,upfront,unresolved,tampering,stockholders,snaps,sleepwalking,shrunk,sermon,seduction,scams,revolve,phenomenal,patrolling,paranormal,ounces,omigod,nightfall,lashing,innocents,infierno,incision,humming,haunts,gloss,gloating,frannie,fetal,feeny,entrapment,discomfort,detonator,dependable,concede,complication,commotion,commence,chulak,caucasian,casually,brainer,bolie,ballpark,anwar,analyzing,accommodations,youse,wring,wallowing,transgenics,thrive,tedious,stylish,strippers,sterile,squeezing,squeaky,sprained,solemn,snoring,shattering,shabby,seams,scrawny,revoked,residue,reeks,recite,ranting,quoting,predicament,plugs,pinpoint,petrified,pathological,passports,oughtta,nighter,navigate,kippie,intrigue,intentional,insufferable,hunky,how've,horrifying,hearty,hamptons,grazie,funerals,forks,fetched,excruciating,enjoyable,endanger,dumber,drying,diabolical,crossword,corry,comprehend,clipped,classmates,candlelight,brutally,brutality,boarded,bathrobe,authorize,assemble,aerobics,wholesome,whiff,vermin,trophies,trait,tragically,toying,testy,tasteful,stocked,spinach,sipping,sidetracked,scrubbing,scraping,sanctity,robberies,ridin,retribution,refrain,realities,radiant,protesting,projector,plutonium,payin,parting,o'reilly,nooooo,motherfucking,measly,manic,lalita,juggling,jerking,intro,inevitably,hypnosis,huddle,horrendous,hobbies,heartfelt,harlin,hairdresser,gonorrhea,fussing,furtwangler,fleeting,flawless,flashed,fetus,eulogy,distinctly,disrespectful,denies,crossbow,cregg,crabs,cowardly,contraction,contingency,confirming,condone,coffins,cleansing,cheesecake,certainty,cages,c'est,briefed,bravest,bosom,boils,binoculars,bachelorette,appetizer,ambushed,alerted,woozy,withhold,vulgar,utmost,unleashed,unholy,unhappiness,unconditional,typewriter,typed,twists,supermodel,subpoenaed,stringing,skeptical,schoolgirl,romantically,rocked,revoir,reopen,puncture,preach,polished,planetarium,penicillin,peacefully,nurturing,more'n,mmhmm,midgets,marklar,lodged,lifeline,jellyfish,infiltrate,hutch,horseback,heist,gents,frickin,freezes,forfeit,flakes,flair,fathered,eternally,epiphany,disgruntled,discouraged,delinquent,decipher,danvers,cubes,credible,coping,chills,cherished,catastrophe,bombshell,birthright,billionaire,ample,affections,admiration,abbotts,whatnot,watering,vinegar,unthinkable,unseen,unprepared,unorthodox,underhanded,uncool,timeless,thump,thermometer,theoretically,tapping,tagged,swung,stares,spiked,solves,smuggle,scarier,saucer,quitter,prudent,powdered,poked,pointers,peril,penetrate,penance,opium,nudge,nostrils,neurological,mockery,mobster,medically,loudly,insights,implicate,hypocritical,humanly,holiness,healthier,hammered,haldeman,gunman,gloom,freshly,francs,flunked,flawed,emptiness,drugging,dozer,derevko,deprive,deodorant,cryin,crocodile,coloring,colder,cognac,clocked,clippings,charades,chanting,certifiable,caterers,brute,brochures,botched,blinders,bitchin,banter,woken,ulcer,tread,thankfully,swine,swimsuit,swans,stressing,steaming,stamped,stabilize,squirm,snooze,shuffle,shredded,seafood,scratchy,savor,sadistic,rhetorical,revlon,realist,prosecuting,prophecies,polyester,petals,persuasion,paddles,o'leary,nuthin,neighbour,negroes,muster,meningitis,matron,lockers,letterman,legged,indictment,hypnotized,housekeeping,hopelessly,hallucinations,grader,goldilocks,girly,flask,envelopes,downside,doves,dissolve,discourage,disapprove,diabetic,deliveries,decorator,crossfire,criminally,containment,comrades,complimentary,chatter,catchy,cashier,cartel,caribou,cardiologist,brawl,booted,barbershop,aryan,angst,administer,zellie,wreak,whistles,vandalism,vamps,uterus,upstate,unstoppable,understudy,tristin,transcript,tranquilizer,toxins,tonsils,stempel,spotting,spectator,spatula,softer,snotty,slinging,showered,sexiest,sensual,sadder,rimbaud,restrain,resilient,remission,reinstate,rehash,recollection,rabies,popsicle,plausible,pediatric,patronizing,ostrich,ortolani,oooooh,omelette,mistrial,marseilles,loophole,laughin,kevvy,irritated,infidelity,hypothermia,horrific,groupie,grinding,graceful,goodspeed,gestures,frantic,extradition,echelon,disks,dawnie,dared,damsel,curled,collateral,collage,chant,calculating,bumping,bribes,boardwalk,blinds,blindly,bleeds,bickering,beasts,backside,avenge,apprehended,anguish,abusing,youthful,yells,yanking,whomever,when'd,vomiting,vengeful,unpacking,unfamiliar,undying,tumble,trolls,treacherous,tipping,tantrum,tanked,summons,straps,stomped,stinkin,stings,staked,squirrels,sprinkles,speculate,sorting,skinned,sicko,sicker,shootin,shatter,seeya,schnapps,s'posed,ronee,respectful,regroup,regretting,reeling,reckoned,ramifications,puddy,projections,preschool,plissken,platonic,permalash,outdone,outburst,mutants,mugging,misfortune,miserably,miraculously,medications,margaritas,manpower,lovemaking,logically,leeches,latrine,kneel,inflict,impostor,hypocrisy,hippies,heterosexual,heightened,hecuba,healer,gunned,grooming,groin,gooey,gloomy,frying,friendships,fredo,firepower,fathom,exhaustion,evils,endeavor,eggnog,dreaded,d'arcy,crotch,coughing,coronary,cookin,consummate,congrats,companionship,caved,caspar,bulletproof,brilliance,breakin,brash,blasting,aloud,airtight,advising,advertise,adultery,aches,wronged,upbeat,trillion,thingies,tending,tarts,surreal,specs,specialize,spade,shrew,shaping,selves,schoolwork,roomie,recuperating,rabid,quart,provocative,proudly,pretenses,prenatal,pharmaceuticals,pacing,overworked,originals,nicotine,murderous,mileage,mayonnaise,massages,losin,interrogated,injunction,impartial,homing,heartbreaker,hacks,glands,giver,fraizh,flips,flaunt,englishman,electrocuted,dusting,ducking,drifted,donating,cylon,crutches,crates,cowards,comfortably,chummy,chitchat,childbirth,businesswoman,brood,blatant,bethy,barring,bagged,awakened,asbestos,airplanes,worshipped,winnings,why're,visualize,unprotected,unleash,trays,thicker,therapists,takeoff,streisand,storeroom,stethoscope,stacked,spiteful,sneaks,snapping,slaughtered,slashed,simplest,silverware,shits,secluded,scruples,scrubs,scraps,ruptured,roaring,receptionist,recap,raditch,radiator,pushover,plastered,pharmacist,perverse,perpetrator,ornament,ointment,nineties,napping,nannies,mousse,moors,momentary,misunderstandings,manipulator,malfunction,laced,kivar,kickin,infuriating,impressionable,holdup,hires,hesitated,headphones,hammering,groundwork,grotesque,graces,gauze,gangsters,frivolous,freeing,fours,forwarding,ferrars,faulty,fantasizing,extracurricular,empathy,divorces,detonate,depraved,demeaning,deadlines,dalai,cursing,cufflink,crows,coupons,comforted,claustrophobic,casinos,camped,busboy,bluth,bennetts,baskets,attacker,aplastic,angrier,affectionate,zapped,wormhole,weaken,unrealistic,unravel,unimportant,unforgettable,twain,suspend,superbowl,stutter,stewardess,stepson,standin,spandex,souvenirs,sociopath,skeletons,shivering,sexier,selfishness,scrapbook,ritalin,ribbons,reunite,remarry,relaxation,rattling,rapist,psychosis,prepping,poses,pleasing,pisses,piling,persecuted,padded,operatives,negotiator,natty,menopause,mennihan,martimmys,loyalties,laynie,lando,justifies,intimately,inexperienced,impotent,immortality,horrors,hooky,hinges,heartbreaking,handcuffed,gypsies,guacamole,grovel,graziella,goggles,gestapo,fussy,ferragamo,feeble,eyesight,explosions,experimenting,enchanting,doubtful,dizziness,dismantle,detectors,deserving,defective,dangling,dancin,crumble,creamed,cramping,conceal,clockwork,chrissakes,chrissake,chopping,cabinets,brooding,bonfire,blurt,bloated,blackmailer,beforehand,bathed,bathe,barcode,banish,badges,babble,await,attentive,aroused,antibodies,animosity,ya'll,wrinkled,wonderland,willed,whisk,waltzing,waitressing,vigilant,upbringing,unselfish,uncles,trendy,trajectory,striped,stamina,stalled,staking,stacks,spoils,snuff,snooty,snide,shrinking,senora,secretaries,scoundrel,saline,salads,rundown,riddles,relapse,recommending,raspberry,plight,pecan,pantry,overslept,ornaments,niner,negligent,negligence,nailing,mucho,mouthed,monstrous,malpractice,lowly,loitering,logged,lingering,lettin,lattes,kamal,juror,jillefsky,jacked,irritate,intrusion,insatiable,infect,impromptu,icing,hmmmm,hefty,gasket,frightens,flapping,firstborn,faucet,estranged,envious,dopey,doesn,disposition,disposable,disappointments,dipped,dignified,deceit,dealership,deadbeat,curses,coven,counselors,concierge,clutches,casbah,callous,cahoots,brotherly,britches,brides,bethie,beige,autographed,attendants,attaboy,astonishing,appreciative,antibiotic,aneurysm,afterlife,affidavit,zoning,whats,whaddaya,vasectomy,unsuspecting,toula,topanga,tonio,toasted,tiring,terrorized,tenderness,tailing,sweats,suffocated,sucky,subconsciously,starvin,sprouts,spineless,sorrows,snowstorm,smirk,slicery,sledding,slander,simmer,signora,sigmund,seventies,sedate,scented,sandals,rollers,retraction,resigning,recuperate,receptive,racketeering,queasy,provoking,priors,prerogative,premed,pinched,pendant,outsiders,orbing,opportunist,olanov,neurologist,nanobot,mommies,molested,misread,mannered,laundromat,intercom,inspect,insanely,infatuation,indulgent,indiscretion,inconsiderate,hurrah,howling,herpes,hasta,harassed,hanukkah,groveling,groosalug,gander,galactica,futile,fridays,flier,fixes,exploiting,exorcism,evasive,endorse,emptied,dreary,dreamy,downloaded,dodged,doctored,disobeyed,disneyland,disable,dehydrated,contemplating,coconuts,cockroaches,clogged,chilling,chaperon,cameraman,bulbs,bucklands,bribing,brava,bracelets,bowels,bluepoint,appetizers,appendix,antics,anointed,analogy,almonds,yammering,winch,weirdness,wangler,vibrations,vendor,unmarked,unannounced,twerp,trespass,travesty,transfusion,trainee,towelie,tiresome,straightening,staggering,sonar,socializing,sinus,sinners,shambles,serene,scraped,scones,scepter,sarris,saberhagen,ridiculously,ridicule,rents,reconciled,radios,publicist,pubes,prune,prude,precrime,postponing,pluck,perish,peppermint,peeled,overdo,nutshell,nostalgic,mulan,mouthing,mistook,meddle,maybourne,martimmy,lobotomy,livelihood,lippman,likeness,kindest,kaffee,jocks,jerked,jeopardizing,jazzed,insured,inquisition,inhale,ingenious,holier,helmets,heirloom,heinous,haste,harmsway,hardship,hanky,gutters,gruesome,groping,goofing,godson,glare,finesse,figuratively,ferrie,endangerment,dreading,dozed,dorky,dmitri,divert,discredit,dialing,cufflinks,crutch,craps,corrupted,cocoon,cleavage,cannery,bystander,brushes,bruising,bribery,brainstorm,bolted,binge,ballistics,astute,arroway,adventurous,adoptive,addicts,addictive,yadda,whitelighters,wematanye,weeds,wedlock,wallets,vulnerability,vroom,vents,upped,unsettling,unharmed,trippin,trifle,tracing,tormenting,thats,syphilis,subtext,stickin,spices,sores,smacked,slumming,sinks,signore,shitting,shameful,shacked,septic,seedy,righteousness,relish,rectify,ravishing,quickest,phoebs,perverted,peeing,pedicure,pastrami,passionately,ozone,outnumbered,oregano,offender,nukes,nosed,nighty,nifty,mounties,motivate,moons,misinterpreted,mercenary,mentality,marsellus,lupus,lumbar,lovesick,lobsters,leaky,laundering,latch,jafar,instinctively,inspires,indoors,incarcerated,hundredth,handkerchief,gynecologist,guittierez,groundhog,grinning,goodbyes,geese,fullest,eyelashes,eyelash,enquirer,endlessly,elusive,disarm,detest,deluding,dangle,cotillion,corsage,conjugal,confessional,cones,commandment,coded,coals,chuckle,christmastime,cheeseburgers,chardonnay,celery,campfire,calming,burritos,brundle,broflovski,brighten,borderline,blinked,bling,beauties,bauers,battered,articulate,alienated,ahhhhh,agamemnon,accountants,y'see,wrongful,wrapper,workaholic,winnebago,whispered,warts,vacate,unworthy,unanswered,tonane,tolerated,throwin,throbbing,thrills,thorns,thereof,there've,tarot,sunscreen,stretcher,stereotype,soggy,sobbing,sizable,sightings,shucks,shrapnel,sever,senile,seaboard,scorned,saver,rebellious,rained,putty,prenup,pores,pinching,pertinent,peeping,paints,ovulating,opposites,occult,nutcracker,nutcase,newsstand,newfound,mocked,midterms,marshmallow,marbury,maclaren,leans,krudski,knowingly,keycard,junkies,juilliard,jolinar,irritable,invaluable,inuit,intoxicating,instruct,insolent,inexcusable,incubator,illustrious,hunsecker,houseguest,homosexuals,homeroom,hernia,harming,handgun,hallways,hallucination,gunshots,groupies,groggy,goiter,gingerbread,giggling,frigging,fledged,fedex,fairies,exchanging,exaggeration,esteemed,enlist,drags,dispense,disloyal,disconnect,desks,dentists,delacroix,degenerate,daydreaming,cushions,cuddly,corroborate,complexion,compensated,cobbler,closeness,chilled,checkmate,channing,carousel,calms,bylaws,benefactor,ballgame,baiting,backstabbing,artifact,airspace,adversary,actin,accuses,accelerant,abundantly,abstinence,zissou,zandt,yapping,witchy,willows,whadaya,vilandra,veiled,undress,undivided,underestimating,ultimatums,twirl,truckload,tremble,toasting,tingling,tents,tempered,sulking,stunk,sponges,spills,softly,snipers,scourge,rooftop,riana,revolting,revisit,refreshments,redecorating,recapture,raysy,pretense,prejudiced,precogs,pouting,poofs,pimple,piles,pediatrician,padre,packets,paces,orvelle,oblivious,objectivity,nighttime,nervosa,mexicans,meurice,melts,matchmaker,maeby,lugosi,lipnik,leprechaun,kissy,kafka,introductions,intestines,inspirational,insightful,inseparable,injections,inadvertently,hussy,huckabees,hittin,hemorrhaging,headin,haystack,hallowed,grudges,granilith,grandkids,grading,gracefully,godsend,gobbles,fragrance,fliers,finchley,farts,eyewitnesses,expendable,existential,dorms,delaying,degrading,deduction,darlings,danes,cylons,counsellor,contraire,consciously,conjuring,congratulating,cokes,buffay,brooch,bitching,bistro,bijou,bewitched,benevolent,bends,bearings,barren,aptitude,amish,amazes,abomination,worldly,whispers,whadda,wayward,wailing,vanishing,upscale,untouchable,unspoken,uncontrollable,unavoidable,unattended,trite,transvestite,toupee,timid,timers,terrorizing,swana,stumped,strolling,storybook,storming,stomachs,stoked,stationery,springtime,spontaneity,spits,spins,soaps,sentiments,scramble,scone,rooftops,retract,reflexes,rawdon,ragged,quirky,quantico,psychologically,prodigal,pounce,potty,pleasantries,pints,petting,perceive,onstage,notwithstanding,nibble,newmans,neutralize,mutilated,millionaires,mayflower,masquerade,mangy,macreedy,lunatics,lovable,locating,limping,lasagna,kwang,keepers,juvie,jaded,ironing,intuitive,intensely,insure,incantation,hysteria,hypnotize,humping,happenin,griet,grasping,glorified,ganging,g'night,focker,flunking,flimsy,flaunting,fixated,fitzwallace,fainting,eyebrow,exonerated,ether,electrician,egotistical,earthly,dusted,dignify,detonation,debrief,dazzling,dan'l,damnedest,daisies,crushes,crucify,contraband,confronting,collapsing,cocked,clicks,cliche,circled,chandelier,carburetor,callers,broads,breathes,bloodshed,blindsided,blabbing,bialystock,bashing,ballerina,aviva,arteries,anomaly,airstrip,agonizing,adjourn,aaaaa,yearning,wrecker,witnessing,whence,warhead,unsure,unheard,unfreeze,unfold,unbalanced,ugliest,troublemaker,toddler,tiptoe,threesome,thirties,thermostat,swipe,surgically,subtlety,stung,stumbling,stubs,stride,strangling,sprayed,socket,smuggled,showering,shhhhh,sabotaging,rumson,rounding,risotto,repairman,rehearsed,ratty,ragging,radiology,racquetball,racking,quieter,quicksand,prowl,prompt,premeditated,prematurely,prancing,porcupine,plated,pinocchio,peeked,peddle,panting,overweight,overrun,outing,outgrown,obsess,nursed,nodding,negativity,negatives,musketeers,mugger,motorcade,merrily,matured,masquerading,marvellous,maniacs,lovey,louse,linger,lilies,lawful,kudos,knuckle,juices,judgments,itches,intolerable,intermission,inept,incarceration,implication,imaginative,huckleberry,holster,heartburn,gunna,groomed,graciously,fulfillment,fugitives,forsaking,forgives,foreseeable,flavors,flares,fixation,fickle,fantasize,famished,fades,expiration,exclamation,erasing,eiffel,eerie,earful,duped,dulles,dissing,dissect,dispenser,dilated,detergent,desdemona,debriefing,damper,curing,crispina,crackpot,courting,cordial,conflicted,comprehension,commie,cleanup,chiropractor,charmer,chariot,cauldron,catatonic,bullied,buckets,brilliantly,breathed,booths,boardroom,blowout,blindness,blazing,biologically,bibles,biased,beseech,barbaric,balraj,audacity,anticipating,alcoholics,airhead,agendas,admittedly,absolution,youre,yippee,wittlesey,withheld,willful,whammy,weakest,washes,virtuous,videotapes,vials,unplugged,unpacked,unfairly,turbulence,tumbling,tricking,tremendously,traitors,torches,tinga,thyroid,teased,tawdry,taker,sympathies,swiped,sundaes,suave,strut,stepdad,spewing,spasm,socialize,slither,simulator,shutters,shrewd,shocks,semantics,schizophrenic,scans,savages,rya'c,runny,ruckus,royally,roadblocks,rewriting,revoke,repent,redecorate,recovers,recourse,ratched,ramali,racquet,quince,quiche,puppeteer,puking,puffed,problemo,praises,pouch,postcards,pooped,poised,piled,phoney,phobia,patching,parenthood,pardner,oozing,ohhhhh,numbing,nostril,nosey,neatly,nappa,nameless,mortuary,moronic,modesty,midwife,mcclane,matuka,maitre,lumps,lucid,loosened,loins,lawnmower,lamotta,kroehner,jinxy,jessep,jamming,jailhouse,jacking,intruders,inhuman,infatuated,indigestion,implore,implanted,hormonal,hoboken,hillbilly,heartwarming,headway,hatched,hartmans,harping,grapevine,gnome,forties,flyin,flirted,fingernail,exhilarating,enjoyment,embark,dumper,dubious,drell,docking,disillusioned,dishonor,disbarred,dicey,custodial,counterproductive,corned,cords,contemplate,concur,conceivable,cobblepot,chickened,checkout,carpe,cap'n,campers,buyin,bullies,braid,boxed,bouncy,blueberries,blubbering,bloodstream,bigamy,beeped,bearable,autographs,alarming,wretch,wimps,widower,whirlwind,whirl,warms,vandelay,unveiling,undoing,unbecoming,turnaround,touche,togetherness,tickles,ticker,teensy,taunt,sweethearts,stitched,standpoint,staffers,spotless,soothe,smothered,sickening,shouted,shepherds,shawl,seriousness,schooled,schoolboy,s'mores,roped,reminders,raggedy,preemptive,plucked,pheromones,particulars,pardoned,overpriced,overbearing,outrun,ohmigod,nosing,nicked,neanderthal,mosquitoes,mortified,milky,messin,mecha,markinson,marivellas,mannequin,manderley,madder,macready,lookie,locusts,lifetimes,lanna,lakhi,kholi,impersonate,hyperdrive,horrid,hopin,hogging,hearsay,harpy,harboring,hairdo,hafta,grasshopper,gobble,gatehouse,foosball,floozy,fished,firewood,finalize,felons,euphemism,entourage,elitist,elegance,drokken,drier,dredge,dossier,diseased,diarrhea,diagnose,despised,defuse,d'amour,contesting,conserve,conscientious,conjured,collars,clogs,chenille,chatty,chamomile,casing,calculator,brittle,breached,blurted,birthing,bikinis,astounding,assaulting,aroma,appliance,antsy,amnio,alienating,aliases,adolescence,xerox,wrongs,workload,willona,whistling,werewolves,wallaby,unwelcome,unseemly,unplug,undermining,ugliness,tyranny,tuesdays,trumpets,transference,ticks,tangible,tagging,swallowing,superheroes,studs,strep,stowed,stomping,steffy,sprain,spouting,sponsoring,sneezing,smeared,slink,shakin,sewed,seatbelt,scariest,scammed,sanctimonious,roasting,rightly,retinal,rethinking,resented,reruns,remover,racks,purest,progressing,presidente,preeclampsia,postponement,portals,poppa,pliers,pinning,pelvic,pampered,padding,overjoyed,ooooo,one'll,octavius,nonono,nicknames,neurosurgeon,narrows,misled,mislead,mishap,milltown,milking,meticulous,mediocrity,meatballs,machete,lurch,layin,knockin,khruschev,jurors,jumpin,jugular,jeweler,intellectually,inquiries,indulging,indestructible,indebted,imitate,ignores,hyperventilating,hyenas,hurrying,hermano,hellish,heheh,harshly,handout,grunemann,glances,giveaway,getup,gerome,furthest,frosting,frail,forwarded,forceful,flavored,flammable,flaky,fingered,fatherly,ethic,embezzlement,duffel,dotted,distressed,disobey,disappearances,dinky,diminish,diaphragm,deuces,creme,courteous,comforts,coerced,clots,clarification,chunks,chickie,chases,chaperoning,cartons,caper,calves,caged,bustin,bulging,bringin,boomhauer,blowin,blindfolded,biscotti,ballplayer,bagging,auster,assurances,aschen,arraigned,anonymity,alters,albatross,agreeable,adoring,abduct,wolfi,weirded,watchers,washroom,warheads,vincennes,urgency,understandably,uncomplicated,uhhhh,twitching,treadmill,thermos,tenorman,tangle,talkative,swarm,surrendering,summoning,strive,stilts,stickers,squashed,spraying,sparring,soaring,snort,sneezed,slaps,skanky,singin,sidle,shreck,shortness,shorthand,sharper,shamed,sadist,rydell,rusik,roulette,resumes,respiration,recount,reacts,purgatory,princesses,presentable,ponytail,plotted,pinot,pigtails,phillippe,peddling,paroled,orbed,offends,o'hara,moonlit,minefield,metaphors,malignant,mainframe,magicks,maggots,maclaine,loathing,leper,leaps,leaping,lashed,larch,larceny,lapses,ladyship,juncture,jiffy,jakov,invoke,infantile,inadmissible,horoscope,hinting,hideaway,hesitating,heddy,heckles,hairline,gripe,gratifying,governess,goebbels,freddo,foresee,fascination,exemplary,executioner,etcetera,escorts,endearing,eaters,earplugs,draped,disrupting,disagrees,dimes,devastate,detain,depositions,delicacy,darklighter,cynicism,cyanide,cutters,cronus,continuance,conquering,confiding,compartments,combing,cofell,clingy,cleanse,christmases,cheered,cheekbones,buttle,burdened,bruenell,broomstick,brained,bozos,bontecou,bluntman,blazes,blameless,bizarro,bellboy,beaucoup,barkeep,awaken,astray,assailant,appease,aphrodisiac,alleys,yesss,wrecks,woodpecker,wondrous,wimpy,willpower,wheeling,weepy,waxing,waive,videotaped,veritable,untouched,unlisted,unfounded,unforeseen,twinge,triggers,traipsing,toxin,tombstone,thumping,therein,testicles,telephones,tarmac,talby,tackled,swirling,suicides,suckered,subtitles,sturdy,strangler,stockbroker,stitching,steered,standup,squeal,sprinkler,spontaneously,splendor,spiking,spender,snipe,snagged,skimming,siddown,showroom,shovels,shotguns,shoelaces,shitload,shellfish,sharpest,shadowy,seizing,scrounge,scapegoat,sayonara,saddled,rummaging,roomful,renounce,reconsidered,recharge,realistically,radioed,quirks,quadrant,punctual,practising,pours,poolhouse,poltergeist,pocketbook,plainly,picnics,pesto,pawing,passageway,partied,oneself,numero,nostalgia,nitwit,neuro,mixer,meanest,mcbeal,matinee,margate,marce,manipulations,manhunt,manger,magicians,loafers,litvack,lightheaded,lifeguard,lawns,laughingstock,ingested,indignation,inconceivable,imposition,impersonal,imbecile,huddled,housewarming,horizons,homicides,hiccups,hearse,hardened,gushing,gushie,greased,goddamit,freelancer,forging,fondue,flustered,flung,flinch,flicker,fixin,festivus,fertilizer,farted,faggots,exonerate,evict,enormously,encrypted,emdash,embracing,duress,dupres,dowser,doormat,disfigured,disciplined,dibbs,depository,deathbed,dazzled,cuttin,cures,crowding,crepe,crammed,copycat,contradict,confidant,condemning,conceited,commute,comatose,clapping,circumference,chuppah,chore,choksondik,chestnuts,briault,bottomless,bonnet,blokes,berluti,beret,beggars,bankroll,bania,athos,arsenic,apperantly,ahhhhhh,afloat,accents,zipped,zeros,zeroes,zamir,yuppie,youngsters,yorkers,wisest,wipes,wield,whyn't,weirdos,wednesdays,vicksburg,upchuck,untraceable,unsupervised,unpleasantness,unhook,unconscionable,uncalled,trappings,tragedies,townie,thurgood,things'll,thine,tetanus,terrorize,temptations,tanning,tampons,swarming,straitjacket,steroid,startling,starry,squander,speculating,sollozzo,sneaked,slugs,skedaddle,sinker,silky,shortcomings,sellin,seasoned,scrubbed,screwup,scrapes,scarves,sandbox,salesmen,rooming,romances,revere,reproach,reprieve,rearranging,ravine,rationalize,raffle,punchy,psychobabble,provocation,profoundly,prescriptions,preferable,polishing,poached,pledges,pirelli,perverts,oversized,overdressed,outdid,nuptials,nefarious,mouthpiece,motels,mopping,mongrel,missin,metaphorically,mertin,memos,melodrama,melancholy,measles,meaner,mantel,maneuvering,mailroom,luring,listenin,lifeless,licks,levon,legwork,kneecaps,kippur,kiddie,kaput,justifiable,insistent,insidious,innuendo,innit,indecent,imaginable,horseshit,hemorrhoid,hella,healthiest,haywire,hamsters,hairbrush,grouchy,grisly,gratuitous,glutton,glimmer,gibberish,ghastly,gentler,generously,geeky,fuhrer,fronting,foolin,faxes,faceless,extinguisher,expel,etched,endangering,ducked,dodgeball,dives,dislocated,discrepancy,devour,derail,dementia,daycare,cynic,crumbling,cowardice,covet,cornwallis,corkscrew,cookbook,commandments,coincidental,cobwebs,clouded,clogging,clicking,clasp,chopsticks,chefs,chaps,cashing,carat,calmer,brazen,brainwashing,bradys,bowing,boned,bloodsucking,bleachers,bleached,bedpan,bearded,barrenger,bachelors,awwww,assures,assigning,asparagus,apprehend,anecdote,amoral,aggravation,afoot,acquaintances,accommodating,yakking,worshipping,wladek,willya,willies,wigged,whoosh,whisked,watered,warpath,volts,violates,valuables,uphill,unwise,untimely,unsavory,unresponsive,unpunished,unexplained,tubby,trolling,toxicology,tormented,toothache,tingly,timmiihh,thursdays,thoreau,terrifies,temperamental,telegrams,talkie,takers,symbiote,swirl,suffocate,stupider,strapping,steckler,springing,someway,sleepyhead,sledgehammer,slant,slams,showgirl,shoveling,shmoopy,sharkbait,shan't,scrambling,schematics,sandeman,sabbatical,rummy,reykjavik,revert,responsive,rescheduled,requisition,relinquish,rejoice,reckoning,recant,rebadow,reassurance,rattlesnake,ramble,primed,pricey,prance,pothole,pocus,persist,perpetrated,pekar,peeling,pastime,parmesan,pacemaker,overdrive,ominous,observant,nothings,noooooo,nonexistent,nodded,nieces,neglecting,nauseating,mutated,musket,mumbling,mowing,mouthful,mooseport,monologue,mistrust,meetin,masseuse,mantini,mailer,madre,lowlifes,locksmith,livid,liven,limos,liberating,lhasa,leniency,leering,laughable,lashes,lasagne,laceration,korben,katan,kalen,jittery,jammies,irreplaceable,intubate,intolerant,inhaler,inhaled,indifferent,indifference,impound,impolite,humbly,heroics,heigh,guillotine,guesthouse,grounding,grips,gossiping,goatee,gnomes,gellar,frutt,frobisher,freudian,foolishness,flagged,femme,fatso,fatherhood,fantasized,fairest,faintest,eyelids,extravagant,extraterrestrial,extraordinarily,escalator,elevate,drivel,dissed,dismal,disarray,dinnertime,devastation,dermatologist,delicately,defrost,debutante,debacle,damone,dainty,cuvee,culpa,crucified,creeped,crayons,courtship,convene,congresswoman,concocted,compromises,comprende,comma,coleslaw,clothed,clinically,chickenshit,checkin,cesspool,caskets,calzone,brothel,boomerang,bodega,blasphemy,bitsy,bicentennial,berlini,beatin,beards,barbas,barbarians,backpacking,arrhythmia,arousing,arbitrator,antagonize,angling,anesthetic,altercation,aggressor,adversity,acathla,aaahhh,wreaking,workup,wonderin,wither,wielding,what'm,what'cha,waxed,vibrating,veterinarian,venting,vasey,valor,validate,upholstery,untied,unscathed,uninterrupted,unforgiving,undies,uncut,twinkies,tucking,treatable,treasured,tranquility,townspeople,torso,tomei,tipsy,tinsel,tidings,thirtieth,tantrums,tamper,talky,swayed,swapping,suitor,stylist,stirs,standoff,sprinklers,sparkly,snobby,snatcher,smoother,sleepin,shrug,shoebox,sheesh,shackles,setbacks,sedatives,screeching,scorched,scanned,satyr,roadblock,riverbank,ridiculed,resentful,repellent,recreate,reconvene,rebuttal,realmedia,quizzes,questionnaire,punctured,pucker,prolong,professionalism,pleasantly,pigsty,penniless,paychecks,patiently,parading,overactive,ovaries,orderlies,oracles,oiled,offending,nudie,neonatal,neighborly,moops,moonlighting,mobilize,mmmmmm,milkshake,menial,meats,mayan,maxed,mangled,magua,lunacy,luckier,liters,lansbury,kooky,knowin,jeopardized,inkling,inhalation,inflated,infecting,incense,inbound,impractical,impenetrable,idealistic,i'mma,hypocrites,hurtin,humbled,hologram,hokey,hocus,hitchhiking,hemorrhoids,headhunter,hassled,harts,hardworking,haircuts,hacksaw,genitals,gazillion,gammy,gamesphere,fugue,footwear,folly,flashlights,fives,filet,extenuating,estrogen,entails,embezzled,eloquent,egomaniac,ducts,drowsy,drones,doree,donovon,disguises,diggin,deserting,depriving,defying,deductible,decorum,decked,daylights,daybreak,dashboard,damnation,cuddling,crunching,crickets,crazies,councilman,coughed,conundrum,complimented,cohaagen,clutching,clued,clader,cheques,checkpoint,chats,channeling,ceases,carasco,capisce,cantaloupe,cancelling,campsite,burglars,breakfasts,bra'tac,blueprint,bleedin,blabbed,beneficiary,basing,avert,atone,arlyn,approves,apothecary,antiseptic,aleikuum,advisement,zadir,wobbly,withnail,whattaya,whacking,wedged,wanders,vaginal,unimaginable,undeniable,unconditionally,uncharted,unbridled,tweezers,tvmegasite,trumped,triumphant,trimming,treading,tranquilizers,toontown,thunk,suture,suppressing,strays,stonewall,stogie,stepdaughter,stace,squint,spouses,splashed,speakin,sounder,sorrier,sorrel,sombrero,solemnly,softened,snobs,snippy,snare,smoothing,slump,slimeball,slaving,silently,shiller,shakedown,sensations,scrying,scrumptious,screamin,saucy,santoses,roundup,roughed,rosary,robechaux,retrospect,rescind,reprehensible,repel,remodeling,reconsidering,reciprocate,railroaded,psychics,promos,prob'ly,pristine,printout,priestess,prenuptial,precedes,pouty,phoning,peppy,pariah,parched,panes,overloaded,overdoing,nymphs,nother,notebooks,nearing,nearer,monstrosity,milady,mieke,mephesto,medicated,marshals,manilow,mammogram,m'lady,lotsa,loopy,lesion,lenient,learner,laszlo,kross,kinks,jinxed,involuntary,insubordination,ingrate,inflatable,incarnate,inane,hypoglycemia,huntin,humongous,hoodlum,honking,hemorrhage,helpin,hathor,hatching,grotto,grandmama,gorillas,godless,girlish,ghouls,gershwin,frosted,flutter,flagpole,fetching,fatter,faithfully,exert,evasion,escalate,enticing,enchantress,elopement,drills,downtime,downloading,dorks,doorways,divulge,dissociative,disgraceful,disconcerting,deteriorate,destinies,depressive,dented,denim,decruz,decidedly,deactivate,daydreams,curls,culprit,cruelest,crippling,cranberries,corvis,copped,commend,coastguard,cloning,cirque,churning,chock,chivalry,catalogues,cartwheels,carols,canister,buttered,bundt,buljanoff,bubbling,brokers,broaden,brimstone,brainless,bores,badmouthing,autopilot,ascertain,aorta,ampata,allenby,accosted,absolve,aborted,aaagh,aaaaaah,yonder,yellin,wyndham,wrongdoing,woodsboro,wigging,wasteland,warranty,waltzed,walnuts,vividly,veggie,unnecessarily,unloaded,unicorns,understated,unclean,umbrellas,twirling,turpentine,tupperware,triage,treehouse,tidbit,tickled,threes,thousandth,thingie,terminally,teething,tassel,talkies,swoon,switchboard,swerved,suspiciously,subsequentlyne,subscribe,strudel,stroking,strictest,stensland,starin,stannart,squirming,squealing,sorely,softie,snookums,sniveling,smidge,sloth,skulking,simian,sightseeing,siamese,shudder,shoppers,sharpen,shannen,semtex,secondhand,seance,scowl,scorn,safekeeping,russe,rummage,roshman,roomies,roaches,rinds,retrace,retires,resuscitate,rerun,reputations,rekall,refreshment,reenactment,recluse,ravioli,raves,raking,purses,punishable,punchline,puked,prosky,previews,poughkeepsie,poppins,polluted,placenta,pissy,petulant,perseverance,pears,pawns,pastries,partake,panky,palate,overzealous,orchids,obstructing,objectively,obituaries,obedient,nothingness,musty,motherly,mooning,momentous,mistaking,minutemen,milos,microchip,meself,merciless,menelaus,mazel,masturbate,mahogany,lysistrata,lillienfield,likable,liberate,leveled,letdown,larynx,lardass,lainey,lagged,klorel,kidnappings,keyed,karmic,jeebies,irate,invulnerable,intrusive,insemination,inquire,injecting,informative,informants,impure,impasse,imbalance,illiterate,hurled,hunts,hematoma,headstrong,handmade,handiwork,growling,gorky,getcha,gesundheit,gazing,galley,foolishly,fondness,floris,ferocious,feathered,fateful,fancies,fakes,faker,expire,ever'body,essentials,eskimos,enlightening,enchilada,emissary,embolism,elsinore,ecklie,drenched,drazi,doped,dogging,doable,dislikes,dishonesty,disengage,discouraging,derailed,deformed,deflect,defer,deactivated,crips,constellations,congressmen,complimenting,clubbing,clawing,chromium,chimes,chews,cheatin,chaste,cellblock,caving,catered,catacombs,calamari,bucking,brulee,brits,brisk,breezes,bounces,boudoir,binks,better'n,bellied,behrani,behaves,bedding,balmy,badmouth,backers,avenging,aromatherapy,armpit,armoire,anythin,anonymously,anniversaries,aftershave,affliction,adrift,admissible,adieu,acquittal,yucky,yearn,whitter,whirlpool,wendigo,watchdog,wannabes,wakey,vomited,voicemail,valedictorian,uttered,unwed,unrequited,unnoticed,unnerving,unkind,unjust,uniformed,unconfirmed,unadulterated,unaccounted,uglier,turnoff,trampled,tramell,toads,timbuktu,throwback,thimble,tasteless,tarantula,tamale,takeovers,swish,supposing,streaking,stargher,stanzi,stabs,squeamish,splattered,spiritually,spilt,speciality,smacking,skywire,skips,skaara,simpatico,shredding,showin,shortcuts,shite,shielding,shamelessly,serafine,sentimentality,seasick,schemer,scandalous,sainted,riedenschneider,rhyming,revel,retractor,retards,resurrect,remiss,reminiscing,remanded,reiben,regains,refuel,refresher,redoing,redheaded,reassured,rearranged,rapport,qumar,prowling,prejudices,precarious,powwow,pondering,plunger,plunged,pleasantville,playpen,phlegm,perfected,pancreas,paley,ovary,outbursts,oppressed,ooohhh,omoroca,offed,o'toole,nurture,nursemaid,nosebleed,necktie,muttering,munchies,mucking,mogul,mitosis,misdemeanor,miscarried,millionth,migraines,midler,manicurist,mandelbaum,manageable,malfunctioned,magnanimous,loudmouth,longed,lifestyles,liddy,lickety,leprechauns,komako,klute,kennel,justifying,irreversible,inventing,intergalactic,insinuate,inquiring,ingenuity,inconclusive,incessant,improv,impersonation,hyena,humperdinck,hubba,housework,hoffa,hither,hissy,hippy,hijacked,heparin,hellooo,hearth,hassles,hairstyle,hahahaha,hadda,guys'll,gutted,gulls,gritty,grievous,graft,gossamer,gooder,gambled,gadgets,fundamentals,frustrations,frolicking,frock,frilly,foreseen,footloose,fondly,flirtation,flinched,flatten,farthest,exposer,evading,escrow,empathize,embryos,embodiment,ellsberg,ebola,dulcinea,dreamin,drawbacks,doting,doose,doofy,disturbs,disorderly,disgusts,detox,denominator,demeanor,deliriously,decode,debauchery,croissant,cravings,cranked,coworkers,councilor,confuses,confiscate,confines,conduit,compress,combed,clouding,clamps,cinch,chinnery,celebratory,catalogs,carpenters,carnal,canin,bundys,bulldozer,buggers,bueller,brainy,booming,bookstores,bloodbath,bittersweet,bellhop,beeping,beanstalk,beady,baudelaire,bartenders,bargains,averted,armadillo,appreciating,appraised,antlers,aloof,allowances,alleyway,affleck,abject,zilch,youore,xanax,wrenching,wouldn,witted,wicca,whorehouse,whooo,whips,vouchers,victimized,vicodin,untested,unsolicited,unfocused,unfettered,unfeeling,unexplainable,understaffed,underbelly,tutorial,tryst,trampoline,towering,tirade,thieving,thang,swimmin,swayzak,suspecting,superstitions,stubbornness,streamers,strattman,stonewalling,stiffs,stacking,spout,splice,sonrisa,smarmy,slows,slicing,sisterly,shrill,shined,seeming,sedley,seatbelts,scour,scold,schoolyard,scarring,salieri,rustling,roxbury,rewire,revved,retriever,reputable,remodel,reins,reincarnation,rance,rafters,rackets,quail,pumbaa,proclaim,probing,privates,pried,prewedding,premeditation,posturing,posterity,pleasurable,pizzeria,pimps,penmanship,penchant,pelvis,overturn,overstepped,overcoat,ovens,outsmart,outed,ooohh,oncologist,omission,offhand,odour,nyazian,notarized,nobody'll,nightie,navel,nabbed,mystique,mover,mortician,morose,moratorium,mockingbird,mobsters,mingling,methinks,messengered,merde,masochist,martouf,martians,marinara,manray,majorly,magnifying,mackerel,lurid,lugging,lonnegan,loathsome,llantano,liberace,leprosy,latinos,lanterns,lamest,laferette,kraut,intestine,innocencia,inhibitions,ineffectual,indisposed,incurable,inconvenienced,inanimate,improbable,implode,hydrant,hustling,hustled,huevos,how'm,hooey,hoods,honcho,hinge,hijack,heimlich,hamunaptra,haladki,haiku,haggle,gutsy,grunting,grueling,gribbs,greevy,grandstanding,godparents,glows,glistening,gimmick,gaping,fraiser,formalities,foreigner,folders,foggy,fitty,fiends,fe'nos,favours,eyeing,extort,expedite,escalating,epinephrine,entitles,entice,eminence,eights,earthlings,eagerly,dunville,dugout,doublemeat,doling,dispensing,dispatcher,discoloration,diners,diddly,dictates,diazepam,derogatory,delights,defies,decoder,dealio,danson,cutthroat,crumbles,croissants,crematorium,craftsmanship,could'a,cordless,cools,conked,confine,concealing,complicates,communique,cockamamie,coasters,clobbered,clipping,clipboard,clemenza,cleanser,circumcision,chanukah,certainaly,cellmate,cancels,cadmium,buzzed,bumstead,bucko,browsing,broth,braver,boggling,bobbing,blurred,birkhead,benet,belvedere,bellies,begrudge,beckworth,banky,baldness,baggy,babysitters,aversion,astonished,assorted,appetites,angina,amiss,ambulances,alibis,airway,admires,adhesive,yoyou,xxxxxx,wreaked,wracking,woooo,wooing,wised,wilshire,wedgie,waging,violets,vincey,uplifting,untrustworthy,unmitigated,uneventful,undressing,underprivileged,unburden,umbilical,tweaking,turquoise,treachery,tosses,torching,toothpick,toasts,thickens,tereza,tenacious,teldar,taint,swill,sweatin,subtly,subdural,streep,stopwatch,stockholder,stillwater,stalkers,squished,squeegee,splinters,spliced,splat,spied,spackle,sophistication,snapshots,smite,sluggish,slithered,skeeters,sidewalks,sickly,shrugs,shrubbery,shrieking,shitless,settin,sentinels,selfishly,scarcely,sangria,sanctum,sahjhan,rustle,roving,rousing,rosomorf,riddled,responsibly,renoir,remoray,remedial,refundable,redirect,recheck,ravenwood,rationalizing,ramus,ramelle,quivering,pyjamas,psychos,provocations,prouder,protestors,prodded,proctologist,primordial,pricks,prickly,precedents,pentangeli,pathetically,parka,parakeet,panicky,overthruster,outsmarted,orthopedic,oncoming,offing,nutritious,nuthouse,nourishment,nibbling,newlywed,narcissist,mutilation,mundane,mummies,mumble,mowed,morvern,mortem,mopes,molasses,misplace,miscommunication,miney,midlife,menacing,memorizing,massaging,masking,magnets,luxuries,lounging,lothario,liposuction,lidocaine,libbets,levitate,leeway,launcelot,larek,lackeys,kumbaya,kryptonite,knapsack,keyhole,katarangura,juiced,jakey,ironclad,invoice,intertwined,interlude,interferes,injure,infernal,indeedy,incur,incorrigible,incantations,impediment,igloo,hysterectomy,hounded,hollering,hindsight,heebie,havesham,hasenfuss,hankering,hangers,hakuna,gutless,gusto,grubbing,grrrr,grazed,gratification,grandeur,gorak,godammit,gnawing,glanced,frostbite,frees,frazzled,fraulein,fraternizing,fortuneteller,formaldehyde,followup,foggiest,flunky,flickering,firecrackers,figger,fetuses,fates,eyeliner,extremities,extradited,expires,exceedingly,evaporate,erupt,epileptic,entrails,emporium,egregious,eggshells,easing,duwayne,droll,dreyfuss,dovey,doubly,doozy,donkeys,donde,distrust,distressing,disintegrate,discreetly,decapitated,dealin,deader,dashed,darkroom,dares,daddies,dabble,cushy,cupcakes,cuffed,croupier,croak,crapped,coursing,coolers,contaminate,consummated,construed,condos,concoction,compulsion,commish,coercion,clemency,clairvoyant,circulate,chesterton,checkered,charlatan,chaperones,categorically,cataracts,carano,capsules,capitalize,burdon,bullshitting,brewed,breathless,breasted,brainstorming,bossing,borealis,bonsoir,bobka,boast,blimp,bleep,bleeder,blackouts,bisque,billboards,beatings,bayberry,bashed,bamboozled,balding,baklava,baffled,backfires,babak,awkwardness,attest,attachments,apologizes,anyhoo,antiquated,alcante,advisable,aahhh,aaahh,zatarc,yearbooks,wuddya,wringing,womanhood,witless,winging,whatsa,wetting,waterproof,wastin,vogelman,vocation,vindicated,vigilance,vicariously,venza,vacuuming,utensils,uplink,unveil,unloved,unloading,uninhibited,unattached,tweaked,turnips,trinkets,toughen,toting,topside,terrors,terrify,technologically,tarnish,tagliati,szpilman,surly,supple,summation,suckin,stepmom,squeaking,splashmore,souffle,solitaire,solicitation,solarium,smokers,slugged,slobbering,skylight,skimpy,sinuses,silenced,sideburns,shrinkage,shoddy,shhhhhh,shelled,shareef,shangri,seuss,serenade,scuffle,scoff,scanners,sauerkraut,sardines,sarcophagus,salvy,rusted,russells,rowboat,rolfsky,ringside,respectability,reparations,renegotiate,reminisce,reimburse,regimen,raincoat,quibble,puzzled,purposefully,pubic,proofing,prescribing,prelim,poisons,poaching,personalized,personable,peroxide,pentonville,payphone,payoffs,paleontology,overflowing,oompa,oddest,objecting,o'hare,o'daniel,notches,nobody'd,nightstand,neutralized,nervousness,nerdy,needlessly,naquadah,nappy,nantucket,nambla,mountaineer,motherfuckin,morrie,monopolizing,mohel,mistreated,misreading,misbehave,miramax,minivan,milligram,milkshakes,metamorphosis,medics,mattresses,mathesar,matchbook,matata,marys,malucci,magilla,lymphoma,lowers,lordy,linens,lindenmeyer,limelight,leapt,laxative,lather,lapel,lamppost,laguardia,kindling,kegger,kawalsky,juries,jokin,jesminder,interning,innermost,injun,infallible,industrious,indulgence,incinerator,impossibility,impart,illuminate,iguanas,hypnotic,hyped,hospitable,hoses,homemaker,hirschmuller,helpers,headset,guardianship,guapo,grubby,granola,granddaddy,goren,goblet,gluttony,globes,giorno,getter,geritol,gassed,gaggle,foxhole,fouled,foretold,floorboards,flippers,flaked,fireflies,feedings,fashionably,farragut,fallback,facials,exterminate,excites,everything'll,evenin,ethically,ensue,enema,empath,eluded,eloquently,eject,edema,dumpling,droppings,dolled,distasteful,disputing,displeasure,disdain,deterrent,dehydration,defied,decomposing,dawned,dailies,custodian,crusts,crucifix,crowning,crier,crept,craze,crawls,couldn,correcting,corkmaster,copperfield,cooties,contraption,consumes,conspire,consenting,consented,conquers,congeniality,complains,communicator,commendable,collide,coladas,colada,clout,clooney,classifieds,clammy,civility,cirrhosis,chink,catskills,carvers,carpool,carelessness,cardio,carbs,capades,butabi,busmalis,burping,burdens,bunks,buncha,bulldozers,browse,brockovich,breakthroughs,bravado,boogety,blossoms,blooming,bloodsucker,blight,betterton,betrayer,belittle,beeps,bawling,barts,bartending,bankbooks,babish,atropine,assertive,armbrust,anyanka,annoyance,anemic,anago,airwaves,aimlessly,aaargh,aaand,yoghurt,writhing,workable,winking,winded,widen,whooping,whiter,whatya,wazoo,voila,virile,vests,vestibule,versed,vanishes,urkel,uproot,unwarranted,unscheduled,unparalleled,undergrad,tweedle,turtleneck,turban,trickery,transponder,toyed,townhouse,thyself,thunderstorm,thinning,thawed,tether,technicalities,tau'ri,tarnished,taffeta,tacked,systolic,swerve,sweepstakes,swabs,suspenders,superwoman,sunsets,succulent,subpoenas,stumper,stosh,stomachache,stewed,steppin,stepatech,stateside,spicoli,sparing,soulless,sonnets,sockets,snatching,smothering,slush,sloman,slashing,sitters,simpleton,sighs,sidra,sickens,shunned,shrunken,showbiz,shopped,shimmering,shagging,semblance,segue,sedation,scuzzlebutt,scumbags,screwin,scoundrels,scarsdale,scabs,saucers,saintly,saddened,runaways,runaround,rheya,resenting,rehashing,rehabilitated,regrettable,refreshed,redial,reconnecting,ravenous,raping,rafting,quandary,pylea,putrid,puffing,psychopathic,prunes,probate,prayin,pomegranate,plummeting,planing,plagues,pinata,pithy,perversion,personals,perched,peeps,peckish,pavarotti,pajama,packin,pacifier,overstepping,okama,obstetrician,nutso,nuance,normalcy,nonnegotiable,nomak,ninny,nines,nicey,newsflash,neutered,nether,negligee,necrosis,navigating,narcissistic,mylie,muses,momento,moisturizer,moderation,misinformed,misconception,minnifield,mikkos,methodical,mebbe,meager,maybes,matchmaking,masry,markovic,malakai,luzhin,lusting,lumberjack,loopholes,loaning,lightening,leotard,launder,lamaze,kubla,kneeling,kibosh,jumpsuit,joliet,jogger,janover,jakovasaurs,irreparable,innocently,inigo,infomercial,inexplicable,indispensable,impregnated,impossibly,imitating,hunches,hummus,houmfort,hothead,hostiles,hooves,hooligans,homos,homie,hisself,heyyy,hesitant,hangout,handsomest,handouts,hairless,gwennie,guzzling,guinevere,grungy,goading,glaring,gavel,gardino,gangrene,fruitful,friendlier,freckle,freakish,forthright,forearm,footnote,flops,fixer,firecracker,finito,figgered,fezzik,fastened,farfetched,fanciful,familiarize,faire,fahrenheit,extravaganza,exploratory,explanatory,everglades,eunuch,estas,escapade,erasers,emptying,embarassing,dweeb,dutiful,dumplings,dries,drafty,dollhouse,dismissing,disgraced,discrepancies,disbelief,disagreeing,digestion,didnt,deviled,deviated,demerol,delectable,decaying,decadent,dears,dateless,d'algout,cultivating,cryto,crumpled,crumbled,cronies,crease,craves,cozying,corduroy,congratulated,confidante,compressions,complicating,compadre,coerce,classier,chums,chumash,chivalrous,chinpoko,charred,chafing,celibacy,carted,carryin,carpeting,carotid,cannibals,candor,butterscotch,busts,busier,bullcrap,buggin,brookside,brodski,brassiere,brainwash,brainiac,botrelle,bonbon,boatload,blimey,blaring,blackness,bipartisan,bimbos,bigamist,biebe,biding,betrayals,bestow,bellerophon,bedpans,bassinet,basking,barzini,barnyard,barfed,backups,audited,asinine,asalaam,arouse,applejack,annoys,anchovies,ampule,alameida,aggravate,adage,accomplices,yokel,y'ever,wringer,witwer,withdrawals,windward,willfully,whorfin,whimsical,whimpering,weddin,weathered,warmest,wanton,volant,visceral,vindication,veggies,urinate,uproar,unwritten,unwrap,unsung,unsubstantiated,unspeakably,unscrupulous,unraveling,unquote,unqualified,unfulfilled,undetectable,underlined,unattainable,unappreciated,ummmm,ulcers,tylenol,tweak,turnin,tuatha,tropez,trellis,toppings,tootin,toodle,tinkering,thrives,thespis,theatrics,thatherton,tempers,tavington,tartar,tampon,swelled,sutures,sustenance,sunflowers,sublet,stubbins,strutting,strewn,stowaway,stoic,sternin,stabilizing,spiraling,spinster,speedometer,speakeasy,soooo,soiled,sneakin,smithereens,smelt,smacks,slaughterhouse,slacks,skids,sketching,skateboards,sizzling,sixes,sirree,simplistic,shouts,shorted,shoelace,sheeit,shards,shackled,sequestered,selmak,seduces,seclusion,seamstress,seabeas,scoops,scooped,scavenger,satch,s'more,rudeness,romancing,rioja,rifkin,rieper,revise,reunions,repugnant,replicating,repaid,renewing,relaxes,rekindle,regrettably,regenerate,reels,reciting,reappear,readin,ratting,rapes,rancher,rammed,rainstorm,railroading,queers,punxsutawney,punishes,pssst,prudy,proudest,protectors,procrastinating,proactive,priss,postmortem,pompoms,poise,pickings,perfectionist,peretti,people'll,pecking,patrolman,paralegal,paragraphs,paparazzi,pankot,pampering,overstep,overpower,outweigh,omnipotent,odious,nuwanda,nurtured,newsroom,neeson,needlepoint,necklaces,neato,muggers,muffler,mousy,mourned,mosey,mopey,mongolians,moldy,misinterpret,minibar,microfilm,mendola,mended,melissande,masturbating,masbath,manipulates,maimed,mailboxes,magnetism,m'lord,m'honey,lymph,lunge,lovelier,lefferts,leezak,ledgers,larraby,laloosh,kundun,kozinski,knockoff,kissin,kiosk,kennedys,kellman,karlo,kaleidoscope,jeffy,jaywalking,instructing,infraction,informer,infarction,impulsively,impressing,impersonated,impeach,idiocy,hyperbole,hurray,humped,huhuh,hsing,hordes,hoodlums,honky,hitchhiker,hideously,heaving,heathcliff,headgear,headboard,hazing,harem,handprint,hairspray,gutiurrez,goosebumps,gondola,glitches,gasping,frolic,freeways,frayed,fortitude,forgetful,forefathers,fonder,foiled,foaming,flossing,flailing,fitzgeralds,firehouse,finders,fiftieth,fellah,fawning,farquaad,faraway,fancied,extremists,exorcist,exhale,ethros,entrust,ennui,energized,encephalitis,embezzling,elster,elixir,electrolytes,duplex,dryers,drexl,dredging,drawback,don'ts,dobisch,divorcee,disrespected,disprove,disobeying,disinfectant,dingy,digress,dieting,dictating,devoured,devise,detonators,desist,deserter,derriere,deron,deceptive,debilitating,deathwok,daffodils,curtsy,cursory,cuppa,cumin,cronkite,cremation,credence,cranking,coverup,courted,countin,counselling,cornball,contentment,consensual,compost,cluett,cleverly,cleansed,cleanliness,chopec,chomp,chins,chime,cheswick,chessler,cheapest,chatted,cauliflower,catharsis,catchin,caress,camcorder,calorie,cackling,bystanders,buttoned,buttering,butted,buries,burgel,buffoon,brogna,bragged,boutros,bogeyman,blurting,blurb,blowup,bloodhound,blissful,birthmark,bigot,bestest,belted,belligerent,beggin,befall,beeswax,beatnik,beaming,barricade,baggoli,badness,awoke,artsy,artful,aroun,armpits,arming,annihilate,anise,angiogram,anaesthetic,amorous,ambiance,alligators,adoration,admittance,adama,abydos,zonked,zhivago,yorkin,wrongfully,writin,wrappers,worrywart,woops,wonderfalls,womanly,wickedness,whoopie,wholeheartedly,whimper,which'll,wheelchairs,what'ya,warranted,wallop,wading,wacked,virginal,vermouth,vermeil,verger,ventriss,veneer,vampira,utero,ushers,urgently,untoward,unshakable,unsettled,unruly,unlocks,ungodly,undue,uncooperative,uncontrollably,unbeatable,twitchy,tumbler,truest,triumphs,triplicate,tribbey,tortures,tongaree,tightening,thorazine,theres,testifies,teenaged,tearful,taxing,taldor,syllabus,swoops,swingin,suspending,sunburn,stuttering,stupor,strides,strategize,strangulation,stooped,stipulation,stingy,stapled,squeaks,squawking,spoilsport,splicing,spiel,spencers,spasms,spaniard,softener,sodding,soapbox,smoldering,smithbauer,skittish,sifting,sickest,sicilians,shuffling,shrivel,segretti,seeping,securely,scurrying,scrunch,scrote,screwups,schenkman,sawing,savin,satine,sapiens,salvaging,salmonella,sacrilege,rumpus,ruffle,roughing,rotted,rondall,ridding,rickshaw,rialto,rhinestone,restrooms,reroute,requisite,repress,rednecks,redeeming,rayed,ravell,raked,raincheck,raffi,racked,pushin,profess,prodding,procure,presuming,preppy,prednisone,potted,posttraumatic,poorhouse,podiatrist,plowed,pledging,playroom,plait,placate,pinback,picketing,photographing,pharoah,petrak,petal,persecuting,perchance,pellets,peeved,peerless,payable,pauses,pathologist,pagliacci,overwrought,overreaction,overqualified,overheated,outcasts,otherworldly,opinionated,oodles,oftentimes,occured,obstinate,nutritionist,numbness,nubile,nooooooo,nobodies,nepotism,neanderthals,mushu,mucus,mothering,mothballs,monogrammed,molesting,misspoke,misspelled,misconstrued,miscalculated,minimums,mince,mildew,mighta,middleman,mementos,mellowed,mayol,mauled,massaged,marmalade,mardi,makings,lundegaard,lovingly,loudest,lotto,loosing,loompa,looming,longs,loathes,littlest,littering,lifelike,legalities,laundered,lapdog,lacerations,kopalski,knobs,knitted,kittridge,kidnaps,kerosene,karras,jungles,jockeys,iranoff,invoices,invigorating,insolence,insincere,insectopia,inhumane,inhaling,ingrates,infestation,individuality,indeterminate,incomprehensible,inadequacy,impropriety,importer,imaginations,illuminating,ignite,hysterics,hypodermic,hyperventilate,hyperactive,humoring,honeymooning,honed,hoist,hoarding,hitching,hiker,hightail,hemoglobin,hell'd,heinie,growin,grasped,grandparent,granddaughters,gouged,goblins,gleam,glades,gigantor,get'em,geriatric,gatekeeper,gargoyles,gardenias,garcon,garbo,gallows,gabbing,futon,fulla,frightful,freshener,fortuitous,forceps,fogged,fodder,foamy,flogging,flaun,flared,fireplaces,feverish,favell,fattest,fattening,fallow,extraordinaire,evacuating,errant,envied,enchant,enamored,egocentric,dussander,dunwitty,dullest,dropout,dredged,dorsia,doornail,donot,dongs,dogged,dodgy,ditty,dishonorable,discriminating,discontinue,dings,dilly,dictation,dialysis,delly,delightfully,daryll,dandruff,cruddy,croquet,cringe,crimp,credo,crackling,courtside,counteroffer,counterfeiting,corrupting,copping,conveyor,contusions,contusion,conspirator,consoling,connoisseur,confetti,composure,compel,colic,coddle,cocksuckers,coattails,cloned,claustrophobia,clamoring,churn,chugga,chirping,chasin,chapped,chalkboard,centimeter,caymans,catheter,casings,caprica,capelli,cannolis,cannoli,camogli,camembert,butchers,butchered,busboys,bureaucrats,buckled,bubbe,brownstone,bravely,brackley,bouquets,botox,boozing,boosters,bodhi,blunders,blunder,blockage,biocyte,betrays,bested,beryllium,beheading,beggar,begbie,beamed,bastille,barstool,barricades,barbecues,barbecued,bandwagon,backfiring,bacarra,avenged,autopsies,aunties,associating,artichoke,arrowhead,appendage,apostrophe,antacid,ansel,annul,amuses,amped,amicable,amberg,alluring,adversaries,admirers,adlai,acupuncture,abnormality,aaaahhhh,zooming,zippity,zipping,zeroed,yuletide,yoyodyne,yengeese,yeahhh,wrinkly,wracked,withered,winks,windmills,whopping,wendle,weigart,waterworks,waterbed,watchful,wantin,wagging,waaah,vying,ventricle,varnish,vacuumed,unreachable,unprovoked,unmistakable,unfriendly,unfolding,underpaid,uncuff,unappealing,unabomber,typhoid,tuxedos,tushie,turds,tumnus,troubadour,trinium,treaters,treads,transpired,transgression,tought,thready,thins,thinners,techs,teary,tattaglia,tassels,tarzana,tanking,tablecloths,synchronize,symptomatic,sycophant,swimmingly,sweatshop,surfboard,superpowers,sunroom,sunblock,sugarplum,stupidly,strumpet,strapless,stooping,stools,stealthy,stalks,stairmaster,staffer,sshhh,squatting,squatters,spectacularly,sorbet,socked,sociable,snubbed,snorting,sniffles,snazzy,snakebite,smuggler,smorgasbord,smooching,slurping,slouch,slingshot,slaved,skimmed,sisterhood,silliest,sidarthur,sheraton,shebang,sharpening,shanghaied,shakers,sendoff,scurvy,scoliosis,scaredy,scagnetti,sawchuk,saugus,sasquatch,sandbag,saltines,s'pose,roston,rostle,riveting,ristle,rifling,revulsion,reverently,retrograde,restful,resents,reptilian,reorganize,renovating,reiterate,reinvent,reinmar,reibers,reechard,recuse,reconciling,recognizance,reclaiming,recitation,recieved,rebate,reacquainted,rascals,railly,quintuplets,quahog,pygmies,puzzling,punctuality,prosthetic,proms,probie,preys,preserver,preppie,poachers,plummet,plumbers,plannin,pitying,pitfalls,piqued,pinecrest,pinches,pillage,pigheaded,physique,pessimistic,persecute,perjure,percentile,pentothal,pensky,penises,peini,pazzi,pastels,parlour,paperweight,pamper,pained,overwhelm,overalls,outrank,outpouring,outhouse,outage,ouija,obstructed,obsessions,obeying,obese,o'riley,o'higgins,nosebleeds,norad,noooooooo,nononono,nonchalant,nippy,neurosis,nekhorvich,necronomicon,naquada,n'est,mystik,mystified,mumps,muddle,mothership,moped,monumentally,monogamous,mondesi,misogynistic,misinterpreting,mindlock,mending,megaphone,meeny,medicating,meanie,masseur,markstrom,marklars,margueritas,manifesting,maharajah,lukewarm,loveliest,loran,lizardo,liquored,lipped,lingers,limey,lemkin,leisurely,lathe,latched,lapping,ladle,krevlorneswath,kosygin,khakis,kenaru,keats,kaitlan,julliard,jollies,jaundice,jargon,jackals,invisibility,insipid,inflamed,inferiority,inexperience,incinerated,incinerate,incendiary,incan,inbred,implicating,impersonator,hunks,horsing,hooded,hippopotamus,hiked,hetson,hetero,hessian,henslowe,hendler,hellstrom,headstone,hayloft,harbucks,handguns,hallucinate,haldol,haggling,gynaecologist,gulag,guilder,guaranteeing,groundskeeper,grindstone,grimoir,grievance,griddle,gribbit,greystone,graceland,gooders,goeth,gentlemanly,gelatin,gawking,ganged,fukes,fromby,frenchmen,foursome,forsley,forbids,footwork,foothold,floater,flinging,flicking,fittest,fistfight,fireballs,fillings,fiddling,fennyman,felonious,felonies,feces,favoritism,fatten,fanatics,faceman,excusing,excepted,entwined,entree,ensconced,eladio,ehrlichman,easterland,dueling,dribbling,drape,downtrodden,doused,dosed,dorleen,dokie,distort,displeased,disown,dismount,disinherited,disarmed,disapproves,diperna,dined,diligent,dicaprio,depress,decoded,debatable,dealey,darsh,damsels,damning,dad'll,d'oeuvre,curlers,curie,cubed,crikey,crepes,countrymen,cornfield,coppers,copilot,copier,cooing,conspiracies,consigliere,condoning,commoner,commies,combust,comas,colds,clawed,clamped,choosy,chomping,chimps,chigorin,chianti,cheep,checkups,cheaters,celibate,cautiously,cautionary,castell,carpentry,caroling,carjacking,caritas,caregiver,cardiology,candlesticks,canasta,cain't,burro,burnin,bunking,bumming,bullwinkle,brummel,brooms,brews,breathin,braslow,bracing,botulism,boorish,bloodless,blayne,blatantly,blankie,bedbugs,becuase,barmaid,bared,baracus,banal,bakes,backpacks,attentions,atrocious,ativan,athame,asunder,astound,assuring,aspirins,asphyxiation,ashtrays,aryans,arnon,apprehension,applauding,anvil,antiquing,antidepressants,annoyingly,amputate,altruistic,alotta,alerting,afterthought,affront,affirm,actuality,abysmal,absentee,yeller,yakushova,wuzzy,wriggle,worrier,woogyman,womanizer,windpipe,windbag,willin,whisking,whimsy,wendall,weeny,weensy,weasels,watery,watcha,wasteful,waski,washcloth,waaay,vouched,viznick,ventriloquist,vendettas,veils,vayhue,vamanos,vadimus,upstage,uppity,unsaid,unlocking,unintentionally,undetected,undecided,uncaring,unbearably,tween,tryout,trotting,trini,trimmings,trickier,treatin,treadstone,trashcan,transcendent,tramps,townsfolk,torturous,torrid,toothpicks,tolerable,tireless,tiptoeing,timmay,tillinghouse,tidying,tibia,thumbing,thrusters,thrashing,these'll,thatos,testicular,teriyaki,tenors,tenacity,tellers,telemetry,tarragon,switchblade,swicker,swells,sweatshirts,swatches,surging,supremely,sump'n,succumb,subsidize,stumbles,stuffs,stoppin,stipulate,stenographer,steamroll,stasis,stagger,squandered,splint,splendidly,splashy,splashing,specter,sorcerers,somewheres,somber,snuggled,snowmobile,sniffed,snags,smugglers,smudged,smirking,smearing,slings,sleet,sleepovers,sleek,slackers,siree,siphoning,singed,sincerest,sickened,shuffled,shriveled,shorthanded,shittin,shish,shipwrecked,shins,sheetrock,shawshank,shamu,sha're,servitude,sequins,seascape,scrapings,scoured,scorching,sandpaper,saluting,salud,ruffled,roughnecks,rougher,rosslyn,rosses,roost,roomy,romping,revolutionize,reprimanded,refute,refrigerated,reeled,redundancies,rectal,recklessly,receding,reassignment,reapers,readout,ration,raring,ramblings,raccoons,quarantined,purging,punters,psychically,premarital,pregnancies,predisposed,precautionary,pollute,podunk,plums,plaything,pixilated,pitting,piranhas,pieced,piddles,pickled,photogenic,phosphorous,pffft,pestilence,pessimist,perspiration,perps,penticoff,passageways,pardons,panics,pancamo,paleontologist,overwhelms,overstating,overpaid,overdid,outlive,orthodontist,orgies,oreos,ordover,ordinates,ooooooh,oooohhh,omelettes,officiate,obtuse,obits,nymph,novocaine,noooooooooo,nipping,nilly,nightstick,negate,neatness,natured,narcotic,narcissism,namun,nakatomi,murky,muchacho,mouthwash,motzah,morsel,morph,morlocks,mooch,moloch,molest,mohra,modus,modicum,mockolate,misdemeanors,miscalculation,middies,meringue,mercilessly,meditating,mayakovsky,maximillian,marlee,markovski,maniacal,maneuvered,magnificence,maddening,lutze,lunged,lovelies,lorry,loosening,lookee,littered,lilac,lightened,laces,kurzon,kurtzweil,kind've,kimono,kenji,kembu,keanu,kazuo,jonesing,jilted,jiggling,jewelers,jewbilee,jacqnoud,jacksons,ivories,insurmountable,innocuous,innkeeper,infantery,indulged,indescribable,incoherent,impervious,impertinent,imperfections,hunnert,huffy,horsies,horseradish,hollowed,hogwash,hockley,hissing,hiromitsu,hidin,hereafter,helpmann,hehehe,haughty,happenings,hankie,handsomely,halliwells,haklar,haise,gunsights,grossly,grope,grocer,grits,gripping,grabby,glorificus,gizzard,gilardi,gibarian,geminon,gasses,garnish,galloping,gairwyn,futterman,futility,fumigated,fruitless,friendless,freon,foregone,forego,floored,flighty,flapjacks,fizzled,ficus,festering,farbman,fabricate,eyghon,extricate,exalted,eventful,esophagus,enterprising,entail,endor,emphatically,embarrasses,electroshock,easel,duffle,drumsticks,dissection,dissected,disposing,disparaging,disorientation,disintegrated,disarming,devoting,dessaline,deprecating,deplorable,delve,degenerative,deduct,decomposed,deathly,dearie,daunting,dankova,cyclotron,cyberspace,cutbacks,culpable,cuddled,crumpets,cruelly,crouching,cranium,cramming,cowering,couric,cordesh,conversational,conclusively,clung,clotting,cleanest,chipping,chimpanzee,chests,cheapen,chainsaws,censure,catapult,caravaggio,carats,captivating,calrissian,butlers,busybody,bussing,bunion,bulimic,budging,brung,browbeat,brokenhearted,brecher,breakdowns,bracebridge,boning,blowhard,blisters,blackboard,bigotry,bialy,bhamra,bended,begat,battering,baste,basquiat,barricaded,barometer,balled,baited,badenweiler,backhand,ascenscion,argumentative,appendicitis,apparition,anxiously,antagonistic,angora,anacott,amniotic,ambience,alonna,aleck,akashic,ageless,abouts,aawwww,aaaaarrrrrrggghhh,aaaaaa,zendi,yuppies,yodel,y'hear,wrangle,wombosi,wittle,withstanding,wisecracks,wiggling,wierd,whittlesley,whipper,whattya,whatsamatter,whatchamacallit,whassup,whad'ya,weakling,warfarin,waponis,wampum,wadn't,vorash,vizzini,virtucon,viridiana,veracity,ventilated,varicose,varcon,vandalized,vamos,vamoose,vaccinated,vacationing,usted,urinal,uppers,unwittingly,unsealed,unplanned,unhinged,unhand,unfathomable,unequivocally,unbreakable,unadvisedly,udall,tynacorp,tuxes,tussle,turati,tunic,tsavo,trussed,troublemakers,trollop,tremors,transsexual,transfusions,toothbrushes,toned,toddlers,tinted,tightened,thundering,thorpey,this'd,thespian,thaddius,tenuous,tenths,tenement,telethon,teleprompter,teaspoon,taunted,tattle,tardiness,taraka,tappy,tapioca,tapeworm,talcum,tacks,swivel,swaying,superpower,summarize,sumbitch,sultry,suburbia,styrofoam,stylings,strolls,strobe,stockpile,stewardesses,sterilized,sterilize,stealin,stakeouts,squawk,squalor,squabble,sprinkled,sportsmanship,spokes,spiritus,sparklers,spareribs,sowing,sororities,sonovabitch,solicit,softy,softness,softening,snuggling,snatchers,snarling,snarky,snacking,smears,slumped,slowest,slithering,sleazebag,slayed,slaughtering,skidded,skated,sivapathasundaram,sissies,silliness,silences,sidecar,sicced,shylock,shtick,shrugged,shriek,shoves,should'a,shortcake,shockingly,shirking,shaves,shatner,sharpener,shapely,shafted,sexless,septum,selflessness,seabea,scuff,screwball,scoping,scooch,scolding,schnitzel,schemed,scalper,santy,sankara,sanest,salesperson,sakulos,safehouse,sabers,runes,rumblings,rumbling,ruijven,ringers,righto,rhinestones,retrieving,reneging,remodelling,relentlessly,regurgitate,refills,reeking,reclusive,recklessness,recanted,ranchers,rafer,quaking,quacks,prophesied,propensity,profusely,problema,prided,prays,postmark,popsicles,poodles,pollyanna,polaroids,pokes,poconos,pocketful,plunging,plugging,pleeease,platters,pitied,pinetti,piercings,phooey,phonies,pestering,periscope,pentagram,pelts,patronized,paramour,paralyze,parachutes,pales,paella,paducci,owatta,overdone,overcrowded,overcompensating,ostracized,ordinate,optometrist,operandi,omens,okayed,oedipal,nuttier,nuptial,nunheim,noxious,nourish,notepad,nitroglycerin,nibblet,neuroses,nanosecond,nabbit,mythic,munchkins,multimillion,mulroney,mucous,muchas,mountaintop,morlin,mongorians,moneybags,mom'll,molto,mixup,misgivings,mindset,michalchuk,mesmerized,merman,mensa,meaty,mbwun,materialize,materialistic,masterminded,marginally,mapuhe,malfunctioning,magnify,macnamara,macinerney,machinations,macadamia,lysol,lurks,lovelorn,lopsided,locator,litback,litany,linea,limousines,limes,lighters,liebkind,levity,levelheaded,letterhead,lesabre,leron,lepers,lefts,leftenant,laziness,layaway,laughlan,lascivious,laryngitis,lapsed,landok,laminated,kurten,kobol,knucklehead,knowed,knotted,kirkeby,kinsa,karnovsky,jolla,jimson,jettison,jeric,jawed,jankis,janitors,jango,jalopy,jailbreak,jackers,jackasses,invalidate,intercepting,intercede,insinuations,infertile,impetuous,impaled,immerse,immaterial,imbeciles,imagines,idyllic,idolized,icebox,i'd've,hypochondriac,hyphen,hurtling,hurried,hunchback,hullo,horsting,hoooo,homeboys,hollandaise,hoity,hijinks,hesitates,herrero,herndorff,helplessly,heeyy,heathen,hearin,headband,harrassment,harpies,halstrom,hahahahaha,hacer,grumbling,grimlocks,grift,greets,grandmothers,grander,grafts,gordievsky,gondorff,godorsky,glscripts,gaudy,gardeners,gainful,fuses,fukienese,frizzy,freshness,freshening,fraught,frantically,foxbooks,fortieth,forked,foibles,flunkies,fleece,flatbed,fisted,firefight,fingerpaint,filibuster,fhloston,fenceline,femur,fatigues,fanucci,fantastically,familiars,falafel,fabulously,eyesore,expedient,ewwww,eviscerated,erogenous,epidural,enchante,embarassed,embarass,embalming,elude,elspeth,electrocute,eigth,eggshell,echinacea,eases,earpiece,earlobe,dumpsters,dumbshit,dumbasses,duloc,duisberg,drummed,drinkers,dressy,dorma,doily,divvy,diverting,dissuade,disrespecting,displace,disorganized,disgustingly,discord,disapproving,diligence,didja,diced,devouring,detach,destructing,desolate,demerits,delude,delirium,degrade,deevak,deemesa,deductions,deduce,debriefed,deadbeats,dateline,darndest,damnable,dalliance,daiquiri,d'agosta,cussing,cryss,cripes,cretins,crackerjack,cower,coveting,couriers,countermission,cotswolds,convertibles,conversationalist,consorting,consoled,consarn,confides,confidentially,commited,commiserate,comme,comforter,comeuppance,combative,comanches,colosseum,colling,coexist,coaxing,cliffside,chutes,chucked,chokes,childlike,childhoods,chickening,chenowith,charmingly,changin,catsup,captioning,capsize,cappucino,capiche,candlewell,cakewalk,cagey,caddie,buxley,bumbling,bulky,buggered,brussel,brunettes,brumby,brotha,bronck,brisket,bridegroom,braided,bovary,bookkeeper,bluster,bloodline,blissfully,blase,billionaires,bicker,berrisford,bereft,berating,berate,bendy,belive,belated,beikoku,beens,bedspread,bawdy,barreling,baptize,banya,balthazar,balmoral,bakshi,bails,badgered,backstreet,awkwardly,auras,attuned,atheists,astaire,assuredly,arrivederci,appetit,appendectomy,apologetic,antihistamine,anesthesiologist,amulets,albie,alarmist,aiight,adstream,admirably,acquaint,abound,abominable,aaaaaaah,zekes,zatunica,wussy,worded,wooed,woodrell,wiretap,windowsill,windjammer,windfall,whisker,whims,whatiya,whadya,weirdly,weenies,waunt,washout,wanto,waning,victimless,verdad,veranda,vandaley,vancomycin,valise,vaguest,upshot,unzip,unwashed,untrained,unstuck,unprincipled,unmentionables,unjustly,unfolds,unemployable,uneducated,unduly,undercut,uncovering,unconsciousness,unconsciously,tyndareus,turncoat,turlock,tulle,tryouts,trouper,triplette,trepkos,tremor,treeger,trapeze,traipse,tradeoff,trach,torin,tommorow,tollan,toity,timpani,thumbprint,thankless,tell'em,telepathy,telemarketing,telekinesis,teevee,teeming,tarred,tambourine,talentless,swooped,switcheroo,swirly,sweatpants,sunstroke,suitors,sugarcoat,subways,subterfuge,subservient,subletting,stunningly,strongbox,striptease,stravanavitch,stradling,stoolie,stodgy,stocky,stifle,stealer,squeezes,squatter,squarely,sprouted,spool,spindly,speedos,soups,soundly,soulmates,somebody'll,soliciting,solenoid,sobering,snowflakes,snowballs,snores,slung,slimming,skulk,skivvies,skewered,skewer,sizing,sistine,sidebar,sickos,shushing,shunt,shugga,shone,shol'va,sharpened,shapeshifter,shadowing,shadoe,selectman,sefelt,seared,scrounging,scribbling,scooping,scintillating,schmoozing,scallops,sapphires,sanitarium,sanded,safes,rudely,roust,rosebush,rosasharn,rondell,roadhouse,riveted,rewrote,revamp,retaliatory,reprimand,replicators,replaceable,remedied,relinquishing,rejoicing,reincarnated,reimbursed,reevaluate,redid,redefine,recreating,reconnected,rebelling,reassign,rearview,rayne,ravings,ratso,rambunctious,radiologist,quiver,quiero,queef,qualms,pyrotechnics,pulsating,psychosomatic,proverb,promiscuous,profanity,prioritize,preying,predisposition,precocious,precludes,prattling,prankster,povich,potting,postpartum,porridge,polluting,plowing,pistachio,pissin,pickpocket,physicals,peruse,pertains,personified,personalize,perjured,perfecting,pepys,pepperdine,pembry,peering,peels,pedophile,patties,passkey,paratrooper,paraphernalia,paralyzing,pandering,paltry,palpable,pagers,pachyderm,overstay,overestimated,overbite,outwit,outgrow,outbid,ooops,oomph,oohhh,oldie,obliterate,objectionable,nygma,notting,noches,nitty,nighters,newsstands,newborns,neurosurgery,nauseated,nastiest,narcolepsy,mutilate,muscled,murmur,mulva,mulling,mukada,muffled,morgues,moonbeams,monogamy,molester,molestation,molars,moans,misprint,mismatched,mirth,mindful,mimosas,millander,mescaline,menstrual,menage,mellowing,medevac,meddlesome,matey,manicures,malevolent,madmen,macaroons,lydell,lycra,lunchroom,lunching,lozenges,looped,litigious,liquidate,linoleum,lingk,limitless,limber,lilacs,ligature,liftoff,lemmiwinks,leggo,learnin,lazarre,lawyered,lactose,knelt,kenosha,kemosabe,jussy,junky,jordy,jimmies,jeriko,jakovasaur,issacs,isabela,irresponsibility,ironed,intoxication,insinuated,inherits,ingest,ingenue,inflexible,inflame,inevitability,inedible,inducement,indignant,indictments,indefensible,incomparable,incommunicado,improvising,impounded,illogical,ignoramus,hydrochloric,hydrate,hungover,humorless,humiliations,hugest,hoverdrone,hovel,hmmph,hitchhike,hibernating,henchman,helloooo,heirlooms,heartsick,headdress,hatches,harebrained,hapless,hanen,handsomer,hallows,habitual,guten,gummy,guiltier,guidebook,gstaad,gruff,griss,grieved,grata,gorignak,goosed,goofed,glowed,glitz,glimpses,glancing,gilmores,gianelli,geraniums,garroway,gangbusters,gamblers,galls,fuddy,frumpy,frowning,frothy,fro'tak,frere,fragrances,forgettin,follicles,flowery,flophouse,floatin,flirts,flings,flatfoot,fingerprinting,fingerprinted,fingering,finald,fillet,fianc,femoral,federales,fawkes,fascinates,farfel,fambly,falsified,fabricating,exterminators,expectant,excusez,excrement,excercises,evian,etins,esophageal,equivalency,equate,equalizer,entrees,enquire,endearment,empathetic,emailed,eggroll,earmuffs,dyslexic,duper,duesouth,drunker,druggie,dreadfully,dramatics,dragline,downplay,downers,dominatrix,doers,docket,docile,diversify,distracts,disloyalty,disinterested,discharging,disagreeable,dirtier,dinghy,dimwitted,dimoxinil,dimmy,diatribe,devising,deviate,detriment,desertion,depressants,depravity,deniability,delinquents,defiled,deepcore,deductive,decimate,deadbolt,dauthuille,dastardly,daiquiris,daggers,dachau,curiouser,curdled,cucamonga,cruller,cruces,crosswalk,crinkle,crescendo,cremate,counseled,couches,cornea,corday,copernicus,contrition,contemptible,constipated,conjoined,confounded,condescend,concoct,conch,compensating,committment,commandeered,comely,coddled,cockfight,cluttered,clunky,clownfish,cloaked,clenched,cleanin,civilised,circumcised,cimmeria,cilantro,chutzpah,chucking,chiseled,chicka,chattering,cervix,carrey,carpal,carnations,cappuccinos,candied,calluses,calisthenics,bushy,burners,budington,buchanans,brimming,braids,boycotting,bouncers,botticelli,botherin,bookkeeping,bogyman,bogged,bloodthirsty,blintzes,blanky,binturong,billable,bigboote,bewildered,betas,bequeath,behoove,befriend,bedpost,bedded,baudelaires,barreled,barboni,barbeque,bangin,baltus,bailout,backstabber,baccarat,awning,augie,arguillo,archway,apricots,apologising,annyong,anchorman,amenable,amazement,allspice,alannis,airfare,airbags,ahhhhhhhhh,ahhhhhhhh,ahhhhhhh,agitator,adrenal,acidosis,achoo,accessorizing,accentuate,abrasions,abductor,aaaahhh,aaaaaaaa,aaaaaaa,zeroing,zelner,zeldy,yevgeny,yeska,yellows,yeesh,yeahh,yamuri,wouldn't've,workmanship,woodsman,winnin,winked,wildness,whoring,whitewash,whiney,when're,wheezer,wheelman,wheelbarrow,westerburg,weeding,watermelons,washboard,waltzes,wafting,voulez,voluptuous,vitone,vigilantes,videotaping,viciously,vices,veruca,vermeer,verifying,vasculitis,valets,upholstered,unwavering,untold,unsympathetic,unromantic,unrecognizable,unpredictability,unmask,unleashing,unintentional,unglued,unequivocal,underrated,underfoot,unchecked,unbutton,unbind,unbiased,unagi,uhhhhh,tugging,triads,trespasses,treehorn,traviata,trappers,transplants,trannie,tramping,tracheotomy,tourniquet,tooty,toothless,tomarrow,toasters,thruster,thoughtfulness,thornwood,tengo,tenfold,telltale,telephoto,telephoned,telemarketer,tearin,tastic,tastefully,tasking,taser,tamed,tallow,taketh,taillight,tadpoles,tachibana,syringes,sweated,swarthy,swagger,surges,supermodels,superhighway,sunup,sun'll,sulfa,sugarless,sufficed,subside,strolled,stringy,strengthens,straightest,straightens,storefront,stopper,stockpiling,stimulant,stiffed,steyne,sternum,stepladder,stepbrother,steers,steelheads,steakhouse,stathis,stankylecartmankennymr,standoffish,stalwart,squirted,spritz,sprig,sprawl,spousal,sphincter,spenders,spearmint,spatter,spangled,southey,soured,sonuvabitch,somethng,snuffed,sniffs,smokescreen,smilin,slobs,sleepwalker,sleds,slays,slayage,skydiving,sketched,skanks,sixed,siphoned,siphon,simpering,sigfried,sidearm,siddons,sickie,shuteye,shuffleboard,shrubberies,shrouded,showmanship,shouldn't've,shoplift,shiatsu,sentries,sentance,sensuality,seething,secretions,searing,scuttlebutt,sculpt,scowling,scouring,scorecard,schoolers,schmucks,scepters,scaly,scalps,scaffolding,sauces,sartorius,santen,salivating,sainthood,saget,saddens,rygalski,rusting,ruination,rueland,rudabaga,rottweiler,roofies,romantics,rollerblading,roldy,roadshow,rickets,rible,rheza,revisiting,retentive,resurface,restores,respite,resounding,resorting,resists,repulse,repressing,repaying,reneged,refunds,rediscover,redecorated,reconstructive,recommitted,recollect,receptacle,reassess,reanimation,realtors,razinin,rationalization,ratatouille,rashum,rasczak,rancheros,rampler,quizzing,quips,quartered,purring,pummeling,puede,proximo,prospectus,pronouncing,prolonging,procreation,proclamations,principled,prides,preoccupation,prego,precog,prattle,pounced,potshots,potpourri,porque,pomegranates,polenta,plying,pluie,plesac,playmates,plantains,pillowcase,piddle,pickers,photocopied,philistine,perpetuate,perpetually,perilous,pawned,pausing,pauper,parter,parlez,parlay,pally,ovulation,overtake,overstate,overpowering,overpowered,overconfident,overbooked,ovaltine,outweighs,outings,ottos,orrin,orifice,orangutan,oopsy,ooooooooh,oooooo,ooohhhh,ocular,obstruct,obscenely,o'dwyer,nutjob,nunur,notifying,nostrand,nonny,nonfat,noblest,nimble,nikes,nicht,newsworthy,nestled,nearsighted,ne'er,nastier,narco,nakedness,muted,mummified,mudda,mozzarella,moxica,motivator,motility,mothafucka,mortmain,mortgaged,mores,mongers,mobbed,mitigating,mistah,misrepresented,mishke,misfortunes,misdirection,mischievous,mineshaft,millaney,microwaves,metzenbaum,mccovey,masterful,masochistic,marliston,marijawana,manya,mantumbi,malarkey,magnifique,madrona,madox,machida,m'hidi,lullabies,loveliness,lotions,looka,lompoc,litterbug,litigator,lithe,liquorice,linds,limericks,lightbulb,lewises,letch,lemec,layover,lavatory,laurels,lateness,laparotomy,laboring,kuato,kroff,krispy,krauts,knuckleheads,kitschy,kippers,kimbrow,keypad,keepsake,kebab,karloff,junket,judgemental,jointed,jezzie,jetting,jeeze,jeeter,jeesus,jeebs,janeane,jails,jackhammer,ixnay,irritates,irritability,irrevocable,irrefutable,irked,invoking,intricacies,interferon,intents,insubordinate,instructive,instinctive,inquisitive,inlay,injuns,inebriated,indignity,indecisive,incisors,incacha,inalienable,impresses,impregnate,impregnable,implosion,idolizes,hypothyroidism,hypoglycemic,huseni,humvee,huddling,honing,hobnobbing,hobnob,histrionics,histamine,hirohito,hippocratic,hindquarters,hikita,hikes,hightailed,hieroglyphics,heretofore,herbalist,hehey,hedriks,heartstrings,headmistress,headlight,hardheaded,happend,handlebars,hagitha,habla,gyroscope,guys'd,guy'd,guttersnipe,grump,growed,grovelling,groan,greenbacks,gravedigger,grating,grasshoppers,grandiose,grandest,grafted,gooood,goood,gooks,godsakes,goaded,glamorama,giveth,gingham,ghostbusters,germane,georgy,gazzo,gazelles,gargle,garbled,galgenstein,gaffe,g'day,fyarl,furnish,furies,fulfills,frowns,frowned,frighteningly,freebies,freakishly,forewarned,foreclose,forearms,fordson,fonics,flushes,flitting,flemmer,flabby,fishbowl,fidgeting,fevers,feigning,faxing,fatigued,fathoms,fatherless,fancier,fanatical,factored,eyelid,eyeglasses,expresso,expletive,expectin,excruciatingly,evidentiary,ever'thing,eurotrash,eubie,estrangement,erlich,epitome,entrap,enclose,emphysema,embers,emasculating,eighths,eardrum,dyslexia,duplicitous,dumpty,dumbledore,dufus,duddy,duchamp,drunkenness,drumlin,drowns,droid,drinky,drifts,drawbridge,dramamine,douggie,douchebag,dostoyevsky,doodling,don'tcha,domineering,doings,dogcatcher,doctoring,ditzy,dissimilar,dissecting,disparage,disliking,disintegrating,dishwalla,dishonored,dishing,disengaged,disavowed,dippy,diorama,dimmed,dilate,digitalis,diggory,dicing,diagnosing,devola,desolation,dennings,denials,deliverance,deliciously,delicacies,degenerates,degas,deflector,defile,deference,decrepit,deciphered,dawdle,dauphine,daresay,dangles,dampen,damndest,cucumbers,cucaracha,cryogenically,croaks,croaked,criticise,crisper,creepiest,creams,crackle,crackin,covertly,counterintelligence,corrosive,cordially,cops'll,convulsions,convoluted,conversing,conga,confrontational,confab,condolence,condiments,complicit,compiegne,commodus,comings,cometh,collusion,collared,cockeyed,clobber,clemonds,clarithromycin,cienega,christmasy,christmassy,chloroform,chippie,chested,cheeco,checklist,chauvinist,chandlers,chambermaid,chakras,cellophane,caveat,cataloguing,cartmanland,carples,carny,carded,caramels,cappy,caped,canvassing,callback,calibrated,calamine,buttermilk,butterfingers,bunsen,bulimia,bukatari,buildin,budged,brobich,bringer,brendell,brawling,bratty,braised,boyish,boundless,botch,boosh,bookies,bonbons,bodes,bobunk,bluntly,blossoming,bloomers,bloodstains,bloodhounds,blech,biter,biometric,bioethics,bijan,bigoted,bicep,bereaved,bellowing,belching,beholden,beached,batmobile,barcodes,barch,barbecuing,bandanna,backwater,backtrack,backdraft,augustino,atrophy,atrocity,atley,atchoo,asthmatic,assoc,armchair,arachnids,aptly,appetizing,antisocial,antagonizing,anorexia,anini,andersons,anagram,amputation,alleluia,airlock,aimless,agonized,agitate,aggravating,aerosol,acing,accomplishing,accidently,abuser,abstain,abnormally,aberration,aaaaahh,zlotys,zesty,zerzura,zapruder,zantopia,yelburton,yeess,y'knowwhati'msayin,wwhat,wussies,wrenched,would'a,worryin,wormser,wooooo,wookiee,wolchek,wishin,wiseguys,windbreaker,wiggy,wieners,wiedersehen,whoopin,whittled,wherefore,wharvey,welts,wellstone,wedges,wavered,watchit,wastebasket,wango,waken,waitressed,wacquiem,vrykolaka,voula,vitally,visualizing,viciousness,vespers,vertes,verily,vegetarians,vater,vaporize,vannacutt,vallens,ussher,urinating,upping,unwitting,untangle,untamed,unsanitary,unraveled,unopened,unisex,uninvolved,uninteresting,unintelligible,unimaginative,undeserving,undermines,undergarments,unconcerned,tyrants,typist,tykes,tybalt,twosome,twits,tutti,turndown,tularemia,tuberculoma,tsimshian,truffaut,truer,truant,trove,triumphed,tripe,trigonometry,trifled,trifecta,tribulations,tremont,tremoille,transcends,trafficker,touchin,tomfoolery,tinkered,tinfoil,tightrope,thousan,thoracotomy,thesaurus,thawing,thatta,tessio,temps,taxidermist,tator,tachycardia,t'akaya,swelco,sweetbreads,swatting,supercollider,sunbathing,summarily,suffocation,sueleen,succinct,subsided,submissive,subjecting,subbing,subatomic,stupendous,stunted,stubble,stubbed,streetwalker,strategizing,straining,straightaway,stoli,stiffer,stickup,stens,steamroller,steadwell,steadfast,stateroom,stans,sshhhh,squishing,squinting,squealed,sprouting,sprimp,spreadsheets,sprawled,spotlights,spooning,spirals,speedboat,spectacles,speakerphone,southglen,souse,soundproof,soothsayer,sommes,somethings,solidify,soars,snorted,snorkeling,snitches,sniping,snifter,sniffin,snickering,sneer,snarl,smila,slinking,slanted,slanderous,slammin,skimp,skilosh,siteid,sirloin,singe,sighing,sidekicks,sicken,showstopper,shoplifter,shimokawa,sherborne,shavadai,sharpshooters,sharking,shagged,shaddup,senorita,sesterces,sensuous,seahaven,scullery,scorcher,schotzie,schnoz,schmooze,schlep,schizo,scents,scalping,scalped,scallop,scalding,sayeth,saybrooke,sawed,savoring,sardine,sandstorm,sandalwood,salutations,sagman,s'okay,rsvp'd,rousted,rootin,romper,romanovs,rollercoaster,rolfie,robinsons,ritzy,ritualistic,ringwald,rhymed,rheingold,rewrites,revoking,reverts,retrofit,retort,retinas,respirations,reprobate,replaying,repaint,renquist,renege,relapsing,rekindled,rejuvenating,rejuvenated,reinstating,recriminations,rechecked,reassemble,rears,reamed,reacquaint,rayanne,ravish,rathole,raspail,rarest,rapists,rants,racketeer,quittin,quitters,quintessential,queremos,quellek,quelle,quasimodo,pyromaniac,puttanesca,puritanical,purer,puree,pungent,pummel,puedo,psychotherapist,prosecutorial,prosciutto,propositioning,procrastination,probationary,primping,preventative,prevails,preservatives,preachy,praetorians,practicality,powders,potus,postop,positives,poser,portolano,portokalos,poolside,poltergeists,pocketed,poach,plummeted,plucking,plimpton,playthings,plastique,plainclothes,pinpointed,pinkus,pinks,pigskin,piffle,pictionary,piccata,photocopy,phobias,perignon,perfumes,pecks,pecked,patently,passable,parasailing,paramus,papier,paintbrush,pacer,paaiint,overtures,overthink,overstayed,overrule,overestimate,overcooked,outlandish,outgrew,outdoorsy,outdo,orchestrate,oppress,opposable,oooohh,oomupwah,okeydokey,okaaay,ohashi,of'em,obscenities,oakie,o'gar,nurection,nostradamus,norther,norcom,nooch,nonsensical,nipped,nimbala,nervously,neckline,nebbleman,narwhal,nametag,n'n't,mycenae,muzak,muumuu,mumbled,mulvehill,muggings,muffet,mouthy,motivates,motaba,moocher,mongi,moley,moisturize,mohair,mocky,mmkay,mistuh,missis,misdeeds,mincemeat,miggs,miffed,methadone,messieur,menopausal,menagerie,mcgillicuddy,mayflowers,matrimonial,matick,masai,marzipan,maplewood,manzelle,mannequins,manhole,manhandle,malfunctions,madwoman,machiavelli,lynley,lynched,lurconis,lujack,lubricant,looove,loons,loofah,lonelyhearts,lollipops,lineswoman,lifers,lexter,lepner,lemony,leggy,leafy,leadeth,lazerus,lazare,lawford,languishing,lagoda,ladman,kundera,krinkle,krendler,kreigel,kowolski,knockdown,knifed,kneed,kneecap,kids'll,kennie,kenmore,keeled,kazootie,katzenmoyer,kasdan,karak,kapowski,kakistos,julyan,jockstrap,jobless,jiggly,jaunt,jarring,jabbering,irrigate,irrevocably,irrationally,ironies,invitro,intimated,intently,intentioned,intelligently,instill,instigator,instep,inopportune,innuendoes,inflate,infects,infamy,indiscretions,indiscreet,indio,indignities,indict,indecision,inconspicuous,inappropriately,impunity,impudent,impotence,implicates,implausible,imperfection,impatience,immutable,immobilize,idealist,iambic,hysterically,hyperspace,hygienist,hydraulics,hydrated,huzzah,husks,hunched,huffed,hubris,hubbub,hovercraft,houngan,hosed,horoscopes,hopelessness,hoodwinked,honorably,honeysuckle,homegirl,holiest,hippity,hildie,hieroglyphs,hexton,herein,heckle,heaping,healthilizer,headfirst,hatsue,harlot,hardwired,halothane,hairstyles,haagen,haaaaa,gutting,gummi,groundless,groaning,gristle,grills,graynamore,grabbin,goodes,goggle,glittering,glint,gleaming,glassy,girth,gimbal,giblets,gellers,geezers,geeze,garshaw,gargantuan,garfunkel,gangway,gandarium,gamut,galoshes,gallivanting,gainfully,gachnar,fusionlips,fusilli,furiously,frugal,fricking,frederika,freckling,frauds,fountainhead,forthwith,forgo,forgettable,foresight,foresaw,fondling,fondled,fondle,folksy,fluttering,fluffing,floundering,flirtatious,flexing,flatterer,flaring,fixating,finchy,figurehead,fiendish,fertilize,ferment,fending,fellahs,feelers,fascinate,fantabulous,falsify,fallopian,faithless,fairer,fainter,failings,facetious,eyepatch,exxon,extraterrestrials,extradite,extracurriculars,extinguish,expunged,expelling,exorbitant,exhilarated,exertion,exerting,excercise,everbody,evaporated,escargot,escapee,erases,epizootics,epithelials,ephrum,entanglements,enslave,engrossed,emphatic,emeralds,ember,emancipated,elevates,ejaculate,effeminate,eccentricities,easygoing,earshot,dunks,dullness,dulli,dulled,drumstick,dropper,driftwood,dregs,dreck,dreamboat,draggin,downsizing,donowitz,dominoes,diversions,distended,dissipate,disraeli,disqualify,disowned,dishwashing,disciplining,discerning,disappoints,dinged,digested,dicking,detonating,despising,depressor,depose,deport,dents,defused,deflecting,decryption,decoys,decoupage,decompress,decibel,decadence,deafening,dawning,dater,darkened,dappy,dallying,dagon,czechoslovakians,cuticles,cuteness,cupboards,culottes,cruisin,crosshairs,cronyn,criminalistics,creatively,creaming,crapping,cranny,cowed,contradicting,constipation,confining,confidences,conceiving,conceivably,concealment,compulsively,complainin,complacent,compels,communing,commode,comming,commensurate,columnists,colonoscopy,colchicine,coddling,clump,clubbed,clowning,cliffhanger,clang,cissy,choosers,choker,chiffon,channeled,chalet,cellmates,cathartic,caseload,carjack,canvass,canisters,candlestick,candlelit,camry,calzones,calitri,caldy,byline,butterball,bustier,burlap,bureaucrat,buffoons,buenas,brookline,bronzed,broiled,broda,briss,brioche,briar,breathable,brays,brassieres,boysenberry,bowline,boooo,boonies,booklets,bookish,boogeyman,boogey,bogas,boardinghouse,bluuch,blundering,bluer,blowed,blotchy,blossomed,bloodwork,bloodied,blithering,blinks,blathering,blasphemous,blacking,birdson,bings,bfmid,bfast,bettin,berkshires,benjamins,benevolence,benched,benatar,bellybutton,belabor,behooves,beddy,beaujolais,beattle,baxworth,baseless,barfing,bannish,bankrolled,banek,ballsy,ballpoint,baffling,badder,badda,bactine,backgammon,baako,aztreonam,authoritah,auctioning,arachtoids,apropos,aprons,apprised,apprehensive,anythng,antivenin,antichrist,anorexic,anoint,anguished,angioplasty,angio,amply,ampicillin,amphetamines,alternator,alcove,alabaster,airlifted,agrabah,affidavits,admonished,admonish,addled,addendum,accuser,accompli,absurdity,absolved,abrusso,abreast,aboot,abductions,abducting,aback,ababwa,aaahhhh,zorin,zinthar,zinfandel,zillions,zephyrs,zatarcs,zacks,youuu,yokels,yardstick,yammer,y'understand,wynette,wrung,wreaths,wowed,wouldn'ta,worming,wormed,workday,woodsy,woodshed,woodchuck,wojadubakowski,withering,witching,wiseass,wiretaps,wining,willoby,wiccaning,whupped,whoopi,whoomp,wholesaler,whiteness,whiner,whatchya,wharves,wenus,weirdoes,weaning,watusi,waponi,waistband,wackos,vouching,votre,vivica,viveca,vivant,vivacious,visor,visitin,visage,vicrum,vetted,ventriloquism,venison,varnsen,vaporized,vapid,vanstock,uuuuh,ushering,urologist,urination,upstart,uprooted,unsubtitled,unspoiled,unseat,unseasonably,unseal,unsatisfying,unnerve,unlikable,unleaded,uninsured,uninspired,unicycle,unhooked,unfunny,unfreezing,unflattering,unfairness,unexpressed,unending,unencumbered,unearth,undiscovered,undisciplined,understan,undershirt,underlings,underline,undercurrent,uncivilized,uncharacteristic,umpteenth,uglies,tuney,trumps,truckasaurus,trubshaw,trouser,tringle,trifling,trickster,trespassers,trespasser,traumas,trattoria,trashes,transgressions,trampling,tp'ed,toxoplasmosis,tounge,tortillas,topsy,topple,topnotch,tonsil,tions,timmuh,timithious,tilney,tighty,tightness,tightens,tidbits,ticketed,thyme,threepio,thoughtfully,thorkel,thommo,thing'll,thefts,that've,thanksgivings,tetherball,testikov,terraforming,tepid,tendonitis,tenboom,telex,teenybopper,tattered,tattaglias,tanneke,tailspin,tablecloth,swooping,swizzle,swiping,swindled,swilling,swerving,sweatshops,swaddling,swackhammer,svetkoff,supossed,superdad,sumptuous,sugary,sugai,subvert,substantiate,submersible,sublimating,subjugation,stymied,strychnine,streetlights,strassmans,stranglehold,strangeness,straddling,straddle,stowaways,stotch,stockbrokers,stifling,stepford,steerage,steena,statuary,starlets,staggeringly,ssshhh,squaw,spurt,spungeon,spritzer,sprightly,sprays,sportswear,spoonful,splittin,splitsville,speedily,specialise,spastic,sparrin,souvlaki,southie,sourpuss,soupy,soundstage,soothes,somebody'd,softest,sociopathic,socialized,snyders,snowmobiles,snowballed,snatches,smugness,smoothest,smashes,sloshed,sleight,skyrocket,skied,skewed,sixpence,sipowicz,singling,simulates,shyness,shuvanis,showoff,shortsighted,shopkeeper,shoehorn,shithouse,shirtless,shipshape,shifu,shelve,shelbyville,sheepskin,sharpens,shaquille,shanshu,servings,sequined,seizes,seashells,scrambler,scopes,schnauzer,schmo,schizoid,scampered,savagely,saudis,santas,sandovals,sanding,saleswoman,sagging,s'cuse,rutting,ruthlessly,runneth,ruffians,rubes,rosalita,rollerblades,rohypnol,roasts,roadies,ritten,rippling,ripples,rigoletto,richardo,rethought,reshoot,reserving,reseda,rescuer,reread,requisitions,repute,reprogram,replenish,repetitious,reorganizing,reinventing,reinvented,reheat,refrigerators,reenter,recruiter,recliner,rawdy,rashes,rajeski,raison,raisers,rages,quinine,questscape,queller,pygmalion,pushers,pusan,purview,pumpin,pubescent,prudes,provolone,propriety,propped,procrastinate,processional,preyed,pretrial,portent,pooling,poofy,polloi,policia,poacher,pluses,pleasuring,platitudes,plateaued,plaguing,pittance,pinheads,pincushion,pimply,pimped,piggyback,piecing,phillipe,philipse,philby,pharaohs,petyr,petitioner,peshtigo,pesaram,persnickety,perpetrate,percolating,pepto,penne,penell,pemmican,peeks,pedaling,peacemaker,pawnshop,patting,pathologically,patchouli,pasts,pasties,passin,parlors,paltrow,palamon,padlock,paddling,oversleep,overheating,overdosed,overcharge,overblown,outrageously,ornery,opportune,oooooooooh,oohhhh,ohhhhhh,ogres,odorless,obliterated,nyong,nymphomaniac,ntozake,novocain,nough,nonnie,nonissue,nodules,nightmarish,nightline,niceties,newsman,needra,nedry,necking,navour,nauseam,nauls,narim,namath,nagged,naboo,n'sync,myslexia,mutator,mustafi,musketeer,murtaugh,murderess,munching,mumsy,muley,mouseville,mortifying,morgendorffers,moola,montel,mongoloid,molestered,moldings,mocarbies,mo'ss,mixers,misrell,misnomer,misheard,mishandled,miscreant,misconceptions,miniscule,millgate,mettle,metricconverter,meteors,menorah,mengele,melding,meanness,mcgruff,mcarnold,matzoh,matted,mastectomy,massager,marveling,marooned,marmaduke,marick,manhandled,manatees,man'll,maltin,maliciously,malfeasance,malahide,maketh,makeovers,maiming,machismo,lumpectomy,lumbering,lucci,lording,lorca,lookouts,loogie,loners,loathed,lissen,lighthearted,lifer,lickin,lewen,levitation,lestercorp,lessee,lentils,legislate,legalizing,lederhosen,lawmen,lasskopf,lardner,lambeau,lamagra,ladonn,lactic,lacquer,labatier,krabappel,kooks,knickknacks,klutzy,kleynach,klendathu,kinross,kinkaid,kind'a,ketch,kesher,karikos,karenina,kanamits,junshi,jumbled,joust,jotted,jobson,jingling,jigalong,jerries,jellies,jeeps,javna,irresistable,internist,intercranial,inseminated,inquisitor,infuriate,inflating,infidelities,incessantly,incensed,incase,incapacitate,inasmuch,inaccuracies,imploding,impeding,impediments,immaturity,illegible,iditarod,icicles,ibuprofen,i'i'm,hymie,hydrolase,hunker,humps,humons,humidor,humdinger,humbling,huggin,huffing,housecleaning,hothouse,hotcakes,hosty,hootenanny,hootchie,hoosegow,honks,honeymooners,homily,homeopathic,hitchhikers,hissed,hillnigger,hexavalent,hewwo,hershe,hermey,hergott,henny,hennigans,henhouse,hemolytic,helipad,heifer,hebrews,hebbing,heaved,headlock,harrowing,harnessed,hangovers,handi,handbasket,halfrek,hacene,gyges,guys're,gundersons,gumption,gruntmaster,grubs,grossie,groped,grins,greaseball,gravesite,gratuity,granma,grandfathers,grandbaby,gradski,gracing,gossips,gooble,goners,golitsyn,gofer,godsake,goddaughter,gnats,gluing,glares,givers,ginza,gimmie,gimmee,gennero,gemme,gazpacho,gazed,gassy,gargling,gandhiji,galvanized,gallbladder,gaaah,furtive,fumigation,fucka,fronkonsteen,frills,freezin,freewald,freeloader,frailty,forger,foolhardy,fondest,fomin,followin,follicle,flotation,flopping,floodgates,flogged,flicked,flenders,fleabag,fixings,fixable,fistful,firewater,firelight,fingerbang,finalizing,fillin,filipov,fiderer,felling,feldberg,feign,faunia,fatale,farkus,fallible,faithfulness,factoring,eyeful,extramarital,exterminated,exhume,exasperated,eviscerate,estoy,esmerelda,escapades,epoxy,enticed,enthused,entendre,engrossing,endorphins,emptive,emmys,eminently,embezzler,embarressed,embarrassingly,embalmed,eludes,eling,elated,eirie,egotitis,effecting,eerily,eecom,eczema,earthy,earlobes,eally,dyeing,dwells,duvet,duncans,dulcet,droves,droppin,drools,drey'auc,downriver,domesticity,dollop,doesnt,dobler,divulged,diversionary,distancing,dispensers,disorienting,disneyworld,dismissive,disingenuous,disheveled,disfiguring,dinning,dimming,diligently,dilettante,dilation,dickensian,diaphragms,devastatingly,destabilize,desecrate,deposing,deniece,demony,delving,delicates,deigned,defraud,deflower,defibrillator,defiantly,defenceless,defacing,deconstruction,decompose,deciphering,decibels,deceptively,deceptions,decapitation,debutantes,debonair,deadlier,dawdling,davic,darwinism,darnit,darks,danke,danieljackson,dangled,cytoxan,cutout,cutlery,curveball,curfews,cummerbund,crunches,crouched,crisps,cripples,crilly,cribs,crewman,creepin,creeds,credenza,creak,crawly,crawlin,crawlers,crated,crackheads,coworker,couldn't've,corwins,coriander,copiously,convenes,contraceptives,contingencies,contaminating,conniption,condiment,concocting,comprehending,complacency,commendatore,comebacks,com'on,collarbone,colitis,coldly,coiffure,coffers,coeds,codependent,cocksucking,cockney,cockles,clutched,closeted,cloistered,cleve,cleats,clarifying,clapped,cinnabar,chunnel,chumps,cholinesterase,choirboy,chocolatey,chlamydia,chigliak,cheesie,chauvinistic,chasm,chartreuse,charo,charnier,chapil,chalked,chadway,certifiably,cellulite,celled,cavalcade,cataloging,castrated,cassio,cashews,cartouche,carnivore,carcinogens,capulet,captivated,capt'n,cancellations,campin,callate,callar,caffeinated,cadavers,cacophony,cackle,buzzes,buttoning,busload,burglaries,burbs,buona,bunions,bullheaded,buffs,bucyk,buckling,bruschetta,browbeating,broomsticks,broody,bromly,brolin,briefings,brewskies,breathalyzer,breakups,bratwurst,brania,braiding,brags,braggin,bradywood,bottomed,bossa,bordello,bookshelf,boogida,bondsman,bolder,boggles,bludgeoned,blowtorch,blotter,blips,blemish,bleaching,blainetologists,blading,blabbermouth,birdseed,bimmel,biloxi,biggly,bianchinni,betadine,berenson,belus,belloq,begets,befitting,beepers,beelzebub,beefed,bedridden,bedevere,beckons,beaded,baubles,bauble,battleground,bathrobes,basketballs,basements,barroom,barnacle,barkin,barked,baretta,bangles,bangler,banality,bambang,baltar,ballplayers,bagman,baffles,backroom,babysat,baboons,averse,audiotape,auctioneer,atten,atcha,astonishment,arugula,arroz,antihistamines,annoyances,anesthesiology,anatomically,anachronism,amiable,amaretto,allahu,alight,aimin,ailment,afterglow,affronte,advil,adrenals,actualization,acrost,ached,accursed,accoutrements,absconded,aboveboard,abetted,aargh,aaaahh,zuwicky,zolda,ziploc,zakamatak,youve,yippie,yesterdays,yella,yearns,yearnings,yearned,yawning,yalta,yahtzee,y'mean,y'are,wuthering,wreaks,worrisome,workiiing,wooooooo,wonky,womanizing,wolodarsky,wiwith,withdraws,wishy,wisht,wipers,wiper,winos,windthorne,windsurfing,windermere,wiggled,wiggen,whwhat,whodunit,whoaaa,whittling,whitesnake,whereof,wheezing,wheeze,whatd'ya,whataya,whammo,whackin,wellll,weightless,weevil,wedgies,webbing,weasly,wayside,waxes,waturi,washy,washrooms,wandell,waitaminute,waddya,waaaah,vornac,vishnoor,virulent,vindictiveness,vinceres,villier,vigeous,vestigial,ventilate,vented,venereal,veering,veered,veddy,vaslova,valosky,vailsburg,vaginas,vagas,urethra,upstaged,uploading,unwrapping,unwieldy,untapped,unsatisfied,unquenchable,unnerved,unmentionable,unlovable,unknowns,uninformed,unimpressed,unhappily,unguarded,unexplored,undergarment,undeniably,unclench,unclaimed,uncharacteristically,unbuttoned,unblemished,ululd,uhhhm,tweeze,tutsami,tushy,tuscarora,turkle,turghan,turbinium,tubers,trucoat,troxa,tropicana,triquetra,trimmers,triceps,trespassed,traya,traumatizing,transvestites,trainors,tradin,trackers,townies,tourelles,toucha,tossin,tortious,topshop,topes,tonics,tongs,tomsk,tomorrows,toiling,toddle,tizzy,tippers,timmi,thwap,thusly,ththe,thrusts,throwers,throwed,throughway,thickening,thermonuclear,thelwall,thataway,terrifically,tendons,teleportation,telepathically,telekinetic,teetering,teaspoons,tarantulas,tapas,tanned,tangling,tamales,tailors,tahitian,tactful,tachy,tablespoon,syrah,synchronicity,synch,synapses,swooning,switchman,swimsuits,sweltering,sweetly,suvolte,suslov,surfed,supposition,suppertime,supervillains,superfluous,superego,sunspots,sunning,sunless,sundress,suckah,succotash,sublevel,subbasement,studious,striping,strenuously,straights,stonewalled,stillness,stilettos,stevesy,steno,steenwyck,stargates,stammering,staedert,squiggly,squiggle,squashing,squaring,spreadsheet,spramp,spotters,sporto,spooking,splendido,spittin,spirulina,spiky,spate,spartacus,spacerun,soonest,something'll,someth,somepin,someone'll,sofas,soberly,sobered,snowmen,snowbank,snowballing,snivelling,sniffling,snakeskin,snagging,smush,smooter,smidgen,smackers,slumlord,slossum,slimmer,slighted,sleepwalk,sleazeball,skokie,skeptic,sitarides,sistah,sipped,sindell,simpletons,simony,silkwood,silks,silken,sightless,sideboard,shuttles,shrugging,shrouds,showy,shoveled,shouldn'ta,shoplifters,shitstorm,sheeny,shapetype,shaming,shallows,shackle,shabbily,shabbas,seppuku,senility,semite,semiautomatic,selznick,secretarial,sebacio,scuzzy,scummy,scrutinized,scrunchie,scribbled,scotches,scolded,scissor,schlub,scavenging,scarin,scarfing,scallions,scald,savour,savored,saute,sarcoidosis,sandbar,saluted,salish,saith,sailboats,sagittarius,sacre,saccharine,sacamano,rushdie,rumpled,rumba,rulebook,rubbers,roughage,rotisserie,rootie,roofy,roofie,romanticize,rittle,ristorante,rippin,rinsing,ringin,rincess,rickety,reveling,retest,retaliating,restorative,reston,restaurateur,reshoots,resetting,resentments,reprogramming,repossess,repartee,renzo,remore,remitting,remeber,relaxants,rejuvenate,rejections,regenerated,refocus,referrals,reeno,recycles,recrimination,reclining,recanting,reattach,reassigning,razgul,raved,rattlesnakes,rattles,rashly,raquetball,ransack,raisinettes,raheem,radisson,radishes,raban,quoth,qumari,quints,quilts,quilting,quien,quarreled,purty,purblind,punchbowl,publically,psychotics,psychopaths,psychoanalyze,pruning,provasik,protectin,propping,proportioned,prophylactic,proofed,prompter,procreate,proclivities,prioritizing,prinze,pricked,press'll,presets,prescribes,preocupe,prejudicial,prefex,preconceived,precipice,pralines,pragmatist,powerbar,pottie,pottersville,potsie,potholes,posses,posies,portkey,porterhouse,pornographers,poring,poppycock,poppers,pomponi,pokin,poitier,podiatry,pleeze,pleadings,playbook,platelets,plane'arium,placebos,place'll,pistachios,pirated,pinochle,pineapples,pinafore,pimples,piggly,piddling,picon,pickpockets,picchu,physiologically,physic,phobic,philandering,phenomenally,pheasants,pewter,petticoat,petronis,petitioning,perturbed,perpetuating,permutat,perishable,perimeters,perfumed,percocet,per'sus,pepperjack,penalize,pelting,pellet,peignoir,pedicures,peckers,pecans,pawning,paulsson,pattycake,patrolmen,patois,pathos,pasted,parishioner,parcheesi,parachuting,papayas,pantaloons,palpitations,palantine,paintballing,overtired,overstress,oversensitive,overnights,overexcited,overanxious,overachiever,outwitted,outvoted,outnumber,outlast,outlander,out've,orphey,orchestrating,openers,ooooooo,okies,ohhhhhhhhh,ohhhhhhhh,ogling,offbeat,obsessively,obeyed,o'hana,o'bannon,o'bannion,numpce,nummy,nuked,nuances,nourishing,nosedive,norbu,nomlies,nomine,nixed,nihilist,nightshift,newmeat,neglectful,neediness,needin,naphthalene,nanocytes,nanite,naivete,n'yeah,mystifying,myhnegon,mutating,musing,mulled,muggy,muerto,muckraker,muchachos,mountainside,motherless,mosquitos,morphed,mopped,moodoo,moncho,mollem,moisturiser,mohicans,mocks,mistresses,misspent,misinterpretation,miscarry,minuses,mindee,mimes,millisecond,milked,mightn't,mightier,mierzwiak,microchips,meyerling,mesmerizing,mershaw,meecrob,medicate,meddled,mckinnons,mcgewan,mcdunnough,mcats,mbien,matzah,matriarch,masturbated,masselin,martialed,marlboros,marksmanship,marinate,marchin,manicured,malnourished,malign,majorek,magnon,magnificently,macking,machiavellian,macdougal,macchiato,macaws,macanaw,m'self,lydells,lusts,lucite,lubricants,lopper,lopped,loneliest,lonelier,lomez,lojack,loath,liquefy,lippy,limps,likin,lightness,liesl,liebchen,licious,libris,libation,lhamo,leotards,leanin,laxatives,lavished,latka,lanyard,lanky,landmines,lameness,laddies,lacerated,labored,l'amour,kreskin,kovitch,kournikova,kootchy,konoss,knknow,knickety,knackety,kmart,klicks,kiwanis,kissable,kindergartners,kilter,kidnet,kid'll,kicky,kickbacks,kickback,kholokov,kewpie,kendo,katra,kareoke,kafelnikov,kabob,junjun,jumba,julep,jordie,jondy,jolson,jenoff,jawbone,janitorial,janiro,ipecac,invigorated,intruded,intros,intravenously,interruptus,interrogations,interject,interfacing,interestin,insuring,instilled,insensitivity,inscrutable,inroads,innards,inlaid,injector,ingratitude,infuriates,infra,infliction,indelicate,incubators,incrimination,inconveniencing,inconsolable,incestuous,incas,incarcerate,inbreeding,impudence,impressionists,impeached,impassioned,imipenem,idling,idiosyncrasies,icebergs,hypotensive,hydrochloride,hushed,humus,humph,hummm,hulking,hubcaps,hubald,howya,howbout,how'll,housebroken,hotwire,hotspots,hotheaded,horrace,hopsfield,honto,honkin,honeymoons,homewrecker,hombres,hollers,hollerin,hoedown,hoboes,hobbling,hobble,hoarse,hinky,highlighters,hexes,heru'ur,hernias,heppleman,hell're,heighten,heheheheheh,heheheh,hedging,heckling,heckled,heavyset,heatshield,heathens,heartthrob,headpiece,hayseed,haveo,hauls,hasten,harridan,harpoons,hardens,harcesis,harbouring,hangouts,halkein,haleh,halberstam,hairnet,hairdressers,hacky,haaaa,h'yah,gusta,gushy,gurgling,guilted,gruel,grudging,grrrrrr,grosses,groomsmen,griping,gravest,gratified,grated,goulash,goopy,goona,goodly,godliness,godawful,godamn,glycerin,glutes,glowy,globetrotters,glimpsed,glenville,glaucoma,girlscout,giraffes,gilbey,gigglepuss,ghora,gestating,gelato,geishas,gearshift,gayness,gasped,gaslighting,garretts,garba,gablyczyck,g'head,fumigating,fumbling,fudged,fuckwad,fuck're,fuchsia,fretting,freshest,frenchies,freezers,fredrica,fraziers,fraidy,foxholes,fourty,fossilized,forsake,forfeits,foreclosed,foreal,footsies,florists,flopped,floorshow,floorboard,flinching,flecks,flaubert,flatware,flatulence,flatlined,flashdance,flail,flagging,fiver,fitzy,fishsticks,finetti,finelli,finagle,filko,fieldstone,fibber,ferrini,feedin,feasting,favore,fathering,farrouhk,farmin,fairytale,fairservice,factoid,facedown,fabled,eyeballin,extortionist,exquisitely,expedited,exorcise,existentialist,execs,exculpatory,exacerbate,everthing,eventuality,evander,euphoric,euphemisms,estamos,erred,entitle,enquiries,enormity,enfants,endive,encyclopedias,emulating,embittered,effortless,ectopic,ecirc,easely,earphones,earmarks,dweller,durslar,durned,dunois,dunking,dunked,dumdum,dullard,dudleys,druthers,druggist,drossos,drooled,driveways,drippy,dreamless,drawstring,drang,drainpipe,dozing,dotes,dorkface,doorknobs,doohickey,donnatella,doncha,domicile,dokos,dobermans,dizzying,divola,ditsy,distaste,disservice,dislodged,dislodge,disinherit,disinformation,discounting,dinka,dimly,digesting,diello,diddling,dictatorships,dictators,diagnostician,devours,devilishly,detract,detoxing,detours,detente,destructs,desecrated,derris,deplore,deplete,demure,demolitions,demean,delish,delbruck,delaford,degaulle,deftly,deformity,deflate,definatly,defector,decrypted,decontamination,decapitate,decanter,dardis,dampener,damme,daddy'll,dabbling,dabbled,d'etre,d'argent,d'alene,d'agnasti,czechoslovakian,cymbal,cyberdyne,cutoffs,cuticle,curvaceous,curiousity,crowing,crowed,croutons,cropped,criminy,crescentis,crashers,cranwell,coverin,courtrooms,countenance,cosmically,cosign,corroboration,coroners,cornflakes,copperpot,copperhead,copacetic,coordsize,convulsing,consults,conjures,congenial,concealer,compactor,commercialism,cokey,cognizant,clunkers,clumsily,clucking,cloves,cloven,cloths,clothe,clods,clocking,clings,clavicle,classless,clashing,clanking,clanging,clamping,civvies,citywide,circulatory,circuited,chronisters,chromic,choos,chloroformed,chillun,cheesed,chatterbox,chaperoned,channukah,cerebellum,centerpieces,centerfold,ceecee,ccedil,cavorting,cavemen,cauterized,cauldwell,catting,caterine,cassiopeia,carves,cartwheel,carpeted,carob,caressing,carelessly,careening,capricious,capitalistic,capillaries,candidly,camaraderie,callously,calfskin,caddies,buttholes,busywork,busses,burps,burgomeister,bunkhouse,bungchow,bugler,buffets,buffed,brutish,brusque,bronchitis,bromden,brolly,broached,brewskis,brewin,brean,breadwinner,brana,bountiful,bouncin,bosoms,borgnine,bopping,bootlegs,booing,bombosity,bolting,boilerplate,bluey,blowback,blouses,bloodsuckers,bloodstained,bloat,bleeth,blackface,blackest,blackened,blacken,blackballed,blabs,blabbering,birdbrain,bipartisanship,biodegradable,biltmore,bilked,big'uns,bidet,besotted,bernheim,benegas,bendiga,belushi,bellboys,belittling,behinds,begone,bedsheets,beckoning,beaute,beaudine,beastly,beachfront,bathes,batak,baser,baseballs,barbella,bankrolling,bandaged,baerly,backlog,backin,babying,azkaban,awwwww,aviary,authorizes,austero,aunty,attics,atreus,astounded,astonish,artemus,arses,arintero,appraiser,apathetic,anybody'd,anxieties,anticlimactic,antar,anglos,angleman,anesthetist,androscoggin,andolini,andale,amway,amuck,amniocentesis,amnesiac,americano,amara,alvah,altruism,alternapalooza,alphabetize,alpaca,allus,allergist,alexandros,alaikum,akimbo,agoraphobia,agides,aggrhh,aftertaste,adoptions,adjuster,addictions,adamantium,activator,accomplishes,aberrant,aaaaargh,aaaaaaaaaaaaa,a'ight,zzzzzzz,zucchini,zookeeper,zirconia,zippers,zequiel,zellary,zeitgeist,zanuck,zagat,you'n,ylang,yes'm,yenta,yecchh,yecch,yawns,yankin,yahdah,yaaah,y'got,xeroxed,wwooww,wristwatch,wrangled,wouldst,worthiness,worshiping,wormy,wormtail,wormholes,woosh,wollsten,wolfing,woefully,wobbling,wintry,wingding,windstorm,windowtext,wiluna,wilting,wilted,willick,willenholly,wildflowers,wildebeest,whyyy,whoppers,whoaa,whizzing,whizz,whitest,whistled,whist,whinny,wheelies,whazzup,whatwhatwhaaat,whato,whatdya,what'dya,whacks,wewell,wetsuit,welluh,weeps,waylander,wavin,wassail,wasnt,warneford,warbucks,waltons,wallbanger,waiving,waitwait,vowing,voucher,vornoff,vorhees,voldemort,vivre,vittles,vindaloo,videogames,vichyssoise,vicarious,vesuvius,verguenza,ven't,velveteen,velour,velociraptor,vastness,vasectomies,vapors,vanderhof,valmont,validates,valiantly,vacuums,usurp,usernum,us'll,urinals,unyielding,unvarnished,unturned,untouchables,untangled,unsecured,unscramble,unreturned,unremarkable,unpretentious,unnerstand,unmade,unimpeachable,unfashionable,underwrite,underlining,underling,underestimates,underappreciated,uncouth,uncork,uncommonly,unclog,uncircumcised,unchallenged,uncas,unbuttoning,unapproved,unamerican,unafraid,umpteen,umhmm,uhwhy,ughuh,typewriters,twitches,twitched,twirly,twinkling,twinges,twiddling,turners,turnabout,tumblin,tryed,trowel,trousseau,trivialize,trifles,tribianni,trenchcoat,trembled,traumatize,transitory,transients,transfuse,transcribing,tranq,trampy,traipsed,trainin,trachea,traceable,touristy,toughie,toscanini,tortola,tortilla,torreon,toreador,tommorrow,tollbooth,tollans,toidy,togas,tofurkey,toddling,toddies,toasties,toadstool,to've,tingles,timin,timey,timetables,tightest,thuggee,thrusting,thrombus,throes,thrifty,thornharts,thinnest,thicket,thetas,thesulac,tethered,testaburger,tersenadine,terrif,terdlington,tepui,temping,tector,taxidermy,tastebuds,tartlets,tartabull,tar'd,tantamount,tangy,tangles,tamer,tabula,tabletops,tabithia,szechwan,synthedyne,svenjolly,svengali,survivalists,surmise,surfboards,surefire,suprise,supremacists,suppositories,superstore,supercilious,suntac,sunburned,summercliff,sullied,sugared,suckle,subtleties,substantiated,subsides,subliminal,subhuman,strowman,stroked,stroganoff,streetlight,straying,strainer,straighter,straightener,stoplight,stirrups,stewing,stereotyping,stepmommy,stephano,stashing,starshine,stairwells,squatsie,squandering,squalid,squabbling,squab,sprinkling,spreader,spongy,spokesmen,splintered,spittle,spitter,spiced,spews,spendin,spect,spearchucker,spatulas,southtown,soused,soshi,sorter,sorrowful,sooth,some'in,soliloquy,soiree,sodomized,sobriki,soaping,snows,snowcone,snitching,snitched,sneering,snausages,snaking,smoothed,smoochies,smarten,smallish,slushy,slurring,sluman,slithers,slippin,sleuthing,sleeveless,skinless,skillfully,sketchbook,skagnetti,sista,sinning,singularly,sinewy,silverlake,siguto,signorina,sieve,sidearms,shying,shunning,shtud,shrieks,shorting,shortbread,shopkeepers,shmancy,shizzit,shitheads,shitfaced,shipmates,shiftless,shelving,shedlow,shavings,shatters,sharifa,shampoos,shallots,shafter,sha'nauc,sextant,serviceable,sepsis,senores,sendin,semis,semanski,selflessly,seinfelds,seers,seeps,seductress,secaucus,sealant,scuttling,scusa,scrunched,scissorhands,schreber,schmancy,scamps,scalloped,savoir,savagery,sarong,sarnia,santangel,samool,sallow,salino,safecracker,sadism,sacrilegious,sabrini,sabath,s'aright,ruttheimer,rudest,rubbery,rousting,rotarian,roslin,roomed,romari,romanica,rolltop,rolfski,rockettes,roared,ringleader,riffing,ribcage,rewired,retrial,reting,resuscitated,restock,resale,reprogrammed,replicant,repentant,repellant,repays,repainting,renegotiating,rendez,remem,relived,relinquishes,relearn,relaxant,rekindling,rehydrate,refueled,refreshingly,refilling,reexamine,reeseman,redness,redeemable,redcoats,rectangles,recoup,reciprocated,reassessing,realy,realer,reachin,re'kali,rawlston,ravages,rappaports,ramoray,ramming,raindrops,rahesh,radials,racists,rabartu,quiches,quench,quarreling,quaintly,quadrants,putumayo,put'em,purifier,pureed,punitis,pullout,pukin,pudgy,puddings,puckering,pterodactyl,psychodrama,psats,protestations,protectee,prosaic,propositioned,proclivity,probed,printouts,prevision,pressers,preset,preposition,preempt,preemie,preconceptions,prancan,powerpuff,potties,potpie,poseur,porthole,poops,pooping,pomade,polyps,polymerized,politeness,polisher,polack,pocketknife,poatia,plebeian,playgroup,platonically,platitude,plastering,plasmapheresis,plaids,placemats,pizzazz,pintauro,pinstripes,pinpoints,pinkner,pincer,pimento,pileup,pilates,pigmen,pieeee,phrased,photocopies,phoebes,philistines,philanderer,pheromone,phasers,pfeffernuesse,pervs,perspire,personify,perservere,perplexed,perpetrating,perkiness,perjurer,periodontist,perfunctory,perdido,percodan,pentameter,pentacle,pensive,pensione,pennybaker,pennbrooke,penhall,pengin,penetti,penetrates,pegnoir,peeve,peephole,pectorals,peckin,peaky,peaksville,paxcow,paused,patted,parkishoff,parkers,pardoning,paraplegic,paraphrasing,paperers,papered,pangs,paneling,palooza,palmed,palmdale,palatable,pacify,pacified,owwwww,oversexed,overrides,overpaying,overdrawn,overcompensate,overcomes,overcharged,outmaneuver,outfoxed,oughtn't,ostentatious,oshun,orthopedist,or'derves,ophthalmologist,operagirl,oozes,oooooooh,onesie,omnis,omelets,oktoberfest,okeydoke,ofthe,ofher,obstetrical,obeys,obeah,o'henry,nyquil,nyanyanyanyah,nuttin,nutsy,nutball,nurhachi,numbskull,nullifies,nullification,nucking,nubbin,nourished,nonspecific,noing,noinch,nohoho,nobler,nitwits,newsprint,newspaperman,newscaster,neuropathy,netherworld,neediest,navasky,narcissists,napped,nafta,mache,mykonos,mutilating,mutherfucker,mutha,mutates,mutate,musn't,murchy,multitasking,mujeeb,mudslinging,muckraking,mousetrap,mourns,mournful,motherf,mostro,morphing,morphate,moralistic,moochy,mooching,monotonous,monopolize,monocle,molehill,moland,mofet,mockup,mobilizing,mmmmmmm,mitzvahs,mistreating,misstep,misjudge,misinformation,misdirected,miscarriages,miniskirt,mindwarped,minced,milquetoast,miguelito,mightily,midstream,midriff,mideast,microbe,methuselah,mesdames,mescal,men'll,memma,megaton,megara,megalomaniac,meeee,medulla,medivac,meaninglessness,mcnuggets,mccarthyism,maypole,may've,mauve,mateys,marshack,markles,marketable,mansiere,manservant,manse,manhandling,mallomars,malcontent,malaise,majesties,mainsail,mailmen,mahandra,magnolias,magnified,magev,maelstrom,machu,macado,m'boy,m'appelle,lustrous,lureen,lunges,lumped,lumberyard,lulled,luego,lucks,lubricated,loveseat,loused,lounger,loski,lorre,loora,looong,loonies,loincloth,lofts,lodgers,lobbing,loaner,livered,liqueur,ligourin,lifesaving,lifeguards,lifeblood,liaisons,let'em,lesbianism,lence,lemonlyman,legitimize,leadin,lazars,lazarro,lawyering,laugher,laudanum,latrines,lations,laters,lapels,lakefront,lahit,lafortunata,lachrymose,l'italien,kwaini,kruczynski,kramerica,kowtow,kovinsky,korsekov,kopek,knowakowski,knievel,knacks,kiowas,killington,kickball,keyworth,keymaster,kevie,keveral,kenyons,keggers,keepsakes,kechner,keaty,kavorka,karajan,kamerev,kaggs,jujyfruit,jostled,jonestown,jokey,joists,jocko,jimmied,jiggled,jests,jenzen,jenko,jellyman,jedediah,jealitosis,jaunty,jarmel,jankle,jagoff,jagielski,jackrabbits,jabbing,jabberjaw,izzat,irresponsibly,irrepressible,irregularity,irredeemable,inuvik,intuitions,intubated,intimates,interminable,interloper,intercostal,instyle,instigate,instantaneously,ining,ingrown,ingesting,infusing,infringe,infinitum,infact,inequities,indubitably,indisputable,indescribably,indentation,indefinable,incontrovertible,inconsequential,incompletes,incoherently,inclement,incidentals,inarticulate,inadequacies,imprudent,improprieties,imprison,imprinted,impressively,impostors,importante,imperious,impale,immodest,immobile,imbedded,imbecilic,illegals,idn't,hysteric,hypotenuse,hygienic,hyeah,hushpuppies,hunhh,humpback,humored,hummed,humiliates,humidifier,huggy,huggers,huckster,hotbed,hosing,hosers,horsehair,homebody,homebake,holing,holies,hoisting,hogwallop,hocks,hobbits,hoaxes,hmmmmm,hisses,hippest,hillbillies,hilarity,heurh,herniated,hermaphrodite,hennifer,hemlines,hemline,hemery,helplessness,helmsley,hellhound,heheheheh,heeey,hedda,heartbeats,heaped,healers,headstart,headsets,headlong,hawkland,havta,haulin,harvey'll,hanta,hansom,hangnail,handstand,handrail,handoff,hallucinogen,hallor,halitosis,haberdashery,gypped,guy'll,gumbel,guerillas,guava,guardrail,grunther,grunick,groppi,groomer,grodin,gripes,grinds,grifters,gretch,greevey,greasing,graveyards,grandkid,grainy,gouging,gooney,googly,goldmuff,goldenrod,goingo,godly,gobbledygook,gobbledegook,glues,gloriously,glengarry,glassware,glamor,gimmicks,giggly,giambetti,ghoulish,ghettos,ghali,gether,geriatrics,gerbils,geosynchronous,georgio,gente,gendarme,gelbman,gazillionth,gayest,gauging,gastro,gaslight,gasbag,garters,garish,garas,gantu,gangy,gangly,gangland,galling,gadda,furrowed,funnies,funkytown,fugimotto,fudging,fuckeen,frustrates,froufrou,froot,fromberge,frizzies,fritters,frightfully,friendliest,freeloading,freelancing,freakazoid,fraternization,framers,fornication,fornicating,forethought,footstool,foisting,focussing,focking,flurries,fluffed,flintstones,fledermaus,flayed,flawlessly,flatters,flashbang,flapped,fishies,firmer,fireproof,firebug,fingerpainting,finessed,findin,financials,finality,fillets,fiercest,fiefdom,fibbing,fervor,fentanyl,fenelon,fedorchuk,feckless,feathering,faucets,farewells,fantasyland,fanaticism,faltered,faggy,faberge,extorting,extorted,exterminating,exhumation,exhilaration,exhausts,exfoliate,excels,exasperating,exacting,everybody'd,evasions,espressos,esmail,errrr,erratically,eroding,ernswiler,epcot,enthralled,ensenada,enriching,enrage,enhancer,endear,encrusted,encino,empathic,embezzle,emanates,electricians,eking,egomaniacal,egging,effacing,ectoplasm,eavesdropped,dummkopf,dugray,duchaisne,drunkard,drudge,droop,droids,drips,dripped,dribbles,drazens,downy,downsize,downpour,dosages,doppelganger,dopes,doohicky,dontcha,doneghy,divining,divest,diuretics,diuretic,distrustful,disrupts,dismemberment,dismember,disinfect,disillusionment,disheartening,discourteous,discotheque,discolored,dirtiest,diphtheria,dinks,dimpled,didya,dickwad,diatribes,diathesis,diabetics,deviants,detonates,detests,detestable,detaining,despondent,desecration,derision,derailing,deputized,depressors,dependant,dentures,denominators,demur,demonology,delts,dellarte,delacour,deflated,defib,defaced,decorators,deaqon,davola,datin,darwinian,darklighters,dandelions,dampened,damaskinos,dalrimple,d'peshu,d'hoffryn,d'astier,cynics,cutesy,cutaway,curmudgeon,curdle,culpability,cuisinart,cuffing,crypts,cryptid,crunched,crumblers,crudely,crosscheck,croon,crissake,crevasse,creswood,creepo,creases,creased,creaky,cranks,crabgrass,coveralls,couple'a,coughs,coslaw,corporeal,cornucopia,cornering,corks,cordoned,coolly,coolin,cookbooks,contrite,contented,constrictor,confound,confit,confiscating,condoned,conditioners,concussions,comprendo,comers,combustible,combusted,collingswood,coldness,coitus,codicil,coasting,clydesdale,cluttering,clunker,clunk,clumsiness,clotted,clothesline,clinches,clincher,cleverness,clench,clein,cleanses,claymores,clammed,chugging,chronically,christsakes,choque,chompers,chiseling,chirpy,chirp,chinks,chingachgook,chickenpox,chickadee,chewin,chessboard,chargin,chanteuse,chandeliers,chamdo,chagrined,chaff,certs,certainties,cerreno,cerebrum,censured,cemetary,caterwauling,cataclysmic,casitas,cased,carvel,carting,carrear,carolling,carolers,carnie,cardiogram,carbuncle,capulets,canines,candaules,canape,caldecott,calamitous,cadillacs,cachet,cabeza,cabdriver,buzzards,butai,businesswomen,bungled,bumpkins,bummers,bulldoze,buffybot,bubut,bubbies,brrrrr,brownout,brouhaha,bronzing,bronchial,broiler,briskly,briefcases,bricked,breezing,breeher,breakable,breadstick,bravenet,braved,brandies,brainwaves,brainiest,braggart,bradlee,boys're,boys'll,boys'd,boutonniere,bossed,bosomy,borans,boosts,bookshelves,bookends,boneless,bombarding,bollo,boinked,boink,bluest,bluebells,bloodshot,blockhead,blockbusters,blithely,blather,blankly,bladders,blackbeard,bitte,bippy,biogenetics,bilge,bigglesworth,bicuspids,beususe,betaseron,besmirch,bernece,bereavement,bentonville,benchley,benching,bembe,bellyaching,bellhops,belie,beleaguered,behrle,beginnin,begining,beenie,beefs,beechwood,becau,beaverhausen,beakers,bazillion,baudouin,barrytown,barringtons,barneys,barbs,barbers,barbatus,bankrupted,bailiffs,backslide,baby'd,baaad,b'fore,awwwk,aways,awakes,automatics,authenticate,aught,aubyn,attired,attagirl,atrophied,asystole,astroturf,assertiveness,artichokes,arquillians,aright,archenemy,appraise,appeased,antin,anspaugh,anesthetics,anaphylactic,amscray,ambivalence,amalio,alriiight,alphabetized,alpena,alouette,allora,alliteration,allenwood,allegiances,algerians,alcerro,alastor,ahaha,agitators,aforethought,advertises,admonition,adirondacks,adenoids,acupuncturist,acula,actuarial,activators,actionable,achingly,accusers,acclimated,acclimate,absurdly,absorbent,absolvo,absolutes,absences,abdomenizer,aaaaaaaaah,aaaaaaaaaa,a'right".split(","),
114531 male_names: "james,john,robert,michael,william,david,richard,charles,joseph,thomas,christopher,daniel,paul,mark,donald,george,kenneth,steven,edward,brian,ronald,anthony,kevin,jason,matthew,gary,timothy,jose,larry,jeffrey,frank,scott,eric,stephen,andrew,raymond,gregory,joshua,jerry,dennis,walter,patrick,peter,harold,douglas,henry,carl,arthur,ryan,roger,joe,juan,jack,albert,jonathan,justin,terry,gerald,keith,samuel,willie,ralph,lawrence,nicholas,roy,benjamin,bruce,brandon,adam,harry,fred,wayne,billy,steve,louis,jeremy,aaron,randy,eugene,carlos,russell,bobby,victor,ernest,phillip,todd,jesse,craig,alan,shawn,clarence,sean,philip,chris,johnny,earl,jimmy,antonio,danny,bryan,tony,luis,mike,stanley,leonard,nathan,dale,manuel,rodney,curtis,norman,marvin,vincent,glenn,jeffery,travis,jeff,chad,jacob,melvin,alfred,kyle,francis,bradley,jesus,herbert,frederick,ray,joel,edwin,don,eddie,ricky,troy,randall,barry,bernard,mario,leroy,francisco,marcus,micheal,theodore,clifford,miguel,oscar,jay,jim,tom,calvin,alex,jon,ronnie,bill,lloyd,tommy,leon,derek,darrell,jerome,floyd,leo,alvin,tim,wesley,dean,greg,jorge,dustin,pedro,derrick,dan,zachary,corey,herman,maurice,vernon,roberto,clyde,glen,hector,shane,ricardo,sam,rick,lester,brent,ramon,tyler,gilbert,gene,marc,reginald,ruben,brett,nathaniel,rafael,edgar,milton,raul,ben,cecil,duane,andre,elmer,brad,gabriel,ron,roland,jared,adrian,karl,cory,claude,erik,darryl,neil,christian,javier,fernando,clinton,ted,mathew,tyrone,darren,lonnie,lance,cody,julio,kurt,allan,clayton,hugh,max,dwayne,dwight,armando,felix,jimmie,everett,ian,ken,bob,jaime,casey,alfredo,alberto,dave,ivan,johnnie,sidney,byron,julian,isaac,clifton,willard,daryl,virgil,andy,salvador,kirk,sergio,seth,kent,terrance,rene,eduardo,terrence,enrique,freddie,stuart,fredrick,arturo,alejandro,joey,nick,luther,wendell,jeremiah,evan,julius,donnie,otis,trevor,luke,homer,gerard,doug,kenny,hubert,angelo,shaun,lyle,matt,alfonso,orlando,rex,carlton,ernesto,pablo,lorenzo,omar,wilbur,blake,horace,roderick,kerry,abraham,rickey,ira,andres,cesar,johnathan,malcolm,rudolph,damon,kelvin,rudy,preston,alton,archie,marco,pete,randolph,garry,geoffrey,jonathon,felipe,bennie,gerardo,dominic,loren,delbert,colin,guillermo,earnest,benny,noel,rodolfo,myron,edmund,salvatore,cedric,lowell,gregg,sherman,devin,sylvester,roosevelt,israel,jermaine,forrest,wilbert,leland,simon,irving,owen,rufus,woodrow,sammy,kristopher,levi,marcos,gustavo,jake,lionel,marty,gilberto,clint,nicolas,laurence,ismael,orville,drew,ervin,dewey,wilfred,josh,hugo,ignacio,caleb,tomas,sheldon,erick,frankie,darrel,rogelio,terence,alonzo,elias,bert,elbert,ramiro,conrad,noah,grady,phil,cornelius,lamar,rolando,clay,percy,bradford,merle,darin,amos,terrell,moses,irvin,saul,roman,darnell,randal,tommie,timmy,darrin,brendan,toby,van,abel,dominick,emilio,elijah,cary,domingo,aubrey,emmett,marlon,emanuel,jerald,edmond,emil,dewayne,otto,teddy,reynaldo,bret,jess,trent,humberto,emmanuel,stephan,louie,vicente,lamont,garland,micah,efrain,heath,rodger,demetrius,ethan,eldon,rocky,pierre,eli,bryce,antoine,robbie,kendall,royce,sterling,grover,elton,cleveland,dylan,chuck,damian,reuben,stan,leonardo,russel,erwin,benito,hans,monte,blaine,ernie,curt,quentin,agustin,jamal,devon,adolfo,tyson,wilfredo,bart,jarrod,vance,denis,damien,joaquin,harlan,desmond,elliot,darwin,gregorio,kermit,roscoe,esteban,anton,solomon,norbert,elvin,nolan,carey,rod,quinton,hal,brain,rob,elwood,kendrick,darius,moises,marlin,fidel,thaddeus,cliff,marcel,ali,raphael,bryon,armand,alvaro,jeffry,dane,joesph,thurman,ned,sammie,rusty,michel,monty,rory,fabian,reggie,kris,isaiah,gus,avery,loyd,diego,adolph,millard,rocco,gonzalo,derick,rodrigo,gerry,rigoberto,alphonso,rickie,noe,vern,elvis,bernardo,mauricio,hiram,donovan,basil,nickolas,scot,vince,quincy,eddy,sebastian,federico,ulysses,heriberto,donnell,denny,gavin,emery,romeo,jayson,dion,dante,clement,coy,odell,jarvis,bruno,issac,dudley,sanford,colby,carmelo,nestor,hollis,stefan,donny,linwood,beau,weldon,galen,isidro,truman,delmar,johnathon,silas,frederic,irwin,merrill,charley,marcelino,carlo,trenton,kurtis,aurelio,winfred,vito,collin,denver,leonel,emory,pasquale,mohammad,mariano,danial,landon,dirk,branden,adan,numbers,clair,buford,bernie,wilmer,emerson,zachery,jacques,errol,josue,edwardo,wilford,theron,raymundo,daren,tristan,robby,lincoln,jame,genaro,octavio,cornell,hung,arron,antony,herschel,alva,giovanni,garth,cyrus,cyril,ronny,stevie,lon,kennith,carmine,augustine,erich,chadwick,wilburn,russ,myles,jonas,mitchel,mervin,zane,jamel,lazaro,alphonse,randell,johnie,jarrett,ariel,abdul,dusty,luciano,seymour,scottie,eugenio,mohammed,arnulfo,lucien,ferdinand,thad,ezra,aldo,rubin,mitch,earle,abe,marquis,lanny,kareem,jamar,boris,isiah,emile,elmo,aron,leopoldo,everette,josef,eloy,dorian,rodrick,reinaldo,lucio,jerrod,weston,hershel,lemuel,lavern,burt,jules,gil,eliseo,ahmad,nigel,efren,antwan,alden,margarito,refugio,dino,osvaldo,les,deandre,normand,kieth,ivory,trey,norberto,napoleon,jerold,fritz,rosendo,milford,sang,deon,christoper,alfonzo,lyman,josiah,brant,wilton,rico,jamaal,dewitt,brenton,yong,olin,faustino,claudio,judson,gino,edgardo,alec,jarred,donn,trinidad,tad,porfirio,odis,lenard,chauncey,tod,mel,marcelo,kory,augustus,keven,hilario,bud,sal,orval,mauro,dannie,zachariah,olen,anibal,milo,jed,thanh,amado,lenny,tory,richie,horacio,brice,mohamed,delmer,dario,mac,jonah,jerrold,robt,hank,sung,rupert,rolland,kenton,damion,chi,antone,waldo,fredric,bradly,kip,burl,tyree,jefferey,ahmed,willy,stanford,oren,moshe,mikel,enoch,brendon,quintin,jamison,florencio,darrick,tobias,minh,hassan,giuseppe,demarcus,cletus,tyrell,lyndon,keenan,werner,theo,geraldo,columbus,chet,bertram,markus,huey,hilton,dwain,donte,tyron,omer,isaias,hipolito,fermin,chung,adalberto,jamey,teodoro,mckinley,maximo,raleigh,lawerence,abram,rashad,emmitt,daron,chong,samual,otha,miquel,eusebio,dong,domenic,darron,wilber,renato,hoyt,haywood,ezekiel,chas,florentino,elroy,clemente,arden,neville,edison,deshawn,carrol,shayne,nathanial,jordon,danilo,claud,sherwood,raymon,rayford,cristobal,ambrose,titus,hyman,felton,ezequiel,erasmo,lonny,milan,lino,jarod,herb,andreas,rhett,jude,douglass,cordell,oswaldo,ellsworth,virgilio,toney,nathanael,benedict,mose,hong,isreal,garret,fausto,arlen,zack,modesto,francesco,manual,gaylord,gaston,filiberto,deangelo,michale,granville,malik,zackary,tuan,nicky,cristopher,antione,malcom,korey,jospeh,colton,waylon,hosea,shad,santo,rudolf,rolf,renaldo,marcellus,lucius,kristofer,harland,arnoldo,rueben,leandro,kraig,jerrell,jeromy,hobert,cedrick,arlie,winford,wally,luigi,keneth,jacinto,graig,franklyn,edmundo,leif,jeramy,willian,vincenzo,shon,michal,lynwood,jere,elden,darell,broderick,alonso".split(",")
114532};
114533
114534module.exports = frequency_lists;
114535
114536
114537
114538},{}],837:[function(require,module,exports){
114539// Generated by CoffeeScript 1.10.0
114540var feedback, matching, scoring, time, time_estimates, zxcvbn;
114541
114542matching = require('./matching');
114543
114544scoring = require('./scoring');
114545
114546time_estimates = require('./time_estimates');
114547
114548feedback = require('./feedback');
114549
114550time = function() {
114551 return (new Date()).getTime();
114552};
114553
114554zxcvbn = function(password, user_inputs) {
114555 var arg, attack_times, i, len, matches, prop, ref, result, sanitized_inputs, start, val;
114556 if (user_inputs == null) {
114557 user_inputs = [];
114558 }
114559 start = time();
114560 sanitized_inputs = [];
114561 for (i = 0, len = user_inputs.length; i < len; i++) {
114562 arg = user_inputs[i];
114563 if ((ref = typeof arg) === "string" || ref === "number" || ref === "boolean") {
114564 sanitized_inputs.push(arg.toString().toLowerCase());
114565 }
114566 }
114567 matching.set_user_input_dictionary(sanitized_inputs);
114568 matches = matching.omnimatch(password);
114569 result = scoring.most_guessable_match_sequence(password, matches);
114570 result.calc_time = time() - start;
114571 attack_times = time_estimates.estimate_attack_times(result.guesses);
114572 for (prop in attack_times) {
114573 val = attack_times[prop];
114574 result[prop] = val;
114575 }
114576 result.feedback = feedback.get_feedback(result.score, result.sequence);
114577 return result;
114578};
114579
114580module.exports = zxcvbn;
114581
114582
114583
114584},{"./feedback":835,"./matching":838,"./scoring":839,"./time_estimates":840}],838:[function(require,module,exports){
114585// Generated by CoffeeScript 1.10.0
114586var DATE_MAX_YEAR, DATE_MIN_YEAR, DATE_SPLITS, GRAPHS, L33T_TABLE, RANKED_DICTIONARIES, REGEXEN, adjacency_graphs, build_ranked_dict, frequency_lists, lst, matching, name, scoring;
114587
114588frequency_lists = require('./frequency_lists');
114589
114590adjacency_graphs = require('./adjacency_graphs');
114591
114592scoring = require('./scoring');
114593
114594build_ranked_dict = function(ordered_list) {
114595 var i, len1, o, result, word;
114596 result = {};
114597 i = 1;
114598 for (o = 0, len1 = ordered_list.length; o < len1; o++) {
114599 word = ordered_list[o];
114600 result[word] = i;
114601 i += 1;
114602 }
114603 return result;
114604};
114605
114606RANKED_DICTIONARIES = {};
114607
114608for (name in frequency_lists) {
114609 lst = frequency_lists[name];
114610 RANKED_DICTIONARIES[name] = build_ranked_dict(lst);
114611}
114612
114613GRAPHS = {
114614 qwerty: adjacency_graphs.qwerty,
114615 dvorak: adjacency_graphs.dvorak,
114616 keypad: adjacency_graphs.keypad,
114617 mac_keypad: adjacency_graphs.mac_keypad
114618};
114619
114620L33T_TABLE = {
114621 a: ['4', '@'],
114622 b: ['8'],
114623 c: ['(', '{', '[', '<'],
114624 e: ['3'],
114625 g: ['6', '9'],
114626 i: ['1', '!', '|'],
114627 l: ['1', '|', '7'],
114628 o: ['0'],
114629 s: ['$', '5'],
114630 t: ['+', '7'],
114631 x: ['%'],
114632 z: ['2']
114633};
114634
114635REGEXEN = {
114636 recent_year: /19\d\d|200\d|201\d/g
114637};
114638
114639DATE_MAX_YEAR = 2050;
114640
114641DATE_MIN_YEAR = 1000;
114642
114643DATE_SPLITS = {
114644 4: [[1, 2], [2, 3]],
114645 5: [[1, 3], [2, 3]],
114646 6: [[1, 2], [2, 4], [4, 5]],
114647 7: [[1, 3], [2, 3], [4, 5], [4, 6]],
114648 8: [[2, 4], [4, 6]]
114649};
114650
114651matching = {
114652 empty: function(obj) {
114653 var k;
114654 return ((function() {
114655 var results;
114656 results = [];
114657 for (k in obj) {
114658 results.push(k);
114659 }
114660 return results;
114661 })()).length === 0;
114662 },
114663 extend: function(lst, lst2) {
114664 return lst.push.apply(lst, lst2);
114665 },
114666 translate: function(string, chr_map) {
114667 var chr;
114668 return ((function() {
114669 var len1, o, ref, results;
114670 ref = string.split('');
114671 results = [];
114672 for (o = 0, len1 = ref.length; o < len1; o++) {
114673 chr = ref[o];
114674 results.push(chr_map[chr] || chr);
114675 }
114676 return results;
114677 })()).join('');
114678 },
114679 mod: function(n, m) {
114680 return ((n % m) + m) % m;
114681 },
114682 sorted: function(matches) {
114683 return matches.sort(function(m1, m2) {
114684 return (m1.i - m2.i) || (m1.j - m2.j);
114685 });
114686 },
114687 omnimatch: function(password) {
114688 var len1, matcher, matchers, matches, o;
114689 matches = [];
114690 matchers = [this.dictionary_match, this.reverse_dictionary_match, this.l33t_match, this.spatial_match, this.repeat_match, this.sequence_match, this.regex_match, this.date_match];
114691 for (o = 0, len1 = matchers.length; o < len1; o++) {
114692 matcher = matchers[o];
114693 this.extend(matches, matcher.call(this, password));
114694 }
114695 return this.sorted(matches);
114696 },
114697 dictionary_match: function(password, _ranked_dictionaries) {
114698 var dictionary_name, i, j, len, matches, o, p, password_lower, rank, ranked_dict, ref, ref1, ref2, word;
114699 if (_ranked_dictionaries == null) {
114700 _ranked_dictionaries = RANKED_DICTIONARIES;
114701 }
114702 matches = [];
114703 len = password.length;
114704 password_lower = password.toLowerCase();
114705 for (dictionary_name in _ranked_dictionaries) {
114706 ranked_dict = _ranked_dictionaries[dictionary_name];
114707 for (i = o = 0, ref = len; 0 <= ref ? o < ref : o > ref; i = 0 <= ref ? ++o : --o) {
114708 for (j = p = ref1 = i, ref2 = len; ref1 <= ref2 ? p < ref2 : p > ref2; j = ref1 <= ref2 ? ++p : --p) {
114709 if (password_lower.slice(i, +j + 1 || 9e9) in ranked_dict) {
114710 word = password_lower.slice(i, +j + 1 || 9e9);
114711 rank = ranked_dict[word];
114712 matches.push({
114713 pattern: 'dictionary',
114714 i: i,
114715 j: j,
114716 token: password.slice(i, +j + 1 || 9e9),
114717 matched_word: word,
114718 rank: rank,
114719 dictionary_name: dictionary_name,
114720 reversed: false,
114721 l33t: false
114722 });
114723 }
114724 }
114725 }
114726 }
114727 return this.sorted(matches);
114728 },
114729 reverse_dictionary_match: function(password, _ranked_dictionaries) {
114730 var len1, match, matches, o, ref, reversed_password;
114731 if (_ranked_dictionaries == null) {
114732 _ranked_dictionaries = RANKED_DICTIONARIES;
114733 }
114734 reversed_password = password.split('').reverse().join('');
114735 matches = this.dictionary_match(reversed_password, _ranked_dictionaries);
114736 for (o = 0, len1 = matches.length; o < len1; o++) {
114737 match = matches[o];
114738 match.token = match.token.split('').reverse().join('');
114739 match.reversed = true;
114740 ref = [password.length - 1 - match.j, password.length - 1 - match.i], match.i = ref[0], match.j = ref[1];
114741 }
114742 return this.sorted(matches);
114743 },
114744 set_user_input_dictionary: function(ordered_list) {
114745 return RANKED_DICTIONARIES['user_inputs'] = build_ranked_dict(ordered_list.slice());
114746 },
114747 relevant_l33t_subtable: function(password, table) {
114748 var chr, len1, letter, o, password_chars, ref, relevant_subs, sub, subs, subtable;
114749 password_chars = {};
114750 ref = password.split('');
114751 for (o = 0, len1 = ref.length; o < len1; o++) {
114752 chr = ref[o];
114753 password_chars[chr] = true;
114754 }
114755 subtable = {};
114756 for (letter in table) {
114757 subs = table[letter];
114758 relevant_subs = (function() {
114759 var len2, p, results;
114760 results = [];
114761 for (p = 0, len2 = subs.length; p < len2; p++) {
114762 sub = subs[p];
114763 if (sub in password_chars) {
114764 results.push(sub);
114765 }
114766 }
114767 return results;
114768 })();
114769 if (relevant_subs.length > 0) {
114770 subtable[letter] = relevant_subs;
114771 }
114772 }
114773 return subtable;
114774 },
114775 enumerate_l33t_subs: function(table) {
114776 var chr, dedup, helper, k, keys, l33t_chr, len1, len2, o, p, ref, sub, sub_dict, sub_dicts, subs;
114777 keys = (function() {
114778 var results;
114779 results = [];
114780 for (k in table) {
114781 results.push(k);
114782 }
114783 return results;
114784 })();
114785 subs = [[]];
114786 dedup = function(subs) {
114787 var assoc, deduped, label, len1, members, o, sub, v;
114788 deduped = [];
114789 members = {};
114790 for (o = 0, len1 = subs.length; o < len1; o++) {
114791 sub = subs[o];
114792 assoc = (function() {
114793 var len2, p, results;
114794 results = [];
114795 for (v = p = 0, len2 = sub.length; p < len2; v = ++p) {
114796 k = sub[v];
114797 results.push([k, v]);
114798 }
114799 return results;
114800 })();
114801 assoc.sort();
114802 label = ((function() {
114803 var len2, p, results;
114804 results = [];
114805 for (v = p = 0, len2 = assoc.length; p < len2; v = ++p) {
114806 k = assoc[v];
114807 results.push(k + ',' + v);
114808 }
114809 return results;
114810 })()).join('-');
114811 if (!(label in members)) {
114812 members[label] = true;
114813 deduped.push(sub);
114814 }
114815 }
114816 return deduped;
114817 };
114818 helper = function(keys) {
114819 var dup_l33t_index, first_key, i, l33t_chr, len1, len2, next_subs, o, p, q, ref, ref1, rest_keys, sub, sub_alternative, sub_extension;
114820 if (!keys.length) {
114821 return;
114822 }
114823 first_key = keys[0];
114824 rest_keys = keys.slice(1);
114825 next_subs = [];
114826 ref = table[first_key];
114827 for (o = 0, len1 = ref.length; o < len1; o++) {
114828 l33t_chr = ref[o];
114829 for (p = 0, len2 = subs.length; p < len2; p++) {
114830 sub = subs[p];
114831 dup_l33t_index = -1;
114832 for (i = q = 0, ref1 = sub.length; 0 <= ref1 ? q < ref1 : q > ref1; i = 0 <= ref1 ? ++q : --q) {
114833 if (sub[i][0] === l33t_chr) {
114834 dup_l33t_index = i;
114835 break;
114836 }
114837 }
114838 if (dup_l33t_index === -1) {
114839 sub_extension = sub.concat([[l33t_chr, first_key]]);
114840 next_subs.push(sub_extension);
114841 } else {
114842 sub_alternative = sub.slice(0);
114843 sub_alternative.splice(dup_l33t_index, 1);
114844 sub_alternative.push([l33t_chr, first_key]);
114845 next_subs.push(sub);
114846 next_subs.push(sub_alternative);
114847 }
114848 }
114849 }
114850 subs = dedup(next_subs);
114851 return helper(rest_keys);
114852 };
114853 helper(keys);
114854 sub_dicts = [];
114855 for (o = 0, len1 = subs.length; o < len1; o++) {
114856 sub = subs[o];
114857 sub_dict = {};
114858 for (p = 0, len2 = sub.length; p < len2; p++) {
114859 ref = sub[p], l33t_chr = ref[0], chr = ref[1];
114860 sub_dict[l33t_chr] = chr;
114861 }
114862 sub_dicts.push(sub_dict);
114863 }
114864 return sub_dicts;
114865 },
114866 l33t_match: function(password, _ranked_dictionaries, _l33t_table) {
114867 var chr, k, len1, len2, match, match_sub, matches, o, p, ref, ref1, sub, subbed_chr, subbed_password, token, v;
114868 if (_ranked_dictionaries == null) {
114869 _ranked_dictionaries = RANKED_DICTIONARIES;
114870 }
114871 if (_l33t_table == null) {
114872 _l33t_table = L33T_TABLE;
114873 }
114874 matches = [];
114875 ref = this.enumerate_l33t_subs(this.relevant_l33t_subtable(password, _l33t_table));
114876 for (o = 0, len1 = ref.length; o < len1; o++) {
114877 sub = ref[o];
114878 if (this.empty(sub)) {
114879 break;
114880 }
114881 subbed_password = this.translate(password, sub);
114882 ref1 = this.dictionary_match(subbed_password, _ranked_dictionaries);
114883 for (p = 0, len2 = ref1.length; p < len2; p++) {
114884 match = ref1[p];
114885 token = password.slice(match.i, +match.j + 1 || 9e9);
114886 if (token.toLowerCase() === match.matched_word) {
114887 continue;
114888 }
114889 match_sub = {};
114890 for (subbed_chr in sub) {
114891 chr = sub[subbed_chr];
114892 if (token.indexOf(subbed_chr) !== -1) {
114893 match_sub[subbed_chr] = chr;
114894 }
114895 }
114896 match.l33t = true;
114897 match.token = token;
114898 match.sub = match_sub;
114899 match.sub_display = ((function() {
114900 var results;
114901 results = [];
114902 for (k in match_sub) {
114903 v = match_sub[k];
114904 results.push(k + " -> " + v);
114905 }
114906 return results;
114907 })()).join(', ');
114908 matches.push(match);
114909 }
114910 }
114911 return this.sorted(matches.filter(function(match) {
114912 return match.token.length > 1;
114913 }));
114914 },
114915 spatial_match: function(password, _graphs) {
114916 var graph, graph_name, matches;
114917 if (_graphs == null) {
114918 _graphs = GRAPHS;
114919 }
114920 matches = [];
114921 for (graph_name in _graphs) {
114922 graph = _graphs[graph_name];
114923 this.extend(matches, this.spatial_match_helper(password, graph, graph_name));
114924 }
114925 return this.sorted(matches);
114926 },
114927 SHIFTED_RX: /[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]/,
114928 spatial_match_helper: function(password, graph, graph_name) {
114929 var adj, adjacents, cur_char, cur_direction, found, found_direction, i, j, last_direction, len1, matches, o, prev_char, shifted_count, turns;
114930 matches = [];
114931 i = 0;
114932 while (i < password.length - 1) {
114933 j = i + 1;
114934 last_direction = null;
114935 turns = 0;
114936 if ((graph_name === 'qwerty' || graph_name === 'dvorak') && this.SHIFTED_RX.exec(password.charAt(i))) {
114937 shifted_count = 1;
114938 } else {
114939 shifted_count = 0;
114940 }
114941 while (true) {
114942 prev_char = password.charAt(j - 1);
114943 found = false;
114944 found_direction = -1;
114945 cur_direction = -1;
114946 adjacents = graph[prev_char] || [];
114947 if (j < password.length) {
114948 cur_char = password.charAt(j);
114949 for (o = 0, len1 = adjacents.length; o < len1; o++) {
114950 adj = adjacents[o];
114951 cur_direction += 1;
114952 if (adj && adj.indexOf(cur_char) !== -1) {
114953 found = true;
114954 found_direction = cur_direction;
114955 if (adj.indexOf(cur_char) === 1) {
114956 shifted_count += 1;
114957 }
114958 if (last_direction !== found_direction) {
114959 turns += 1;
114960 last_direction = found_direction;
114961 }
114962 break;
114963 }
114964 }
114965 }
114966 if (found) {
114967 j += 1;
114968 } else {
114969 if (j - i > 2) {
114970 matches.push({
114971 pattern: 'spatial',
114972 i: i,
114973 j: j - 1,
114974 token: password.slice(i, j),
114975 graph: graph_name,
114976 turns: turns,
114977 shifted_count: shifted_count
114978 });
114979 }
114980 i = j;
114981 break;
114982 }
114983 }
114984 }
114985 return matches;
114986 },
114987 repeat_match: function(password) {
114988 var base_analysis, base_guesses, base_matches, base_token, greedy, greedy_match, i, j, lastIndex, lazy, lazy_anchored, lazy_match, match, matches, ref;
114989 matches = [];
114990 greedy = /(.+)\1+/g;
114991 lazy = /(.+?)\1+/g;
114992 lazy_anchored = /^(.+?)\1+$/;
114993 lastIndex = 0;
114994 while (lastIndex < password.length) {
114995 greedy.lastIndex = lazy.lastIndex = lastIndex;
114996 greedy_match = greedy.exec(password);
114997 lazy_match = lazy.exec(password);
114998 if (greedy_match == null) {
114999 break;
115000 }
115001 if (greedy_match[0].length > lazy_match[0].length) {
115002 match = greedy_match;
115003 base_token = lazy_anchored.exec(match[0])[1];
115004 } else {
115005 match = lazy_match;
115006 base_token = match[1];
115007 }
115008 ref = [match.index, match.index + match[0].length - 1], i = ref[0], j = ref[1];
115009 base_analysis = scoring.most_guessable_match_sequence(base_token, this.omnimatch(base_token));
115010 base_matches = base_analysis.sequence;
115011 base_guesses = base_analysis.guesses;
115012 matches.push({
115013 pattern: 'repeat',
115014 i: i,
115015 j: j,
115016 token: match[0],
115017 base_token: base_token,
115018 base_guesses: base_guesses,
115019 base_matches: base_matches,
115020 repeat_count: match[0].length / base_token.length
115021 });
115022 lastIndex = j + 1;
115023 }
115024 return matches;
115025 },
115026 MAX_DELTA: 5,
115027 sequence_match: function(password) {
115028 var delta, i, j, k, last_delta, o, ref, result, update;
115029 if (password.length === 1) {
115030 return [];
115031 }
115032 update = (function(_this) {
115033 return function(i, j, delta) {
115034 var ref, sequence_name, sequence_space, token;
115035 if (j - i > 1 || Math.abs(delta) === 1) {
115036 if ((0 < (ref = Math.abs(delta)) && ref <= _this.MAX_DELTA)) {
115037 token = password.slice(i, +j + 1 || 9e9);
115038 if (/^[a-z]+$/.test(token)) {
115039 sequence_name = 'lower';
115040 sequence_space = 26;
115041 } else if (/^[A-Z]+$/.test(token)) {
115042 sequence_name = 'upper';
115043 sequence_space = 26;
115044 } else if (/^\d+$/.test(token)) {
115045 sequence_name = 'digits';
115046 sequence_space = 10;
115047 } else {
115048 sequence_name = 'unicode';
115049 sequence_space = 26;
115050 }
115051 return result.push({
115052 pattern: 'sequence',
115053 i: i,
115054 j: j,
115055 token: password.slice(i, +j + 1 || 9e9),
115056 sequence_name: sequence_name,
115057 sequence_space: sequence_space,
115058 ascending: delta > 0
115059 });
115060 }
115061 }
115062 };
115063 })(this);
115064 result = [];
115065 i = 0;
115066 last_delta = null;
115067 for (k = o = 1, ref = password.length; 1 <= ref ? o < ref : o > ref; k = 1 <= ref ? ++o : --o) {
115068 delta = password.charCodeAt(k) - password.charCodeAt(k - 1);
115069 if (last_delta == null) {
115070 last_delta = delta;
115071 }
115072 if (delta === last_delta) {
115073 continue;
115074 }
115075 j = k - 1;
115076 update(i, j, last_delta);
115077 i = j;
115078 last_delta = delta;
115079 }
115080 update(i, password.length - 1, last_delta);
115081 return result;
115082 },
115083 regex_match: function(password, _regexen) {
115084 var matches, regex, rx_match, token;
115085 if (_regexen == null) {
115086 _regexen = REGEXEN;
115087 }
115088 matches = [];
115089 for (name in _regexen) {
115090 regex = _regexen[name];
115091 regex.lastIndex = 0;
115092 while (rx_match = regex.exec(password)) {
115093 token = rx_match[0];
115094 matches.push({
115095 pattern: 'regex',
115096 token: token,
115097 i: rx_match.index,
115098 j: rx_match.index + rx_match[0].length - 1,
115099 regex_name: name,
115100 regex_match: rx_match
115101 });
115102 }
115103 }
115104 return this.sorted(matches);
115105 },
115106 date_match: function(password) {
115107 var best_candidate, candidate, candidates, distance, dmy, i, j, k, l, len1, len2, matches, maybe_date_no_separator, maybe_date_with_separator, metric, min_distance, o, p, q, r, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, rx_match, s, t, token;
115108 matches = [];
115109 maybe_date_no_separator = /^\d{4,8}$/;
115110 maybe_date_with_separator = /^(\d{1,4})([\s\/\\_.-])(\d{1,2})\2(\d{1,4})$/;
115111 for (i = o = 0, ref = password.length - 4; 0 <= ref ? o <= ref : o >= ref; i = 0 <= ref ? ++o : --o) {
115112 for (j = p = ref1 = i + 3, ref2 = i + 7; ref1 <= ref2 ? p <= ref2 : p >= ref2; j = ref1 <= ref2 ? ++p : --p) {
115113 if (j >= password.length) {
115114 break;
115115 }
115116 token = password.slice(i, +j + 1 || 9e9);
115117 if (!maybe_date_no_separator.exec(token)) {
115118 continue;
115119 }
115120 candidates = [];
115121 ref3 = DATE_SPLITS[token.length];
115122 for (q = 0, len1 = ref3.length; q < len1; q++) {
115123 ref4 = ref3[q], k = ref4[0], l = ref4[1];
115124 dmy = this.map_ints_to_dmy([parseInt(token.slice(0, k)), parseInt(token.slice(k, l)), parseInt(token.slice(l))]);
115125 if (dmy != null) {
115126 candidates.push(dmy);
115127 }
115128 }
115129 if (!(candidates.length > 0)) {
115130 continue;
115131 }
115132 best_candidate = candidates[0];
115133 metric = function(candidate) {
115134 return Math.abs(candidate.year - scoring.REFERENCE_YEAR);
115135 };
115136 min_distance = metric(candidates[0]);
115137 ref5 = candidates.slice(1);
115138 for (r = 0, len2 = ref5.length; r < len2; r++) {
115139 candidate = ref5[r];
115140 distance = metric(candidate);
115141 if (distance < min_distance) {
115142 ref6 = [candidate, distance], best_candidate = ref6[0], min_distance = ref6[1];
115143 }
115144 }
115145 matches.push({
115146 pattern: 'date',
115147 token: token,
115148 i: i,
115149 j: j,
115150 separator: '',
115151 year: best_candidate.year,
115152 month: best_candidate.month,
115153 day: best_candidate.day
115154 });
115155 }
115156 }
115157 for (i = s = 0, ref7 = password.length - 6; 0 <= ref7 ? s <= ref7 : s >= ref7; i = 0 <= ref7 ? ++s : --s) {
115158 for (j = t = ref8 = i + 5, ref9 = i + 9; ref8 <= ref9 ? t <= ref9 : t >= ref9; j = ref8 <= ref9 ? ++t : --t) {
115159 if (j >= password.length) {
115160 break;
115161 }
115162 token = password.slice(i, +j + 1 || 9e9);
115163 rx_match = maybe_date_with_separator.exec(token);
115164 if (rx_match == null) {
115165 continue;
115166 }
115167 dmy = this.map_ints_to_dmy([parseInt(rx_match[1]), parseInt(rx_match[3]), parseInt(rx_match[4])]);
115168 if (dmy == null) {
115169 continue;
115170 }
115171 matches.push({
115172 pattern: 'date',
115173 token: token,
115174 i: i,
115175 j: j,
115176 separator: rx_match[2],
115177 year: dmy.year,
115178 month: dmy.month,
115179 day: dmy.day
115180 });
115181 }
115182 }
115183 return this.sorted(matches.filter(function(match) {
115184 var is_submatch, len3, other_match, u;
115185 is_submatch = false;
115186 for (u = 0, len3 = matches.length; u < len3; u++) {
115187 other_match = matches[u];
115188 if (match === other_match) {
115189 continue;
115190 }
115191 if (other_match.i <= match.i && other_match.j >= match.j) {
115192 is_submatch = true;
115193 break;
115194 }
115195 }
115196 return !is_submatch;
115197 }));
115198 },
115199 map_ints_to_dmy: function(ints) {
115200 var dm, int, len1, len2, len3, o, over_12, over_31, p, possible_year_splits, q, ref, ref1, rest, under_1, y;
115201 if (ints[1] > 31 || ints[1] <= 0) {
115202 return;
115203 }
115204 over_12 = 0;
115205 over_31 = 0;
115206 under_1 = 0;
115207 for (o = 0, len1 = ints.length; o < len1; o++) {
115208 int = ints[o];
115209 if ((99 < int && int < DATE_MIN_YEAR) || int > DATE_MAX_YEAR) {
115210 return;
115211 }
115212 if (int > 31) {
115213 over_31 += 1;
115214 }
115215 if (int > 12) {
115216 over_12 += 1;
115217 }
115218 if (int <= 0) {
115219 under_1 += 1;
115220 }
115221 }
115222 if (over_31 >= 2 || over_12 === 3 || under_1 >= 2) {
115223 return;
115224 }
115225 possible_year_splits = [[ints[2], ints.slice(0, 2)], [ints[0], ints.slice(1, 3)]];
115226 for (p = 0, len2 = possible_year_splits.length; p < len2; p++) {
115227 ref = possible_year_splits[p], y = ref[0], rest = ref[1];
115228 if ((DATE_MIN_YEAR <= y && y <= DATE_MAX_YEAR)) {
115229 dm = this.map_ints_to_dm(rest);
115230 if (dm != null) {
115231 return {
115232 year: y,
115233 month: dm.month,
115234 day: dm.day
115235 };
115236 } else {
115237 return;
115238 }
115239 }
115240 }
115241 for (q = 0, len3 = possible_year_splits.length; q < len3; q++) {
115242 ref1 = possible_year_splits[q], y = ref1[0], rest = ref1[1];
115243 dm = this.map_ints_to_dm(rest);
115244 if (dm != null) {
115245 y = this.two_to_four_digit_year(y);
115246 return {
115247 year: y,
115248 month: dm.month,
115249 day: dm.day
115250 };
115251 }
115252 }
115253 },
115254 map_ints_to_dm: function(ints) {
115255 var d, len1, m, o, ref, ref1;
115256 ref = [ints, ints.slice().reverse()];
115257 for (o = 0, len1 = ref.length; o < len1; o++) {
115258 ref1 = ref[o], d = ref1[0], m = ref1[1];
115259 if ((1 <= d && d <= 31) && (1 <= m && m <= 12)) {
115260 return {
115261 day: d,
115262 month: m
115263 };
115264 }
115265 }
115266 },
115267 two_to_four_digit_year: function(year) {
115268 if (year > 99) {
115269 return year;
115270 } else if (year > 50) {
115271 return year + 1900;
115272 } else {
115273 return year + 2000;
115274 }
115275 }
115276};
115277
115278module.exports = matching;
115279
115280
115281
115282},{"./adjacency_graphs":834,"./frequency_lists":836,"./scoring":839}],839:[function(require,module,exports){
115283// Generated by CoffeeScript 1.10.0
115284var BRUTEFORCE_CARDINALITY, MIN_GUESSES_BEFORE_GROWING_SEQUENCE, MIN_SUBMATCH_GUESSES_MULTI_CHAR, MIN_SUBMATCH_GUESSES_SINGLE_CHAR, adjacency_graphs, calc_average_degree, k, scoring, v;
115285
115286adjacency_graphs = require('./adjacency_graphs');
115287
115288calc_average_degree = function(graph) {
115289 var average, k, key, n, neighbors, v;
115290 average = 0;
115291 for (key in graph) {
115292 neighbors = graph[key];
115293 average += ((function() {
115294 var len, o, results;
115295 results = [];
115296 for (o = 0, len = neighbors.length; o < len; o++) {
115297 n = neighbors[o];
115298 if (n) {
115299 results.push(n);
115300 }
115301 }
115302 return results;
115303 })()).length;
115304 }
115305 average /= ((function() {
115306 var results;
115307 results = [];
115308 for (k in graph) {
115309 v = graph[k];
115310 results.push(k);
115311 }
115312 return results;
115313 })()).length;
115314 return average;
115315};
115316
115317BRUTEFORCE_CARDINALITY = 10;
115318
115319MIN_GUESSES_BEFORE_GROWING_SEQUENCE = 10000;
115320
115321MIN_SUBMATCH_GUESSES_SINGLE_CHAR = 10;
115322
115323MIN_SUBMATCH_GUESSES_MULTI_CHAR = 50;
115324
115325scoring = {
115326 nCk: function(n, k) {
115327 var d, o, r, ref;
115328 if (k > n) {
115329 return 0;
115330 }
115331 if (k === 0) {
115332 return 1;
115333 }
115334 r = 1;
115335 for (d = o = 1, ref = k; 1 <= ref ? o <= ref : o >= ref; d = 1 <= ref ? ++o : --o) {
115336 r *= n;
115337 r /= d;
115338 n -= 1;
115339 }
115340 return r;
115341 },
115342 log10: function(n) {
115343 return Math.log(n) / Math.log(10);
115344 },
115345 log2: function(n) {
115346 return Math.log(n) / Math.log(2);
115347 },
115348 factorial: function(n) {
115349 var f, i, o, ref;
115350 if (n < 2) {
115351 return 1;
115352 }
115353 f = 1;
115354 for (i = o = 2, ref = n; 2 <= ref ? o <= ref : o >= ref; i = 2 <= ref ? ++o : --o) {
115355 f *= i;
115356 }
115357 return f;
115358 },
115359 most_guessable_match_sequence: function(password, matches, _exclude_additive) {
115360 var _, bruteforce_update, guesses, k, l, len, len1, len2, lst, m, make_bruteforce_match, matches_by_j, n, o, optimal, optimal_l, optimal_match_sequence, q, ref, ref1, u, unwind, update, w;
115361 if (_exclude_additive == null) {
115362 _exclude_additive = false;
115363 }
115364 n = password.length;
115365 matches_by_j = (function() {
115366 var o, ref, results;
115367 results = [];
115368 for (_ = o = 0, ref = n; 0 <= ref ? o < ref : o > ref; _ = 0 <= ref ? ++o : --o) {
115369 results.push([]);
115370 }
115371 return results;
115372 })();
115373 for (o = 0, len = matches.length; o < len; o++) {
115374 m = matches[o];
115375 matches_by_j[m.j].push(m);
115376 }
115377 for (q = 0, len1 = matches_by_j.length; q < len1; q++) {
115378 lst = matches_by_j[q];
115379 lst.sort(function(m1, m2) {
115380 return m1.i - m2.i;
115381 });
115382 }
115383 optimal = {
115384 m: (function() {
115385 var ref, results, u;
115386 results = [];
115387 for (_ = u = 0, ref = n; 0 <= ref ? u < ref : u > ref; _ = 0 <= ref ? ++u : --u) {
115388 results.push({});
115389 }
115390 return results;
115391 })(),
115392 pi: (function() {
115393 var ref, results, u;
115394 results = [];
115395 for (_ = u = 0, ref = n; 0 <= ref ? u < ref : u > ref; _ = 0 <= ref ? ++u : --u) {
115396 results.push({});
115397 }
115398 return results;
115399 })(),
115400 g: (function() {
115401 var ref, results, u;
115402 results = [];
115403 for (_ = u = 0, ref = n; 0 <= ref ? u < ref : u > ref; _ = 0 <= ref ? ++u : --u) {
115404 results.push({});
115405 }
115406 return results;
115407 })()
115408 };
115409 update = (function(_this) {
115410 return function(m, l) {
115411 var competing_g, competing_l, g, k, pi, ref;
115412 k = m.j;
115413 pi = _this.estimate_guesses(m, password);
115414 if (l > 1) {
115415 pi *= optimal.pi[m.i - 1][l - 1];
115416 }
115417 g = _this.factorial(l) * pi;
115418 if (!_exclude_additive) {
115419 g += Math.pow(MIN_GUESSES_BEFORE_GROWING_SEQUENCE, l - 1);
115420 }
115421 ref = optimal.g[k];
115422 for (competing_l in ref) {
115423 competing_g = ref[competing_l];
115424 if (competing_l > l) {
115425 continue;
115426 }
115427 if (competing_g <= g) {
115428 return;
115429 }
115430 }
115431 optimal.g[k][l] = g;
115432 optimal.m[k][l] = m;
115433 return optimal.pi[k][l] = pi;
115434 };
115435 })(this);
115436 bruteforce_update = (function(_this) {
115437 return function(k) {
115438 var i, l, last_m, ref, results, u;
115439 m = make_bruteforce_match(0, k);
115440 update(m, 1);
115441 results = [];
115442 for (i = u = 1, ref = k; 1 <= ref ? u <= ref : u >= ref; i = 1 <= ref ? ++u : --u) {
115443 m = make_bruteforce_match(i, k);
115444 results.push((function() {
115445 var ref1, results1;
115446 ref1 = optimal.m[i - 1];
115447 results1 = [];
115448 for (l in ref1) {
115449 last_m = ref1[l];
115450 l = parseInt(l);
115451 if (last_m.pattern === 'bruteforce') {
115452 continue;
115453 }
115454 results1.push(update(m, l + 1));
115455 }
115456 return results1;
115457 })());
115458 }
115459 return results;
115460 };
115461 })(this);
115462 make_bruteforce_match = (function(_this) {
115463 return function(i, j) {
115464 return {
115465 pattern: 'bruteforce',
115466 token: password.slice(i, +j + 1 || 9e9),
115467 i: i,
115468 j: j
115469 };
115470 };
115471 })(this);
115472 unwind = (function(_this) {
115473 return function(n) {
115474 var candidate_g, candidate_l, g, k, l, optimal_match_sequence, ref;
115475 optimal_match_sequence = [];
115476 k = n - 1;
115477 l = void 0;
115478 g = Infinity;
115479 ref = optimal.g[k];
115480 for (candidate_l in ref) {
115481 candidate_g = ref[candidate_l];
115482 if (candidate_g < g) {
115483 l = candidate_l;
115484 g = candidate_g;
115485 }
115486 }
115487 while (k >= 0) {
115488 m = optimal.m[k][l];
115489 optimal_match_sequence.unshift(m);
115490 k = m.i - 1;
115491 l--;
115492 }
115493 return optimal_match_sequence;
115494 };
115495 })(this);
115496 for (k = u = 0, ref = n; 0 <= ref ? u < ref : u > ref; k = 0 <= ref ? ++u : --u) {
115497 ref1 = matches_by_j[k];
115498 for (w = 0, len2 = ref1.length; w < len2; w++) {
115499 m = ref1[w];
115500 if (m.i > 0) {
115501 for (l in optimal.m[m.i - 1]) {
115502 l = parseInt(l);
115503 update(m, l + 1);
115504 }
115505 } else {
115506 update(m, 1);
115507 }
115508 }
115509 bruteforce_update(k);
115510 }
115511 optimal_match_sequence = unwind(n);
115512 optimal_l = optimal_match_sequence.length;
115513 if (password.length === 0) {
115514 guesses = 1;
115515 } else {
115516 guesses = optimal.g[n - 1][optimal_l];
115517 }
115518 return {
115519 password: password,
115520 guesses: guesses,
115521 guesses_log10: this.log10(guesses),
115522 sequence: optimal_match_sequence
115523 };
115524 },
115525 estimate_guesses: function(match, password) {
115526 var estimation_functions, guesses, min_guesses;
115527 if (match.guesses != null) {
115528 return match.guesses;
115529 }
115530 min_guesses = 1;
115531 if (match.token.length < password.length) {
115532 min_guesses = match.token.length === 1 ? MIN_SUBMATCH_GUESSES_SINGLE_CHAR : MIN_SUBMATCH_GUESSES_MULTI_CHAR;
115533 }
115534 estimation_functions = {
115535 bruteforce: this.bruteforce_guesses,
115536 dictionary: this.dictionary_guesses,
115537 spatial: this.spatial_guesses,
115538 repeat: this.repeat_guesses,
115539 sequence: this.sequence_guesses,
115540 regex: this.regex_guesses,
115541 date: this.date_guesses
115542 };
115543 guesses = estimation_functions[match.pattern].call(this, match);
115544 match.guesses = Math.max(guesses, min_guesses);
115545 match.guesses_log10 = this.log10(match.guesses);
115546 return match.guesses;
115547 },
115548 bruteforce_guesses: function(match) {
115549 var guesses, min_guesses;
115550 guesses = Math.pow(BRUTEFORCE_CARDINALITY, match.token.length);
115551 if (guesses === Number.POSITIVE_INFINITY) {
115552 guesses = Number.MAX_VALUE;
115553 }
115554 min_guesses = match.token.length === 1 ? MIN_SUBMATCH_GUESSES_SINGLE_CHAR + 1 : MIN_SUBMATCH_GUESSES_MULTI_CHAR + 1;
115555 return Math.max(guesses, min_guesses);
115556 },
115557 repeat_guesses: function(match) {
115558 return match.base_guesses * match.repeat_count;
115559 },
115560 sequence_guesses: function(match) {
115561 var base_guesses, first_chr;
115562 first_chr = match.token.charAt(0);
115563 if (first_chr === 'a' || first_chr === 'A' || first_chr === 'z' || first_chr === 'Z' || first_chr === '0' || first_chr === '1' || first_chr === '9') {
115564 base_guesses = 4;
115565 } else {
115566 if (first_chr.match(/\d/)) {
115567 base_guesses = 10;
115568 } else {
115569 base_guesses = 26;
115570 }
115571 }
115572 if (!match.ascending) {
115573 base_guesses *= 2;
115574 }
115575 return base_guesses * match.token.length;
115576 },
115577 MIN_YEAR_SPACE: 20,
115578 REFERENCE_YEAR: new Date().getFullYear(),
115579 regex_guesses: function(match) {
115580 var char_class_bases, year_space;
115581 char_class_bases = {
115582 alpha_lower: 26,
115583 alpha_upper: 26,
115584 alpha: 52,
115585 alphanumeric: 62,
115586 digits: 10,
115587 symbols: 33
115588 };
115589 if (match.regex_name in char_class_bases) {
115590 return Math.pow(char_class_bases[match.regex_name], match.token.length);
115591 } else {
115592 switch (match.regex_name) {
115593 case 'recent_year':
115594 year_space = Math.abs(parseInt(match.regex_match[0]) - this.REFERENCE_YEAR);
115595 year_space = Math.max(year_space, this.MIN_YEAR_SPACE);
115596 return year_space;
115597 }
115598 }
115599 },
115600 date_guesses: function(match) {
115601 var guesses, year_space;
115602 year_space = Math.max(Math.abs(match.year - this.REFERENCE_YEAR), this.MIN_YEAR_SPACE);
115603 guesses = year_space * 365;
115604 if (match.separator) {
115605 guesses *= 4;
115606 }
115607 return guesses;
115608 },
115609 KEYBOARD_AVERAGE_DEGREE: calc_average_degree(adjacency_graphs.qwerty),
115610 KEYPAD_AVERAGE_DEGREE: calc_average_degree(adjacency_graphs.keypad),
115611 KEYBOARD_STARTING_POSITIONS: ((function() {
115612 var ref, results;
115613 ref = adjacency_graphs.qwerty;
115614 results = [];
115615 for (k in ref) {
115616 v = ref[k];
115617 results.push(k);
115618 }
115619 return results;
115620 })()).length,
115621 KEYPAD_STARTING_POSITIONS: ((function() {
115622 var ref, results;
115623 ref = adjacency_graphs.keypad;
115624 results = [];
115625 for (k in ref) {
115626 v = ref[k];
115627 results.push(k);
115628 }
115629 return results;
115630 })()).length,
115631 spatial_guesses: function(match) {
115632 var L, S, U, d, guesses, i, j, o, possible_turns, q, ref, ref1, ref2, ref3, s, shifted_variations, t, u;
115633 if ((ref = match.graph) === 'qwerty' || ref === 'dvorak') {
115634 s = this.KEYBOARD_STARTING_POSITIONS;
115635 d = this.KEYBOARD_AVERAGE_DEGREE;
115636 } else {
115637 s = this.KEYPAD_STARTING_POSITIONS;
115638 d = this.KEYPAD_AVERAGE_DEGREE;
115639 }
115640 guesses = 0;
115641 L = match.token.length;
115642 t = match.turns;
115643 for (i = o = 2, ref1 = L; 2 <= ref1 ? o <= ref1 : o >= ref1; i = 2 <= ref1 ? ++o : --o) {
115644 possible_turns = Math.min(t, i - 1);
115645 for (j = q = 1, ref2 = possible_turns; 1 <= ref2 ? q <= ref2 : q >= ref2; j = 1 <= ref2 ? ++q : --q) {
115646 guesses += this.nCk(i - 1, j - 1) * s * Math.pow(d, j);
115647 }
115648 }
115649 if (match.shifted_count) {
115650 S = match.shifted_count;
115651 U = match.token.length - match.shifted_count;
115652 if (S === 0 || U === 0) {
115653 guesses *= 2;
115654 } else {
115655 shifted_variations = 0;
115656 for (i = u = 1, ref3 = Math.min(S, U); 1 <= ref3 ? u <= ref3 : u >= ref3; i = 1 <= ref3 ? ++u : --u) {
115657 shifted_variations += this.nCk(S + U, i);
115658 }
115659 guesses *= shifted_variations;
115660 }
115661 }
115662 return guesses;
115663 },
115664 dictionary_guesses: function(match) {
115665 var reversed_variations;
115666 match.base_guesses = match.rank;
115667 match.uppercase_variations = this.uppercase_variations(match);
115668 match.l33t_variations = this.l33t_variations(match);
115669 reversed_variations = match.reversed && 2 || 1;
115670 return match.base_guesses * match.uppercase_variations * match.l33t_variations * reversed_variations;
115671 },
115672 START_UPPER: /^[A-Z][^A-Z]+$/,
115673 END_UPPER: /^[^A-Z]+[A-Z]$/,
115674 ALL_UPPER: /^[^a-z]+$/,
115675 ALL_LOWER: /^[^A-Z]+$/,
115676 uppercase_variations: function(match) {
115677 var L, U, chr, i, len, o, q, ref, ref1, regex, variations, word;
115678 word = match.token;
115679 if (word.match(this.ALL_LOWER) || word.toLowerCase() === word) {
115680 return 1;
115681 }
115682 ref = [this.START_UPPER, this.END_UPPER, this.ALL_UPPER];
115683 for (o = 0, len = ref.length; o < len; o++) {
115684 regex = ref[o];
115685 if (word.match(regex)) {
115686 return 2;
115687 }
115688 }
115689 U = ((function() {
115690 var len1, q, ref1, results;
115691 ref1 = word.split('');
115692 results = [];
115693 for (q = 0, len1 = ref1.length; q < len1; q++) {
115694 chr = ref1[q];
115695 if (chr.match(/[A-Z]/)) {
115696 results.push(chr);
115697 }
115698 }
115699 return results;
115700 })()).length;
115701 L = ((function() {
115702 var len1, q, ref1, results;
115703 ref1 = word.split('');
115704 results = [];
115705 for (q = 0, len1 = ref1.length; q < len1; q++) {
115706 chr = ref1[q];
115707 if (chr.match(/[a-z]/)) {
115708 results.push(chr);
115709 }
115710 }
115711 return results;
115712 })()).length;
115713 variations = 0;
115714 for (i = q = 1, ref1 = Math.min(U, L); 1 <= ref1 ? q <= ref1 : q >= ref1; i = 1 <= ref1 ? ++q : --q) {
115715 variations += this.nCk(U + L, i);
115716 }
115717 return variations;
115718 },
115719 l33t_variations: function(match) {
115720 var S, U, chr, chrs, i, o, p, possibilities, ref, ref1, subbed, unsubbed, variations;
115721 if (!match.l33t) {
115722 return 1;
115723 }
115724 variations = 1;
115725 ref = match.sub;
115726 for (subbed in ref) {
115727 unsubbed = ref[subbed];
115728 chrs = match.token.toLowerCase().split('');
115729 S = ((function() {
115730 var len, o, results;
115731 results = [];
115732 for (o = 0, len = chrs.length; o < len; o++) {
115733 chr = chrs[o];
115734 if (chr === subbed) {
115735 results.push(chr);
115736 }
115737 }
115738 return results;
115739 })()).length;
115740 U = ((function() {
115741 var len, o, results;
115742 results = [];
115743 for (o = 0, len = chrs.length; o < len; o++) {
115744 chr = chrs[o];
115745 if (chr === unsubbed) {
115746 results.push(chr);
115747 }
115748 }
115749 return results;
115750 })()).length;
115751 if (S === 0 || U === 0) {
115752 variations *= 2;
115753 } else {
115754 p = Math.min(U, S);
115755 possibilities = 0;
115756 for (i = o = 1, ref1 = p; 1 <= ref1 ? o <= ref1 : o >= ref1; i = 1 <= ref1 ? ++o : --o) {
115757 possibilities += this.nCk(U + S, i);
115758 }
115759 variations *= possibilities;
115760 }
115761 }
115762 return variations;
115763 }
115764};
115765
115766module.exports = scoring;
115767
115768
115769
115770},{"./adjacency_graphs":834}],840:[function(require,module,exports){
115771// Generated by CoffeeScript 1.10.0
115772var time_estimates;
115773
115774time_estimates = {
115775 estimate_attack_times: function(guesses) {
115776 var crack_times_display, crack_times_seconds, scenario, seconds;
115777 crack_times_seconds = {
115778 online_throttling_100_per_hour: guesses / (100 / 3600),
115779 online_no_throttling_10_per_second: guesses / 10,
115780 offline_slow_hashing_1e4_per_second: guesses / 1e4,
115781 offline_fast_hashing_1e10_per_second: guesses / 1e10
115782 };
115783 crack_times_display = {};
115784 for (scenario in crack_times_seconds) {
115785 seconds = crack_times_seconds[scenario];
115786 crack_times_display[scenario] = this.display_time(seconds);
115787 }
115788 return {
115789 crack_times_seconds: crack_times_seconds,
115790 crack_times_display: crack_times_display,
115791 score: this.guesses_to_score(guesses)
115792 };
115793 },
115794 guesses_to_score: function(guesses) {
115795 var DELTA;
115796 DELTA = 5;
115797 if (guesses < 1e3 + DELTA) {
115798 return 0;
115799 } else if (guesses < 1e6 + DELTA) {
115800 return 1;
115801 } else if (guesses < 1e8 + DELTA) {
115802 return 2;
115803 } else if (guesses < 1e10 + DELTA) {
115804 return 3;
115805 } else {
115806 return 4;
115807 }
115808 },
115809 display_time: function(seconds) {
115810 var base, century, day, display_num, display_str, hour, minute, month, ref, year;
115811 minute = 60;
115812 hour = minute * 60;
115813 day = hour * 24;
115814 month = day * 31;
115815 year = month * 12;
115816 century = year * 100;
115817 ref = seconds < 1 ? [null, 'less than a second'] : seconds < minute ? (base = Math.round(seconds), [base, base + " second"]) : seconds < hour ? (base = Math.round(seconds / minute), [base, base + " minute"]) : seconds < day ? (base = Math.round(seconds / hour), [base, base + " hour"]) : seconds < month ? (base = Math.round(seconds / day), [base, base + " day"]) : seconds < year ? (base = Math.round(seconds / month), [base, base + " month"]) : seconds < century ? (base = Math.round(seconds / year), [base, base + " year"]) : [null, 'centuries'], display_num = ref[0], display_str = ref[1];
115818 if ((display_num != null) && display_num !== 1) {
115819 display_str += 's';
115820 }
115821 return display_str;
115822 }
115823};
115824
115825module.exports = time_estimates;
115826
115827
115828
115829},{}]},{},[1])(1)
115830});